=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/less/main.c,v retrieving revision 1.1.1.3 retrieving revision 1.1.1.4 diff -c -r1.1.1.3 -r1.1.1.4 *** src/usr.bin/less/main.c 2011/09/16 17:47:06 1.1.1.3 --- src/usr.bin/less/main.c 2014/04/25 13:33:49 1.1.1.4 *************** *** 1,11 **** /* ! * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. * ! * For more information about less, or for information on how to ! * contact the author, see the README file. */ --- 1,10 ---- /* ! * Copyright (C) 1984-2012 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. * ! * For more information, see the README file. */ *************** *** 96,106 **** char *path = getenv("HOMEPATH"); if (drive != NULL && path != NULL) { ! char *env = (char *) ecalloc(strlen(drive) + ! strlen(path) + 6, sizeof(char)); ! strcpy(env, "HOME="); ! strcat(env, drive); ! strcat(env, path); putenv(env); } } --- 95,105 ---- char *path = getenv("HOMEPATH"); if (drive != NULL && path != NULL) { ! size_t len = strlen(drive) + strlen(path) + 6; ! char *env = (char *) ecalloc(len, sizeof(char)); ! strlcpy(env, "HOME=", len); ! strlcat(env, drive, len); ! strlcat(env, path, len); putenv(env); } } *************** *** 134,139 **** --- 133,145 ---- 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"); if (s != NULL) scan_option(save(s)); *************** *** 180,187 **** * to "register" them with the ifile system. */ ifile = NULL_IFILE; if (dohelp) ! ifile = get_ifile(FAKE_HELPFILE, ifile); while (argc-- > 0) { char *filename; --- 186,195 ---- * to "register" them with the ifile system. */ ifile = NULL_IFILE; + #if !SMALL if (dohelp) ! ifile = get_ifile(HELPFILE, ifile); ! #endif /* !SMALL */ while (argc-- > 0) { char *filename; *************** *** 211,216 **** --- 219,225 ---- argv++; (void) get_ifile(filename, ifile); ifile = prev_ifile(NULL_IFILE); + free(filename); #endif } /* *************** *** 236,242 **** quit(QUIT_OK); } ! if (missing_cap && !know_dumb) error("WARNING: terminal is not fully functional", NULL_PARG); init_mark(); open_getchr(); --- 245,251 ---- quit(QUIT_OK); } ! if (missing_cap && !know_dumb && !less_is_more) error("WARNING: terminal is not fully functional", NULL_PARG); init_mark(); open_getchr(); *************** *** 299,307 **** char *s; { register char *p; ! p = (char *) ecalloc(strlen(s)+1, sizeof(char)); ! strcpy(p, s); return (p); } --- 308,317 ---- char *s; { register char *p; + size_t len = strlen(s) + 1; ! p = (char *) ecalloc(len, sizeof(char)); ! strlcpy(p, s, len); return (p); } *************** *** 337,342 **** --- 347,353 ---- return (s); } + #if GNU_OPTIONS /* * See how many characters of two strings are identical. * If uppercase is true, the first string must begin with an uppercase *************** *** 371,376 **** --- 382,388 ---- } return (len); } + #endif /* GNU_OPTIONS */ /* * Exit the program.