[BACK]Return to main.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / less

Diff for /src/usr.bin/less/main.c between version 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2011/09/16 17:47:06 version 1.1.1.4, 2014/04/25 13:33:49
Line 1 
Line 1 
 /*  /*
  * 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.  
  */   */
   
   
Line 96 
Line 95 
                 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);
                 }                  }
         }          }
Line 134 
Line 133 
   
         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));
Line 180 
Line 186 
          * 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;
Line 211 
Line 219 
                 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
         }          }
         /*          /*
Line 236 
Line 245 
                 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();
Line 299 
Line 308 
         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);
 }  }
   
Line 337 
Line 347 
         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
Line 371 
Line 382 
         }          }
         return (len);          return (len);
 }  }
   #endif /* GNU_OPTIONS */
   
 /*  /*
  * Exit the program.   * Exit the program.

Legend:
Removed from v.1.1.1.3  
changed lines
  Added in v.1.1.1.4