ntpd: default to FEATURE_NTP_AUTH=y
[oweals/busybox.git] / coreutils / basename.c
index ace0148c034ab4646871d32c807032f676402817..812a5e63e7aa5b9ae63576ec0d1914c5c79f6d1d 100644 (file)
@@ -6,7 +6,6 @@
  *
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
-
 /* Mar 16, 2003      Manuel Novoa III   (mjn3@codepoet.org)
  *
  * Changes:
  * 3) Save some space by using strcmp().  Calling strncmp() here was silly.
  */
 //config:config BASENAME
-//config:      bool "basename"
+//config:      bool "basename (371 bytes)"
 //config:      default y
 //config:      help
-//config:        basename is used to strip the directory and suffix from filenames,
-//config:        leaving just the filename itself. Enable this option if you wish
-//config:        to enable the 'basename' utility.
+//config:      basename is used to strip the directory and suffix from filenames,
+//config:      leaving just the filename itself. Enable this option if you wish
+//config:      to enable the 'basename' utility.
 
 //applet:IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename))
 
 /* This is a NOFORK applet. Be very careful! */
 
 int basename_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int basename_main(int argc, char **argv)
+int basename_main(int argc UNUSED_PARAM, char **argv)
 {
        size_t m, n;
        char *s;
 
        if (argv[1] && strcmp(argv[1], "--") == 0) {
                argv++;
-               argc--;
        }
-
-       if ((unsigned)(argc-2) >= 2) {
+       if (!argv[1])
                bb_show_usage();
-       }
 
        /* It should strip slash: /abc/def/ -> def */
        s = bb_get_last_path_component_strip(*++argv);
 
        m = strlen(s);
        if (*++argv) {
+               if (argv[1])
+                       bb_show_usage();
                n = strlen(*argv);
                if ((m > n) && (strcmp(s+m-n, *argv) == 0)) {
                        m -= n;