summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cat.c10
-rw-r--r--src/comm.c10
-rw-r--r--src/csplit.c10
-rw-r--r--src/cut.c10
-rw-r--r--src/expand.c8
-rw-r--r--src/fmt.c10
-rw-r--r--src/fold.c10
-rw-r--r--src/head.c10
-rw-r--r--src/join.c14
-rw-r--r--src/md5sum.c8
-rw-r--r--src/nl.c8
-rw-r--r--src/od.c11
-rw-r--r--src/paste.c10
-rw-r--r--src/pr.c6
-rw-r--r--src/ptx.c9
-rw-r--r--src/split.c10
-rw-r--r--src/sum.c10
-rw-r--r--src/tac.c8
-rw-r--r--src/tail.c10
-rw-r--r--src/tr.c10
-rw-r--r--src/unexpand.c8
-rw-r--r--src/uniq.c10
-rw-r--r--src/wc.c10
23 files changed, 126 insertions, 94 deletions
diff --git a/src/cat.c b/src/cat.c
index 2f49d3726..0899cb79f 100644
--- a/src/cat.c
+++ b/src/cat.c
@@ -32,7 +32,6 @@
#endif
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "safe-read.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -528,6 +527,8 @@ main (int argc, char **argv)
#if O_BINARY
{"binary", no_argument, NULL, 'B'},
#endif
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -536,9 +537,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
/* Parse command line options. */
while ((c = getopt_long (argc, argv,
@@ -615,6 +613,10 @@ main (int argc, char **argv)
output_tabs = 0;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (EXIT_FAILURE);
}
diff --git a/src/comm.c b/src/comm.c
index c7be39b1a..9aab98b02 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -24,7 +24,6 @@
#include <sys/types.h>
#include "system.h"
#include "linebuffer.h"
-#include "long-options.h"
#include "error.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -50,6 +49,8 @@ static int both;
static struct option const long_options[] =
{
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{0, 0, 0, 0}
};
@@ -219,9 +220,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
only_file_1 = 1;
only_file_2 = 1;
both = 1;
@@ -244,6 +242,10 @@ main (int argc, char **argv)
both = 0;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/csplit.c b/src/csplit.c
index bc1bd58e6..e5a82a6e6 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -31,7 +31,6 @@
#include <regex.h>
#include "error.h"
-#include "long-options.h"
#include "safe-read.h"
#include "xstrtoul.h"
#include "xalloc.h"
@@ -217,6 +216,8 @@ static struct option const longopts[] =
{"elide-empty-files", no_argument, NULL, 'z'},
{"prefix", required_argument, NULL, 'f'},
{"suffix-format", required_argument, NULL, 'b'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -1377,9 +1378,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
global_argv = argv;
controls = NULL;
control_used = 0;
@@ -1455,6 +1453,10 @@ main (int argc, char **argv)
elide_empty_files = TRUE;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/cut.c b/src/cut.c
index 90c4dbd8d..ac8864dfd 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -66,7 +66,6 @@
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
-#include "long-options.h"
#include "error.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -182,6 +181,8 @@ static struct option const longopts[] =
{"delimiter", required_argument, 0, 'd'},
{"only-delimited", no_argument, 0, 's'},
{"output-delimiter", required_argument, 0, CHAR_MAX + 1},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{0, 0, 0, 0}
};
@@ -694,9 +695,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
operating_mode = undefined_mode;
/* By default, all non-delimited lines are printed. */
@@ -755,6 +753,10 @@ main (int argc, char **argv)
suppress_non_delimited = 1;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (2);
}
diff --git a/src/expand.c b/src/expand.c
index e50d10c8d..315fd9ac3 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -40,7 +40,6 @@
#include <sys/types.h>
#include "system.h"
#include "error.h"
-#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "expand"
@@ -93,6 +92,8 @@ static struct option const longopts[] =
{
{"tabs", required_argument, NULL, 't'},
{"initial", no_argument, NULL, 'i'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -338,9 +339,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
while ((c = getopt_long (argc, argv, "it:,0123456789", longopts, NULL)) != -1)
{
switch (c)
@@ -360,6 +358,8 @@ main (int argc, char **argv)
add_tabstop (tabval);
tabval = -1;
break;
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
if (tabval == -1)
tabval = 0;
diff --git a/src/fmt.c b/src/fmt.c
index 2f8f355e9..67aded871 100644
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -28,7 +28,6 @@
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -302,6 +301,8 @@ static const struct option long_options[] =
{"tagged-paragraph", no_argument, NULL, 't'},
{"uniform-spacing", no_argument, NULL, 'u'},
{"width", required_argument, NULL, 'w'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{0, 0, 0, 0},
};
@@ -315,9 +316,6 @@ main (register int argc, register char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
crown = tagged = split = uniform = FALSE;
max_width = WIDTH;
prefix = "";
@@ -381,6 +379,10 @@ main (register int argc, register char **argv)
set_prefix (optarg);
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
}
best_width = max_width * (2 * (100 - LEEWAY) + 1) / 200;
diff --git a/src/fold.c b/src/fold.c
index d1c6bf88d..a9b25f662 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -25,7 +25,6 @@
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -50,6 +49,8 @@ static struct option const longopts[] =
{"bytes", no_argument, NULL, 'b'},
{"spaces", no_argument, NULL, 's'},
{"width", required_argument, NULL, 'w'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -241,9 +242,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
break_spaces = count_bytes = have_read_stdin = 0;
/* Turn any numeric options into -w options. */
@@ -287,6 +285,10 @@ main (int argc, char **argv)
}
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/head.c b/src/head.c
index 4c869baa1..8a45942d6 100644
--- a/src/head.c
+++ b/src/head.c
@@ -31,7 +31,6 @@
#include <sys/types.h>
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "xstrtoul.h"
#include "safe-read.h"
@@ -71,6 +70,8 @@ static struct option const long_options[] =
{"quiet", no_argument, NULL, 'q'},
{"silent", no_argument, NULL, 'q'},
{"verbose", no_argument, NULL, 'v'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -266,9 +267,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
have_read_stdin = 0;
print_headers = 0;
@@ -368,6 +366,10 @@ main (int argc, char **argv)
header_mode = always;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/join.c b/src/join.c
index de9b1625b..3603caf42 100644
--- a/src/join.c
+++ b/src/join.c
@@ -31,10 +31,9 @@
#endif
#include "system.h"
-#include "long-options.h"
-#include "xstrtol.h"
#include "error.h"
#include "memcasecmp.h"
+#include "xstrtol.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "join"
@@ -123,6 +122,8 @@ static struct option const longopts[] =
{"j", required_argument, NULL, 'j'},
{"j1", required_argument, NULL, '1'},
{"j2", required_argument, NULL, '2'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -742,9 +743,6 @@ main (int argc, char **argv)
it may be increased. */
uni_blank.nfields = 1;
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
nfiles = 0;
print_pairables = 1;
@@ -832,7 +830,11 @@ main (int argc, char **argv)
names[nfiles++] = optarg;
break;
- case '?':
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
+ default:
usage (1);
}
prev_optc = optc;
diff --git a/src/md5sum.c b/src/md5sum.c
index f80b0ebef..592267c70 100644
--- a/src/md5sum.c
+++ b/src/md5sum.c
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <sys/types.h>
-#include "long-options.h"
#include "md5.h"
#include "getline.h"
#include "system.h"
@@ -95,6 +94,8 @@ static const struct option long_options[] =
{ "string", required_argument, 0, 1 },
{ "text", no_argument, 0, 't' },
{ "warn", no_argument, 0, 'w' },
+ { GETOPT_HELP_OPTION_DECL },
+ { GETOPT_VERSION_OPTION_DECL },
{ NULL, 0, NULL, 0 }
};
@@ -477,9 +478,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
while ((opt = getopt_long (argc, argv, "bctw", long_options, NULL)) != -1)
switch (opt)
{
@@ -514,6 +512,8 @@ main (int argc, char **argv)
status_only = 0;
warn = 1;
break;
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (EXIT_FAILURE);
}
diff --git a/src/nl.c b/src/nl.c
index c2ba80af0..79394ff65 100644
--- a/src/nl.c
+++ b/src/nl.c
@@ -30,7 +30,6 @@
#include "error.h"
#include "linebuffer.h"
-#include "long-options.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -158,6 +157,8 @@ static struct option const longopts[] =
{"number-width", required_argument, NULL, 'w'},
{"number-format", required_argument, NULL, 'n'},
{"section-delimiter", required_argument, NULL, 'd'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -450,9 +451,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
have_read_stdin = 0;
while ((c = getopt_long (argc, argv, "h:b:f:v:i:pl:s:w:n:d:", longopts,
@@ -554,6 +552,8 @@ main (int argc, char **argv)
case 'd':
section_del = optarg;
break;
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (2);
break;
diff --git a/src/od.c b/src/od.c
index 3280dd516..b6906f413 100644
--- a/src/od.c
+++ b/src/od.c
@@ -25,7 +25,6 @@
#include <sys/types.h>
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "xstrtoul.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -258,6 +257,9 @@ static struct option const long_options[] =
{"strings", optional_argument, NULL, 's'},
{"traditional", no_argument, NULL, 'B'},
{"width", optional_argument, NULL, 'w'},
+
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -1598,9 +1600,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
err = 0;
for (i = 0; i <= MAX_INTEGRAL_TYPE_SIZE; i++)
@@ -1761,6 +1760,10 @@ the maximum\nrepresentable value of type `long'"), optarg);
}
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
break;
diff --git a/src/paste.c b/src/paste.c
index 465c87205..c77075f17 100644
--- a/src/paste.c
+++ b/src/paste.c
@@ -45,7 +45,6 @@
#include <sys/types.h>
#include "system.h"
#include "error.h"
-#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "paste"
@@ -83,6 +82,8 @@ static struct option const longopts[] =
{
{"serial", no_argument, 0, 's'},
{"delimiters", required_argument, 0, 'd'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{0, 0, 0, 0}
};
@@ -436,9 +437,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
have_read_stdin = 0;
serial_merge = 0;
delims = default_delims;
@@ -463,6 +461,10 @@ main (int argc, char **argv)
serial_merge++;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/pr.c b/src/pr.c
index 871b25c1b..c423c7637 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -302,7 +302,6 @@
#include <time.h>
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -735,6 +734,8 @@ static struct option const long_options[] =
{"show-nonprinting", no_argument, NULL, 'v'},
{"width", required_argument, NULL, 'w'},
{"page-width", required_argument, NULL, 'W'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{0, 0, 0, 0}
};
@@ -827,9 +828,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
n_files = 0;
file_names = (argc > 1
? (char **) xmalloc ((argc - 1) * sizeof (char *))
diff --git a/src/ptx.c b/src/ptx.c
index 93e73bbb5..80d8c1b2b 100644
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -28,7 +28,6 @@
#include "bumpalloc.h"
#include "diacrit.h"
#include "error.h"
-#include "long-options.h"
#include "regex.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -1938,6 +1937,8 @@ static const struct option long_options[] =
{"typeset-mode", no_argument, NULL, 't'},
{"width", required_argument, NULL, 'w'},
{"word-regexp", required_argument, NULL, 'W'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{0, 0, 0, 0},
};
@@ -1968,9 +1969,6 @@ main (int argc, char **argv)
setchrclass (NULL);
#endif
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
while (optchar = getopt_long (argc, argv, "ACF:GM:ORS:TW:b:i:fg:o:trw:",
long_options, NULL),
optchar != EOF)
@@ -2073,6 +2071,9 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"),
case 10:
output_format = XARGMATCH ("--format", optarg,
format_args, format_vals);
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
}
}
diff --git a/src/split.c b/src/split.c
index 74e08f81f..46ba9b3ca 100644
--- a/src/split.c
+++ b/src/split.c
@@ -29,7 +29,6 @@
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "safe-read.h"
#include "xstrtol.h"
@@ -72,6 +71,8 @@ static struct option const longopts[] =
{"lines", required_argument, NULL, 'l'},
{"line-bytes", required_argument, NULL, 'C'},
{"verbose", no_argument, NULL, 2},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -347,9 +348,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
/* Parse command line options. */
infile = "-";
@@ -445,6 +443,10 @@ main (int argc, char **argv)
verbose = 1;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (EXIT_FAILURE);
}
diff --git a/src/sum.c b/src/sum.c
index 47524e483..cadcee007 100644
--- a/src/sum.c
+++ b/src/sum.c
@@ -26,7 +26,6 @@
#include <getopt.h>
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "safe-read.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -46,6 +45,8 @@ static int have_read_stdin;
static struct option const longopts[] =
{
{"sysv", no_argument, NULL, 's'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -214,9 +215,6 @@ main (int argc, char **argv)
have_read_stdin = 0;
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
while ((optc = getopt_long (argc, argv, "rs", longopts, NULL)) != -1)
{
switch (optc)
@@ -232,6 +230,10 @@ main (int argc, char **argv)
sum_func = sysv_sum_file;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/tac.c b/src/tac.c
index a88bfab6b..29dd020fb 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -45,7 +45,6 @@ tac -r -s '.\|
#include <regex.h>
#include "error.h"
-#include "long-options.h"
#include "safe-read.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -113,6 +112,8 @@ static struct option const longopts[] =
{"before", no_argument, NULL, 'b'},
{"regex", no_argument, NULL, 'r'},
{"separator", required_argument, NULL, 's'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -614,9 +615,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
errors = 0;
separator = "\n";
sentinel_length = 1;
@@ -639,6 +637,8 @@ main (int argc, char **argv)
if (*separator == 0)
error (EXIT_FAILURE, 0, _("separator cannot be empty"));
break;
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}
diff --git a/src/tail.c b/src/tail.c
index 2b24371f8..93083090b 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -33,7 +33,6 @@
#include "system.h"
#include "argmatch.h"
#include "error.h"
-#include "long-options.h"
#include "safe-read.h"
#include "xstrtoul.h"
@@ -179,6 +178,8 @@ static struct option const long_options[] =
{"silent", no_argument, NULL, 'q'},
{"sleep-interval", required_argument, NULL, 's'},
{"verbose", no_argument, NULL, 'v'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -1316,6 +1317,10 @@ parse_options (int argc, char **argv,
*header_mode = always;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
@@ -1343,9 +1348,6 @@ main (int argc, char **argv)
have_read_stdin = 0;
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
{
int found_obsolescent;
int fail;
diff --git a/src/tr.c b/src/tr.c
index ac8fb3cc1..dc3332b7f 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -27,7 +27,6 @@
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "safe-read.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -310,6 +309,8 @@ static struct option const long_options[] =
{"delete", no_argument, NULL, 'd'},
{"squeeze-repeats", no_argument, NULL, 's'},
{"truncate-set1", no_argument, NULL, 't'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -1803,9 +1804,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
while ((c = getopt_long (argc, argv, "cdst", long_options, NULL)) != -1)
{
switch (c)
@@ -1829,6 +1827,10 @@ main (int argc, char **argv)
truncate_set1 = 1;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (2);
break;
diff --git a/src/unexpand.c b/src/unexpand.c
index ed6443751..c0749c4ed 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -42,7 +42,6 @@
#include <sys/types.h>
#include "system.h"
-#include "long-options.h"
#include "error.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -96,6 +95,8 @@ static struct option const longopts[] =
{
{"tabs", required_argument, NULL, 't'},
{"all", no_argument, NULL, 'a'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -389,9 +390,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
have_read_stdin = 0;
exit_status = 0;
convert_entire_line = 0;
@@ -418,6 +416,8 @@ main (int argc, char **argv)
add_tabstop (tabval);
tabval = -1;
break;
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
if (tabval == -1)
tabval = 0;
diff --git a/src/uniq.c b/src/uniq.c
index 26c6753bd..822a5389d 100644
--- a/src/uniq.c
+++ b/src/uniq.c
@@ -25,7 +25,6 @@
#include "system.h"
#include "linebuffer.h"
-#include "long-options.h"
#include "error.h"
#include "xstrtol.h"
#include "memcasecmp.h"
@@ -85,6 +84,8 @@ static struct option const longopts[] =
{"skip-fields", required_argument, NULL, 'f'},
{"skip-chars", required_argument, NULL, 's'},
{"check-chars", required_argument, NULL, 'w'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -289,9 +290,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
skip_chars = 0;
skip_fields = 0;
check_chars = 0;
@@ -375,6 +373,10 @@ main (int argc, char **argv)
}
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/wc.c b/src/wc.c
index 886b4484a..4799ee446 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -29,7 +29,6 @@
#include "system.h"
#include "error.h"
#include "human.h"
-#include "long-options.h"
#include "safe-read.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -66,6 +65,8 @@ static struct option const longopts[] =
{"lines", no_argument, NULL, 'l'},
{"words", no_argument, NULL, 'w'},
{"max-line-length", no_argument, NULL, 'L'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -302,9 +303,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
exit_status = 0;
print_lines = print_words = print_chars = print_linelength = 0;
total_lines = total_words = total_chars = max_line_length = 0;
@@ -331,6 +329,10 @@ main (int argc, char **argv)
print_linelength = 1;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}