diff options
Diffstat (limited to 'cp_mv.c')
-rw-r--r-- | cp_mv.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -43,8 +43,8 @@ | |||
43 | #include <errno.h> | 43 | #include <errno.h> |
44 | #include <getopt.h> | 44 | #include <getopt.h> |
45 | 45 | ||
46 | #define is_cp 0 | 46 | static const int is_cp = 0; |
47 | #define is_mv 1 | 47 | static const int is_mv = 1; |
48 | static int dz_i; /* index into cp_mv_usage */ | 48 | static int dz_i; /* index into cp_mv_usage */ |
49 | 49 | ||
50 | static const char *cp_mv_usage[] = /* .rodata */ | 50 | static const char *cp_mv_usage[] = /* .rodata */ |
@@ -62,7 +62,7 @@ static const char *baseSrcName; | |||
62 | static int srcDirFlag; | 62 | static int srcDirFlag; |
63 | static struct stat srcStatBuf; | 63 | static struct stat srcStatBuf; |
64 | 64 | ||
65 | static char baseDestName[BUFSIZ + 1]; | 65 | static char *pBaseDestName; |
66 | static size_t baseDestLen; | 66 | static size_t baseDestLen; |
67 | static int destDirFlag; | 67 | static int destDirFlag; |
68 | static struct stat destStatBuf; | 68 | static struct stat destStatBuf; |
@@ -104,7 +104,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
104 | const char *srcBasename; | 104 | const char *srcBasename; |
105 | char *name; | 105 | char *name; |
106 | 106 | ||
107 | strcpy(destName, baseDestName); | 107 | strcpy(destName, pBaseDestName); |
108 | destLen = strlen(destName); | 108 | destLen = strlen(destName); |
109 | 109 | ||
110 | if (srcDirFlag == TRUE) { | 110 | if (srcDirFlag == TRUE) { |
@@ -175,6 +175,8 @@ extern int cp_mv_main(int argc, char **argv) | |||
175 | { | 175 | { |
176 | volatile int i; | 176 | volatile int i; |
177 | int c; | 177 | int c; |
178 | char baseDestName[BUFSIZ + 1]; /* not declared globally == less bss used */ | ||
179 | pBaseDestName = baseDestName; /* but available globally */ | ||
178 | 180 | ||
179 | if (*applet_name == 'c' && *(applet_name + 1) == 'p') | 181 | if (*applet_name == 'c' && *(applet_name + 1) == 'p') |
180 | dz_i = is_cp; | 182 | dz_i = is_cp; |