aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-11-19 02:38:58 +0000
committerEric Andersen <andersen@codepoet.org>1999-11-19 02:38:58 +0000
commit08b1034f4f0b910660a8b1a537f86462fa41ebad (patch)
tree4a39b721f4654120bff47fcd7cd95906172ec16f /coreutils
parentab746abfc05c28824b25e12b86a538b09fb9275d (diff)
downloadbusybox-w32-08b1034f4f0b910660a8b1a537f86462fa41ebad.tar.gz
busybox-w32-08b1034f4f0b910660a8b1a537f86462fa41ebad.tar.bz2
busybox-w32-08b1034f4f0b910660a8b1a537f86462fa41ebad.zip
Stuf
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/dd.c15
-rw-r--r--coreutils/ls.c2
-rw-r--r--coreutils/mkdir.c3
-rw-r--r--coreutils/rm.c5
4 files changed, 18 insertions, 7 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 9468cddfc..39c6a6263 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -162,8 +162,13 @@ extern int dd_main (int argc, char **argv)
162 intotal = 0; 162 intotal = 0;
163 outTotal = 0; 163 outTotal = 0;
164 164
165 if (inFile == NULL) 165 if (inFile == NULL) {
166 inFd = STDIN; 166 struct stat statBuf;
167 inFd = fileno(stdin);
168 if (fstat(inFd, &statBuf) < 0)
169 exit( FALSE);
170 count = statBuf.st_size;
171 }
167 else 172 else
168 inFd = open (inFile, 0); 173 inFd = open (inFile, 0);
169 174
@@ -174,7 +179,7 @@ extern int dd_main (int argc, char **argv)
174 } 179 }
175 180
176 if (outFile == NULL) 181 if (outFile == NULL)
177 outFd = STDOUT; 182 outFd = fileno(stdout);
178 else 183 else
179 outFd = creat (outFile, 0666); 184 outFd = creat (outFile, 0666);
180 185
@@ -191,6 +196,8 @@ extern int dd_main (int argc, char **argv)
191 if (inCc < 0) { 196 if (inCc < 0) {
192 perror (inFile); 197 perror (inFile);
193 goto cleanup; 198 goto cleanup;
199 } else if (inCc == 0) {
200 goto cleanup;
194 } 201 }
195 intotal += inCc; 202 intotal += inCc;
196 cp = buf; 203 cp = buf;
@@ -202,6 +209,8 @@ extern int dd_main (int argc, char **argv)
202 if (outCc < 0) { 209 if (outCc < 0) {
203 perror (outFile); 210 perror (outFile);
204 goto cleanup; 211 goto cleanup;
212 } else if (outCc == 0) {
213 goto cleanup;
205 } 214 }
206 215
207 inCc -= outCc; 216 inCc -= outCc;
diff --git a/coreutils/ls.c b/coreutils/ls.c
index f09cbbc22..0558bb227 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -475,7 +475,7 @@ ls_main(int argc, char * * argv)
475 475
476 /* choose a display format */ 476 /* choose a display format */
477 if (display_fmt == FMT_AUTO) 477 if (display_fmt == FMT_AUTO)
478 display_fmt = isatty(STDOUT_FILENO) ? FMT_COLUMNS : FMT_SINGLE; 478 display_fmt = isatty(fileno(stdout)) ? FMT_COLUMNS : FMT_SINGLE;
479 if (argi < argc - 1) 479 if (argi < argc - 1)
480 opts |= DISP_DIRNAME; /* 2 or more items? label directories */ 480 opts |= DISP_DIRNAME; /* 2 or more items? label directories */
481#ifdef FEATURE_AUTOWIDTH 481#ifdef FEATURE_AUTOWIDTH
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 28315cad6..2cd178805 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -85,8 +85,9 @@ extern int mkdir_main(int argc, char **argv)
85 fprintf(stderr, "%s: File exists\n", *argv); 85 fprintf(stderr, "%s: File exists\n", *argv);
86 exit( FALSE); 86 exit( FALSE);
87 } 87 }
88 if (parentFlag == TRUE) 88 if (parentFlag == TRUE) {
89 createPath(*argv, mode); 89 createPath(*argv, mode);
90 }
90 else { 91 else {
91 if (mkdir (*argv, mode) != 0) { 92 if (mkdir (*argv, mode) != 0) {
92 perror(*argv); 93 perror(*argv);
diff --git a/coreutils/rm.c b/coreutils/rm.c
index ba5d30e92..ee434fb39 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
@@ -31,8 +31,8 @@
31static const char* rm_usage = "rm [OPTION]... FILE...\n\n" 31static const char* rm_usage = "rm [OPTION]... FILE...\n\n"
32"Remove (unlink) the FILE(s).\n\n" 32"Remove (unlink) the FILE(s).\n\n"
33"Options:\n" 33"Options:\n"
34"\t-f\tremove existing destinations, never prompt\n" 34"\t-f\t\tremove existing destinations, never prompt\n"
35"\t-r\tremove the contents of directories recursively\n"; 35"\t-r or -R\tremove the contents of directories recursively\n";
36 36
37 37
38static int recursiveFlag = FALSE; 38static int recursiveFlag = FALSE;
@@ -72,6 +72,7 @@ extern int rm_main(int argc, char **argv)
72 while (**argv == '-') { 72 while (**argv == '-') {
73 while (*++(*argv)) 73 while (*++(*argv))
74 switch (**argv) { 74 switch (**argv) {
75 case 'R':
75 case 'r': 76 case 'r':
76 recursiveFlag = TRUE; 77 recursiveFlag = TRUE;
77 break; 78 break;