diff options
author | Jim Meyering <jim@meyering.net> | 1993-08-05 02:20:48 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1993-08-05 02:20:48 +0000 |
commit | 410da16d0250bcf31c51a160de9eccb92667c7fe (patch) | |
tree | fb530f65b6ee0bc13a6cc8c1e9f576d9d92d447f /src | |
parent | 08701d38a4c4e746e79132651c4577a6c03b02f6 (diff) | |
download | coreutils-410da16d0250bcf31c51a160de9eccb92667c7fe.tar.xz |
merge with 3.8.1
Diffstat (limited to 'src')
-rw-r--r-- | src/chgrp.c | 12 | ||||
-rw-r--r-- | src/chmod.c | 12 | ||||
-rw-r--r-- | src/chown.c | 12 | ||||
-rw-r--r-- | src/cp.c | 12 | ||||
-rw-r--r-- | src/dd.c | 20 | ||||
-rw-r--r-- | src/df.c | 12 | ||||
-rw-r--r-- | src/du.c | 12 | ||||
-rw-r--r-- | src/install.c | 12 | ||||
-rw-r--r-- | src/ln.c | 12 | ||||
-rw-r--r-- | src/ls.c | 28 | ||||
-rw-r--r-- | src/mkdir.c | 21 | ||||
-rw-r--r-- | src/mkfifo.c | 12 | ||||
-rw-r--r-- | src/mknod.c | 12 | ||||
-rw-r--r-- | src/mv.c | 12 | ||||
-rw-r--r-- | src/rm.c | 12 | ||||
-rw-r--r-- | src/rmdir.c | 17 | ||||
-rw-r--r-- | src/touch.c | 12 |
17 files changed, 118 insertions, 124 deletions
diff --git a/src/chgrp.c b/src/chgrp.c index 65a0d4107..f9118cdbd 100644 --- a/src/chgrp.c +++ b/src/chgrp.c @@ -73,10 +73,10 @@ static int changes_only; static char *groupname; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_options[] = { @@ -85,8 +85,8 @@ static struct option const long_options[] = {"silent", no_argument, 0, 'f'}, {"quiet", no_argument, 0, 'f'}, {"verbose", no_argument, 0, 'v'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -127,13 +127,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind >= argc - 1) diff --git a/src/chmod.c b/src/chmod.c index 870f9f100..19c8cd8cd 100644 --- a/src/chmod.c +++ b/src/chmod.c @@ -59,10 +59,10 @@ static int verbose; static int changes_only; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_options[] = { @@ -71,8 +71,8 @@ static struct option const long_options[] = {"silent", no_argument, 0, 'f'}, {"quiet", no_argument, 0, 'f'}, {"verbose", no_argument, 0, 'v'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -142,13 +142,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (modeind == 0) diff --git a/src/chown.c b/src/chown.c index 7a2f4989f..37346aec9 100644 --- a/src/chown.c +++ b/src/chown.c @@ -83,10 +83,10 @@ static char *username; static char *groupname; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_options[] = { @@ -95,8 +95,8 @@ static struct option const long_options[] = {"silent", no_argument, 0, 'f'}, {"quiet", no_argument, 0, 'f'}, {"verbose", no_argument, 0, 'v'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -139,13 +139,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind >= argc - 1) @@ -119,10 +119,10 @@ static int umask_kill; static uid_t myeuid; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_opts[] = { @@ -141,8 +141,8 @@ static struct option const long_opts[] = {"update", no_argument, &flag_update, 1}, {"verbose", no_argument, &flag_verbose, 1}, {"version-control", required_argument, NULL, 'V'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -258,13 +258,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (NULL); if (flag_hard_link && flag_symbolic_link) @@ -20,7 +20,7 @@ /* Options: Numbers can be followed by a multiplier: - b=512, k=1024, w=2, xm=number m + b=512, c=1, k=1024, w=2, xm=number m if=FILE Read from FILE instead of stdin. of=FILE Write to FILE instead of stdout; don't @@ -309,15 +309,15 @@ static unsigned char const ebcdic_to_ascii[] = }; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_options[] = { - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -340,13 +340,13 @@ main (argc, argv) /* Decode arguments. */ scanargs (argc, argv); - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); apply_translations (); @@ -905,6 +905,8 @@ loop: case 'b': n *= 512; goto loop; + case 'c': + goto loop; case 'k': n *= 1024; goto loop; @@ -1032,7 +1034,7 @@ print_stats () fprintf (stderr, "%u+%u records in\n", r_full, r_partial); fprintf (stderr, "%u+%u records out\n", w_full, w_partial); if (r_truncate > 0) - fprintf (stderr, "%u truncated block%s\n", r_truncate, + fprintf (stderr, "%u truncated record%s\n", r_truncate, r_truncate == 1 ? "" : "s"); } @@ -1064,7 +1066,7 @@ Usage: %s [if=file] [of=file] [ibs=bytes] [obs=bytes] [bs=bytes] [cbs=bytes]\n\ [conv={ascii,ebcdic,ibm,block,unblock,lcase,ucase,swab,noerror,notrunc,\n\ sync}] [--help] [--version]\n\ Numbers can be followed by a multiplier:\n\ -b=512, k=1024, w=2, xm=number m\n", +b=512, c=1, k=1024, w=2, xm=number m\n", program_name); exit (1); } @@ -110,10 +110,10 @@ static struct fs_type_list *fs_exclude_list; static struct mount_entry *mount_list; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_options[] = { @@ -123,8 +123,8 @@ static struct option const long_options[] = {"portability", no_argument, &posix_format, 1}, {"type", required_argument, 0, 't'}, {"exclude-type", required_argument, 0, 'x'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -178,13 +178,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind != argc) @@ -156,10 +156,10 @@ static int (*xstat) (); static int exit_status; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_options[] = { @@ -173,8 +173,8 @@ static struct option const long_options[] = {"separate-dirs", no_argument, &opt_separate_dirs, 1}, {"summarize", no_argument, &opt_summarize_only, 1}, {"total", no_argument, &opt_combined_arguments, 1}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -258,13 +258,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (NULL); if (opt_all && opt_summarize_only) diff --git a/src/install.c b/src/install.c index c4593602b..9d579c22d 100644 --- a/src/install.c +++ b/src/install.c @@ -133,10 +133,10 @@ static int strip_files; static int dir_arg; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_options[] = { @@ -145,8 +145,8 @@ static struct option const long_options[] = {"group", required_argument, NULL, 'g'}, {"mode", required_argument, NULL, 'm'}, {"owner", required_argument, NULL, 'o'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -196,13 +196,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); /* Check for invalid combinations of arguments. */ @@ -66,10 +66,10 @@ static int verbose; static int hard_dir_link; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_options[] = { @@ -81,8 +81,8 @@ static struct option const long_options[] = {"symbolic", no_argument, &symbolic_link, 1}, {"verbose", no_argument, &verbose, 1}, {"version-control", required_argument, NULL, 'V'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -150,13 +150,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind == argc) @@ -359,10 +359,10 @@ static int format_needs_stat; static int exit_status; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_options[] = { @@ -391,8 +391,8 @@ static struct option const long_options[] = {"sort", required_argument, 0, 10}, {"tabsize", required_argument, 0, 'T'}, {"time", required_argument, 0, 11}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -446,13 +446,13 @@ main (argc, argv) program_name = argv[0]; i = decode_switches (argc, argv); - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); format_needs_stat = sort_type == sort_time || sort_type == sort_size @@ -1076,31 +1076,21 @@ get_link_name (filename, f) char *filename; struct file *f; { - register char *linkbuf; -#ifdef _AIX - register int bufsiz = PATH_MAX; /* st_size is wrong. */ -#else - register int bufsiz = f->stat.st_size; -#endif + char linkbuf[PATH_MAX + 1]; register int linksize; - linkbuf = (char *) xmalloc (bufsiz + 1); /* Some automounters give incorrect st_size for mount points. I can't think of a good workaround for it, though. */ - linksize = readlink (filename, linkbuf, bufsiz); + linksize = readlink (filename, linkbuf, sizeof (linkbuf)); if (linksize < 0) { error (0, errno, "%s", filename); exit_status = 1; - free (linkbuf); } else { -#ifdef _AIX - linkbuf = (char *) xrealloc (linkbuf, linksize + 1); -#endif linkbuf[linksize] = '\0'; - f->linkname = linkbuf; + f->linkname = xstrdup (linkbuf); } } diff --git a/src/mkdir.c b/src/mkdir.c index 360396b8d..f03f91f36 100644 --- a/src/mkdir.c +++ b/src/mkdir.c @@ -16,7 +16,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Options: - -p, --path Ensure that the given path(s) exist: + -p, --parent Ensure that the given path(s) exist: Make any missing parent directories for each argument. Parent dirs default to umask modified by `u+wx'. Do not consider an argument directory that already @@ -42,21 +42,22 @@ static void usage (); /* The name this program was run with. */ char *program_name; -/* If nonzero, ensure that a path exists. */ +/* If nonzero, ensure that all parents of the specified directory exist. */ static int path_mode; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const longopts[] = { {"mode", required_argument, NULL, 'm'}, {"path", no_argument, &path_mode, 1}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"parents", no_argument, &path_mode, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -91,13 +92,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind == argc) @@ -133,8 +134,8 @@ static void usage () { fprintf (stderr, "\ -Usage: %s [-p] [-m mode] [--path] [--mode=mode] [--help] [--version] dir...\n", - program_name); +Usage: %s [-p] [-m mode] [--parents] [--mode=mode]\n\ + [--help] [--version] dir...\n", program_name); exit (1); } diff --git a/src/mkfifo.c b/src/mkfifo.c index 1a0e27e03..ce8a7924c 100644 --- a/src/mkfifo.c +++ b/src/mkfifo.c @@ -37,16 +37,16 @@ static void usage (); char *program_name; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const longopts[] = { {"mode", required_argument, NULL, 'm'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -81,13 +81,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind == argc) diff --git a/src/mknod.c b/src/mknod.c index 24930c1d3..e4e3ad2f7 100644 --- a/src/mknod.c +++ b/src/mknod.c @@ -42,16 +42,16 @@ static void usage (); char *program_name; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const longopts[] = { {"mode", required_argument, NULL, 'm'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -82,13 +82,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); newmode = 0666 & ~umask (0); @@ -88,10 +88,10 @@ static int stdin_tty; static uid_t myeuid; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_options[] = { @@ -102,8 +102,8 @@ static struct option const long_options[] = {"update", no_argument, &update, 1}, {"verbose", no_argument, &verbose, 1}, {"version-control", required_argument, NULL, 'V'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -161,13 +161,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (argc < optind + 2) @@ -78,10 +78,10 @@ static int unlink_dirs; static int stdin_tty; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const long_opts[] = { @@ -90,8 +90,8 @@ static struct option const long_opts[] = {"interactive", no_argument, NULL, 'i'}, {"recursive", no_argument, &recursive, 1}, {"verbose", no_argument, &verbose, 1}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -138,13 +138,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind == argc) diff --git a/src/rmdir.c b/src/rmdir.c index 7302f25d4..6c1341ec2 100644 --- a/src/rmdir.c +++ b/src/rmdir.c @@ -16,7 +16,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Options: - -p, --path Remove any parent dirs that are explicitly mentioned + -p, --parent Remove any parent dirs that are explicitly mentioned in an argument, if they become empty after the argument file is removed. @@ -41,16 +41,17 @@ char *program_name; static int empty_paths; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const longopts[] = { {"path", no_argument, &empty_paths, 1}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"parents", no_argument, &empty_paths, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -79,13 +80,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (optind == argc) @@ -134,7 +135,7 @@ remove_parents (path) static void usage () { - fprintf (stderr, "Usage: %s [-p] [--path] [--help] [--version] dir...\n", + fprintf (stderr, "Usage: %s [-p] [--parents] [--help] [--version] dir...\n", program_name); exit (1); } diff --git a/src/touch.c b/src/touch.c index 583359162..ae5b82c12 100644 --- a/src/touch.c +++ b/src/touch.c @@ -93,10 +93,10 @@ static char *ref_file; static struct stat ref_stats; /* If non-zero, display usage information and exit. */ -static int flag_help; +static int show_help; /* If non-zero, print the version on standard error. */ -static int flag_version; +static int show_version; static struct option const longopts[] = { @@ -104,8 +104,8 @@ static struct option const longopts[] = {"no-create", no_argument, 0, 'c'}, {"date", required_argument, 0, 'd'}, {"file", required_argument, 0, 'r'}, - {"help", no_argument, &flag_help, 1}, - {"version", no_argument, &flag_version, 1}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {0, 0, 0, 0} }; @@ -193,13 +193,13 @@ main (argc, argv) } } - if (flag_version) + if (show_version) { fprintf (stderr, "%s\n", version_string); exit (0); } - if (flag_help) + if (show_help) usage (); if (change_times == 0) |