Stuff
[oweals/busybox.git] / coreutils / date.c
index 2df9e0cc7a63661d385b66d39a3b14d6ac7adf62..501ccc28f90097f09baa2d1e67346b6497a86ee2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Mini date implementation for busybox
  *
- * Copyright (C) 1999 by Erik Andersen <andersee@debian.org>
+ * by Matthew Grant <grantma@anathoth.gen.nz>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@
    an RFC 822 complient date output for shell scripting
    mail commands */
 
-const char     date_usage[] = "Usage: date [OPTION]... [+FORMAT]\n"
+static const char      date_usage[] = "date [OPTION]... [+FORMAT]\n"
 "  or:  date [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n"
 "Display the current time in the given FORMAT, or set the system date.\n"
 "\nOptions:\n\t-R\t\toutput RFC-822 compliant date string\n"
@@ -159,12 +159,6 @@ date_conv_ftime(struct tm *tm_time, const char *t_string) {
 }
 
 
-void
-date_err(void) {
-    fprintf (stderr, "%s\n", date_usage);
-    exit( FALSE);
-}
-
 int
 date_main(int argc, char * * argv)
 {
@@ -190,7 +184,7 @@ date_main(int argc, char * * argv)
                break;
            case 's':
                set_time = 1;
-               if(date_str != NULL) date_err();
+               if(date_str != NULL) usage ( date_usage);
                date_str = optarg;
                break;
            case 'u':
@@ -202,11 +196,11 @@ date_main(int argc, char * * argv)
                /* Look ma, no break.  Don't fix it either. */
            case 'd':
                use_arg = 1;
-               if(date_str != NULL) date_err();
+               if(date_str != NULL) usage ( date_usage);
                date_str = optarg;
                break;
            case '-':
-               date_err();
+               usage ( date_usage);
            }
        } else {
            if ( (date_fmt == NULL) && (strcmp(*argv, "+")==0) )
@@ -215,7 +209,7 @@ date_main(int argc, char * * argv)
                set_time = 1;
                date_str=*argv;
            } else { 
-               date_err();
+               usage ( date_usage);
            }
        }
        i--;