- while (--argc > 0) {
- struct stat statBuf;
- if (stat(*(++argv), &statBuf) != ENOENT) {
- fprintf(stderr, "%s: File exists\n", *argv);
- return( FALSE);
+ /* Parse any options */
+ while (argc > 0 && **argv == '-') {
+ while (i == FALSE && *++(*argv)) {
+ switch (**argv) {
+ case 'm':
+ if (--argc == 0)
+ usage(mkdir_usage);
+ /* Find the specified modes */
+ mode = 0;
+ if (parse_mode(*(++argv), &mode) == FALSE) {
+ errorMsg("Unknown mode: %s\n", *argv);
+ return EXIT_FAILURE;
+ }
+ /* Set the umask for this process so it doesn't
+ * screw up whatever the user just entered. */
+ umask(0);
+ i = TRUE;
+ break;
+ case 'p':
+ parentFlag = TRUE;
+ break;
+ default:
+ usage(mkdir_usage);
+ }
+ }
+ argc--;
+ argv++;