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

Diff for /src/usr.bin/make/main.c between version 1.108 and 1.109

version 1.108, 2015/01/23 22:35:57 version 1.109, 2015/02/07 13:32:12
Line 41 
Line 41 
 #ifndef MAKE_BOOTSTRAP  #ifndef MAKE_BOOTSTRAP
 #include <sys/utsname.h>  #include <sys/utsname.h>
 #endif  #endif
   #include <err.h>
 #include <errno.h>  #include <errno.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
Line 188 
Line 189 
 {  {
         int c, optend;          int c, optend;
   
 #define OPTFLAGS "BD:I:SV:d:ef:ij:km:npqrst"  #define OPTFLAGS "BC:D:I:SV:d:ef:ij:km:npqrst"
 #define OPTLETTERS "BSiknpqrst"  #define OPTLETTERS "BSiknpqrst"
   
         optind = 1;     /* since we're called more than once */          optind = 1;     /* since we're called more than once */
Line 206 
Line 207 
                 }                  }
                 c = optend ? -1 : getopt(argc, argv, OPTFLAGS);                  c = optend ? -1 : getopt(argc, argv, OPTFLAGS);
                 switch (c) {                  switch (c) {
                   case 'C':
                           break;
                 case 'D':                  case 'D':
                         Var_Set(optarg, "1");                          Var_Set(optarg, "1");
                         record_option(c, optarg);                          record_option(c, optarg);
Line 337 
Line 340 
                         posixParseOptLetter(c);                          posixParseOptLetter(c);
                 }                  }
         }          }
   }
   
   static void
   MainParseChdir(int argc, char **argv)
   {
           int c, optend, oldopterr;
   
           optind = 1;     /* since we're called more than once */
           optreset = 1;
           optend = 0;
           oldopterr = opterr;
           opterr = 0;
           while (optind < argc) {
                   if (!optend && argv[optind][0] == '-') {
                           if (argv[optind][1] == '\0')
                                   optind++;       /* ignore "-" */
                           else if (argv[optind][1] == '-' &&
                               argv[optind][2] == '\0') {
                                   optind++;       /* ignore "--" */
                                   optend++;       /* "--" denotes end of flags */
                           }
                   }
                   c = optend ? -1 : getopt(argc, argv, OPTFLAGS);
                   switch (c) {
                   case 'C':
                           if (chdir(optarg) == -1)
                                   err(1, "chdir(%s)", optarg);
                           break;
                   case -1:
                           optind++;       /* skip over non-option */
                           break;
                   default:
                           break;
                   }
           }
           opterr = oldopterr;
 }  }
   
 /*-  /*-
Line 625 
Line 663 
         static struct dirs d;          static struct dirs d;
         bool read_depend = true;/* false if we don't want to read .depend */          bool read_depend = true;/* false if we don't want to read .depend */
   
           MainParseChdir(argc, argv);
         setup_CURDIR_OBJDIR(&d, machine);          setup_CURDIR_OBJDIR(&d, machine);
   
         esetenv("PWD", d.object);          esetenv("PWD", d.object);
Line 853 
Line 892 
 usage()  usage()
 {  {
         (void)fprintf(stderr,          (void)fprintf(stderr,
 "usage: make [-BeiknPqrSst] [-D variable] [-d flags] [-f makefile]\n\  "usage: make [-BeiknPqrSst] [-C dir] [-D variable] [-d flags] [-f makefile]\n\
             [-I directory] [-j max_jobs] [-m directory] [-V variable]\n\              [-I directory] [-j max_jobs] [-m directory] [-V variable]\n\
             [NAME=value] [target ...]\n");              [NAME=value] [target ...]\n");
         exit(2);          exit(2);

Legend:
Removed from v.1.108  
changed lines
  Added in v.1.109