summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-03-31 05:52:46 +0000
committerJim Meyering <jim@meyering.net>1999-03-31 05:52:46 +0000
commitfdd07e3d2b4113a076cbb862115c43c9285e8b55 (patch)
tree7639c6587c2472b375e7175b32b1ca6114be0f9d
parent419aa421810a797b42eabc72dd767d26941bc17b (diff)
downloadcoreutils-fdd07e3d2b4113a076cbb862115c43c9285e8b55.tar.xz
No longer include long-options.h.
[long_options]: Add entries for --help and --version. Remove parse_long_options call. (main) [getopt switch]: Add a case for each of --help and --version.
-rw-r--r--src/date.c8
-rw-r--r--src/env.c8
-rw-r--r--src/id.c8
-rw-r--r--src/pinky.c10
-rw-r--r--src/seq.c10
-rw-r--r--src/su.c10
-rw-r--r--src/tee.c10
-rw-r--r--src/tty.c10
-rw-r--r--src/uname.c10
-rw-r--r--src/who.c10
10 files changed, 54 insertions, 40 deletions
diff --git a/src/date.c b/src/date.c
index a61fb45b6..ff85239d5 100644
--- a/src/date.c
+++ b/src/date.c
@@ -27,7 +27,6 @@
#include "error.h"
#include "getdate.h"
#include "getline.h"
-#include "long-options.h"
#include "posixtm.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -66,6 +65,8 @@ static struct option const long_options[] =
{"uct", no_argument, NULL, 'u'},
{"utc", no_argument, NULL, 'u'},
{"universal", no_argument, NULL, 'u'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -285,9 +286,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
while ((optc = getopt_long (argc, argv, "d:f:r:Rs:u", long_options, NULL))
!= -1)
switch (optc)
@@ -313,6 +311,8 @@ main (int argc, char **argv)
case 'u':
universal_time = 1;
break;
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}
diff --git a/src/env.c b/src/env.c
index dda5c119d..7d83b572f 100644
--- a/src/env.c
+++ b/src/env.c
@@ -85,7 +85,6 @@
#include "system.h"
#include "error.h"
-#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "env"
@@ -103,6 +102,8 @@ static struct option const longopts[] =
{
{"ignore-environment", no_argument, NULL, 'i'},
{"unset", required_argument, NULL, 'u'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -144,9 +145,6 @@ main (register int argc, register char **argv, char **envp)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
while ((optc = getopt_long (argc, argv, "+iu:", longopts, NULL)) != -1)
{
switch (optc)
@@ -158,6 +156,8 @@ main (register int argc, register char **argv, char **envp)
break;
case 'u':
break;
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (2);
}
diff --git a/src/id.c b/src/id.c
index fb982f24a..ad070dc05 100644
--- a/src/id.c
+++ b/src/id.c
@@ -28,7 +28,6 @@
#include "system.h"
#include "error.h"
-#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "id"
@@ -83,6 +82,8 @@ static struct option const longopts[] =
{"name", no_argument, NULL, 'n'},
{"real", no_argument, NULL, 'r'},
{"user", no_argument, NULL, 'u'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -124,9 +125,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
while ((optc = getopt_long (argc, argv, "agnruG", longopts, NULL)) != -1)
{
switch (optc)
@@ -151,6 +149,8 @@ main (int argc, char **argv)
case 'G':
just_group_list = 1;
break;
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}
diff --git a/src/pinky.c b/src/pinky.c
index 4bf6f7e23..ac15f7e1d 100644
--- a/src/pinky.c
+++ b/src/pinky.c
@@ -24,7 +24,6 @@
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "readutmp.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -77,6 +76,8 @@ static int include_where = 1;
static struct option const longopts[] =
{
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -440,9 +441,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
while ((optc = getopt_long (argc, argv, "sfwiqbhlp", longopts, &longind))
!= -1)
{
@@ -494,6 +492,10 @@ main (int argc, char **argv)
include_home_and_shell = 0;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/seq.c b/src/seq.c
index a0527891b..b15be8880 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -25,7 +25,6 @@
#include "system.h"
#include "error.h"
-#include "long-options.h"
#include "xstrtod.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -69,6 +68,8 @@ static struct option const long_options[] =
{ "equal-width", no_argument, NULL, 'w'},
{ "format", required_argument, NULL, 'f'},
{ "separator", required_argument, NULL, 's'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{ NULL, 0, NULL, 0}
};
@@ -117,9 +118,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
equal_width = 0;
format_str = NULL;
separator = "\n";
@@ -157,6 +155,10 @@ main (int argc, char **argv)
equal_width = 1;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
/* NOTREACHED */
diff --git a/src/su.c b/src/su.c
index ec18c0f15..0f5efd22d 100644
--- a/src/su.c
+++ b/src/su.c
@@ -82,7 +82,6 @@
#define getusershell _getusershell_sys_proto_
#include "system.h"
-#include "long-options.h"
#undef getusershell
@@ -174,6 +173,8 @@ static struct option const longopts[] =
{"login", no_argument, NULL, 'l'},
{"preserve-environment", no_argument, &change_environment, 0},
{"shell", required_argument, 0, 's'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{0, 0, 0, 0}
};
@@ -465,9 +466,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
fast_startup = 0;
simulate_login = 0;
change_environment = 1;
@@ -500,6 +498,10 @@ main (int argc, char **argv)
shell = optarg;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/tee.c b/src/tee.c
index e71fa6112..618c44ea8 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -26,7 +26,6 @@
#include "system.h"
#include "closeout.h"
#include "error.h"
-#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "tee"
@@ -50,6 +49,8 @@ static struct option const long_options[] =
{
{"append", no_argument, NULL, 'a'},
{"ignore-interrupts", no_argument, NULL, 'i'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -86,9 +87,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
append = 0;
ignore_interrupts = 0;
@@ -107,6 +105,10 @@ main (int argc, char **argv)
ignore_interrupts = 1;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/tty.c b/src/tty.c
index 2e1e2ee04..f1c4310bc 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -30,7 +30,6 @@
#include "system.h"
#include "closeout.h"
#include "error.h"
-#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "tty"
@@ -47,6 +46,8 @@ static struct option const longopts[] =
{
{"silent", no_argument, NULL, 's'},
{"quiet", no_argument, NULL, 's'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -82,9 +83,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
silent = 0;
while ((optc = getopt_long (argc, argv, "s", longopts, NULL)) != -1)
@@ -98,6 +96,10 @@ main (int argc, char **argv)
silent = 1;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (2);
}
diff --git a/src/uname.c b/src/uname.c
index 4017dbe90..f199ad065 100644
--- a/src/uname.c
+++ b/src/uname.c
@@ -40,7 +40,6 @@
#include "system.h"
#include "error.h"
-#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "uname"
@@ -82,6 +81,8 @@ static struct option const long_options[] =
{"sysname", no_argument, NULL, 's'},
{"processor", no_argument, NULL, 'p'},
{"all", no_argument, NULL, 'a'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -123,9 +124,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
toprint = 0;
while ((c = getopt_long (argc, argv, "snrvpma", long_options, NULL)) != -1)
@@ -164,6 +162,10 @@ main (int argc, char **argv)
PRINT_PROCESSOR | PRINT_VERSION | PRINT_MACHINE);
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}
diff --git a/src/who.c b/src/who.c
index 88088f313..e5fd094ef 100644
--- a/src/who.c
+++ b/src/who.c
@@ -29,7 +29,6 @@
#include <stdio.h>
#include "error.h"
-#include "long-options.h"
#include "readutmp.h"
#include "system.h"
@@ -81,6 +80,8 @@ static struct option const longopts[] =
{"message", no_argument, NULL, 'T'},
{"mesg", no_argument, NULL, 'T'},
{"writable", no_argument, NULL, 'T'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -388,9 +389,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- AUTHORS, usage);
-
while ((optc = getopt_long (argc, argv, "ilmqsuwHT", longopts, &longind))
!= -1)
{
@@ -428,6 +426,10 @@ main (int argc, char **argv)
include_mesg = 1;
break;
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (1);
}