aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-10-14 22:16:57 +0000
committerEric Andersen <andersen@codepoet.org>1999-10-14 22:16:57 +0000
commit3c163822d88105450806fdb6a29fdfc2511267d1 (patch)
tree4c67645bbc6677ad2217da3cdf6c0a748e0ca88d
parent2c1030177e0a6f849ba557400e3e4867de455ce9 (diff)
downloadbusybox-w32-3c163822d88105450806fdb6a29fdfc2511267d1.tar.gz
busybox-w32-3c163822d88105450806fdb6a29fdfc2511267d1.tar.bz2
busybox-w32-3c163822d88105450806fdb6a29fdfc2511267d1.zip
Fixed cp -[aR] and some other stuf.
-rw-r--r--Makefile2
-rw-r--r--coreutils/cp.c12
-rw-r--r--coreutils/ls.c4
-rw-r--r--cp.c12
-rw-r--r--init.c128
-rw-r--r--init/init.c128
-rw-r--r--ls.c4
-rw-r--r--mount.c18
-rw-r--r--umount.c8
-rw-r--r--util-linux/mount.c18
-rw-r--r--util-linux/umount.c8
-rw-r--r--utility.c28
12 files changed, 188 insertions, 182 deletions
diff --git a/Makefile b/Makefile
index 59d648512..3069c0711 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ BUILDTIME=$(shell date "+%Y%m%d-%H%M")
4 4
5# Comment out the following to make a debuggable build 5# Comment out the following to make a debuggable build
6# Leave this off for production use. 6# Leave this off for production use.
7DODEBUG=true 7#DODEBUG=true
8 8
9#This will choke on a non-debian system 9#This will choke on a non-debian system
10ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'` 10ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
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;
40static int preserveFlag = FALSE; 40static int preserveFlag = FALSE;
41static const char *srcName; 41static const char *srcName;
42static const char *destName; 42static const char *destName;
43static const char *skipName;
43 44
44 45
45static int fileAction(const char *fileName) 46static int fileAction(const char *fileName)
46{ 47{
47 char newdestName[NAME_MAX]; 48 char newdestName[NAME_MAX];
48 strcpy(newdestName, destName); 49 strcpy(newdestName, destName);
49 strcat(newdestName, fileName+(strlen(srcName))); 50 strcat(newdestName, strstr(fileName, skipName));
50 return (copyFile(fileName, newdestName, preserveFlag, followLinks)); 51 return (copyFile(fileName, newdestName, preserveFlag, followLinks));
51} 52}
52 53
@@ -98,10 +99,13 @@ extern int cp_main(int argc, char **argv)
98 exit (FALSE); 99 exit (FALSE);
99 } 100 }
100 101
101 while (argc-- >= 2) { 102 while (argc-- > 1) {
102 srcName = *(argv++); 103 srcName = *(argv++);
103 exit( recursiveAction(srcName, recursiveFlag, followLinks, 104 skipName = strrchr(srcName, '/');
104 fileAction, fileAction)); 105 if (skipName) skipName++;
106 if (recursiveAction(srcName, recursiveFlag, followLinks,
107 fileAction, fileAction) == FALSE)
108 exit( FALSE);
105 } 109 }
106 exit( TRUE); 110 exit( TRUE);
107} 111}
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)
179#define FEATURE_AUTOWIDTH /* calculate terminal & column widths */ 179#define FEATURE_AUTOWIDTH /* calculate terminal & column widths */
180#define FEATURE_FILETYPECHAR /* enable -p and -F */ 180#define FEATURE_FILETYPECHAR /* enable -p and -F */
181 181
182#undef OP_BUF_SIZE 1024 /* leave undefined for unbuffered output */
183
184#define TERMINAL_WIDTH 80 /* use 79 if your terminal has linefold bug */ 182#define TERMINAL_WIDTH 80 /* use 79 if your terminal has linefold bug */
185#define COLUMN_WIDTH 14 /* default if AUTOWIDTH not defined */ 183#define COLUMN_WIDTH 14 /* default if AUTOWIDTH not defined */
186#define COLUMN_GAP 2 /* includes the file type char, if present */ 184#define COLUMN_GAP 2 /* includes the file type char, if present */
185#define HAS_REWINDDIR
187 186
188/************************************************************************/ 187/************************************************************************/
189 188
190#define HAS_REWINDDIR
191 189
192#if 1 /* FIXME libc 6 */ 190#if 1 /* FIXME libc 6 */
193# include <linux/types.h> 191# include <linux/types.h>
diff --git a/cp.c b/cp.c
index 94b4ab024..6ca66e642 100644
--- a/cp.c
+++ b/cp.c
@@ -40,13 +40,14 @@ static int followLinks = FALSE;
40static int preserveFlag = FALSE; 40static int preserveFlag = FALSE;
41static const char *srcName; 41static const char *srcName;
42static const char *destName; 42static const char *destName;
43static const char *skipName;
43 44
44 45
45static int fileAction(const char *fileName) 46static int fileAction(const char *fileName)
46{ 47{
47 char newdestName[NAME_MAX]; 48 char newdestName[NAME_MAX];
48 strcpy(newdestName, destName); 49 strcpy(newdestName, destName);
49 strcat(newdestName, fileName+(strlen(srcName))); 50 strcat(newdestName, strstr(fileName, skipName));
50 return (copyFile(fileName, newdestName, preserveFlag, followLinks)); 51 return (copyFile(fileName, newdestName, preserveFlag, followLinks));
51} 52}
52 53
@@ -98,10 +99,13 @@ extern int cp_main(int argc, char **argv)
98 exit (FALSE); 99 exit (FALSE);
99 } 100 }
100 101
101 while (argc-- >= 2) { 102 while (argc-- > 1) {
102 srcName = *(argv++); 103 srcName = *(argv++);
103 exit( recursiveAction(srcName, recursiveFlag, followLinks, 104 skipName = strrchr(srcName, '/');
104 fileAction, fileAction)); 105 if (skipName) skipName++;
106 if (recursiveAction(srcName, recursiveFlag, followLinks,
107 fileAction, fileAction) == FALSE)
108 exit( FALSE);
105 } 109 }
106 exit( TRUE); 110 exit( TRUE);
107} 111}
diff --git a/init.c b/init.c
index 2860272f9..19cbec130 100644
--- a/init.c
+++ b/init.c
@@ -66,11 +66,8 @@ waitfor(int pid)
66} 66}
67 67
68static int 68static int
69run( 69run(const char* program, const char* const* arguments,
70 const char * program 70 const char* terminal, int get_enter)
71,const char * const * arguments
72,const char * terminal
73,int get_enter)
74{ 71{
75 static const char control_characters[] = { 72 static const char control_characters[] = {
76 '\003', 73 '\003',
@@ -137,7 +134,8 @@ run(
137 * before the user wants it. This is critical if swap is not 134 * before the user wants it. This is critical if swap is not
138 * enabled and the system has low memory. Generally this will 135 * enabled and the system has low memory. Generally this will
139 * be run on the second virtual console, and the first will 136 * be run on the second virtual console, and the first will
140 * be allowed to start a shell or the installation system. 137 * be allowed to start a shell or whatever an init script
138 * specifies.
141 */ 139 */
142 char c; 140 char c;
143 write(1, press_enter, sizeof(press_enter) - 1); 141 write(1, press_enter, sizeof(press_enter) - 1);
@@ -246,26 +244,49 @@ exit_signal(int sig)
246} 244}
247 245
248void 246void
249configure_terminals( int serial_cons ); 247configure_terminals( int serial_cons )
248{
249 //struct stat statbuf;
250 char *tty;
251
252 switch (serial_cons) {
253 case 1:
254 strcpy( console, "/dev/ttyS0" );
255 break;
256 case 2:
257 strcpy( console, "/dev/ttyS1" );
258 break;
259 default:
260 tty = ttyname(0);
261 if (tty) {
262 strcpy( console, tty );
263 if (!strncmp( tty, "/dev/ttyS", 9 ))
264 serial_cons=1;
265 }
266 else
267 /* falls back to /dev/tty1 if an error occurs */
268 strcpy( console, default_console );
269 }
270 if (!first_terminal)
271 first_terminal = console;
272 if (serial_cons && !strncmp(term_ptr,"TERM=linux",10))
273 term_ptr = "TERM=vt100";
274}
250 275
251extern int 276extern int
252init_main(int argc, char * * argv) 277init_main(int argc, char * * argv)
253{ 278{
254 static const char * const rc = "etc/rc"; 279 static const char* const rc = "etc/rc";
255 const char * arguments[100]; 280 const char * arguments[100];
256 int run_rc = 1; 281 int run_rc = 1;
257 int j; 282 int j;
258 int pid1 = 0; 283 int pid1 = 0;
259 int pid2 = 0; 284 int pid2 = 0;
260 int create_swap= -1; 285 int create_swap= -1;
261 struct stat statbuf; 286 struct stat statbuf;
262#ifndef INCLUDE_DINSTALL 287 const char * tty_commands[2] = { "bin/sh", "bin/sh"};
263 const char * tty_commands[2] = { "bin/sh", "bin/sh"}; 288 char swap[20];
264#else 289 int serial_console = 0;
265 const char * tty_commands[2] = { "sbin/dinstall", "bin/sh"};
266#endif
267 char swap[20];
268 int serial_console = 0;
269 290
270 /* 291 /*
271 * If I am started as /linuxrc instead of /sbin/init, I don't have the 292 * If I am started as /linuxrc instead of /sbin/init, I don't have the
@@ -330,17 +351,13 @@ init_main(int argc, char * * argv)
330 351
331 set_free_pages(); 352 set_free_pages();
332 353
333 if (mem_total() < 3500) { /* not enough memory for standard install */ 354 /* not enough memory to do anything useful*/
355 if (mem_total() < 2000) {
334 int retval; 356 int retval;
335 retval= stat("/etc/swappartition",&statbuf); 357 retval= stat("/etc/swappartition",&statbuf);
336 if (retval) { 358 if (retval) {
337 printf(" 359 printf("You do not have enough RAM, sorry.\n");
338You do not have enough RAM, hence you must boot using the Boot Disk 360 while (1) { sleep(1);}
339for Low Memory systems.
340
341Read the instructions in the install.html file.
342");
343 while (1) {;}
344 } else { /* everything OK */ 361 } else { /* everything OK */
345 FILE *f; 362 FILE *f;
346 363
@@ -371,8 +388,13 @@ Read the instructions in the install.html file.
371 arguments[j] = 0; 388 arguments[j] = 0;
372 389
373 if ( run_rc ) { 390 if ( run_rc ) {
374 printf("running %s\n",rc); 391 printf("running %s with args \"",rc);
392 for ( j = 0; j < argc; j++ ) {
393 printf("%s ", arguments[j]);
394 }
395 printf("\" on console %s\n", console);
375 waitfor(run(rc, arguments, console, 0)); 396 waitfor(run(rc, arguments, console, 0));
397 printf("done.\n");
376 } 398 }
377 399
378 if ( 0 == create_swap) { 400 if ( 0 == create_swap) {
@@ -392,10 +414,21 @@ Read the instructions in the install.html file.
392 /* 414 /*
393 arguments[0] = tty_commands[0]; 415 arguments[0] = tty_commands[0];
394 */ 416 */
395 pid1 = run(tty_commands[0], arguments, first_terminal, 0); 417 printf("running %s with args \"",tty_commands[0]);
418 for ( j = 0; j < argc; j++ ) {
419 printf("%s ", arguments[j]);
420 }
421 printf("\" on console %s\n", first_terminal);
422 pid1 = run(tty_commands[0], arguments, first_terminal, 1);
396 } 423 }
397 if ( pid2 == 0 && tty_commands[1] ) 424 if ( pid2 == 0 && tty_commands[1] ) {
425 printf("running %s with args \"",tty_commands[0]);
426 for ( j = 0; j < argc; j++ ) {
427 printf("%s ", arguments[j]);
428 }
429 printf("\" on console %s\n", first_terminal);
398 pid2 = run(tty_commands[1], arguments, second_terminal, 1); 430 pid2 = run(tty_commands[1], arguments, second_terminal, 1);
431 }
399 wpid = wait(&status); 432 wpid = wait(&status);
400 if ( wpid > 0 ) { 433 if ( wpid > 0 ) {
401 /* DEBUGGING */ 434 /* DEBUGGING */
@@ -409,32 +442,3 @@ Read the instructions in the install.html file.
409 } 442 }
410} 443}
411 444
412void
413configure_terminals( int serial_cons )
414{
415 //struct stat statbuf;
416 char *tty;
417
418 switch (serial_cons) {
419 case 1:
420 strcpy( console, "/dev/ttyS0" );
421 break;
422 case 2:
423 strcpy( console, "/dev/ttyS1" );
424 break;
425 default:
426 tty = ttyname(0);
427 if (tty) {
428 strcpy( console, tty );
429 if (!strncmp( tty, "/dev/ttyS", 9 ))
430 serial_cons=1;
431 }
432 else
433 /* falls back to /dev/tty1 if an error occurs */
434 strcpy( console, default_console );
435 }
436 if (!first_terminal)
437 first_terminal = console;
438 if (serial_cons && !strncmp(term_ptr,"TERM=linux",10))
439 term_ptr = "TERM=vt100";
440}
diff --git a/init/init.c b/init/init.c
index 2860272f9..19cbec130 100644
--- a/init/init.c
+++ b/init/init.c
@@ -66,11 +66,8 @@ waitfor(int pid)
66} 66}
67 67
68static int 68static int
69run( 69run(const char* program, const char* const* arguments,
70 const char * program 70 const char* terminal, int get_enter)
71,const char * const * arguments
72,const char * terminal
73,int get_enter)
74{ 71{
75 static const char control_characters[] = { 72 static const char control_characters[] = {
76 '\003', 73 '\003',
@@ -137,7 +134,8 @@ run(
137 * before the user wants it. This is critical if swap is not 134 * before the user wants it. This is critical if swap is not
138 * enabled and the system has low memory. Generally this will 135 * enabled and the system has low memory. Generally this will
139 * be run on the second virtual console, and the first will 136 * be run on the second virtual console, and the first will
140 * be allowed to start a shell or the installation system. 137 * be allowed to start a shell or whatever an init script
138 * specifies.
141 */ 139 */
142 char c; 140 char c;
143 write(1, press_enter, sizeof(press_enter) - 1); 141 write(1, press_enter, sizeof(press_enter) - 1);
@@ -246,26 +244,49 @@ exit_signal(int sig)
246} 244}
247 245
248void 246void
249configure_terminals( int serial_cons ); 247configure_terminals( int serial_cons )
248{
249 //struct stat statbuf;
250 char *tty;
251
252 switch (serial_cons) {
253 case 1:
254 strcpy( console, "/dev/ttyS0" );
255 break;
256 case 2:
257 strcpy( console, "/dev/ttyS1" );
258 break;
259 default:
260 tty = ttyname(0);
261 if (tty) {
262 strcpy( console, tty );
263 if (!strncmp( tty, "/dev/ttyS", 9 ))
264 serial_cons=1;
265 }
266 else
267 /* falls back to /dev/tty1 if an error occurs */
268 strcpy( console, default_console );
269 }
270 if (!first_terminal)
271 first_terminal = console;
272 if (serial_cons && !strncmp(term_ptr,"TERM=linux",10))
273 term_ptr = "TERM=vt100";
274}
250 275
251extern int 276extern int
252init_main(int argc, char * * argv) 277init_main(int argc, char * * argv)
253{ 278{
254 static const char * const rc = "etc/rc"; 279 static const char* const rc = "etc/rc";
255 const char * arguments[100]; 280 const char * arguments[100];
256 int run_rc = 1; 281 int run_rc = 1;
257 int j; 282 int j;
258 int pid1 = 0; 283 int pid1 = 0;
259 int pid2 = 0; 284 int pid2 = 0;
260 int create_swap= -1; 285 int create_swap= -1;
261 struct stat statbuf; 286 struct stat statbuf;
262#ifndef INCLUDE_DINSTALL 287 const char * tty_commands[2] = { "bin/sh", "bin/sh"};
263 const char * tty_commands[2] = { "bin/sh", "bin/sh"}; 288 char swap[20];
264#else 289 int serial_console = 0;
265 const char * tty_commands[2] = { "sbin/dinstall", "bin/sh"};
266#endif
267 char swap[20];
268 int serial_console = 0;
269 290
270 /* 291 /*
271 * If I am started as /linuxrc instead of /sbin/init, I don't have the 292 * If I am started as /linuxrc instead of /sbin/init, I don't have the
@@ -330,17 +351,13 @@ init_main(int argc, char * * argv)
330 351
331 set_free_pages(); 352 set_free_pages();
332 353
333 if (mem_total() < 3500) { /* not enough memory for standard install */ 354 /* not enough memory to do anything useful*/
355 if (mem_total() < 2000) {
334 int retval; 356 int retval;
335 retval= stat("/etc/swappartition",&statbuf); 357 retval= stat("/etc/swappartition",&statbuf);
336 if (retval) { 358 if (retval) {
337 printf(" 359 printf("You do not have enough RAM, sorry.\n");
338You do not have enough RAM, hence you must boot using the Boot Disk 360 while (1) { sleep(1);}
339for Low Memory systems.
340
341Read the instructions in the install.html file.
342");
343 while (1) {;}
344 } else { /* everything OK */ 361 } else { /* everything OK */
345 FILE *f; 362 FILE *f;
346 363
@@ -371,8 +388,13 @@ Read the instructions in the install.html file.
371 arguments[j] = 0; 388 arguments[j] = 0;
372 389
373 if ( run_rc ) { 390 if ( run_rc ) {
374 printf("running %s\n",rc); 391 printf("running %s with args \"",rc);
392 for ( j = 0; j < argc; j++ ) {
393 printf("%s ", arguments[j]);
394 }
395 printf("\" on console %s\n", console);
375 waitfor(run(rc, arguments, console, 0)); 396 waitfor(run(rc, arguments, console, 0));
397 printf("done.\n");
376 } 398 }
377 399
378 if ( 0 == create_swap) { 400 if ( 0 == create_swap) {
@@ -392,10 +414,21 @@ Read the instructions in the install.html file.
392 /* 414 /*
393 arguments[0] = tty_commands[0]; 415 arguments[0] = tty_commands[0];
394 */ 416 */
395 pid1 = run(tty_commands[0], arguments, first_terminal, 0); 417 printf("running %s with args \"",tty_commands[0]);
418 for ( j = 0; j < argc; j++ ) {
419 printf("%s ", arguments[j]);
420 }
421 printf("\" on console %s\n", first_terminal);
422 pid1 = run(tty_commands[0], arguments, first_terminal, 1);
396 } 423 }
397 if ( pid2 == 0 && tty_commands[1] ) 424 if ( pid2 == 0 && tty_commands[1] ) {
425 printf("running %s with args \"",tty_commands[0]);
426 for ( j = 0; j < argc; j++ ) {
427 printf("%s ", arguments[j]);
428 }
429 printf("\" on console %s\n", first_terminal);
398 pid2 = run(tty_commands[1], arguments, second_terminal, 1); 430 pid2 = run(tty_commands[1], arguments, second_terminal, 1);
431 }
399 wpid = wait(&status); 432 wpid = wait(&status);
400 if ( wpid > 0 ) { 433 if ( wpid > 0 ) {
401 /* DEBUGGING */ 434 /* DEBUGGING */
@@ -409,32 +442,3 @@ Read the instructions in the install.html file.
409 } 442 }
410} 443}
411 444
412void
413configure_terminals( int serial_cons )
414{
415 //struct stat statbuf;
416 char *tty;
417
418 switch (serial_cons) {
419 case 1:
420 strcpy( console, "/dev/ttyS0" );
421 break;
422 case 2:
423 strcpy( console, "/dev/ttyS1" );
424 break;
425 default:
426 tty = ttyname(0);
427 if (tty) {
428 strcpy( console, tty );
429 if (!strncmp( tty, "/dev/ttyS", 9 ))
430 serial_cons=1;
431 }
432 else
433 /* falls back to /dev/tty1 if an error occurs */
434 strcpy( console, default_console );
435 }
436 if (!first_terminal)
437 first_terminal = console;
438 if (serial_cons && !strncmp(term_ptr,"TERM=linux",10))
439 term_ptr = "TERM=vt100";
440}
diff --git a/ls.c b/ls.c
index 7a1b0f3d0..50b983e24 100644
--- a/ls.c
+++ b/ls.c
@@ -179,15 +179,13 @@ int ls_main(int argc, char **argv)
179#define FEATURE_AUTOWIDTH /* calculate terminal & column widths */ 179#define FEATURE_AUTOWIDTH /* calculate terminal & column widths */
180#define FEATURE_FILETYPECHAR /* enable -p and -F */ 180#define FEATURE_FILETYPECHAR /* enable -p and -F */
181 181
182#undef OP_BUF_SIZE 1024 /* leave undefined for unbuffered output */
183
184#define TERMINAL_WIDTH 80 /* use 79 if your terminal has linefold bug */ 182#define TERMINAL_WIDTH 80 /* use 79 if your terminal has linefold bug */
185#define COLUMN_WIDTH 14 /* default if AUTOWIDTH not defined */ 183#define COLUMN_WIDTH 14 /* default if AUTOWIDTH not defined */
186#define COLUMN_GAP 2 /* includes the file type char, if present */ 184#define COLUMN_GAP 2 /* includes the file type char, if present */
185#define HAS_REWINDDIR
187 186
188/************************************************************************/ 187/************************************************************************/
189 188
190#define HAS_REWINDDIR
191 189
192#if 1 /* FIXME libc 6 */ 190#if 1 /* FIXME libc 6 */
193# include <linux/types.h> 191# include <linux/types.h>
diff --git a/mount.c b/mount.c
index 4e5c0745b..d7b2682ce 100644
--- a/mount.c
+++ b/mount.c
@@ -190,7 +190,7 @@ extern int mount_main (int argc, char **argv)
190 } 190 }
191 endmntent (mountTable); 191 endmntent (mountTable);
192 } 192 }
193 return( TRUE); 193 exit( TRUE);
194 } 194 }
195 195
196 196
@@ -203,7 +203,7 @@ extern int mount_main (int argc, char **argv)
203 case 'o': 203 case 'o':
204 if (--i == 0) { 204 if (--i == 0) {
205 fprintf (stderr, "%s\n", mount_usage); 205 fprintf (stderr, "%s\n", mount_usage);
206 return( FALSE); 206 exit( FALSE);
207 } 207 }
208 parse_mount_options (*(++argv), &flags, string_flags); 208 parse_mount_options (*(++argv), &flags, string_flags);
209 --i; 209 --i;
@@ -215,7 +215,7 @@ extern int mount_main (int argc, char **argv)
215 case 't': 215 case 't':
216 if (--i == 0) { 216 if (--i == 0) {
217 fprintf (stderr, "%s\n", mount_usage); 217 fprintf (stderr, "%s\n", mount_usage);
218 return( FALSE); 218 exit( FALSE);
219 } 219 }
220 filesystemType = *(++argv); 220 filesystemType = *(++argv);
221 --i; 221 --i;
@@ -231,7 +231,7 @@ extern int mount_main (int argc, char **argv)
231 case 'h': 231 case 'h':
232 case '-': 232 case '-':
233 fprintf (stderr, "%s\n", mount_usage); 233 fprintf (stderr, "%s\n", mount_usage);
234 return( TRUE); 234 exit( TRUE);
235 break; 235 break;
236 } 236 }
237 } else { 237 } else {
@@ -241,7 +241,7 @@ extern int mount_main (int argc, char **argv)
241 directory=*argv; 241 directory=*argv;
242 else { 242 else {
243 fprintf (stderr, "%s\n", mount_usage); 243 fprintf (stderr, "%s\n", mount_usage);
244 return( TRUE); 244 exit( TRUE);
245 } 245 }
246 } 246 }
247 i--; 247 i--;
@@ -254,7 +254,7 @@ extern int mount_main (int argc, char **argv)
254 254
255 if (f == NULL) { 255 if (f == NULL) {
256 perror("/etc/fstab"); 256 perror("/etc/fstab");
257 return( FALSE); 257 exit( FALSE);
258 } 258 }
259 while ((m = getmntent (f)) != NULL) { 259 while ((m = getmntent (f)) != NULL) {
260 // If the file system isn't noauto, and isn't mounted on /, mount 260 // If the file system isn't noauto, and isn't mounted on /, mount
@@ -270,12 +270,12 @@ extern int mount_main (int argc, char **argv)
270 endmntent (f); 270 endmntent (f);
271 } else { 271 } else {
272 if (device && directory) { 272 if (device && directory) {
273 return (mount_one (device, directory, filesystemType, 273 exit (mount_one (device, directory, filesystemType,
274 flags, string_flags)); 274 flags, string_flags));
275 } else { 275 } else {
276 fprintf (stderr, "%s\n", mount_usage); 276 fprintf (stderr, "%s\n", mount_usage);
277 return( FALSE); 277 exit( FALSE);
278 } 278 }
279 } 279 }
280 return( TRUE); 280 exit( TRUE);
281} 281}
diff --git a/umount.c b/umount.c
index 5274e2f6f..04cd8a080 100644
--- a/umount.c
+++ b/umount.c
@@ -69,7 +69,7 @@ umount_main(int argc, char * * argv)
69 69
70 if (argc < 2) { 70 if (argc < 2) {
71 fprintf(stderr, "Usage: %s", umount_usage); 71 fprintf(stderr, "Usage: %s", umount_usage);
72 return(FALSE); 72 exit(FALSE);
73 } 73 }
74 argc--; 74 argc--;
75 argv++; 75 argv++;
@@ -78,7 +78,7 @@ umount_main(int argc, char * * argv)
78 while (**argv == '-') { 78 while (**argv == '-') {
79 while (*++(*argv)) switch (**argv) { 79 while (*++(*argv)) switch (**argv) {
80 case 'a': 80 case 'a':
81 return umount_all(); 81 exit ( umount_all() );
82 break; 82 break;
83 default: 83 default:
84 fprintf(stderr, "Usage: %s\n", umount_usage); 84 fprintf(stderr, "Usage: %s\n", umount_usage);
@@ -86,10 +86,10 @@ umount_main(int argc, char * * argv)
86 } 86 }
87 } 87 }
88 if ( umount(*argv) == 0 ) 88 if ( umount(*argv) == 0 )
89 return (TRUE); 89 exit (TRUE);
90 else { 90 else {
91 perror("umount"); 91 perror("umount");
92 return( FALSE); 92 exit( FALSE);
93 } 93 }
94} 94}
95 95
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 4e5c0745b..d7b2682ce 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -190,7 +190,7 @@ extern int mount_main (int argc, char **argv)
190 } 190 }
191 endmntent (mountTable); 191 endmntent (mountTable);
192 } 192 }
193 return( TRUE); 193 exit( TRUE);
194 } 194 }
195 195
196 196
@@ -203,7 +203,7 @@ extern int mount_main (int argc, char **argv)
203 case 'o': 203 case 'o':
204 if (--i == 0) { 204 if (--i == 0) {
205 fprintf (stderr, "%s\n", mount_usage); 205 fprintf (stderr, "%s\n", mount_usage);
206 return( FALSE); 206 exit( FALSE);
207 } 207 }
208 parse_mount_options (*(++argv), &flags, string_flags); 208 parse_mount_options (*(++argv), &flags, string_flags);
209 --i; 209 --i;
@@ -215,7 +215,7 @@ extern int mount_main (int argc, char **argv)
215 case 't': 215 case 't':
216 if (--i == 0) { 216 if (--i == 0) {
217 fprintf (stderr, "%s\n", mount_usage); 217 fprintf (stderr, "%s\n", mount_usage);
218 return( FALSE); 218 exit( FALSE);
219 } 219 }
220 filesystemType = *(++argv); 220 filesystemType = *(++argv);
221 --i; 221 --i;
@@ -231,7 +231,7 @@ extern int mount_main (int argc, char **argv)
231 case 'h': 231 case 'h':
232 case '-': 232 case '-':
233 fprintf (stderr, "%s\n", mount_usage); 233 fprintf (stderr, "%s\n", mount_usage);
234 return( TRUE); 234 exit( TRUE);
235 break; 235 break;
236 } 236 }
237 } else { 237 } else {
@@ -241,7 +241,7 @@ extern int mount_main (int argc, char **argv)
241 directory=*argv; 241 directory=*argv;
242 else { 242 else {
243 fprintf (stderr, "%s\n", mount_usage); 243 fprintf (stderr, "%s\n", mount_usage);
244 return( TRUE); 244 exit( TRUE);
245 } 245 }
246 } 246 }
247 i--; 247 i--;
@@ -254,7 +254,7 @@ extern int mount_main (int argc, char **argv)
254 254
255 if (f == NULL) { 255 if (f == NULL) {
256 perror("/etc/fstab"); 256 perror("/etc/fstab");
257 return( FALSE); 257 exit( FALSE);
258 } 258 }
259 while ((m = getmntent (f)) != NULL) { 259 while ((m = getmntent (f)) != NULL) {
260 // If the file system isn't noauto, and isn't mounted on /, mount 260 // If the file system isn't noauto, and isn't mounted on /, mount
@@ -270,12 +270,12 @@ extern int mount_main (int argc, char **argv)
270 endmntent (f); 270 endmntent (f);
271 } else { 271 } else {
272 if (device && directory) { 272 if (device && directory) {
273 return (mount_one (device, directory, filesystemType, 273 exit (mount_one (device, directory, filesystemType,
274 flags, string_flags)); 274 flags, string_flags));
275 } else { 275 } else {
276 fprintf (stderr, "%s\n", mount_usage); 276 fprintf (stderr, "%s\n", mount_usage);
277 return( FALSE); 277 exit( FALSE);
278 } 278 }
279 } 279 }
280 return( TRUE); 280 exit( TRUE);
281} 281}
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 5274e2f6f..04cd8a080 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -69,7 +69,7 @@ umount_main(int argc, char * * argv)
69 69
70 if (argc < 2) { 70 if (argc < 2) {
71 fprintf(stderr, "Usage: %s", umount_usage); 71 fprintf(stderr, "Usage: %s", umount_usage);
72 return(FALSE); 72 exit(FALSE);
73 } 73 }
74 argc--; 74 argc--;
75 argv++; 75 argv++;
@@ -78,7 +78,7 @@ umount_main(int argc, char * * argv)
78 while (**argv == '-') { 78 while (**argv == '-') {
79 while (*++(*argv)) switch (**argv) { 79 while (*++(*argv)) switch (**argv) {
80 case 'a': 80 case 'a':
81 return umount_all(); 81 exit ( umount_all() );
82 break; 82 break;
83 default: 83 default:
84 fprintf(stderr, "Usage: %s\n", umount_usage); 84 fprintf(stderr, "Usage: %s\n", umount_usage);
@@ -86,10 +86,10 @@ umount_main(int argc, char * * argv)
86 } 86 }
87 } 87 }
88 if ( umount(*argv) == 0 ) 88 if ( umount(*argv) == 0 )
89 return (TRUE); 89 exit (TRUE);
90 else { 90 else {
91 perror("umount"); 91 perror("umount");
92 return( FALSE); 92 exit( FALSE);
93 } 93 }
94} 94}
95 95
diff --git a/utility.c b/utility.c
index b2228f0cb..cf90f37d1 100644
--- a/utility.c
+++ b/utility.c
@@ -58,9 +58,8 @@ int isDirectory(const char *name)
58 * be set.) 58 * be set.)
59 */ 59 */
60int 60int
61copyFile( 61copyFile( const char *srcName, const char *destName,
62 const char *srcName, 62 int setModes, int followLinks)
63 const char *destName, int setModes, int followLinks)
64{ 63{
65 int rfd; 64 int rfd;
66 int wfd; 65 int wfd;
@@ -75,7 +74,6 @@ copyFile(
75 result = stat(srcName, &srcStatBuf); 74 result = stat(srcName, &srcStatBuf);
76 else 75 else
77 result = lstat(srcName, &srcStatBuf); 76 result = lstat(srcName, &srcStatBuf);
78
79 if (result < 0) { 77 if (result < 0) {
80 perror(srcName); 78 perror(srcName);
81 return FALSE; 79 return FALSE;
@@ -115,7 +113,8 @@ copyFile(
115 return (FALSE); 113 return (FALSE);
116 } 114 }
117 link_val[link_size] = '\0'; 115 link_val[link_size] = '\0';
118 if (symlink(link_val, destName)) { 116 link_size = symlink(link_val, destName);
117 if (link_size != 0) {
119 perror(destName); 118 perror(destName);
120 return (FALSE); 119 return (FALSE);
121 } 120 }
@@ -179,7 +178,6 @@ copyFile(
179 178
180 179
181 error_exit: 180 error_exit:
182 //fprintf(stderr, "choking on %s\n", destName);
183 perror(destName); 181 perror(destName);
184 close(rfd); 182 close(rfd);
185 close(wfd); 183 close(wfd);
@@ -476,10 +474,11 @@ recursiveAction(const char *fileName, int recurse, int followLinks,
476 struct stat statbuf; 474 struct stat statbuf;
477 struct dirent *next; 475 struct dirent *next;
478 476
479 if (followLinks) 477 if (followLinks == FALSE)
480 status = lstat(fileName, &statbuf);
481 else
482 status = stat(fileName, &statbuf); 478 status = stat(fileName, &statbuf);
479 else
480 status = lstat(fileName, &statbuf);
481
483 if (status < 0) { 482 if (status < 0) {
484 perror(fileName); 483 perror(fileName);
485 return (FALSE); 484 return (FALSE);
@@ -487,16 +486,11 @@ recursiveAction(const char *fileName, int recurse, int followLinks,
487 486
488 if (recurse == FALSE) { 487 if (recurse == FALSE) {
489 if (S_ISDIR(statbuf.st_mode)) { 488 if (S_ISDIR(statbuf.st_mode)) {
490 if (dirAction == NULL) 489 if (dirAction != NULL)
491 return (TRUE);
492 else
493 return (dirAction(fileName)); 490 return (dirAction(fileName));
494 } else {
495 if (fileAction == NULL)
496 return (TRUE);
497 else 491 else
498 return (fileAction(fileName)); 492 return (TRUE);
499 } 493 }
500 } 494 }
501 495
502 if (S_ISDIR(statbuf.st_mode)) { 496 if (S_ISDIR(statbuf.st_mode)) {