/*
* Mini basename implementation for busybox
*
- * Copyright (C) 1999,2000 by Lineo, inc.
- * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+ * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
+ * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
*
* 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
*
*/
-#include "internal.h"
-#include <stdio.h>
+/* getopt not needed */
+
+#include <stdlib.h>
+#include "busybox.h"
+#include <string.h>
extern int basename_main(int argc, char **argv)
{
char *s;
if ((argc < 2) || (**(argv + 1) == '-')) {
- usage(basename_usage);
+ show_usage();
}
argv++;
argv++;
n = strlen(*argv);
m = strlen(s);
- if (m>=n && strncmp(s+m-n, *argv, n)==0)
+ if (m>n && strncmp(s+m-n, *argv, n)==0)
s[m-n] = '\0';
}
- printf("%s\n", s);
- return(TRUE);
+ puts(s);
+ return EXIT_SUCCESS;
}