From eb3a2516dba78740843793f755af412f24ac5330 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 2 Dec 1992 18:31:56 +0000 Subject: Convert static declarations of struct option to use new macros from getopt.h: no_argument, required_argument, and optional_argument. --- src/cat.c | 14 +++++++------- src/csplit.c | 10 +++++----- src/cut.c | 10 +++++----- src/expand.c | 4 ++-- src/fold.c | 6 +++--- src/head.c | 10 +++++----- src/join.c | 6 +++--- src/nl.c | 22 +++++++++++----------- src/od.c | 14 +++++++------- src/paste.c | 4 ++-- src/split.c | 6 +++--- src/sum.c | 2 +- src/tac.c | 6 +++--- src/tail.c | 12 ++++++------ src/tr.c | 8 ++++---- src/unexpand.c | 4 ++-- src/uniq.c | 12 ++++++------ src/wc.c | 8 ++++---- 18 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/cat.c b/src/cat.c index f16daaab6..ef4828c96 100644 --- a/src/cat.c +++ b/src/cat.c @@ -136,13 +136,13 @@ main (argc, argv) static struct option const long_options[] = { - {"number-nonblank", 0, NULL, 'b'}, - {"number", 0, NULL, 'n'}, - {"squeeze-blank", 0, NULL, 's'}, - {"show-nonprinting", 0, NULL, 'v'}, - {"show-ends", 0, NULL, 'E'}, - {"show-tabs", 0, NULL, 'T'}, - {"show-all", 0, NULL, 'A'}, + {"number-nonblank", no_argument, NULL, 'b'}, + {"number", no_argument, NULL, 'n'}, + {"squeeze-blank", no_argument, NULL, 's'}, + {"show-nonprinting", no_argument, NULL, 'v'}, + {"show-ends", no_argument, NULL, 'E'}, + {"show-tabs", no_argument, NULL, 'T'}, + {"show-all", no_argument, NULL, 'A'}, {NULL, 0, NULL, 0} }; diff --git a/src/csplit.c b/src/csplit.c index 03ee5d79b..ec8d2ed51 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -1198,11 +1198,11 @@ interrupt_handler () static struct option const longopts[] = { - {"digits", 1, NULL, 'n'}, - {"quiet", 0, NULL, 's'}, - {"silent", 0, NULL, 's'}, - {"keep-files", 0, NULL, 'k'}, - {"prefix", 1, NULL, 'f'}, + {"digits", required_argument, NULL, 'n'}, + {"quiet", no_argument, NULL, 's'}, + {"silent", no_argument, NULL, 's'}, + {"keep-files", no_argument, NULL, 'k'}, + {"prefix", required_argument, NULL, 'f'}, {NULL, 0, NULL, 0} }; diff --git a/src/cut.c b/src/cut.c index 5ce3f85dd..1069a6400 100644 --- a/src/cut.c +++ b/src/cut.c @@ -145,11 +145,11 @@ char *program_name; static struct option const longopts[] = { - {"bytes", 1, 0, 'b'}, - {"characters", 1, 0, 'c'}, - {"fields", 1, 0, 'f'}, - {"delimiter", 1, 0, 'd'}, - {"only-delimited", 0, 0, 's'}, + {"bytes", required_argument, 0, 'b'}, + {"characters", required_argument, 0, 'c'}, + {"fields", required_argument, 0, 'f'}, + {"delimiter", required_argument, 0, 'd'}, + {"only-delimited", no_argument, 0, 's'}, {0, 0, 0, 0} }; diff --git a/src/expand.c b/src/expand.c index 4c46e3f41..a4fb1af5b 100644 --- a/src/expand.c +++ b/src/expand.c @@ -105,8 +105,8 @@ char *program_name; static struct option const longopts[] = { - {"tabs", 1, NULL, 't'}, - {"initial", 0, NULL, 'i'}, + {"tabs", required_argument, NULL, 't'}, + {"initial", no_argument, NULL, 'i'}, {NULL, 0, NULL, 0} }; diff --git a/src/fold.c b/src/fold.c index 4cd0a2c6b..3cd471596 100644 --- a/src/fold.c +++ b/src/fold.c @@ -48,9 +48,9 @@ char *program_name; static struct option const longopts[] = { - {"bytes", 0, NULL, 'b'}, - {"spaces", 0, NULL, 's'}, - {"width", 1, NULL, 'w'}, + {"bytes", no_argument, NULL, 'b'}, + {"spaces", no_argument, NULL, 's'}, + {"width", required_argument, NULL, 'w'}, {NULL, 0, NULL, 0} }; diff --git a/src/head.c b/src/head.c index 475894fff..b0719c826 100644 --- a/src/head.c +++ b/src/head.c @@ -84,11 +84,11 @@ static int have_read_stdin; static struct option const long_options[] = { - {"bytes", 1, NULL, 'c'}, - {"lines", 1, NULL, 'n'}, - {"quiet", 0, NULL, 'q'}, - {"silent", 0, NULL, 'q'}, - {"verbose", 0, NULL, 'v'}, + {"bytes", required_argument, NULL, 'c'}, + {"lines", required_argument, NULL, 'n'}, + {"quiet", no_argument, NULL, 'q'}, + {"silent", no_argument, NULL, 'q'}, + {"verbose", no_argument, NULL, 'v'}, {NULL, 0, NULL, 0} }; diff --git a/src/join.c b/src/join.c index 6e593b628..2399ad4ac 100644 --- a/src/join.c +++ b/src/join.c @@ -561,9 +561,9 @@ add_field_list (str) a character that is a short option. */ static struct option const longopts[] = { - {"j", 1, NULL, 'j'}, - {"j1", 1, NULL, '1'}, - {"j2", 1, NULL, '2'}, + {"j", required_argument, NULL, 'j'}, + {"j1", required_argument, NULL, '1'}, + {"j2", required_argument, NULL, '2'}, {NULL, 0, NULL, 0} }; diff --git a/src/nl.c b/src/nl.c index 09ff8d2b9..233a6f26a 100644 --- a/src/nl.c +++ b/src/nl.c @@ -150,17 +150,17 @@ static void build_print_fmt (); static struct option const longopts[] = { - {"header-numbering", 1, NULL, 'h'}, - {"body-numbering", 1, NULL, 'b'}, - {"footer-numbering", 1, NULL, 'f'}, - {"first-page", 1, NULL, 'v'}, - {"page-increment", 1, NULL, 'i'}, - {"no-renumber", 0, NULL, 'p'}, - {"join-blank-lines", 1, NULL, 'l'}, - {"number-separator", 1, NULL, 's'}, - {"number-width", 1, NULL, 'w'}, - {"number-format", 1, NULL, 'n'}, - {"section-delimiter", 1, NULL, 'd'}, + {"header-numbering", required_argument, NULL, 'h'}, + {"body-numbering", required_argument, NULL, 'b'}, + {"footer-numbering", required_argument, NULL, 'f'}, + {"first-page", required_argument, NULL, 'v'}, + {"page-increment", required_argument, NULL, 'i'}, + {"no-renumber", no_argument, NULL, 'p'}, + {"join-blank-lines", required_argument, NULL, 'l'}, + {"number-separator", required_argument, NULL, 's'}, + {"number-width", required_argument, NULL, 'w'}, + {"number-format", required_argument, NULL, 'n'}, + {"section-delimiter", required_argument, NULL, 'd'}, {NULL, 0, NULL, 0} }; diff --git a/src/od.c b/src/od.c index d6b1c1b2f..eb6ffed31 100644 --- a/src/od.c +++ b/src/od.c @@ -254,15 +254,15 @@ static enum size_spec fp_type_size[MAX_FP_TYPE_SIZE + 1]; static struct option const long_options[] = { /* POSIX options. */ - {"skip-bytes", 1, NULL, 'j'}, - {"address-radix", 1, NULL, 'A'}, - {"read-bytes", 1, NULL, 'N'}, - {"format", 1, NULL, 't'}, - {"output-duplicates", 0, NULL, 'v'}, + {"skip-bytes", required_argument, NULL, 'j'}, + {"address-radix", required_argument, NULL, 'A'}, + {"read-bytes", required_argument, NULL, 'N'}, + {"format", required_argument, NULL, 't'}, + {"output-duplicates", no_argument, NULL, 'v'}, /* non-POSIX options. */ - {"strings", 2, NULL, 's'}, - {"width", 2, NULL, 'w'}, + {"strings", optional_argument, NULL, 's'}, + {"width", optional_argument, NULL, 'w'}, {NULL, 0, NULL, 0} }; diff --git a/src/paste.c b/src/paste.c index 3b2b1de65..3cd95d368 100644 --- a/src/paste.c +++ b/src/paste.c @@ -79,8 +79,8 @@ static char *delim_end; static struct option const longopts[] = { - {"serial", 0, 0, 's'}, - {"delimiters", 1, 0, 'd'}, + {"serial", no_argument, 0, 's'}, + {"delimiters", required_argument, 0, 'd'}, {0, 0, 0, 0} }; diff --git a/src/split.c b/src/split.c index 01c53bb38..a2aee897b 100644 --- a/src/split.c +++ b/src/split.c @@ -82,9 +82,9 @@ Usage: %s [-lines] [-l lines] [-b bytes[bkm]] [-C bytes[bkm]]\n\ static struct option const longopts[] = { - {"bytes", 1, NULL, 'b'}, - {"lines", 1, NULL, 'l'}, - {"line-bytes", 1, NULL, 'C'}, + {"bytes", required_argument, NULL, 'b'}, + {"lines", required_argument, NULL, 'l'}, + {"line-bytes", required_argument, NULL, 'C'}, {NULL, 0, NULL, 0} }; diff --git a/src/sum.c b/src/sum.c index 35780d1e5..a7079b882 100644 --- a/src/sum.c +++ b/src/sum.c @@ -40,7 +40,7 @@ static int have_read_stdin; static struct option const longopts[] = { - {"sysv", 0, NULL, 's'}, + {"sysv", no_argument, NULL, 's'}, {NULL, 0, NULL, 0} }; diff --git a/src/tac.c b/src/tac.c index f7a2479e1..8f3c94aab 100644 --- a/src/tac.c +++ b/src/tac.c @@ -103,9 +103,9 @@ static struct re_pattern_buffer compiled_separator; static struct option const longopts[] = { - {"before", 0, &separator_ends_record, 0}, - {"regex", 0, &sentinel_length, 0}, - {"separator", 1, NULL, 's'}, + {"before", no_argument, &separator_ends_record, 0}, + {"regex", no_argument, &sentinel_length, 0}, + {"separator", required_argument, NULL, 's'}, {NULL, 0, NULL, 0} }; diff --git a/src/tail.c b/src/tail.c index e3aa464fe..969488b7b 100644 --- a/src/tail.c +++ b/src/tail.c @@ -117,12 +117,12 @@ static int have_read_stdin; static struct option const long_options[] = { - {"bytes", 1, NULL, 'c'}, - {"follow", 0, NULL, 'f'}, - {"lines", 1, NULL, 'n'}, - {"quiet", 0, NULL, 'q'}, - {"silent", 0, NULL, 'q'}, - {"verbose", 0, NULL, 'v'}, + {"bytes", required_argument, NULL, 'c'}, + {"follow", no_argument, NULL, 'f'}, + {"lines", required_argument, NULL, 'n'}, + {"quiet", no_argument, NULL, 'q'}, + {"silent", no_argument, NULL, 'q'}, + {"verbose", no_argument, NULL, 'v'}, {NULL, 0, NULL, 0} }; diff --git a/src/tr.c b/src/tr.c index 38ed7167b..e943903f8 100644 --- a/src/tr.c +++ b/src/tr.c @@ -313,10 +313,10 @@ static char xlate[N_CHARS]; static struct option const long_options[] = { - {"complement", 0, NULL, 'c'}, - {"delete", 0, NULL, 'd'}, - {"squeeze-repeats", 0, NULL, 's'}, - {"truncate-set1", 0, NULL, 't'}, + {"complement", no_argument, NULL, 'c'}, + {"delete", no_argument, NULL, 'd'}, + {"squeeze-repeats", no_argument, NULL, 's'}, + {"truncate-set1", no_argument, NULL, 't'}, {NULL, 0, NULL, 0} }; diff --git a/src/unexpand.c b/src/unexpand.c index e595f434b..e3de5e709 100644 --- a/src/unexpand.c +++ b/src/unexpand.c @@ -107,8 +107,8 @@ char *program_name; static struct option const longopts[] = { - {"tabs", 1, NULL, 't'}, - {"all", 0, NULL, 'a'}, + {"tabs", required_argument, NULL, 't'}, + {"all", no_argument, NULL, 'a'}, {NULL, 0, NULL, 0} }; diff --git a/src/uniq.c b/src/uniq.c index 339b2aead..1b8e8e4d3 100644 --- a/src/uniq.c +++ b/src/uniq.c @@ -73,12 +73,12 @@ char *program_name; static struct option const longopts[] = { - {"count", 0, NULL, 'c'}, - {"repeated", 0, NULL, 'd'}, - {"unique", 0, NULL, 'u'}, - {"skip-fields", 1, NULL, 'f'}, - {"skip-chars", 1, NULL, 's'}, - {"check-chars", 1, NULL, 'w'}, + {"count", no_argument, NULL, 'c'}, + {"repeated", no_argument, NULL, 'd'}, + {"unique", no_argument, NULL, 'u'}, + {"skip-fields", required_argument, NULL, 'f'}, + {"skip-chars", required_argument, NULL, 's'}, + {"check-chars", required_argument, NULL, 'w'}, {NULL, 0, NULL, 0} }; diff --git a/src/wc.c b/src/wc.c index f2d791824..5bb4f2405 100644 --- a/src/wc.c +++ b/src/wc.c @@ -49,10 +49,10 @@ static int exit_status; static struct option const longopts[] = { - {"bytes", 0, NULL, 'c'}, - {"chars", 0, NULL, 'c'}, - {"lines", 0, NULL, 'l'}, - {"words", 0, NULL, 'w'}, + {"bytes", no_argument, NULL, 'c'}, + {"chars", no_argument, NULL, 'c'}, + {"lines", no_argument, NULL, 'l'}, + {"words", no_argument, NULL, 'w'}, {NULL, 0, NULL, 0} }; -- cgit v1.2.3-70-g09d2