static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
- {"path", no_argument, &path_mode, 1},
{"parents", no_argument, &path_mode, 1},
{"help", no_argument, &show_help, 1},
+ {"verbose", no_argument, NULL, 2},
{"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
\n\
-p, --parents no error if existing, make parent directories as needed\n\
-m, --mode=MODE set permission mode (as in chmod), not rwxrwxrwx - umask\n\
+ --verbose print a message for each created directory\n\
--help display this help and exit\n\
--version output version information and exit\n"));
}
unsigned int newmode;
unsigned int parent_mode;
char *symbolic_mode = NULL;
+ const char *verbose_fmt_string = NULL;
int errors = 0;
int optc;
case 'm':
symbolic_mode = optarg;
break;
+ case 2: /* --verbose */
+ verbose_fmt_string = _("created directory `%s'");
+ break;
default:
usage (1);
}
if (path_mode)
{
errors |= make_path (argv[optind], newmode, parent_mode,
- -1, -1, 1, NULL);
+ -1, -1, 1, _("created directory `%s'"));
}
else if (mkdir (argv[optind], newmode))
{
error (0, errno, _("cannot make directory `%s'"), argv[optind]);
errors = 1;
}
+ else if (verbose_fmt_string)
+ {
+ error (0, 0, verbose_fmt_string, argv[optind]);
+ }
}
exit (errors);