Changeset 3216 for trunk/src/kmk/kmkbuiltin/rm.c
- Timestamp:
- Mar 31, 2018, 12:09:15 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/rm.c
r3192 r3216 46 46 * Header Files * 47 47 *********************************************************************************************************************************/ 48 #define FAKES_NO_GETOPT_H /* bird */ 48 49 #include "config.h" 49 50 #include <sys/stat.h> … … 69 70 #include <unistd.h> 70 71 #include <ctype.h> 71 #include "getopt .h"72 #include "getopt_r.h" 72 73 #ifdef __HAIKU__ 73 74 # include "haikufakes.h" … … 187 188 { 188 189 RMINSTANCE This; 190 struct getopt_state_r gos; 189 191 int ch, rflag; 190 192 … … 205 207 kBuildProtectionInit(&This.g_ProtData, pCtx); 206 208 207 /* kmk: reset getopt and set program name. */208 opterr = 1;209 optarg = NULL;210 optopt = 0;211 optind = 0; /* init */212 213 209 rflag = 0; 214 while ((ch = getopt_long(argc, argv, "dfiPRvW", long_options, NULL)) != -1) 210 getopt_initialize_r(&gos, argc, argv, "dfiPRvW", long_options, envp, pCtx); 211 while ((ch = getopt_long_r(&gos, NULL)) != -1) 215 212 switch (ch) { 216 213 case 'd': … … 262 259 break; 263 260 case 267: 264 if (kBuildProtectionSetDepth(&This.g_ProtData, optarg)) {261 if (kBuildProtectionSetDepth(&This.g_ProtData, gos.optarg)) { 265 262 kBuildProtectionTerm(&This.g_ProtData); 266 263 return 1; … … 277 274 return usage(pCtx, 1); 278 275 } 279 argc -= optind;280 argv += optind;276 argc -= gos.optind; 277 argv += gos.optind; 281 278 282 279 if (argc < 1) { … … 347 344 348 345 flags = FTS_PHYSICAL; 346 #ifndef KMK_BUILTIN_STANDALONE 347 flags |= FTS_NOCHDIR; /* Must not change the directory from inside kmk! */ 348 #endif 349 349 if (!needstat) 350 350 flags |= FTS_NOSTAT;
Note:
See TracChangeset
for help on using the changeset viewer.