]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Convert static declarations of struct option to use new macros from
authorJim Meyering <jim@meyering.net>
Wed, 2 Dec 1992 18:55:36 +0000 (18:55 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 2 Dec 1992 18:55:36 +0000 (18:55 +0000)
getopt.h: no_argument, required_argument, and optional_argument.

15 files changed:
src/chgrp.c
src/chown.c
src/cp.c
src/df.c
src/du.c
src/install.c
src/ln.c
src/ls.c
src/mkdir.c
src/mkfifo.c
src/mknod.c
src/mv.c
src/rm.c
src/rmdir.c
src/touch.c

index 9b178eac79b428d9749cbd1599973df1bb7b4738..57904ac490b24277988687cf10018f61f40831ff 100644 (file)
@@ -66,11 +66,11 @@ static char *groupname;
 
 static struct option const long_options[] =
 {
-  {"recursive", 0, 0, 'R'},
-  {"changes", 0, 0, 'c'},
-  {"silent", 0, 0, 'f'},
-  {"quiet", 0, 0, 'f'},
-  {"verbose", 0, 0, 'v'},
+  {"recursive", no_argument, 0, 'R'},
+  {"changes", no_argument, 0, 'c'},
+  {"silent", no_argument, 0, 'f'},
+  {"quiet", no_argument, 0, 'f'},
+  {"verbose", no_argument, 0, 'v'},
   {0, 0, 0, 0}
 };
 
index b510f12287a36e12fbafc2ea6bec3087309f1d8f..37a881e2fd265f0a76bb5a7ba5c325ab82d24e70 100644 (file)
@@ -83,11 +83,11 @@ static char *groupname;
 
 static struct option const long_options[] =
 {
-  {"recursive", 0, 0, 'R'},
-  {"changes", 0, 0, 'c'},
-  {"silent", 0, 0, 'f'},
-  {"quiet", 0, 0, 'f'},
-  {"verbose", 0, 0, 'v'},
+  {"recursive", no_argument, 0, 'R'},
+  {"changes", no_argument, 0, 'c'},
+  {"silent", no_argument, 0, 'f'},
+  {"quiet", no_argument, 0, 'f'},
+  {"verbose", no_argument, 0, 'v'},
   {0, 0, 0, 0}
 };
 
index 916c52f92089e9a49743e5af8ad9ba9ed4e22ada..c1415b7902585522e7101e33486dab155b315f80 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -119,21 +119,21 @@ static uid_t myeuid;
 
 static struct option const long_opts[] =
 {
-  {"archive", 0, NULL, 'a'},
-  {"backup", 0, NULL, 'b'},
-  {"force", 0, NULL, 'f'},
-  {"interactive", 0, NULL, 'i'},
-  {"link", 0, NULL, 'l'},
-  {"no-dereference", 0, &flag_dereference, 0},
-  {"one-file-system", 0, &flag_one_file_system, 1},
-  {"path", 0, &flag_path, 1},
-  {"preserve", 0, &flag_preserve, 1},
-  {"recursive", 0, NULL, 'R'},
-  {"suffix", 1, NULL, 'S'},
-  {"symbolic-link", 0, NULL, 's'},
-  {"update", 0, &flag_update, 1},
-  {"verbose", 0, &flag_verbose, 1},
-  {"version-control", 1, NULL, 'V'},
+  {"archive", no_argument, NULL, 'a'},
+  {"backup", no_argument, NULL, 'b'},
+  {"force", no_argument, NULL, 'f'},
+  {"interactive", no_argument, NULL, 'i'},
+  {"link", no_argument, NULL, 'l'},
+  {"no-dereference", no_argument, &flag_dereference, 0},
+  {"one-file-system", no_argument, &flag_one_file_system, 1},
+  {"path", no_argument, &flag_path, 1},
+  {"preserve", no_argument, &flag_preserve, 1},
+  {"recursive", no_argument, NULL, 'R'},
+  {"suffix", required_argument, NULL, 'S'},
+  {"symbolic-link", no_argument, NULL, 's'},
+  {"update", no_argument, &flag_update, 1},
+  {"verbose", no_argument, &flag_verbose, 1},
+  {"version-control", required_argument, NULL, 'V'},
   {NULL, 0, NULL, 0}
 };
 \f
index d6ce9d2422409de1672d94a372a5c7aa3b39fb61..35c069d2630432308e076b81352a9563c3e39c8b 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -96,11 +96,11 @@ static struct mount_entry *mount_list;
 
 static struct option const long_options[] =
 {
-  {"all", 0, &show_all_fs, 1},
-  {"inodes", 0, &inode_format, 1},
-  {"kilobytes", 0, &kilobyte_blocks, 1},
-  {"portability", 0, &posix_format, 1},
-  {"type", 1, 0, 't'},
+  {"all", no_argument, &show_all_fs, 1},
+  {"inodes", no_argument, &inode_format, 1},
+  {"kilobytes", no_argument, &kilobyte_blocks, 1},
+  {"portability", no_argument, &posix_format, 1},
+  {"type", required_argument, 0, 't'},
   {NULL, 0, NULL, 0}
 };
 
index 6f24f126028d754874a6cebe10e8b6736922d5e0..5543ceea86c68c59ed52cf80f71ae77c35fa54d7 100644 (file)
--- a/src/du.c
+++ b/src/du.c
@@ -157,16 +157,16 @@ static int exit_status;
 
 static struct option const long_options[] =
 {
-  {"all", 0, &opt_all, 1},
-  {"bytes", 0, NULL, 'b'},
-  {"count-links", 0, &opt_count_all, 1},
-  {"dereference", 0, NULL, 'L'},
-  {"dereference-args", 0, &opt_dereference_arguments, 1},
-  {"kilobytes", 0, NULL, 'k'},
-  {"one-file-system", 0, &opt_one_file_system, 1},
-  {"separate-dirs", 0, &opt_separate_dirs, 1},
-  {"summarize", 0, &opt_summarize_only, 1},
-  {"total", 0, &opt_combined_arguments, 1},
+  {"all", no_argument, &opt_all, 1},
+  {"bytes", no_argument, NULL, 'b'},
+  {"count-links", no_argument, &opt_count_all, 1},
+  {"dereference", no_argument, NULL, 'L'},
+  {"dereference-args", no_argument, &opt_dereference_arguments, 1},
+  {"kilobytes", no_argument, NULL, 'k'},
+  {"one-file-system", no_argument, &opt_one_file_system, 1},
+  {"separate-dirs", no_argument, &opt_separate_dirs, 1},
+  {"summarize", no_argument, &opt_summarize_only, 1},
+  {"total", no_argument, &opt_combined_arguments, 1},
   {NULL, 0, NULL, 0}
 };
 
index 326fb57e25aa55bd0c1b8369aae03769203b5c11..c4d8c9de4b1c8462ed28e91d6808f9f2f0598414 100644 (file)
@@ -126,11 +126,11 @@ static int dir_arg;
 
 static struct option const long_options[] =
 {
-  {"strip", 0, NULL, 's'},
-  {"directory", 0, NULL, 'd'},
-  {"group", 1, NULL, 'g'},
-  {"mode", 1, NULL, 'm'},
-  {"owner", 1, NULL, 'o'},
+  {"strip", no_argument, NULL, 's'},
+  {"directory", no_argument, NULL, 'd'},
+  {"group", required_argument, NULL, 'g'},
+  {"mode", required_argument, NULL, 'm'},
+  {"owner", required_argument, NULL, 'o'},
   {NULL, 0, NULL, 0}
 };
 
index 008e595d8b17a571f16ae2ffda05052a94b18ce5..ea8d3b2f3f278933c55c5be6262c21f4ce98ad5d 100644 (file)
--- a/src/ln.c
+++ b/src/ln.c
@@ -65,14 +65,14 @@ char *program_name;
 
 static struct option const long_options[] = 
 {
-  {"backup", 0, NULL, 'b'},
-  {"directory", 0, &hard_dir_link, 1},
-  {"force", 0, NULL, 'f'},
-  {"interactive", 0, NULL, 'i'},
-  {"suffix", 1, NULL, 'S'},
-  {"symbolic", 0, &symbolic_link, 1},
-  {"verbose", 0, &verbose, 1},
-  {"version-control", 1, NULL, 'V'},
+  {"backup", no_argument, NULL, 'b'},
+  {"directory", no_argument, &hard_dir_link, 1},
+  {"force", no_argument, NULL, 'f'},
+  {"interactive", no_argument, NULL, 'i'},
+  {"suffix", required_argument, NULL, 'S'},
+  {"symbolic", no_argument, &symbolic_link, 1},
+  {"verbose", no_argument, &verbose, 1},
+  {"version-control", required_argument, NULL, 'V'},
   {NULL, 0, NULL, 0}
 };
 
index 6fb98fc8ae2269cf6eb17679ffe71796188a54c7..202e16c6f41680887f23635f5be43a85477adf1c 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -422,29 +422,29 @@ main (argc, argv)
 \f
 static struct option const long_options[] =
 {
-  {"all", 0, 0, 'a'},
-  {"escape", 0, 0, 'b'},
-  {"directory", 0, 0, 'd'},
-  {"inode", 0, 0, 'i'},
-  {"kilobytes", 0, 0, 'k'},
-  {"numeric-uid-gid", 0, 0, 'n'},
-  {"hide-control-chars", 0, 0, 'q'},
-  {"reverse", 0, 0, 'r'},
-  {"size", 0, 0, 's'},
-  {"width", 1, 0, 'w'},
-  {"almost-all", 0, 0, 'A'},
-  {"ignore-backups", 0, 0, 'B'},
-  {"classify", 0, 0, 'F'},
-  {"file-type", 0, 0, 'F'},
-  {"ignore", 1, 0, 'I'},
-  {"dereference", 0, 0, 'L'},
-  {"literal", 0, 0, 'N'},
-  {"quote-name", 0, 0, 'Q'},
-  {"recursive", 0, 0, 'R'},
-  {"format", 1, 0, 12},
-  {"sort", 1, 0, 10},
-  {"tabsize", 1, 0, 'T'},
-  {"time", 1, 0, 11},
+  {"all", no_argument, 0, 'a'},
+  {"escape", no_argument, 0, 'b'},
+  {"directory", no_argument, 0, 'd'},
+  {"inode", no_argument, 0, 'i'},
+  {"kilobytes", no_argument, 0, 'k'},
+  {"numeric-uid-gid", no_argument, 0, 'n'},
+  {"hide-control-chars", no_argument, 0, 'q'},
+  {"reverse", no_argument, 0, 'r'},
+  {"size", no_argument, 0, 's'},
+  {"width", required_argument, 0, 'w'},
+  {"almost-all", no_argument, 0, 'A'},
+  {"ignore-backups", no_argument, 0, 'B'},
+  {"classify", no_argument, 0, 'F'},
+  {"file-type", no_argument, 0, 'F'},
+  {"ignore", required_argument, 0, 'I'},
+  {"dereference", no_argument, 0, 'L'},
+  {"literal", no_argument, 0, 'N'},
+  {"quote-name", no_argument, 0, 'Q'},
+  {"recursive", no_argument, 0, 'R'},
+  {"format", required_argument, 0, 12},
+  {"sort", required_argument, 0, 10},
+  {"tabsize", required_argument, 0, 'T'},
+  {"time", required_argument, 0, 11},
   {0, 0, 0, 0}
 };
 
index d8de4aff2a1d77fd31c863753ca20693637072fb..00bde815fad109c3bfde2724606511e777300516 100644 (file)
@@ -46,8 +46,8 @@ char *program_name;
 
 static struct option const longopts[] =
 {
-  {"mode", 1, NULL, 'm'},
-  {"path", 0, &path_mode, 1},
+  {"mode", required_argument, NULL, 'm'},
+  {"path", no_argument, &path_mode, 1},
   {NULL, 0, NULL, 0}
 };
 
index b2bc152471a35df0762de369d9bbf1465a75a2b5..075cece515bd4208acde2c53e73fb9b1341501ca 100644 (file)
@@ -37,7 +37,7 @@ char *program_name;
 
 static struct option const longopts[] =
 {
-  {"mode", 1, NULL, 'm'},
+  {"mode", required_argument, NULL, 'm'},
   {NULL, 0, NULL, 0}
 };
 
index d3091a5bf8cec33a8b48733c8a63f691d5393c52..66029ad0f6f0a4d29ea271e67fd636d35317587b 100644 (file)
@@ -42,7 +42,7 @@ char *program_name;
 
 static struct option const longopts[] =
 {
-  {"mode", 1, NULL, 'm'},
+  {"mode", required_argument, NULL, 'm'},
   {NULL, 0, NULL, 0}
 };
 
index 5fe629dd6f9c9913e44a917971a36bad45cace95..9d28d4a87f3f9362b8981bf10988b17c19cb6d4b 100644 (file)
--- a/src/mv.c
+++ b/src/mv.c
@@ -88,13 +88,13 @@ static uid_t myeuid;
 
 static struct option const long_options[] =
 {
-  {"backup", 0, NULL, 'b'},
-  {"force", 0, NULL, 'f'},
-  {"interactive", 0, NULL, 'i'},
-  {"suffix", 1, NULL, 'S'},
-  {"update", 0, &update, 1},
-  {"verbose", 0, &verbose, 1},
-  {"version-control", 1, NULL, 'V'},
+  {"backup", no_argument, NULL, 'b'},
+  {"force", no_argument, NULL, 'f'},
+  {"interactive", no_argument, NULL, 'i'},
+  {"suffix", required_argument, NULL, 'S'},
+  {"update", no_argument, &update, 1},
+  {"verbose", no_argument, &verbose, 1},
+  {"version-control", required_argument, NULL, 'V'},
   {NULL, 0, NULL, 0}
 };
 
index 5368ac73e6136ca911da5d9795875008a92d29ea..bcf28a4b9abc8c46e5f3adf71e936f600290a084 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -78,11 +78,11 @@ static int stdin_tty;
 
 static struct option const long_opts[] =
 {
-  {"directory", 0, &unlink_dirs, 1},
-  {"force", 0, NULL, 'f'},
-  {"interactive", 0, NULL, 'i'},
-  {"recursive", 0, &recursive, 1},
-  {"verbose", 0, &verbose, 1},
+  {"directory", no_argument, &unlink_dirs, 1},
+  {"force", no_argument, NULL, 'f'},
+  {"interactive", no_argument, NULL, 'i'},
+  {"recursive", no_argument, &recursive, 1},
+  {"verbose", no_argument, &verbose, 1},
   {NULL, 0, NULL, 0}
 };
 
index 137efb69c400f0ca68f0b41e6beff8c73dc9c511..35bd7d652b91a9956eb0341705d54417a422e7d1 100644 (file)
@@ -41,7 +41,7 @@ char *program_name;
 
 static struct option const longopts[] =
 {
-  {"path", 0, &empty_paths, 1},
+  {"path", no_argument, &empty_paths, 1},
   {NULL, 0, NULL, 0}
 };
 
index f3848ed80e20a44802cc9ff2ff67580465cf5c20..65d76279fb31217bba00df78fcc5dfaecb3ddeb8 100644 (file)
@@ -95,10 +95,10 @@ char *program_name;
 
 static struct option const longopts[] =
 {
-  {"time", 1, 0, 130},
-  {"no-create", 0, 0, 'c'},
-  {"date", 1, 0, 'd'},
-  {"file", 1, 0, 'r'},
+  {"time", required_argument, 0, 130},
+  {"no-create", no_argument, 0, 'c'},
+  {"date", required_argument, 0, 'd'},
+  {"file", required_argument, 0, 'r'},
   {0, 0, 0, 0}
 };