|
|
{"silent", no_argument, NULL, 'f'}, | {"silent", no_argument, NULL, 'f'}, |
{"reference", required_argument, NULL, REFERENCE_FILE_OPTION}, | {"reference", required_argument, NULL, REFERENCE_FILE_OPTION}, |
{"verbose", no_argument, NULL, 'v'}, | {"verbose", no_argument, NULL, 'v'}, |
|
{"numeric", no_argument, NULL, 'n'}, |
{GETOPT_HELP_OPTION_DECL}, | {GETOPT_HELP_OPTION_DECL}, |
{GETOPT_VERSION_OPTION_DECL}, | {GETOPT_VERSION_OPTION_DECL}, |
{NULL, 0, NULL, 0} | {NULL, 0, NULL, 0} |
|
|
ownership of a symlink)\n\ | ownership of a symlink)\n\ |
"), stdout); | "), stdout); |
fputs (_("\ | fputs (_("\ |
|
-n, --numeric treats OWNER and GROUP as numeric by default. User '0'\n\ |
|
would be root rather then username '0'.\n\ |
|
"), stdout); |
|
fputs (_("\ |
--from=CURRENT_OWNER:CURRENT_GROUP\n\ | --from=CURRENT_OWNER:CURRENT_GROUP\n\ |
change the owner and/or group of each file only if\n\ | change the owner and/or group of each file only if\n\ |
its current owner and/or group match those specified\n\ | its current owner and/or group match those specified\n\ |
|
|
| |
chopt_init (&chopt); | chopt_init (&chopt); |
| |
while ((optc = getopt_long (argc, argv, "HLPRcfhv", long_options, NULL)) |
while ((optc = getopt_long (argc, argv, "HLPRcfhvn", long_options, NULL)) |
!= -1) | != -1) |
{ | { |
switch (optc) | switch (optc) |
|
|
char *u_dummy, *g_dummy; | char *u_dummy, *g_dummy; |
const char *e = parse_user_spec (optarg, | const char *e = parse_user_spec (optarg, |
&required_uid, &required_gid, | &required_uid, &required_gid, |
&u_dummy, &g_dummy); |
&u_dummy, &g_dummy, chopt.numeric); |
if (e) | if (e) |
error (EXIT_FAILURE, 0, "%s: %s", quote (optarg), e); | error (EXIT_FAILURE, 0, "%s: %s", quote (optarg), e); |
break; | break; |
|
|
chopt.verbosity = V_high; | chopt.verbosity = V_high; |
break; | break; |
| |
|
case 'n': |
|
chopt.numeric = true; |
|
break; |
|
|
case_GETOPT_HELP_CHAR; | case_GETOPT_HELP_CHAR; |
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); | case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); |
default: | default: |
|
|
else | else |
{ | { |
const char *e = parse_user_spec (argv[optind], &uid, &gid, | const char *e = parse_user_spec (argv[optind], &uid, &gid, |
&chopt.user_name, &chopt.group_name); |
&chopt.user_name, &chopt.group_name, chopt.numeric); |
if (e) | if (e) |
error (EXIT_FAILURE, 0, "%s: %s", quote (argv[optind]), e); | error (EXIT_FAILURE, 0, "%s: %s", quote (argv[optind]), e); |
| |