1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-05-24 11:20:24 +02:00

Standardize --help and --version processing.

This commit is contained in:
Jim Meyering
1999-04-04 15:44:26 +00:00
parent 25abb410d4
commit d815c152df
23 changed files with 126 additions and 94 deletions
+6 -4
View File
@@ -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);
}
+6 -4
View File
@@ -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);
}
+6 -4
View File
@@ -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);
}
+6 -4
View File
@@ -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);
}
+4 -4
View File
@@ -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;
+6 -4
View File
@@ -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;
+6 -4
View File
@@ -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);
}
+6 -4
View File
@@ -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);
}
+8 -6
View File
@@ -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;
+4 -4
View File
@@ -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);
}
+4 -4
View File
@@ -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;
+7 -4
View File
@@ -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;
+6 -4
View File
@@ -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);
}
+2 -4
View File
@@ -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 *))
+5 -4
View File
@@ -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);
}
}
+6 -4
View File
@@ -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);
}
+6 -4
View File
@@ -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);
}
+4 -4
View File
@@ -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);
}
+6 -4
View File
@@ -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;
+6 -4
View File
@@ -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;
+4 -4
View File
@@ -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;
+6 -4
View File
@@ -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);
}
+6 -4
View File
@@ -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);
}