* Mini `cp' and `mv' implementation for BusyBox.
*
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000,2001 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* Copyright (C) 2000 by BitterSweet Enterprises, LLC. (GPL)
#include <unistd.h>
#include <errno.h>
#include <getopt.h>
+#include <stdlib.h>
static const int is_cp = 0;
static const int is_mv = 1;
static int dz_i; /* index into cp_mv_usage */
-static const char *cp_mv_usage[] = /* .rodata */
-{
- cp_usage,
- mv_usage
-};
static int recursiveFlag;
static int followLinks;
{
volatile int i;
int c;
- char baseDestName[BUFSIZ + 1]; /* not declared globally == less bss used */
- pBaseDestName = baseDestName; /* but available globally */
+ RESERVE_BB_BUFFER(baseDestName,BUFSIZ + 1);
+ pBaseDestName = baseDestName; /* available globally */
if (*applet_name == 'c' && *(applet_name + 1) == 'p')
dz_i = is_cp;
else
dz_i = is_mv;
if (argc < 3)
- usage(cp_mv_usage[dz_i]);
+ show_usage();
if (dz_i == is_cp) {
recursiveFlag = preserveFlag = forceFlag = FALSE;
forceFlag = TRUE;
break;
default:
- usage(cp_mv_usage[is_cp]);
+ show_usage();
}
}
if ((argc - optind) < 2) {
- usage(cp_mv_usage[dz_i]);
+ show_usage();
}
} else { /* (dz_i == is_mv) */
/* Initialize optind to 1, since in libc5 optind
if ((sb.st_ino == srcStatBuf.st_ino) &&
(sb.st_dev == srcStatBuf.st_dev)) {
error_msg("Cannot %s `%s' into a subdirectory of itself, "
- "`%s/%s'\n", applet_name, baseSrcName,
+ "`%s/%s'", applet_name, baseSrcName,
baseDestName, baseSrcName);
state = -1;
continue;