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

Diff for /src/usr.bin/which/which.c between version 1.25 and 1.26

version 1.25, 2016/01/14 22:02:13 version 1.26, 2016/10/28 07:22:59
Line 21 
Line 21 
   
 #include <err.h>  #include <err.h>
 #include <errno.h>  #include <errno.h>
 #include <locale.h>  #include <limits.h>
 #include <paths.h>  #include <paths.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
 #include <limits.h>  
   
 #define PROG_WHICH      1  #define PROG_WHICH      1
 #define PROG_WHEREIS    2  #define PROG_WHEREIS    2
Line 35 
Line 34 
 extern char *__progname;  extern char *__progname;
   
 int findprog(char *, char *, int, int);  int findprog(char *, char *, int, int);
 __dead void usage(void);  static void __dead usage(void);
   
 /*  /*
  * which(1) -- find an executable(s) in the user's path   * which(1) -- find an executable(s) in the user's path
Line 54 
Line 53 
         size_t n;          size_t n;
         int ch, allmatches = 0, notfound = 0, progmode = PROG_WHICH;          int ch, allmatches = 0, notfound = 0, progmode = PROG_WHICH;
   
         (void)setlocale(LC_ALL, "");  
   
         while ((ch = getopt(argc, argv, "a")) != -1)          while ((ch = getopt(argc, argv, "a")) != -1)
                 switch (ch) {                  switch (ch) {
                 case 'a':                  case 'a':
Line 91 
Line 88 
                 if (findprog(argv[n], path, progmode, allmatches) == 0)                  if (findprog(argv[n], path, progmode, allmatches) == 0)
                         notfound++;                          notfound++;
   
         exit((notfound == 0) ? 0 : ((notfound == argc) ? 2 : 1));          return ((notfound == 0) ? 0 : ((notfound == argc) ? 2 : 1));
 }  }
   
 int  int
Line 150 
Line 147 
         return (rval);          return (rval);
 }  }
   
 __dead void  static void __dead
 usage(void)  usage(void)
 {  {
         (void)fprintf(stderr, "usage: %s [-a] name ...\n", __progname);          (void)fprintf(stderr, "usage: %s [-a] name ...\n", __progname);

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26