[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.16 and 1.17

version 1.16, 2010/05/31 14:01:49 version 1.17, 2011/03/11 04:30:21
Line 55 
Line 55 
   
         (void)setlocale(LC_ALL, "");          (void)setlocale(LC_ALL, "");
   
         if (argc == 1)          while ((ch = getopt(argc, argv, "a")) != -1)
                 usage();  
   
         /* Don't accept command args but check since old whereis(1) used to */  
         while ((ch = getopt(argc, argv, "a")) != -1) {  
                 switch (ch) {                  switch (ch) {
                 case 'a':                  case 'a':
                         allmatches = 1;                          allmatches = 1;
Line 67 
Line 63 
                 default:                  default:
                         usage();                          usage();
                 }                  }
         }          argc -= optind;
           argv += optind;
   
           if (argc == 0)
                   usage();
   
         /*          /*
          * which(1) uses user's $PATH.           * which(1) uses user's $PATH.
          * whereis(1) uses user.cs_path from sysctl(3).           * whereis(1) uses user.cs_path from sysctl(3).
Line 98 
Line 98 
         if (setuid(geteuid()))          if (setuid(geteuid()))
                 err(1, "Can't set uid to %u", geteuid());                  err(1, "Can't set uid to %u", geteuid());
   
         for (n = optind; n < argc; n++)          for (n = 0; n < argc; n++)
                 if (findprog(argv[n], path, progmode, allmatches) == 0)                  if (findprog(argv[n], path, progmode, allmatches) == 0)
                         notfound++;                          notfound++;
   
         exit((notfound == 0) ? 0 : ((notfound == argc - 1) ? 2 : 1));          exit((notfound == 0) ? 0 : ((notfound == argc) ? 2 : 1));
 }  }
   
 int  int

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17