(main): Handle flag_help and flag_version before checking for invocation errors.
}
}
- if (optind >= argc - 1)
- usage ();
-
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage ();
+ if (optind >= argc - 1)
+ usage ();
+
parse_group (argv[optind++], &group);
for (; optind < argc; ++optind)
{
fprintf (stderr, "\
Usage: %s [-Rcfv] [--recursive] [--changes] [--silent] [--quiet]\n\
- [--verbose] group file...\n",
+ [--verbose] [--help] [--version] group file...\n",
program_name);
exit (1);
}
}
}
- if (modeind == 0)
- modeind = optind++;
- if (optind >= argc)
- usage ();
-
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage ();
+ if (modeind == 0)
+ modeind = optind++;
+
+ if (optind >= argc)
+ usage ();
+
changes = mode_compile (argv[modeind],
MODE_MASK_EQUALS | MODE_MASK_PLUS | MODE_MASK_MINUS);
if (changes == MODE_INVALID)
usage ()
{
fprintf (stderr, "\
-Usage: %s [-Rcfv] mode file...\n\
+Usage: %s [-Rcfv] [--recursive] [--changes] [--silent] [--quiet]\n\
+ [--verbose] [--help] [--version] mode file...\n\
mode is [ugoa...][[+-=][rwxXstugo...]...][,...] or octal number\n",
program_name);
exit (1);
}
}
- if (optind >= argc - 1)
- usage ();
-
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage ();
+ if (optind >= argc - 1)
+ usage ();
+
e = parse_user_spec (argv[optind], &user, &group, &username, &groupname);
if (e)
error (1, 0, "%s: %s", argv[optind], e);
{
fprintf (stderr, "\
Usage: %s [-Rcfv] [--recursive] [--changes] [--silent] [--quiet]\n\
- [--verbose] [user][:.][group] file...\n",
+ [--verbose] [--help] [--version] [user][:.][group] file...\n",
program_name);
exit (1);
}
}
}
- if (flag_hard_link && flag_symbolic_link)
- usage ("cannot make both hard and symbolic links");
-
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage (NULL);
+ if (flag_hard_link && flag_symbolic_link)
+ usage ("cannot make both hard and symbolic links");
+
if (make_backups)
backup_type = get_version (version);
Usage: %s [if=file] [of=file] [ibs=bytes] [obs=bytes] [bs=bytes] [cbs=bytes]\n\
[skip=blocks] [seek=blocks] [count=blocks]\n\
[conv={ascii,ebcdic,ibm,block,unblock,lcase,ucase,swab,noerror,notrunc,\n\
- sync}]\n\
+ sync}] [--help] [--version]\n\
Numbers can be followed by a multiplier:\n\
b=512, k=1024, w=2, xm=number m\n",
program_name);
fprintf (stderr, "\
Usage: %s [-aikPv] [-t fstype] [-x fstype] [--all] [--inodes]\n\
\t[--type=fstype] [--exclude-type=fstype] [--kilobytes] [--portability]\n\
-\t[path...]\n",
+\t[--help] [--version] [path...]\n",
program_name);
exit (1);
}
fprintf (stderr, "\
Usage: %s [-abcklsxDLS] [--all] [--total] [--count-links] [--summarize]\n\
[--bytes] [--kilobytes] [--one-file-system] [--separate-dirs]\n\
- [--dereference] [--dereference-args] [path...]\n",
+ [--dereference] [--dereference-args] [--help] [--version] [path...]\n",
program_name);
exit (2);
}
}
- if (opt_all && opt_summarize_only)
- usage ("cannot both summarize and show all entries");
-
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
- usage ("");
+ usage (NULL);
+
+ if (opt_all && opt_summarize_only)
+ usage ("cannot both summarize and show all entries");
/* Initialize the hash structure for inode numbers. */
hash_init (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE);
}
}
- /* Check for invalid combinations of arguments. */
- if ((dir_arg && strip_files)
- || (optind == argc)
- || (optind == argc - 1 && !dir_arg))
- usage ();
-
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage ();
+ /* Check for invalid combinations of arguments. */
+ if ((dir_arg && strip_files)
+ || (optind == argc)
+ || (optind == argc - 1 && !dir_arg))
+ usage ();
+
if (symbolic_mode)
{
struct mode_change *change = mode_compile (symbolic_mode, 0);
%s [options] [-s] [--strip] source... directory\n\
%s [options] {-d,--directory} directory...\n\
Options:\n\
- [-c] [-g group] [-m mode] [-o owner]\n\
- [--group=group] [--mode=mode] [--owner=owner]\n",
+ [-c] [-g group] [-m mode] [-o owner] [--group=group]\n\
+ [--help] [--version] [--mode=mode] [--owner=owner]\n",
program_name, program_name, program_name);
exit (1);
}
break;
}
}
- if (optind == argc)
- usage ();
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage ();
+ if (optind == argc)
+ usage ();
+
if (make_backups)
backup_type = get_version (version);
[-bdfisvF] [-S backup-suffix] [-V {numbered,existing,simple}]\n\
[--version-control={numbered,existing,simple}] [--backup] [--directory]\n\
[--force] [--interactive] [--symbolic] [--verbose]\n\
- [--suffix=backup-suffix]\n",
+ [--suffix=backup-suffix] [--help] [--version]\n",
program_name, program_name);
exit (1);
}
[--classify] [--file-type] [--ignore=pattern] [--dereference]\n\
[--quote-name] [--recursive] [--sort={none,time,size,extension}]\n\
[--format={long,verbose,commas,across,vertical,single-column}]\n\
- [--time={atime,access,use,ctime,status}] [--no-group] [path...]\n");
+ [--time={atime,access,use,ctime,status}] [--no-group]\n\
+ [--help] [--version] [path...]\n");
exit (1);
}
}
}
- if (optind == argc)
- usage ();
-
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage ();
+ if (optind == argc)
+ usage ();
+
newmode = 0777 & ~umask (0);
parent_mode = newmode | 0300; /* u+wx */
if (symbolic_mode)
usage ()
{
fprintf (stderr, "\
-Usage: %s [-p] [-m mode] [--path] [--mode=mode] dir...\n",
+Usage: %s [-p] [-m mode] [--path] [--mode=mode] [--help] [--version] dir...\n",
program_name);
exit (1);
}
}
}
- if (optind == argc)
- usage ();
-
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage ();
+ if (optind == argc)
+ usage ();
+
newmode = 0666 & ~umask (0);
if (symbolic_mode)
{
usage ()
{
fprintf (stderr, "\
-Usage: %s [-m mode] [--mode=mode] path...\n",
+Usage: %s [-m mode] [--mode=mode] [--help] [--version] path...\n",
program_name);
exit (1);
}
usage ()
{
fprintf (stderr, "\
-Usage: %s [-m mode] [--mode=mode] path {bcu} major minor\n\
- %s [-m mode] [--mode=mode] path p\n",
+Usage: %s [options] path {bcu} major minor\n\
+ %s [options] path p\n\
+Options:\n\
+ [-m mode] [--mode=mode] [--help] [--version]\n",
program_name, program_name);
exit (1);
}
usage ();
}
}
- if (argc < optind + 2)
- usage ();
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage ();
+ if (argc < optind + 2)
+ usage ();
+
if (make_backups)
backup_type = get_version (version);
Options:\n\
[-bfiuv] [-S backup-suffix] [-V {numbered,existing,simple}]\n\
[--backup] [--force] [--interactive] [--update] [--verbose]\n\
- [--suffix=backup-suffix] [--version-control={numbered,existing,simple}]\n",
+ [--suffix=backup-suffix] [--version-control={numbered,existing,simple}]\n\
+ [--help] [--version]\n",
program_name, program_name);
exit (1);
}
{
fprintf (stderr, "\
Usage: %s [-dfirvR] [--directory] [--force] [--interactive] [--recursive]\n\
- [--verbose] path...\n",
+ [--verbose] [--help] [--version] path...\n",
program_name);
exit (1);
}
}
}
- if (optind == argc)
- usage ();
-
if (flag_version)
fprintf (stderr, "%s\n", version_string);
if (flag_help)
usage ();
+ if (optind == argc)
+ usage ();
+
for (; optind < argc; ++optind)
{
/* Stripping slashes is harmless for rmdir;
static void
usage ()
{
- fprintf (stderr, "Usage: %s [-p] [--path] dir...\n",
+ fprintf (stderr, "Usage: %s [-p] [--path] [--help] [--version] dir...\n",
program_name);
exit (1);
}
fprintf (stderr, "\
Usage: %s [-acfm] [-r reference-file] [-t MMDDhhmm[[CC]YY][.ss]]\n\
[-d time] [--time={atime,access,use,mtime,modify}] [--date=time]\n\
- [--file=reference-file] [--no-create] file...\n",
+ [--file=reference-file] [--no-create] [--help] [--version] file...\n",
program_name);
exit (1);
}