From 3c163822d88105450806fdb6a29fdfc2511267d1 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 14 Oct 1999 22:16:57 +0000 Subject: Fixed cp -[aR] and some other stuf. --- coreutils/cp.c | 12 ++++++++---- coreutils/ls.c | 4 +--- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'coreutils') diff --git a/coreutils/cp.c b/coreutils/cp.c index 94b4ab024..6ca66e642 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c @@ -40,13 +40,14 @@ static int followLinks = FALSE; static int preserveFlag = FALSE; static const char *srcName; static const char *destName; +static const char *skipName; static int fileAction(const char *fileName) { char newdestName[NAME_MAX]; strcpy(newdestName, destName); - strcat(newdestName, fileName+(strlen(srcName))); + strcat(newdestName, strstr(fileName, skipName)); return (copyFile(fileName, newdestName, preserveFlag, followLinks)); } @@ -98,10 +99,13 @@ extern int cp_main(int argc, char **argv) exit (FALSE); } - while (argc-- >= 2) { + while (argc-- > 1) { srcName = *(argv++); - exit( recursiveAction(srcName, recursiveFlag, followLinks, - fileAction, fileAction)); + skipName = strrchr(srcName, '/'); + if (skipName) skipName++; + if (recursiveAction(srcName, recursiveFlag, followLinks, + fileAction, fileAction) == FALSE) + exit( FALSE); } exit( TRUE); } diff --git a/coreutils/ls.c b/coreutils/ls.c index 7a1b0f3d0..50b983e24 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -179,15 +179,13 @@ int ls_main(int argc, char **argv) #define FEATURE_AUTOWIDTH /* calculate terminal & column widths */ #define FEATURE_FILETYPECHAR /* enable -p and -F */ -#undef OP_BUF_SIZE 1024 /* leave undefined for unbuffered output */ - #define TERMINAL_WIDTH 80 /* use 79 if your terminal has linefold bug */ #define COLUMN_WIDTH 14 /* default if AUTOWIDTH not defined */ #define COLUMN_GAP 2 /* includes the file type char, if present */ +#define HAS_REWINDDIR /************************************************************************/ -#define HAS_REWINDDIR #if 1 /* FIXME libc 6 */ # include -- cgit v1.2.3