Applied patch from David Douthitt to fix build error in df.c when
[oweals/busybox.git] / getopt.c
index 8c94bb4c1486f10001d056ff593bd6dc6d19b333..eb28d5d07118ff8d021a009ba88c0324591b99ba 100644 (file)
--- a/getopt.c
+++ b/getopt.c
@@ -37,7 +37,7 @@
  *     <misiek@misiek.eu.org>)
  * Ported to Busybox - Alfred M. Szmidt <ams@trillian.itslinux.org>
  *  Removed --version/-V and --help/-h in
- *  Removed prase_error(), using errorMsg() from Busybox instead
+ *  Removed prase_error(), using error_msg() from Busybox instead
  *  Replaced our_malloc with xmalloc and our_realloc with xrealloc
  *
  */
@@ -53,9 +53,9 @@
 
 /* NON_OPT is the code that is returned when a non-option is found in '+'
    mode */
-#define NON_OPT 1
+static const int NON_OPT = 1;
 /* LONG_OPT is the code that is returned when a long option is found. */
-#define LONG_OPT 2
+static const int LONG_OPT = 2;
 
 /* The shells recognized. */
 typedef enum {BASH,TCSH} shell_t;
@@ -199,7 +199,7 @@ int generate_output(char * argv[],int argc,const char *optstr,
 static struct option *long_options=NULL;
 static int long_options_length=0; /* Length of array */
 static int long_options_nr=0; /* Nr of used elements in array */
-#define LONG_OPTIONS_INCR 10
+static const int LONG_OPTIONS_INCR = 10;
 #define init_longopt() add_longopt(NULL,0)
 
 /* Register a long option. The contents of name is copied. */
@@ -258,7 +258,7 @@ void add_long_options(char *options)
                                         arg_opt=required_argument;
                                 }
                                 if (strlen(tokptr) == 0)
-                                        errorMsg("empty long option after -l or --long argument\n");
+                                        error_msg("empty long option after -l or --long argument");
                         }
                         add_longopt(tokptr,arg_opt);
                 }
@@ -277,7 +277,7 @@ void set_shell(const char *new_shell)
         else if (!strcmp(new_shell,"csh"))
                 shell=TCSH;
         else
-                errorMsg("unknown shell after -s or --shell argument\n");
+                error_msg("unknown shell after -s or --shell argument");
 }
 
 
@@ -326,7 +326,7 @@ int getopt_main(int argc, char *argv[])
                         printf(" --\n");
                         exit(0);
                 } else
-                        fatalError("missing optstring argument\n");
+                        error_msg_and_die("missing optstring argument");
         }
 
         if (argv[1][0] != '-' || compatible) {
@@ -372,12 +372,12 @@ int getopt_main(int argc, char *argv[])
                         quote=0;
                         break;
                 default:
-                        usage(getopt_usage);
+                        show_usage();
                 }
 
         if (!optstr) {
                 if (optind >= argc)
-                        fatalError("missing optstring argument\n");
+                        error_msg_and_die("missing optstring argument");
                 else {
                         optstr=xmalloc(strlen(argv[optind])+1);
                         strcpy(optstr,argv[optind]);