version 1.1.1.3, 2011/09/16 17:47:06 |
version 1.1.1.4, 2014/04/25 13:33:49 |
|
|
/* |
/* |
* Copyright (C) 1984-2011 Mark Nudelman |
* Copyright (C) 1984-2012 Mark Nudelman |
* |
* |
* You may distribute under the terms of either the GNU General Public |
* You may distribute under the terms of either the GNU General Public |
* License or the Less License, as specified in the README file. |
* License or the Less License, as specified in the README file. |
* |
* |
* For more information about less, or for information on how to |
* For more information, see the README file. |
* contact the author, see the README file. |
|
*/ |
*/ |
|
|
|
|
|
|
char *path = getenv("HOMEPATH"); |
char *path = getenv("HOMEPATH"); |
if (drive != NULL && path != NULL) |
if (drive != NULL && path != NULL) |
{ |
{ |
char *env = (char *) ecalloc(strlen(drive) + |
size_t len = strlen(drive) + strlen(path) + 6; |
strlen(path) + 6, sizeof(char)); |
char *env = (char *) ecalloc(len, sizeof(char)); |
strcpy(env, "HOME="); |
strlcpy(env, "HOME=", len); |
strcat(env, drive); |
strlcat(env, drive, len); |
strcat(env, path); |
strlcat(env, path, len); |
putenv(env); |
putenv(env); |
} |
} |
} |
} |
|
|
|
|
init_prompt(); |
init_prompt(); |
|
|
|
if (less_is_more) { |
|
scan_option("-G"); |
|
scan_option("-L"); |
|
scan_option("-X"); |
|
scan_option("-c"); |
|
} |
|
|
s = lgetenv(less_is_more ? "MORE" : "LESS"); |
s = lgetenv(less_is_more ? "MORE" : "LESS"); |
if (s != NULL) |
if (s != NULL) |
scan_option(save(s)); |
scan_option(save(s)); |
|
|
* to "register" them with the ifile system. |
* to "register" them with the ifile system. |
*/ |
*/ |
ifile = NULL_IFILE; |
ifile = NULL_IFILE; |
|
#if !SMALL |
if (dohelp) |
if (dohelp) |
ifile = get_ifile(FAKE_HELPFILE, ifile); |
ifile = get_ifile(HELPFILE, ifile); |
|
#endif /* !SMALL */ |
while (argc-- > 0) |
while (argc-- > 0) |
{ |
{ |
char *filename; |
char *filename; |
|
|
argv++; |
argv++; |
(void) get_ifile(filename, ifile); |
(void) get_ifile(filename, ifile); |
ifile = prev_ifile(NULL_IFILE); |
ifile = prev_ifile(NULL_IFILE); |
|
free(filename); |
#endif |
#endif |
} |
} |
/* |
/* |
|
|
quit(QUIT_OK); |
quit(QUIT_OK); |
} |
} |
|
|
if (missing_cap && !know_dumb) |
if (missing_cap && !know_dumb && !less_is_more) |
error("WARNING: terminal is not fully functional", NULL_PARG); |
error("WARNING: terminal is not fully functional", NULL_PARG); |
init_mark(); |
init_mark(); |
open_getchr(); |
open_getchr(); |
|
|
char *s; |
char *s; |
{ |
{ |
register char *p; |
register char *p; |
|
size_t len = strlen(s) + 1; |
|
|
p = (char *) ecalloc(strlen(s)+1, sizeof(char)); |
p = (char *) ecalloc(len, sizeof(char)); |
strcpy(p, s); |
strlcpy(p, s, len); |
return (p); |
return (p); |
} |
} |
|
|
|
|
return (s); |
return (s); |
} |
} |
|
|
|
#if GNU_OPTIONS |
/* |
/* |
* See how many characters of two strings are identical. |
* See how many characters of two strings are identical. |
* If uppercase is true, the first string must begin with an uppercase |
* If uppercase is true, the first string must begin with an uppercase |
|
|
} |
} |
return (len); |
return (len); |
} |
} |
|
#endif /* GNU_OPTIONS */ |
|
|
/* |
/* |
* Exit the program. |
* Exit the program. |