Changeset 3214 in kBuild for trunk/src/kmk/kmkbuiltin/install.c
- Timestamp:
- Mar 30, 2018 9:03:40 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/install.c
r3192 r3214 47 47 #endif 48 48 49 #define FAKES_NO_GETOPT_H 49 50 #include "config.h" 50 51 #ifndef _MSC_VER … … 79 80 # include <process.h> 80 81 #endif 81 #include "getopt .h"82 #include "getopt_r.h" 82 83 #ifdef __sun__ 83 84 # include "solfakes.h" … … 175 176 { 176 177 INSTALLINSTANCE This; 178 struct getopt_state_r gos; 177 179 struct stat from_sb, to_sb; 178 180 mode_t *set; … … 203 205 This.dos2unix = 0; 204 206 205 /* reset getopt and set progname. */206 opterr = 1;207 optarg = NULL;208 optopt = 0;209 optind = 0; /* init */210 211 207 iflags = 0; 212 208 group = owner = NULL; 213 while ((ch = getopt_long(argc, argv, "B:bCcdf:g:Mm:o:pSsv", long_options, NULL)) != -1) 209 getopt_initialize_r(&gos, argc, argv, "B:bCcdf:g:Mm:o:pSsv", long_options, envp, pCtx); 210 while ((ch = getopt_long_r(&gos, NULL)) != -1) 214 211 switch(ch) { 215 212 case 'B': 216 This.suffix = optarg;213 This.suffix = gos.optarg; 217 214 /* FALLTHROUGH */ 218 215 case 'b': … … 239 236 break; 240 237 case 'g': 241 group = optarg;238 group = gos.optarg; 242 239 break; 243 240 case 'M': … … 245 242 break; 246 243 case 'm': 247 if (!(set = bsd_setmode( optarg)))248 return errx(pCtx, EX_USAGE, "invalid file mode: %s", optarg);244 if (!(set = bsd_setmode(gos.optarg))) 245 return errx(pCtx, EX_USAGE, "invalid file mode: %s", gos.optarg); 249 246 This.mode = bsd_getmode(set, 0); 250 247 free(set); … … 252 249 break; 253 250 case 'o': 254 owner = optarg;251 owner = gos.optarg; 255 252 break; 256 253 case 'p': … … 293 290 return usage(pCtx, 1); 294 291 } 295 argc -= optind;296 argv += optind;292 argc -= gos.optind; 293 argv += gos.optind; 297 294 298 295 /* some options make no sense when creating directories */
Note:
See TracChangeset
for help on using the changeset viewer.