]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Remove now-unused long-options static var.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 21 Sep 2004 22:09:09 +0000 (22:09 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 21 Sep 2004 22:09:09 +0000 (22:09 +0000)
(main): Use getopt where it suffices, not getopt_long.

src/logname.c
src/printenv.c
src/sleep.c
src/tsort.c
src/uptime.c
src/users.c
src/whoami.c

index e1201b1fbb7f2b596693f5398edd56a346cf4d5a..005a7a43ea6965f04e9772468a3ca7108123faa0 100644 (file)
 /* The name this program was run with. */
 char *program_name;
 
-static struct option const long_options[] =
-{
-  {0, 0, 0, 0}
-};
-
 void
 usage (int status)
 {
@@ -74,18 +69,8 @@ main (int argc, char **argv)
 
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
-
-  while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1)
-    {
-      switch (c)
-       {
-       case 0:
-         break;
-
-       default:
-         usage (EXIT_FAILURE);
-       }
-    }
+  if (getopt (argc, argv, "") != -1)
+    usage (EXIT_FAILURE);
 
   if (optind < argc)
     {
index 1ad28199418f2557927301f5a84698744aa3a458..545f1aaee072e7a2518ad8566f9080dcfc1f6d34 100644 (file)
@@ -48,11 +48,6 @@ enum { PRINTENV_FAILURE = 2 };
 /* The name this program was run with. */
 char *program_name;
 
-static struct option const long_options[] =
-{
-  {0, 0, 0, 0}
-};
-
 extern char **environ;
 
 void
@@ -97,18 +92,8 @@ main (int argc, char **argv)
 
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
-
-  while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1)
-    {
-      switch (c)
-       {
-       case 0:
-         break;
-
-       default:
-         usage (PRINTENV_FAILURE);
-       }
-    }
+  if (getopt (argc, argv, "+") != -1)
+    usage (PRINTENV_FAILURE);
 
   if (optind >= argc)
     {
index aa766ee332b1079235649f21e6952c13638492d1..d327285c8678e8de2b9998ee417c3ab8710dd57f 100644 (file)
 /* The name by which this program was run. */
 char *program_name;
 
-static struct option const long_options[] =
-{
-  {0, 0, 0, 0}
-};
-
 void
 usage (int status)
 {
@@ -119,18 +114,8 @@ main (int argc, char **argv)
 
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
-
-  while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1)
-    {
-      switch (c)
-       {
-       case 0:
-         break;
-
-       default:
-         usage (EXIT_FAILURE);
-       }
-    }
+  if (getopt (argc, argv, "") != -1)
+    usage (EXIT_FAILURE);
 
   if (argc == 1)
     {
index 5d12a3db1abb40debd74f0a08da825ec9bf76a12..2dc82700854df810ecbdba563560cbc67d6829a6 100644 (file)
@@ -77,11 +77,6 @@ static struct item *loop = NULL;
 
 /* The number of strings to sort.  */
 static size_t n_strings = 0;
-
-static struct option const long_options[] =
-{
-  { NULL, 0, NULL, 0}
-};
 \f
 void
 usage (int status)
@@ -558,15 +553,8 @@ main (int argc, char **argv)
 
   parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
-
-  while ((opt = getopt_long (argc, argv, "", long_options, NULL)) != -1)
-    switch (opt)
-      {
-      case 0:                  /* long option */
-       break;
-      default:
-       usage (EXIT_FAILURE);
-      }
+  if (getopt (argc, argv, "") != -1)
+    usage (EXIT_FAILURE);
 
   have_read_stdin = false;
 
index cf27270ae9cad9c72c65904b53823ef3c37dc2c8..1c3b8813f2d1497425d22d1233f86d49fe576c66 100644 (file)
@@ -44,11 +44,6 @@ int getloadavg ();
 /* The name this program was run with. */
 char *program_name;
 
-static struct option const longopts[] =
-{
-  {NULL, 0, NULL, 0}
-};
-
 static void
 print_uptime (size_t n, const STRUCT_UTMP *this)
 {
@@ -225,18 +220,8 @@ main (int argc, char **argv)
 
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
-
-  while ((optc = getopt_long (argc, argv, "", longopts, NULL)) != -1)
-    {
-      switch (optc)
-       {
-       case 0:
-         break;
-
-       default:
-         usage (EXIT_FAILURE);
-       }
-    }
+  if (getopt (argc, argv, "") != -1)
+    usage (EXIT_FAILURE);
 
   switch (argc - optind)
     {
index a03b883257328c0838a2e4cf72d35c09b7efb6df..2858019cc1de5b3c40eca5626b419f69be0ddcf5 100644 (file)
 /* The name this program was run with. */
 char *program_name;
 
-static struct option const longopts[] =
-{
-  {NULL, 0, NULL, 0}
-};
-
 static int
 userid_compare (const void *v_a, const void *v_b)
 {
@@ -130,7 +125,6 @@ If FILE is not specified, use %s.  %s as FILE is common.\n\
 int
 main (int argc, char **argv)
 {
-  int optc;
   initialize_main (&argc, &argv);
   program_name = argv[0];
   setlocale (LC_ALL, "");
@@ -141,18 +135,8 @@ main (int argc, char **argv)
 
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
-
-  while ((optc = getopt_long (argc, argv, "", longopts, NULL)) != -1)
-    {
-      switch (optc)
-       {
-       case 0:
-         break;
-
-       default:
-         usage (EXIT_FAILURE);
-       }
-    }
+  if (getopt (argc, argv, "") != -1)
+    usage (EXIT_FAILURE);
 
   switch (argc - optind)
     {
index 12b2b104d250802d5e1181cfc24af672fdeff1e5..8614c5b82a516d2cc48de504320a04278fd79902 100644 (file)
 /* The name this program was run with. */
 char *program_name;
 
-static struct option const long_options[] =
-{
-  {0, 0, 0, 0}
-};
-
 void
 usage (int status)
 {
@@ -70,7 +65,6 @@ main (int argc, char **argv)
 {
   register struct passwd *pw;
   register uid_t uid;
-  int c;
 
   initialize_main (&argc, &argv);
   program_name = argv[0];
@@ -82,18 +76,8 @@ main (int argc, char **argv)
 
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
-
-  while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1)
-    {
-      switch (c)
-       {
-       case 0:
-         break;
-
-       default:
-         usage (EXIT_FAILURE);
-       }
-    }
+  if (getopt (argc, argv, "") != -1)
+    usage (EXIT_FAILURE);
 
   if (optind != argc)
     {