diff options
author | Matt Kraai <kraai@debian.org> | 2000-12-01 02:55:13 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2000-12-01 02:55:13 +0000 |
commit | 3e856ce428cabaf6c8d99a2374a1f9a4a05db5f0 (patch) | |
tree | 013a1e7752113314831ad7d51854ce8dc9e0918b | |
parent | b558e76eb1ba173ce3501c3e13fb80f426a7faac (diff) | |
download | busybox-3e856ce428cabaf6c8d99a2374a1f9a4a05db5f0.tar.gz |
Stop using TRUE and FALSE for exit status.
132 files changed, 375 insertions, 373 deletions
@@ -387,5 +387,5 @@ extern int ar_main(int argc, char **argv) } extractList=extractList->next; } - return (TRUE); + return EXIT_SUCCESS; } diff --git a/archival/ar.c b/archival/ar.c index f3ba59b6a..0f16ec88c 100644 --- a/archival/ar.c +++ b/archival/ar.c @@ -387,5 +387,5 @@ extern int ar_main(int argc, char **argv) } extractList=extractList->next; } - return (TRUE); + return EXIT_SUCCESS; } diff --git a/archival/gunzip.c b/archival/gunzip.c index 70b25bdb0..eeff9774a 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c @@ -1350,7 +1350,7 @@ int gunzip_main(int argc, char **argv) if (delInputFile == 1 && unlink(delFileName) < 0) { perror(delFileName); - exit(FALSE); + return EXIT_FAILURE; } } return(exit_code); diff --git a/archival/gzip.c b/archival/gzip.c index 2e147b1ca..d8c22a924 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -1930,7 +1930,7 @@ int gzip_main(int argc, char **argv) if (unlink(delFileName) < 0) { perror(delFileName); - exit(FALSE); + exit(EXIT_FAILURE); } } diff --git a/archival/tar.c b/archival/tar.c index 826ab9665..01997e464 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -156,6 +156,7 @@ extern int tar_main(int argc, char **argv) int tostdoutFlag = FALSE; int firstOpt = TRUE; int stopIt; + int status; if (argc <= 1) @@ -227,16 +228,21 @@ extern int tar_main(int argc, char **argv) #ifndef BB_FEATURE_TAR_CREATE fatalError( "This version of tar was not compiled with tar creation support.\n"); #else - exit(writeTarFile(tarName, verboseFlag, argv, excludeList)); + status = writeTarFile(tarName, verboseFlag, argv, excludeList); #endif } if (listFlag == TRUE || extractFlag == TRUE) { if (*argv) extractList = argv; - exit(readTarFile(tarName, extractFlag, listFlag, tostdoutFlag, - verboseFlag, extractList, excludeList)); + status = readTarFile(tarName, extractFlag, listFlag, tostdoutFlag, + verboseFlag, extractList, excludeList); } + if (status == TRUE) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; + flagError: fatalError( "Exactly one of 'c', 'x' or 't' must be specified\n"); } diff --git a/basename.c b/basename.c index 4d9fc4ec0..fcc7d4619 100644 --- a/basename.c +++ b/basename.c @@ -45,5 +45,5 @@ extern int basename_main(int argc, char **argv) s[m-n] = '\0'; } printf("%s\n", s); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c index 1ec7eec6c..e8ccb8156 100644 --- a/chmod_chown_chgrp.c +++ b/chmod_chown_chgrp.c @@ -161,9 +161,9 @@ int chmod_chown_chgrp_main(int argc, char **argv) while (argc-- > 1) { if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE, fileAction, fileAction, NULL) == FALSE) - exit(FALSE); + return EXIT_FAILURE; } - exit(TRUE); + return EXIT_SUCCESS; bad_group: fatalError( "unknown group name: %s\n", groupName); @@ -54,7 +54,7 @@ int chroot_main(int argc, char **argv) execlp(prog, prog, NULL); #else shell_main(argc, argv); - exit (0); + return EXIT_SUCCESS; #endif } fatalError("cannot execute %s: %s\n", prog, strerror(errno)); @@ -25,13 +25,13 @@ int chvt_main(int argc, char **argv) num = atoi(argv[1]); if (ioctl(fd, VT_ACTIVATE, num)) { perror("VT_ACTIVATE"); - exit(FALSE); + return EXIT_FAILURE; } if (ioctl(fd, VT_WAITACTIVE, num)) { perror("VT_WAITACTIVE"); - exit(FALSE); + return EXIT_FAILURE; } - return(TRUE); + return EXIT_SUCCESS; } @@ -29,5 +29,5 @@ extern int clear_main(int argc, char **argv) { printf("\033[H\033[J"); - return(TRUE); + return EXIT_SUCCESS; } @@ -135,7 +135,7 @@ void clean_up_and_die(int sig) cmdedit_reset_term(); fprintf(stdout, "\n"); if (sig!=SIGINT) - exit(TRUE); + exit(EXIT_SUCCESS); } /* Go to HOME position */ @@ -54,7 +54,7 @@ int cmp_main(int argc, char **argv) else printf("%s %s differ: char %d, line %d\n", filename1, filename2, char_pos, line_pos); - return 1; + return EXIT_FAILURE; } char_pos++; if (c1 == '\n') diff --git a/console-tools/chvt.c b/console-tools/chvt.c index d4b16a05d..790964586 100644 --- a/console-tools/chvt.c +++ b/console-tools/chvt.c @@ -25,13 +25,13 @@ int chvt_main(int argc, char **argv) num = atoi(argv[1]); if (ioctl(fd, VT_ACTIVATE, num)) { perror("VT_ACTIVATE"); - exit(FALSE); + return EXIT_FAILURE; } if (ioctl(fd, VT_WAITACTIVE, num)) { perror("VT_WAITACTIVE"); - exit(FALSE); + return EXIT_FAILURE; } - return(TRUE); + return EXIT_SUCCESS; } diff --git a/console-tools/clear.c b/console-tools/clear.c index 4a8e0450f..ca83f3820 100644 --- a/console-tools/clear.c +++ b/console-tools/clear.c @@ -29,5 +29,5 @@ extern int clear_main(int argc, char **argv) { printf("\033[H\033[J"); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index 65af79b77..4600c0d05 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c @@ -28,7 +28,7 @@ printf("erik: A\n"); /* deallocate all unused consoles */ if (ioctl(fd, VT_DISALLOCATE, 0)) { perror("VT_DISALLOCATE"); - exit( FALSE); + return EXIT_FAILURE; } } else printf("erik: B\n"); @@ -44,5 +44,5 @@ printf("erik: B\n"); } } printf("erik: C\n"); - return( TRUE); + return EXIT_SUCCESS; } diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c index 2d989dfc4..77689fc84 100644 --- a/console-tools/dumpkmap.c +++ b/console-tools/dumpkmap.c @@ -51,7 +51,7 @@ int dumpkmap_main(int argc, char **argv) fd = open("/dev/tty0", O_RDWR); if (fd < 0) { errorMsg("Error opening /dev/tty0: %s\n", strerror(errno)); - return 1; + return EXIT_FAILURE; } write(1, magic, 7); @@ -88,5 +88,5 @@ int dumpkmap_main(int argc, char **argv) } } close(fd); - return 0; + return EXIT_SUCCESS; } diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c index f57737925..156210890 100644 --- a/console-tools/loadacm.c +++ b/console-tools/loadacm.c @@ -40,17 +40,17 @@ int loadacm_main(int argc, char **argv) fd = open("/dev/tty", O_RDWR); if (fd < 0) { errorMsg("Error opening /dev/tty1: %s\n", strerror(errno)); - return( FALSE); + return EXIT_FAILURE; } if (screen_map_load(fd, stdin)) { errorMsg("Error loading acm: %s\n", strerror(errno)); - return( FALSE); + return EXIT_FAILURE; } write(fd, "\033(K", 3); - return( TRUE); + return EXIT_SUCCESS; } int screen_map_load(int fd, FILE * fp) diff --git a/console-tools/reset.c b/console-tools/reset.c index 8e2c491e2..bf8c3ed45 100644 --- a/console-tools/reset.c +++ b/console-tools/reset.c @@ -29,6 +29,6 @@ extern int reset_main(int argc, char **argv) { printf("\033c"); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c index 63c106333..6a31e042a 100644 --- a/console-tools/setkeycodes.c +++ b/console-tools/setkeycodes.c @@ -68,5 +68,5 @@ setkeycodes_main(int argc, char** argv) argc -= 2; argv += 2; } - return( TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/basename.c b/coreutils/basename.c index 4d9fc4ec0..fcc7d4619 100644 --- a/coreutils/basename.c +++ b/coreutils/basename.c @@ -45,5 +45,5 @@ extern int basename_main(int argc, char **argv) s[m-n] = '\0'; } printf("%s\n", s); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/chroot.c b/coreutils/chroot.c index f0a298104..f279af18d 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c @@ -54,7 +54,7 @@ int chroot_main(int argc, char **argv) execlp(prog, prog, NULL); #else shell_main(argc, argv); - exit (0); + return EXIT_SUCCESS; #endif } fatalError("cannot execute %s: %s\n", prog, strerror(errno)); diff --git a/coreutils/cmp.c b/coreutils/cmp.c index 98b747eed..6b955447c 100644 --- a/coreutils/cmp.c +++ b/coreutils/cmp.c @@ -54,7 +54,7 @@ int cmp_main(int argc, char **argv) else printf("%s %s differ: char %d, line %d\n", filename1, filename2, char_pos, line_pos); - return 1; + return EXIT_FAILURE; } char_pos++; if (c1 == '\n') diff --git a/coreutils/cut.c b/coreutils/cut.c index 2d313cc24..b281fa234 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -241,5 +241,5 @@ extern int cut_main(int argc, char **argv) } } - return 0; + return EXIT_SUCCESS; } diff --git a/coreutils/date.c b/coreutils/date.c index 7e4216768..2e69bde4a 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -232,7 +232,7 @@ int date_main(int argc, char **argv) } else if (*date_fmt == '\0') { /* Imitate what GNU 'date' does with NO format string! */ printf("\n"); - exit(TRUE); + return EXIT_SUCCESS; } /* Handle special conversions */ @@ -246,5 +246,5 @@ int date_main(int argc, char **argv) strftime(t_buff, 200, date_fmt, &tm_time); printf("%s\n", t_buff); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/dd.c b/coreutils/dd.c index 2b77ea6a5..044f167c3 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -174,7 +174,7 @@ extern int dd_main(int argc, char **argv) (inTotal % blockSize) != 0); printf("%ld+%d records out\n", (long) (outTotal / blockSize), (outTotal % blockSize) != 0); - exit(TRUE); + return EXIT_SUCCESS; usage: usage(dd_usage); diff --git a/coreutils/df.c b/coreutils/df.c index 8d6242c56..aefffc771 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -79,12 +79,12 @@ extern int df_main(int argc, char **argv) exit(FALSE); } status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); - if (status != 0) - exit(status); + if (status != TRUE) + return EXIT_FAILURE; argc--; argv++; } - exit(TRUE); + return EXIT_SUCCESS; } else { FILE *mountTable; struct mntent *mountEntry; @@ -92,7 +92,7 @@ extern int df_main(int argc, char **argv) mountTable = setmntent(mtab_file, "r"); if (mountTable == 0) { perror(mtab_file); - exit(FALSE); + return EXIT_FAILURE; } while ((mountEntry = getmntent(mountTable))) { @@ -101,7 +101,7 @@ extern int df_main(int argc, char **argv) endmntent(mountTable); } - return(TRUE); + return EXIT_FAILURE; } /* diff --git a/coreutils/dirname.c b/coreutils/dirname.c index 23f46be40..ceb750cb8 100644 --- a/coreutils/dirname.c +++ b/coreutils/dirname.c @@ -40,5 +40,5 @@ extern int dirname_main(int argc, char **argv) if (s && *s) *s = '\0'; printf("%s\n", (s)? *argv : "."); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index c9f783f1a..ed2088e4e 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c @@ -41,5 +41,5 @@ int dos2unix_main( int argc, char **argv ) { putchar(c); c = getchar(); } - return 0; + return EXIT_SUCCESS; } diff --git a/coreutils/du.c b/coreutils/du.c index 408ad994c..a0f1606fe 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -160,10 +160,10 @@ int du_main(int argc, char **argv) } } - return(0); + return EXIT_SUCCESS; } -/* $Id: du.c,v 1.25 2000/09/25 21:45:57 andersen Exp $ */ +/* $Id: du.c,v 1.26 2000/12/01 02:55:13 kraai Exp $ */ /* Local Variables: c-file-style: "linux" diff --git a/coreutils/echo.c b/coreutils/echo.c index a6b5152d8..393f4425f 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c @@ -107,7 +107,7 @@ just_echo: putchar('\n'); fflush(stdout); - return 0; + return EXIT_SUCCESS; } /*- diff --git a/coreutils/hostid.c b/coreutils/hostid.c index 47bd8d724..35a5859c4 100644 --- a/coreutils/hostid.c +++ b/coreutils/hostid.c @@ -26,5 +26,5 @@ extern int hostid_main(int argc, char **argv) { printf("%lx\n", gethostid()); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/length.c b/coreutils/length.c index 14d15c81c..1ab4e3a58 100644 --- a/coreutils/length.c +++ b/coreutils/length.c @@ -9,5 +9,5 @@ extern int length_main(int argc, char **argv) if (argc != 2 || **(argv + 1) == '-') usage(length_usage); printf("%lu\n", (long)strlen(argv[1])); - return (TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/ls.c b/coreutils/ls.c index d508a1bfe..225132ba4 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -878,5 +878,4 @@ extern int ls_main(int argc, char **argv) print_usage_message: usage(ls_usage); - return(FALSE); } diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c index 21570de93..30b882ab5 100644 --- a/coreutils/md5sum.c +++ b/coreutils/md5sum.c @@ -902,22 +902,22 @@ int md5sum_main(int argc, if (file_type_specified && do_check) { errorMsg("the -b and -t options are meaningless when verifying checksums\n"); - exit FALSE; + return EXIT_FAILURE; } if (n_strings > 0 && do_check) { errorMsg("the -g and -c options are mutually exclusive\n"); - exit FALSE; + return EXIT_FAILURE; } if (status_only && !do_check) { errorMsg("the -s option is meaningful only when verifying checksums\n"); - exit FALSE; + return EXIT_FAILURE; } if (warn && !do_check) { errorMsg("the -w option is meaningful only when verifying checksums\n"); - exit FALSE; + return EXIT_FAILURE; } if (n_strings > 0) { @@ -925,7 +925,7 @@ int md5sum_main(int argc, if (optind < argc) { errorMsg("no files may be specified when using -g\n"); - exit FALSE; + return EXIT_FAILURE; } for (i = 0; i < n_strings; ++i) { size_t cnt; @@ -992,13 +992,16 @@ int md5sum_main(int argc, if (fclose (stdout) == EOF) { errorMsg("write error\n"); - exit FALSE; + return EXIT_FAILURE; } if (have_read_stdin && fclose (stdin) == EOF) { errorMsg("standard input\n"); - exit FALSE; + return EXIT_FAILURE; } - exit (err == 0 ? TRUE : FALSE); + if (err == 0) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; } diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 04310e4c7..c950847dc 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c @@ -51,7 +51,7 @@ extern int mkdir_main(int argc, char **argv) mode = 0; if (parse_mode(*(++argv), &mode) == FALSE) { errorMsg("Unknown mode: %s\n", *argv); - exit FALSE; + return EXIT_FAILURE; } /* Set the umask for this process so it doesn't * screw up whatever the user just entered. */ @@ -80,13 +80,13 @@ extern int mkdir_main(int argc, char **argv) if (strlen(*argv) > BUFSIZ - 1) { errorMsg(name_too_long); - exit FALSE; + return EXIT_FAILURE; } strcpy(buf, *argv); status = stat(buf, &statBuf); if (parentFlag == FALSE && status != -1 && errno != ENOENT) { errorMsg("%s: File exists\n", buf); - exit FALSE; + return EXIT_FAILURE; } if (parentFlag == TRUE) { strcat(buf, "/"); @@ -94,11 +94,11 @@ extern int mkdir_main(int argc, char **argv) } else { if (mkdir(buf, mode) != 0 && parentFlag == FALSE) { perror(buf); - exit FALSE; + return EXIT_FAILURE; } } argc--; argv++; } - return( TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c index 5e1bc1a78..ef4a5256f 100644 --- a/coreutils/mkfifo.c +++ b/coreutils/mkfifo.c @@ -55,7 +55,7 @@ extern int mkfifo_main(int argc, char **argv) usage(mkfifo_usage); if (mkfifo(*argv, mode) < 0) { perror("mkfifo"); - exit(255); + return EXIT_FAILURE; } - return(TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/mknod.c b/coreutils/mknod.c index ecb0e4780..21b2689cc 100644 --- a/coreutils/mknod.c +++ b/coreutils/mknod.c @@ -85,6 +85,6 @@ int mknod_main(int argc, char **argv) if (mknod(argv[0], mode, dev) != 0) fatalError("%s: %s\n", argv[0], strerror(errno)); - return (TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/pwd.c b/coreutils/pwd.c index c9de7778e..54129b175 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c @@ -34,5 +34,5 @@ extern int pwd_main(int argc, char **argv) fatalError("%s\n", strerror(errno)); printf("%s\n", buf); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/rm.c b/coreutils/rm.c index 4f97cad23..c62083e9b 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c @@ -102,9 +102,9 @@ extern int rm_main(int argc, char **argv) } else { if (recursiveAction(srcName, recursiveFlag, FALSE, TRUE, fileAction, dirAction, NULL) == FALSE) { - exit(FALSE); + return EXIT_FAILURE; } } } - return(TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 709e3de34..ad92b106d 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c @@ -32,7 +32,7 @@ extern int sleep_main(int argc, char **argv) if (sleep(atoi(*(++argv))) != 0) { perror("sleep"); - exit(FALSE); + return EXIT_FAILURE; } - return(TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/touch.c b/coreutils/touch.c index 7db6c6e33..5537fb63b 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c @@ -43,7 +43,6 @@ extern int touch_main(int argc, char **argv) break; default: usage(touch_usage); - exit(FALSE); } } } @@ -57,7 +56,7 @@ extern int touch_main(int argc, char **argv) S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if (fd < 0) { if (create == FALSE && errno == ENOENT) - exit(TRUE); + return EXIT_SUCCESS; else { fatalError("%s", strerror(errno)); } @@ -70,5 +69,5 @@ extern int touch_main(int argc, char **argv) argv++; } - return(TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/tty.c b/coreutils/tty.c index 6eebed9fb..46201d3e6 100644 --- a/coreutils/tty.c +++ b/coreutils/tty.c @@ -38,5 +38,5 @@ extern int tty_main(int argc, char **argv) else puts("not a tty"); } - return(isatty(0) ? TRUE : FALSE); + return(isatty(0) ? EXIT_SUCCESS : EXIT_FAILURE); } diff --git a/coreutils/uname.c b/coreutils/uname.c index 8d9427c86..2781b80b3 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c @@ -138,7 +138,7 @@ int uname_main(int argc, char **argv) print_element(PRINT_MACHINE, name.machine); print_element(PRINT_PROCESSOR, processor); - return(TRUE); + return EXIT_SUCCESS; } /* If the name element set in MASK is selected for printing in `toprint', diff --git a/coreutils/usleep.c b/coreutils/usleep.c index 69790ef09..86dc0501b 100644 --- a/coreutils/usleep.c +++ b/coreutils/usleep.c @@ -32,5 +32,5 @@ extern int usleep_main(int argc, char **argv) } usleep(atoi(*(++argv))); /* return void */ - return(TRUE); + return EXIT_SUCCESS; } diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 78ca0968d..825fdb562 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c @@ -294,16 +294,16 @@ int uudecode_main (int argc, } if (optind == argc) - exit_status = decode ("stdin", outname) == 0 ? TRUE : FALSE; + exit_status = decode ("stdin", outname) == 0 ? EXIT_SUCCESS : EXIT_FAILURE; else { - exit_status = TRUE; + exit_status = EXIT_SUCCESS; do { if (freopen (argv[optind], "r", stdin) != NULL) { if (decode (argv[optind], outname) != 0) exit_status = FALSE; } else { errorMsg("%s: %s\n", argv[optind], strerror(errno)); - exit_status = FALSE; + exit_status = EXIT_FAILURE; } optind++; } diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index aea99ed87..8d15adbf6 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c @@ -179,7 +179,7 @@ int uuencode_main (int argc, /* Optional first argument is input file. */ if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { errorMsg("%s: %s\n", argv[optind], strerror(errno)); - exit FALSE; + return EXIT_FAILURE; } mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); optind++; @@ -200,9 +200,9 @@ int uuencode_main (int argc, printf(trans_ptr == uu_std ? "end\n" : "====\n"); if (ferror (stdout)) { errorMsg("Write error\n"); - exit FALSE; + return EXIT_FAILURE; } - return( TRUE); + return EXIT_SUCCESS; } /* Copyright (c) 1983 Regents of the University of California. @@ -316,9 +316,9 @@ extern int cp_mv_main(int argc, char **argv) if (flags_memo) *(baseDestName + baseDestLen) = '\0'; } - return( TRUE); + return EXIT_SUCCESS; exit_false: - return( FALSE); + return EXIT_FAILURE; } /* @@ -241,5 +241,5 @@ extern int cut_main(int argc, char **argv) } } - return 0; + return EXIT_SUCCESS; } @@ -232,7 +232,7 @@ int date_main(int argc, char **argv) } else if (*date_fmt == '\0') { /* Imitate what GNU 'date' does with NO format string! */ printf("\n"); - exit(TRUE); + return EXIT_SUCCESS; } /* Handle special conversions */ @@ -246,5 +246,5 @@ int date_main(int argc, char **argv) strftime(t_buff, 200, date_fmt, &tm_time); printf("%s\n", t_buff); - return(TRUE); + return EXIT_SUCCESS; } @@ -13,19 +13,15 @@ static unsigned int pointer; static void push(double a) { - if (pointer >= (sizeof(stack) / sizeof(*stack))) { - errorMsg("stack overflow\n"); - exit(-1); - } else - stack[pointer++] = a; + if (pointer >= (sizeof(stack) / sizeof(*stack))) + fatalError("stack overflow\n"); + stack[pointer++] = a; } static double pop() { - if (pointer == 0) { - errorMsg("stack underflow\n"); - exit(-1); - } + if (pointer == 0) + fatalError("stack underflow\n"); return stack[--pointer]; } @@ -124,8 +120,7 @@ static void stack_machine(const char *argument) } o++; } - errorMsg("%s: syntax error.\n", argument); - exit(-1); + fatalError("%s: syntax error.\n", argument); } /* return pointer to next token in buffer and set *buffer to one char @@ -182,5 +177,5 @@ int dc_main(int argc, char **argv) } } stack_machine(0); - return( TRUE); + return EXIT_SUCCESS; } @@ -174,7 +174,7 @@ extern int dd_main(int argc, char **argv) (inTotal % blockSize) != 0); printf("%ld+%d records out\n", (long) (outTotal / blockSize), (outTotal % blockSize) != 0); - exit(TRUE); + return EXIT_SUCCESS; usage: usage(dd_usage); diff --git a/deallocvt.c b/deallocvt.c index 65af79b77..4600c0d05 100644 --- a/deallocvt.c +++ b/deallocvt.c @@ -28,7 +28,7 @@ printf("erik: A\n"); /* deallocate all unused consoles */ if (ioctl(fd, VT_DISALLOCATE, 0)) { perror("VT_DISALLOCATE"); - exit( FALSE); + return EXIT_FAILURE; } } else printf("erik: B\n"); @@ -44,5 +44,5 @@ printf("erik: B\n"); } } printf("erik: C\n"); - return( TRUE); + return EXIT_SUCCESS; } @@ -79,12 +79,12 @@ extern int df_main(int argc, char **argv) exit(FALSE); } status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); - if (status != 0) - exit(status); + if (status != TRUE) + return EXIT_FAILURE; argc--; argv++; } - exit(TRUE); + return EXIT_SUCCESS; } else { FILE *mountTable; struct mntent *mountEntry; @@ -92,7 +92,7 @@ extern int df_main(int argc, char **argv) mountTable = setmntent(mtab_file, "r"); if (mountTable == 0) { perror(mtab_file); - exit(FALSE); + return EXIT_FAILURE; } while ((mountEntry = getmntent(mountTable))) { @@ -101,7 +101,7 @@ extern int df_main(int argc, char **argv) endmntent(mountTable); } - return(TRUE); + return EXIT_FAILURE; } /* @@ -40,5 +40,5 @@ extern int dirname_main(int argc, char **argv) if (s && *s) *s = '\0'; printf("%s\n", (s)? *argv : "."); - return(TRUE); + return EXIT_SUCCESS; } @@ -73,7 +73,7 @@ int dmesg_main(int argc, char **argv) if (n < 0) { goto klogctl_error; } - exit(TRUE); + return EXIT_SUCCESS; } if (bufsize < 4096) @@ -98,11 +98,11 @@ int dmesg_main(int argc, char **argv) } if (lastc != '\n') putchar('\n'); - exit(TRUE); + return EXIT_SUCCESS; end: usage(dmesg_usage); - exit(FALSE); + return EXIT_FAILURE; klogctl_error: perror("klogctl"); - return(FALSE); + return EXIT_FAILURE; } diff --git a/dos2unix.c b/dos2unix.c index c9f783f1a..ed2088e4e 100644 --- a/dos2unix.c +++ b/dos2unix.c @@ -41,5 +41,5 @@ int dos2unix_main( int argc, char **argv ) { putchar(c); c = getchar(); } - return 0; + return EXIT_SUCCESS; } @@ -160,10 +160,10 @@ int du_main(int argc, char **argv) } } - return(0); + return EXIT_SUCCESS; } -/* $Id: du.c,v 1.25 2000/09/25 21:45:57 andersen Exp $ */ +/* $Id: du.c,v 1.26 2000/12/01 02:55:13 kraai Exp $ */ /* Local Variables: c-file-style: "linux" diff --git a/dumpkmap.c b/dumpkmap.c index 2d989dfc4..77689fc84 100644 --- a/dumpkmap.c +++ b/dumpkmap.c @@ -51,7 +51,7 @@ int dumpkmap_main(int argc, char **argv) fd = open("/dev/tty0", O_RDWR); if (fd < 0) { errorMsg("Error opening /dev/tty0: %s\n", strerror(errno)); - return 1; + return EXIT_FAILURE; } write(1, magic, 7); @@ -88,5 +88,5 @@ int dumpkmap_main(int argc, char **argv) } } close(fd); - return 0; + return EXIT_SUCCESS; } @@ -62,5 +62,5 @@ extern int dutmp_main(int argc, char **argv) ut.ut_addr); } #endif - return(TRUE); + return EXIT_SUCCESS; } @@ -107,7 +107,7 @@ just_echo: putchar('\n'); fflush(stdout); - return 0; + return EXIT_SUCCESS; } /*- @@ -434,7 +434,7 @@ extern int fbset_main(int argc, char **argv) if (g_options & OPT_READMODE) { if (!readmode(&var, modefile, mode)) { errorMsg("Unknown video mode `%s'\n", mode); - exit(1); + return EXIT_FAILURE; } } @@ -446,5 +446,5 @@ extern int fbset_main(int argc, char **argv) /* Don't close the file, as exiting will take care of that */ /* close(fh); */ - return (TRUE); + return EXIT_SUCCESS; } @@ -40,7 +40,7 @@ extern int fdflush_main(int argc, char **argv) fd = open(*argv, 0); if (fd < 0) { perror(*argv); - exit(FALSE); + return EXIT_FAILURE; } value = ioctl(fd, FDFLUSH, 0); @@ -50,7 +50,7 @@ extern int fdflush_main(int argc, char **argv) if (value) { perror(*argv); - exit(FALSE); + return EXIT_FAILURE; } - return(TRUE); + return EXIT_SUCCESS; } @@ -100,8 +100,8 @@ int find_main(int argc, char **argv) if (recursiveAction(directory, TRUE, FALSE, FALSE, fileAction, fileAction, NULL) == FALSE) { - exit(FALSE); + return EXIT_FAILURE; } - return(TRUE); + return EXIT_SUCCESS; } diff --git a/findutils/find.c b/findutils/find.c index 48faf2c30..a86b07e73 100644 --- a/findutils/find.c +++ b/findutils/find.c @@ -100,8 +100,8 @@ int find_main(int argc, char **argv) if (recursiveAction(directory, TRUE, FALSE, FALSE, fileAction, fileAction, NULL) == FALSE) { - exit(FALSE); + return EXIT_FAILURE; } - return(TRUE); + return EXIT_SUCCESS; } @@ -60,7 +60,7 @@ extern int free_main(int argc, char **argv) printf("%6s%13ld%13ld%13ld\n", "Total:", info.totalram+info.totalswap, (info.totalram-info.freeram)+(info.totalswap-info.freeswap), info.freeram+info.freeswap); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/freeramdisk.c b/freeramdisk.c index 22fc3e643..567151455 100644 --- a/freeramdisk.c +++ b/freeramdisk.c @@ -51,7 +51,7 @@ freeramdisk_main(int argc, char **argv) /* Don't bother closing. Exit does * that, so we can save a few bytes */ /* close(f); */ - return(TRUE); + return EXIT_SUCCESS; } /* @@ -1350,7 +1350,7 @@ int gunzip_main(int argc, char **argv) if (delInputFile == 1 && unlink(delFileName) < 0) { perror(delFileName); - exit(FALSE); + return EXIT_FAILURE; } } return(exit_code); @@ -1930,7 +1930,7 @@ int gzip_main(int argc, char **argv) if (unlink(delFileName) < 0) { perror(delFileName); - exit(FALSE); + exit(EXIT_FAILURE); } } @@ -26,5 +26,5 @@ extern int hostid_main(int argc, char **argv) { printf("%lx\n", gethostid()); - return(TRUE); + return EXIT_SUCCESS; } @@ -77,7 +77,7 @@ #ifndef MODUTILS_MODULE_H #define MODUTILS_MODULE_H 1 -#ident "$Id: insmod.c,v 1.28 2000/10/23 18:03:46 kraai Exp $" +#ident "$Id: insmod.c,v 1.29 2000/12/01 02:55:13 kraai Exp $" /* This file contains the structures used by the 2.0 and 2.1 kernels. We do not use the kernel headers directly because we do not wish @@ -283,7 +283,7 @@ int delete_module(const char *); #ifndef MODUTILS_OBJ_H #define MODUTILS_OBJ_H 1 -#ident "$Id: insmod.c,v 1.28 2000/10/23 18:03:46 kraai Exp $" +#ident "$Id: insmod.c,v 1.29 2000/12/01 02:55:13 kraai Exp $" /* The relocatable object is manipulated using elfin types. */ @@ -2769,7 +2769,7 @@ extern int insmod_main( int argc, char **argv) FILE *fp; struct obj_file *f; char m_name[BUFSIZ + 1] = "\0"; - int exit_status = FALSE; + int exit_status = EXIT_FAILURE; int m_has_modinfo; #ifdef BB_FEATURE_INSMOD_VERSION_CHECKING int k_version; @@ -2833,7 +2833,7 @@ extern int insmod_main( int argc, char **argv) || ((fp = fopen(m_filename, "r")) == NULL)) { errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); - exit(FALSE); + return EXIT_FAILURE; } } else fatalError("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); @@ -2843,7 +2843,7 @@ extern int insmod_main( int argc, char **argv) if ((f = obj_load(fp)) == NULL) { perror("Could not load the module\n"); - exit(FALSE); + return EXIT_FAILURE; } if (get_modinfo_value(f, "kernel_version") == NULL) @@ -2981,7 +2981,7 @@ extern int insmod_main( int argc, char **argv) goto out; } - exit_status = TRUE; + exit_status = EXIT_SUCCESS; out: fclose(fp); @@ -158,7 +158,7 @@ extern int kill_main(int argc, char **argv) } } fprintf(stderr, "\n\n"); - exit(TRUE); + return EXIT_SUCCESS; } break; case '-': @@ -236,11 +236,12 @@ extern int kill_main(int argc, char **argv) * upon exit, so we can save a byte or two */ argv++; } - exit (all_found); + if (all_found == FALSE) + return EXIT_FAILURE; } #endif - exit(TRUE); + return EXIT_SUCCESS; end: @@ -217,11 +217,11 @@ static int builtin_cd(struct job *cmd, struct jobSet *junk) newdir = cmd->progs[0].argv[1]; if (chdir(newdir)) { printf("cd: %s: %s\n", newdir, strerror(errno)); - return FALSE; + return EXIT_FAILURE; } getcwd(cwd, sizeof(char)*MAX_LINE); - return TRUE; + return EXIT_SUCCESS; } /* built-in 'env' handler */ @@ -245,14 +245,14 @@ static int builtin_exec(struct job *cmd, struct jobSet *junk) fatalError("Exec to %s failed: %s\n", cmd->progs[0].argv[0], strerror(errno)); } - return TRUE; + return EXIT_SUCCESS; } /* built-in 'exit' handler */ static int builtin_exit(struct job *cmd, struct jobSet *junk) { if (!cmd->progs[0].argv[1] == 1) - exit TRUE; + exit(EXIT_SUCCESS); exit (atoi(cmd->progs[0].argv[1])); } @@ -267,12 +267,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { errorMsg("%s: exactly one argument is expected\n", cmd->progs[0].argv[0]); - return FALSE; + return EXIT_FAILURE; } if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { errorMsg("%s: bad argument '%s'\n", cmd->progs[0].argv[0], cmd->progs[0].argv[1]); - return FALSE; + return EXIT_FAILURE; for (job = jobList->head; job; job = job->next) { if (job->jobId == jobNum) { break; @@ -286,7 +286,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) if (!job) { errorMsg("%s: unknown job %d\n", cmd->progs[0].argv[0], jobNum); - return FALSE; + return EXIT_FAILURE; } if (*cmd->progs[0].argv[0] == 'f') { @@ -305,7 +305,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) job->stoppedProgs = 0; - return TRUE; + return EXIT_SUCCESS; } /* built-in 'help' handler */ @@ -326,7 +326,7 @@ static int builtin_help(struct job *dummy, struct jobSet *junk) fprintf(stdout, "%s\t%s\n", x->cmd, x->descr); } fprintf(stdout, "\n\n"); - return TRUE; + return EXIT_SUCCESS; } /* built-in 'jobs' handler */ @@ -343,7 +343,7 @@ static int builtin_jobs(struct job *dummy, struct jobSet *jobList) printf(JOB_STATUS_FORMAT, job->jobId, statusString, job->text); } - return TRUE; + return EXIT_SUCCESS; } @@ -352,7 +352,7 @@ static int builtin_pwd(struct job *dummy, struct jobSet *junk) { getcwd(cwd, sizeof(char)*MAX_LINE); fprintf(stdout, "%s\n", cwd); - return TRUE; + return EXIT_SUCCESS; } /* built-in 'export VAR=value' handler */ @@ -437,11 +437,11 @@ static int builtin_then(struct job *cmd, struct jobSet *junk) if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { errorMsg("unexpected token `then'\n"); - return FALSE; + return EXIT_FAILURE; } /* If the if result was FALSE, skip the 'then' stuff */ if (cmd->jobContext & IF_FALSE_CONTEXT) { - return TRUE; + return EXIT_SUCCESS; } cmd->jobContext |= THEN_EXP_CONTEXT; @@ -464,11 +464,11 @@ static int builtin_else(struct job *cmd, struct jobSet *junk) if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { errorMsg("unexpected token `else'\n"); - return FALSE; + return EXIT_FAILURE; } /* If the if result was TRUE, skip the 'else' stuff */ if (cmd->jobContext & IF_TRUE_CONTEXT) { - return TRUE; + return EXIT_SUCCESS; } cmd->jobContext |= ELSE_EXP_CONTEXT; @@ -488,12 +488,12 @@ static int builtin_fi(struct job *cmd, struct jobSet *junk) { if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { errorMsg("unexpected token `fi'\n"); - return FALSE; + return EXIT_FAILURE; } /* Clear out the if and then context bits */ cmd->jobContext &= ~(IF_TRUE_CONTEXT|IF_FALSE_CONTEXT|THEN_EXP_CONTEXT|ELSE_EXP_CONTEXT); debug_printf(stderr, "Hit an fi -- jobContext=%d\n", cmd->jobContext); - return TRUE; + return EXIT_SUCCESS; } #endif @@ -504,13 +504,13 @@ static int builtin_source(struct job *cmd, struct jobSet *junk) int status; if (!cmd->progs[0].argv[1] == 1) - return FALSE; + return EXIT_FAILURE; input = fopen(cmd->progs[0].argv[1], "r"); if (!input) { fprintf(stdout, "Couldn't open file '%s'\n", cmd->progs[0].argv[1]); - return FALSE; + return EXIT_FAILURE; } /* Now run the file */ @@ -524,10 +524,10 @@ static int builtin_unset(struct job *cmd, struct jobSet *junk) { if (!cmd->progs[0].argv[1] == 1) { fprintf(stdout, "unset: parameter required.\n"); - return FALSE; + return EXIT_FAILURE; } unsetenv(cmd->progs[0].argv[1]); - return TRUE; + return EXIT_SUCCESS; } /* free up all memory from a job */ @@ -9,5 +9,5 @@ extern int length_main(int argc, char **argv) if (argc != 2 || **(argv + 1) == '-') usage(length_usage); printf("%lu\n", (long)strlen(argv[1])); - return (TRUE); + return EXIT_SUCCESS; } @@ -40,17 +40,17 @@ int loadacm_main(int argc, char **argv) fd = open("/dev/tty", O_RDWR); if (fd < 0) { errorMsg("Error opening /dev/tty1: %s\n", strerror(errno)); - return( FALSE); + return EXIT_FAILURE; } if (screen_map_load(fd, stdin)) { errorMsg("Error loading acm: %s\n", strerror(errno)); - return( FALSE); + return EXIT_FAILURE; } write(fd, "\033(K", 3); - return( TRUE); + return EXIT_SUCCESS; } int screen_map_load(int fd, FILE * fp) @@ -878,5 +878,4 @@ extern int ls_main(int argc, char **argv) print_usage_message: usage(ls_usage); - return(FALSE); } @@ -902,22 +902,22 @@ int md5sum_main(int argc, if (file_type_specified && do_check) { errorMsg("the -b and -t options are meaningless when verifying checksums\n"); - exit FALSE; + return EXIT_FAILURE; } if (n_strings > 0 && do_check) { errorMsg("the -g and -c options are mutually exclusive\n"); - exit FALSE; + return EXIT_FAILURE; } if (status_only && !do_check) { errorMsg("the -s option is meaningful only when verifying checksums\n"); - exit FALSE; + return EXIT_FAILURE; } if (warn && !do_check) { errorMsg("the -w option is meaningful only when verifying checksums\n"); - exit FALSE; + return EXIT_FAILURE; } if (n_strings > 0) { @@ -925,7 +925,7 @@ int md5sum_main(int argc, if (optind < argc) { errorMsg("no files may be specified when using -g\n"); - exit FALSE; + return EXIT_FAILURE; } for (i = 0; i < n_strings; ++i) { size_t cnt; @@ -992,13 +992,16 @@ int md5sum_main(int argc, if (fclose (stdout) == EOF) { errorMsg("write error\n"); - exit FALSE; + return EXIT_FAILURE; } if (have_read_stdin && fclose (stdin) == EOF) { errorMsg("standard input\n"); - exit FALSE; + return EXIT_FAILURE; } - exit (err == 0 ? TRUE : FALSE); + if (err == 0) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; } diff --git a/miscutils/dc.c b/miscutils/dc.c index 48aa830d6..0f5f1fc77 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c @@ -13,19 +13,15 @@ static unsigned int pointer; static void push(double a) { - if (pointer >= (sizeof(stack) / sizeof(*stack))) { - errorMsg("stack overflow\n"); - exit(-1); - } else - stack[pointer++] = a; + if (pointer >= (sizeof(stack) / sizeof(*stack))) + fatalError("stack overflow\n"); + stack[pointer++] = a; } static double pop() { - if (pointer == 0) { - errorMsg("stack underflow\n"); - exit(-1); - } + if (pointer == 0) + fatalError("stack underflow\n"); return stack[--pointer]; } @@ -124,8 +120,7 @@ static void stack_machine(const char *argument) } o++; } - errorMsg("%s: syntax error.\n", argument); - exit(-1); + fatalError("%s: syntax error.\n", argument); } /* return pointer to next token in buffer and set *buffer to one char @@ -182,5 +177,5 @@ int dc_main(int argc, char **argv) } } stack_machine(0); - return( TRUE); + return EXIT_SUCCESS; } diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c index cf5f1cff8..03d80d87d 100644 --- a/miscutils/dutmp.c +++ b/miscutils/dutmp.c @@ -62,5 +62,5 @@ extern int dutmp_main(int argc, char **argv) ut.ut_addr); } #endif - return(TRUE); + return EXIT_SUCCESS; } diff --git a/miscutils/mktemp.c b/miscutils/mktemp.c index 62ca870c5..2d53cc2a4 100644 --- a/miscutils/mktemp.c +++ b/miscutils/mktemp.c @@ -31,7 +31,7 @@ extern int mktemp_main(int argc, char **argv) if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q"))) usage(mktemp_usage); if(mkstemp(argv[argc-1]) < 0) - exit(FALSE); + return EXIT_FAILURE; (void) puts(argv[argc-1]); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/miscutils/mt.c b/miscutils/mt.c index 6acae4ea1..583674b18 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c @@ -76,7 +76,7 @@ extern int mt_main(int argc, char **argv) if (code->name == 0) { errorMsg("unrecognized opcode %s.\n", argv[1]); - exit (FALSE); + return EXIT_FAILURE; } op.mt_op = code->value; @@ -87,13 +87,13 @@ extern int mt_main(int argc, char **argv) if ((fd = open(file, O_RDONLY, 0)) < 0) { perror(file); - exit (FALSE); + return EXIT_FAILURE; } if (ioctl(fd, MTIOCTOP, &op) != 0) { perror(file); - exit (FALSE); + return EXIT_FAILURE; } - return (TRUE); + return EXIT_SUCCESS; } diff --git a/miscutils/update.c b/miscutils/update.c index 7279d83a8..080cb99c3 100644 --- a/miscutils/update.c +++ b/miscutils/update.c @@ -67,7 +67,7 @@ extern int update_main(int argc, char **argv) pid = fork(); if (pid < 0) - exit(FALSE); + return EXIT_FAILURE; else if (pid == 0) { /* Become a proper daemon */ setsid(); @@ -99,12 +99,12 @@ extern int update_main(int argc, char **argv) syslog(LOG_INFO, "This kernel does not need update(8). Exiting."); closelog(); - exit(TRUE); + return EXIT_SUCCESS; } } } } - return( TRUE); + return EXIT_SUCCESS; } /* @@ -51,7 +51,7 @@ extern int mkdir_main(int argc, char **argv) mode = 0; if (parse_mode(*(++argv), &mode) == FALSE) { errorMsg("Unknown mode: %s\n", *argv); - exit FALSE; + return EXIT_FAILURE; } /* Set the umask for this process so it doesn't * screw up whatever the user just entered. */ @@ -80,13 +80,13 @@ extern int mkdir_main(int argc, char **argv) if (strlen(*argv) > BUFSIZ - 1) { errorMsg(name_too_long); - exit FALSE; + return EXIT_FAILURE; } strcpy(buf, *argv); status = stat(buf, &statBuf); if (parentFlag == FALSE && status != -1 && errno != ENOENT) { errorMsg("%s: File exists\n", buf); - exit FALSE; + return EXIT_FAILURE; } if (parentFlag == TRUE) { strcat(buf, "/"); @@ -94,11 +94,11 @@ extern int mkdir_main(int argc, char **argv) } else { if (mkdir(buf, mode) != 0 && parentFlag == FALSE) { perror(buf); - exit FALSE; + return EXIT_FAILURE; } } argc--; argv++; } - return( TRUE); + return EXIT_SUCCESS; } @@ -55,7 +55,7 @@ extern int mkfifo_main(int argc, char **argv) usage(mkfifo_usage); if (mkfifo(*argv, mode) < 0) { perror("mkfifo"); - exit(255); + return EXIT_FAILURE; } - return(TRUE); + return EXIT_SUCCESS; } @@ -85,6 +85,6 @@ int mknod_main(int argc, char **argv) if (mknod(argv[0], mode, dev) != 0) fatalError("%s: %s\n", argv[0], strerror(errno)); - return (TRUE); + return EXIT_SUCCESS; } @@ -176,7 +176,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr) void die(const char *str) { errorMsg("%s\n", str); - exit(FALSE); + exit(EXIT_FAILURE); } void page_ok(int page) @@ -325,7 +325,7 @@ int mkswap_main(int argc, char **argv) } else if (PAGES > sz && !force) { errorMsg("error: size %ld is larger than device size %d\n", PAGES * (pagesize / 1024), sz * (pagesize / 1024)); - exit(FALSE); + return EXIT_FAILURE; } if (version == -1) { @@ -369,7 +369,7 @@ int mkswap_main(int argc, char **argv) DEV = open(device_name, O_RDWR); if (DEV < 0 || fstat(DEV, &statbuf) < 0) { perror(device_name); - exit(FALSE); + return EXIT_FAILURE; } if (!S_ISBLK(statbuf.st_mode)) check = 0; @@ -393,7 +393,7 @@ int mkswap_main(int argc, char **argv) "This probably means creating v0 swap would destroy your partition table\n" "No swap created. If you really want to create swap v0 on that device, use\n" "the -f option to force it.\n", device_name); - exit(FALSE); + return EXIT_FAILURE; } } } @@ -429,5 +429,5 @@ int mkswap_main(int argc, char **argv) */ if (fsync(DEV)) die("fsync failed"); - return(TRUE); + return EXIT_SUCCESS; } @@ -31,7 +31,7 @@ extern int mktemp_main(int argc, char **argv) if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q"))) usage(mktemp_usage); if(mkstemp(argv[argc-1]) < 0) - exit(FALSE); + return EXIT_FAILURE; (void) puts(argv[argc-1]); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/modutils/insmod.c b/modutils/insmod.c index 4f96c950e..6386b9407 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -77,7 +77,7 @@ #ifndef MODUTILS_MODULE_H #define MODUTILS_MODULE_H 1 -#ident "$Id: insmod.c,v 1.28 2000/10/23 18:03:46 kraai Exp $" +#ident "$Id: insmod.c,v 1.29 2000/12/01 02:55:13 kraai Exp $" /* This file contains the structures used by the 2.0 and 2.1 kernels. We do not use the kernel headers directly because we do not wish @@ -283,7 +283,7 @@ int delete_module(const char *); #ifndef MODUTILS_OBJ_H #define MODUTILS_OBJ_H 1 -#ident "$Id: insmod.c,v 1.28 2000/10/23 18:03:46 kraai Exp $" +#ident "$Id: insmod.c,v 1.29 2000/12/01 02:55:13 kraai Exp $" /* The relocatable object is manipulated using elfin types. */ @@ -2769,7 +2769,7 @@ extern int insmod_main( int argc, char **argv) FILE *fp; struct obj_file *f; char m_name[BUFSIZ + 1] = "\0"; - int exit_status = FALSE; + int exit_status = EXIT_FAILURE; int m_has_modinfo; #ifdef BB_FEATURE_INSMOD_VERSION_CHECKING int k_version; @@ -2833,7 +2833,7 @@ extern int insmod_main( int argc, char **argv) || ((fp = fopen(m_filename, "r")) == NULL)) { errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); - exit(FALSE); + return EXIT_FAILURE; } } else fatalError("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); @@ -2843,7 +2843,7 @@ extern int insmod_main( int argc, char **argv) if ((f = obj_load(fp)) == NULL) { perror("Could not load the module\n"); - exit(FALSE); + return EXIT_FAILURE; } if (get_modinfo_value(f, "kernel_version") == NULL) @@ -2981,7 +2981,7 @@ extern int insmod_main( int argc, char **argv) goto out; } - exit_status = TRUE; + exit_status = EXIT_SUCCESS; out: fclose(fp); diff --git a/modutils/rmmod.c b/modutils/rmmod.c index dd293523d..f5d7d359a 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c @@ -34,7 +34,7 @@ _syscall1(int, delete_module, const char *, name) extern int rmmod_main(int argc, char **argv) { - int ret = TRUE; + int ret = EXIT_SUCCESS; if (argc <= 1) { usage(rmmod_usage); } @@ -47,9 +47,9 @@ extern int rmmod_main(int argc, char **argv) /* Unload _all_ unused modules via NULL delete_module() call */ if (delete_module(NULL)) { perror("rmmod"); - exit(FALSE); + return EXIT_FAILURE; } - exit(TRUE); + return EXIT_SUCCESS; default: usage(rmmod_usage); } @@ -59,7 +59,7 @@ extern int rmmod_main(int argc, char **argv) while (argc-- > 0) { if (delete_module(*argv) < 0) { perror(*argv); - ret=FALSE; + ret = EXIT_FAILURE; } argv++; } @@ -330,7 +330,7 @@ extern int mount_main(int argc, char **argv) int fakeIt = FALSE; int useMtab = TRUE; int i; - int rc = FALSE; + int rc = EXIT_FAILURE; int fstabmount = FALSE; #if defined BB_FEATURE_USE_DEVPS_PATCH @@ -367,7 +367,7 @@ extern int mount_main(int argc, char **argv) free( mntentlist); close(fd); #endif - exit(TRUE); + return EXIT_SUCCESS; } #else if (argc == 1) { @@ -388,7 +388,7 @@ extern int mount_main(int argc, char **argv) } else { perror(mtab_file); } - exit(TRUE); + return EXIT_SUCCESS; } #endif @@ -489,7 +489,7 @@ singlemount: &extra_opts, &string_flags, 1); if ( rc != 0) { fatalError("nfsmount failed: %s\n", strerror(errno)); - rc = FALSE; + rc = EXIT_FAILURE; } } #endif @@ -499,7 +499,7 @@ singlemount: if (all == FALSE) break; - rc = TRUE; // Always return 0 for 'all' + rc = EXIT_SUCCESS; // Always return 0 for 'all' } if (fstabmount == TRUE) endmntent(f); @@ -512,8 +512,6 @@ singlemount: goto singlemount; - exit(FALSE); - goodbye: usage(mount_usage); } @@ -76,7 +76,7 @@ extern int mt_main(int argc, char **argv) if (code->name == 0) { errorMsg("unrecognized opcode %s.\n", argv[1]); - exit (FALSE); + return EXIT_FAILURE; } op.mt_op = code->value; @@ -87,13 +87,13 @@ extern int mt_main(int argc, char **argv) if ((fd = open(file, O_RDONLY, 0)) < 0) { perror(file); - exit (FALSE); + return EXIT_FAILURE; } if (ioctl(fd, MTIOCTOP, &op) != 0) { perror(file); - exit (FALSE); + return EXIT_FAILURE; } - return (TRUE); + return EXIT_SUCCESS; } diff --git a/networking/nslookup.c b/networking/nslookup.c index acb3e3bb2..c46a0b8ea 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c @@ -167,7 +167,7 @@ int nslookup_main(int argc, char **argv) host = gethostbyname(argv[1]); } hostent_fprint(host, stdout); - return( TRUE); + return EXIT_SUCCESS; } -/* $Id: nslookup.c,v 1.12 2000/09/25 21:45:58 andersen Exp $ */ +/* $Id: nslookup.c,v 1.13 2000/12/01 02:55:13 kraai Exp $ */ diff --git a/networking/ping.c b/networking/ping.c index a4363098e..af109cf0a 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: ping.c,v 1.26 2000/11/14 23:29:24 andersen Exp $ + * $Id: ping.c,v 1.27 2000/12/01 02:55:13 kraai Exp $ * Mini ping implementation for busybox * * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> @@ -256,7 +256,7 @@ extern int ping_main(int argc, char **argv) if (argc < 1) usage(ping_usage); ping(*argv); - exit(TRUE); + return EXIT_SUCCESS; } #else /* ! BB_FEATURE_SIMPLE_PING */ @@ -546,7 +546,7 @@ extern int ping_main(int argc, char **argv) myid = getpid() & 0xFFFF; ping(*argv); - return(TRUE); + return EXIT_SUCCESS; } #endif /* ! BB_FEATURE_SIMPLE_PING */ diff --git a/nslookup.c b/nslookup.c index acb3e3bb2..c46a0b8ea 100644 --- a/nslookup.c +++ b/nslookup.c @@ -167,7 +167,7 @@ int nslookup_main(int argc, char **argv) host = gethostbyname(argv[1]); } hostent_fprint(host, stdout); - return( TRUE); + return EXIT_SUCCESS; } -/* $Id: nslookup.c,v 1.12 2000/09/25 21:45:58 andersen Exp $ */ +/* $Id: nslookup.c,v 1.13 2000/12/01 02:55:13 kraai Exp $ */ @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: ping.c,v 1.26 2000/11/14 23:29:24 andersen Exp $ + * $Id: ping.c,v 1.27 2000/12/01 02:55:13 kraai Exp $ * Mini ping implementation for busybox * * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> @@ -256,7 +256,7 @@ extern int ping_main(int argc, char **argv) if (argc < 1) usage(ping_usage); ping(*argv); - exit(TRUE); + return EXIT_SUCCESS; } #else /* ! BB_FEATURE_SIMPLE_PING */ @@ -546,7 +546,7 @@ extern int ping_main(int argc, char **argv) myid = getpid() & 0xFFFF; ping(*argv); - return(TRUE); + return EXIT_SUCCESS; } #endif /* ! BB_FEATURE_SIMPLE_PING */ diff --git a/procps/free.c b/procps/free.c index a33fa9a59..f2e746e39 100644 --- a/procps/free.c +++ b/procps/free.c @@ -60,7 +60,7 @@ extern int free_main(int argc, char **argv) printf("%6s%13ld%13ld%13ld\n", "Total:", info.totalram+info.totalswap, (info.totalram-info.freeram)+(info.totalswap-info.freeswap), info.freeram+info.freeswap); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/procps/kill.c b/procps/kill.c index 7ade8228c..dd5ca49fa 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -158,7 +158,7 @@ extern int kill_main(int argc, char **argv) } } fprintf(stderr, "\n\n"); - exit(TRUE); + return EXIT_SUCCESS; } break; case '-': @@ -236,11 +236,12 @@ extern int kill_main(int argc, char **argv) * upon exit, so we can save a byte or two */ argv++; } - exit (all_found); + if (all_found == FALSE) + return EXIT_FAILURE; } #endif - exit(TRUE); + return EXIT_SUCCESS; end: diff --git a/procps/ps.c b/procps/ps.c index df321612a..4998e15b1 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -183,7 +183,7 @@ extern int ps_main(int argc, char **argv) fprintf(stdout, "\n"); } closedir(dir); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/procps/uptime.c b/procps/uptime.c index fe4e48cd6..159f24baa 100644 --- a/procps/uptime.c +++ b/procps/uptime.c @@ -70,5 +70,5 @@ extern int uptime_main(int argc, char **argv) LOAD_INT(info.loads[1]), LOAD_FRAC(info.loads[1]), LOAD_INT(info.loads[2]), LOAD_FRAC(info.loads[2])); - return(TRUE); + return EXIT_SUCCESS; } @@ -183,7 +183,7 @@ extern int ps_main(int argc, char **argv) fprintf(stdout, "\n"); } closedir(dir); - return(TRUE); + return EXIT_SUCCESS; } @@ -34,5 +34,5 @@ extern int pwd_main(int argc, char **argv) fatalError("%s\n", strerror(errno)); printf("%s\n", buf); - return(TRUE); + return EXIT_SUCCESS; } @@ -101,7 +101,6 @@ int rdate_main(int argc, char **argv) default: case 'H': usage(rdate_usage); - return(FALSE); break; case 's': setdate++; @@ -117,11 +116,10 @@ int rdate_main(int argc, char **argv) if (optind == argc) { usage(rdate_usage); - return(FALSE); } if ((time= askremotedate(argv[optind])) == (time_t)-1) { - return(FALSE); + return EXIT_FAILURE; } if (setdate) { if (stime(&time) < 0) @@ -131,5 +129,5 @@ int rdate_main(int argc, char **argv) fprintf(stdout, "%s", ctime(&time)); } - return(TRUE); + return EXIT_SUCCESS; } @@ -29,6 +29,6 @@ extern int reset_main(int argc, char **argv) { printf("\033c"); - return(TRUE); + return EXIT_SUCCESS; } @@ -102,9 +102,9 @@ extern int rm_main(int argc, char **argv) } else { if (recursiveAction(srcName, recursiveFlag, FALSE, TRUE, fileAction, dirAction, NULL) == FALSE) { - exit(FALSE); + return EXIT_FAILURE; } } } - return(TRUE); + return EXIT_SUCCESS; } @@ -34,7 +34,7 @@ _syscall1(int, delete_module, const char *, name) extern int rmmod_main(int argc, char **argv) { - int ret = TRUE; + int ret = EXIT_SUCCESS; if (argc <= 1) { usage(rmmod_usage); } @@ -47,9 +47,9 @@ extern int rmmod_main(int argc, char **argv) /* Unload _all_ unused modules via NULL delete_module() call */ if (delete_module(NULL)) { perror("rmmod"); - exit(FALSE); + return EXIT_FAILURE; } - exit(TRUE); + return EXIT_SUCCESS; default: usage(rmmod_usage); } @@ -59,7 +59,7 @@ extern int rmmod_main(int argc, char **argv) while (argc-- > 0) { if (delete_module(*argv) < 0) { perror(*argv); - ret=FALSE; + ret = EXIT_FAILURE; } argv++; } diff --git a/setkeycodes.c b/setkeycodes.c index 63c106333..6a31e042a 100644 --- a/setkeycodes.c +++ b/setkeycodes.c @@ -68,5 +68,5 @@ setkeycodes_main(int argc, char** argv) argc -= 2; argv += 2; } - return( TRUE); + return EXIT_SUCCESS; } @@ -217,11 +217,11 @@ static int builtin_cd(struct job *cmd, struct jobSet *junk) newdir = cmd->progs[0].argv[1]; if (chdir(newdir)) { printf("cd: %s: %s\n", newdir, strerror(errno)); - return FALSE; + return EXIT_FAILURE; } getcwd(cwd, sizeof(char)*MAX_LINE); - return TRUE; + return EXIT_SUCCESS; } /* built-in 'env' handler */ @@ -245,14 +245,14 @@ static int builtin_exec(struct job *cmd, struct jobSet *junk) fatalError("Exec to %s failed: %s\n", cmd->progs[0].argv[0], strerror(errno)); } - return TRUE; + return EXIT_SUCCESS; } /* built-in 'exit' handler */ static int builtin_exit(struct job *cmd, struct jobSet *junk) { if (!cmd->progs[0].argv[1] == 1) - exit TRUE; + exit(EXIT_SUCCESS); exit (atoi(cmd->progs[0].argv[1])); } @@ -267,12 +267,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { errorMsg("%s: exactly one argument is expected\n", cmd->progs[0].argv[0]); - return FALSE; + return EXIT_FAILURE; } if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { errorMsg("%s: bad argument '%s'\n", cmd->progs[0].argv[0], cmd->progs[0].argv[1]); - return FALSE; + return EXIT_FAILURE; for (job = jobList->head; job; job = job->next) { if (job->jobId == jobNum) { break; @@ -286,7 +286,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) if (!job) { errorMsg("%s: unknown job %d\n", cmd->progs[0].argv[0], jobNum); - return FALSE; + return EXIT_FAILURE; } if (*cmd->progs[0].argv[0] == 'f') { @@ -305,7 +305,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) job->stoppedProgs = 0; - return TRUE; + return EXIT_SUCCESS; } /* built-in 'help' handler */ @@ -326,7 +326,7 @@ static int builtin_help(struct job *dummy, struct jobSet *junk) fprintf(stdout, "%s\t%s\n", x->cmd, x->descr); } fprintf(stdout, "\n\n"); - return TRUE; + return EXIT_SUCCESS; } /* built-in 'jobs' handler */ @@ -343,7 +343,7 @@ static int builtin_jobs(struct job *dummy, struct jobSet *jobList) printf(JOB_STATUS_FORMAT, job->jobId, statusString, job->text); } - return TRUE; + return EXIT_SUCCESS; } @@ -352,7 +352,7 @@ static int builtin_pwd(struct job *dummy, struct jobSet *junk) { getcwd(cwd, sizeof(char)*MAX_LINE); fprintf(stdout, "%s\n", cwd); - return TRUE; + return EXIT_SUCCESS; } /* built-in 'export VAR=value' handler */ @@ -437,11 +437,11 @@ static int builtin_then(struct job *cmd, struct jobSet *junk) if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { errorMsg("unexpected token `then'\n"); - return FALSE; + return EXIT_FAILURE; } /* If the if result was FALSE, skip the 'then' stuff */ if (cmd->jobContext & IF_FALSE_CONTEXT) { - return TRUE; + return EXIT_SUCCESS; } cmd->jobContext |= THEN_EXP_CONTEXT; @@ -464,11 +464,11 @@ static int builtin_else(struct job *cmd, struct jobSet *junk) if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { errorMsg("unexpected token `else'\n"); - return FALSE; + return EXIT_FAILURE; } /* If the if result was TRUE, skip the 'else' stuff */ if (cmd->jobContext & IF_TRUE_CONTEXT) { - return TRUE; + return EXIT_SUCCESS; } cmd->jobContext |= ELSE_EXP_CONTEXT; @@ -488,12 +488,12 @@ static int builtin_fi(struct job *cmd, struct jobSet *junk) { if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { errorMsg("unexpected token `fi'\n"); - return FALSE; + return EXIT_FAILURE; } /* Clear out the if and then context bits */ cmd->jobContext &= ~(IF_TRUE_CONTEXT|IF_FALSE_CONTEXT|THEN_EXP_CONTEXT|ELSE_EXP_CONTEXT); debug_printf(stderr, "Hit an fi -- jobContext=%d\n", cmd->jobContext); - return TRUE; + return EXIT_SUCCESS; } #endif @@ -504,13 +504,13 @@ static int builtin_source(struct job *cmd, struct jobSet *junk) int status; if (!cmd->progs[0].argv[1] == 1) - return FALSE; + return EXIT_FAILURE; input = fopen(cmd->progs[0].argv[1], "r"); if (!input) { fprintf(stdout, "Couldn't open file '%s'\n", cmd->progs[0].argv[1]); - return FALSE; + return EXIT_FAILURE; } /* Now run the file */ @@ -524,10 +524,10 @@ static int builtin_unset(struct job *cmd, struct jobSet *junk) { if (!cmd->progs[0].argv[1] == 1) { fprintf(stdout, "unset: parameter required.\n"); - return FALSE; + return EXIT_FAILURE; } unsetenv(cmd->progs[0].argv[1]); - return TRUE; + return EXIT_SUCCESS; } /* free up all memory from a job */ diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 8115e5259..94b8fc7b1 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c @@ -135,7 +135,7 @@ void clean_up_and_die(int sig) cmdedit_reset_term(); fprintf(stdout, "\n"); if (sig!=SIGINT) - exit(TRUE); + exit(EXIT_SUCCESS); } /* Go to HOME position */ diff --git a/shell/lash.c b/shell/lash.c index 461f2c092..1524ef16b 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -217,11 +217,11 @@ static int builtin_cd(struct job *cmd, struct jobSet *junk) newdir = cmd->progs[0].argv[1]; if (chdir(newdir)) { printf("cd: %s: %s\n", newdir, strerror(errno)); - return FALSE; + return EXIT_FAILURE; } getcwd(cwd, sizeof(char)*MAX_LINE); - return TRUE; + return EXIT_SUCCESS; } /* built-in 'env' handler */ @@ -245,14 +245,14 @@ static int builtin_exec(struct job *cmd, struct jobSet *junk) fatalError("Exec to %s failed: %s\n", cmd->progs[0].argv[0], strerror(errno)); } - return TRUE; + return EXIT_SUCCESS; } /* built-in 'exit' handler */ static int builtin_exit(struct job *cmd, struct jobSet *junk) { if (!cmd->progs[0].argv[1] == 1) - exit TRUE; + exit(EXIT_SUCCESS); exit (atoi(cmd->progs[0].argv[1])); } @@ -267,12 +267,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { errorMsg("%s: exactly one argument is expected\n", cmd->progs[0].argv[0]); - return FALSE; + return EXIT_FAILURE; } if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { errorMsg("%s: bad argument '%s'\n", cmd->progs[0].argv[0], cmd->progs[0].argv[1]); - return FALSE; + return EXIT_FAILURE; for (job = jobList->head; job; job = job->next) { if (job->jobId == jobNum) { break; @@ -286,7 +286,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) if (!job) { errorMsg("%s: unknown job %d\n", cmd->progs[0].argv[0], jobNum); - return FALSE; + return EXIT_FAILURE; } if (*cmd->progs[0].argv[0] == 'f') { @@ -305,7 +305,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) job->stoppedProgs = 0; - return TRUE; + return EXIT_SUCCESS; } /* built-in 'help' handler */ @@ -326,7 +326,7 @@ static int builtin_help(struct job *dummy, struct jobSet *junk) fprintf(stdout, "%s\t%s\n", x->cmd, x->descr); } fprintf(stdout, "\n\n"); - return TRUE; + return EXIT_SUCCESS; } /* built-in 'jobs' handler */ @@ -343,7 +343,7 @@ static int builtin_jobs(struct job *dummy, struct jobSet *jobList) printf(JOB_STATUS_FORMAT, job->jobId, statusString, job->text); } - return TRUE; + return EXIT_SUCCESS; } @@ -352,7 +352,7 @@ static int builtin_pwd(struct job *dummy, struct jobSet *junk) { getcwd(cwd, sizeof(char)*MAX_LINE); fprintf(stdout, "%s\n", cwd); - return TRUE; + return EXIT_SUCCESS; } /* built-in 'export VAR=value' handler */ @@ -437,11 +437,11 @@ static int builtin_then(struct job *cmd, struct jobSet *junk) if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { errorMsg("unexpected token `then'\n"); - return FALSE; + return EXIT_FAILURE; } /* If the if result was FALSE, skip the 'then' stuff */ if (cmd->jobContext & IF_FALSE_CONTEXT) { - return TRUE; + return EXIT_SUCCESS; } cmd->jobContext |= THEN_EXP_CONTEXT; @@ -464,11 +464,11 @@ static int builtin_else(struct job *cmd, struct jobSet *junk) if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { errorMsg("unexpected token `else'\n"); - return FALSE; + return EXIT_FAILURE; } /* If the if result was TRUE, skip the 'else' stuff */ if (cmd->jobContext & IF_TRUE_CONTEXT) { - return TRUE; + return EXIT_SUCCESS; } cmd->jobContext |= ELSE_EXP_CONTEXT; @@ -488,12 +488,12 @@ static int builtin_fi(struct job *cmd, struct jobSet *junk) { if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { errorMsg("unexpected token `fi'\n"); - return FALSE; + return EXIT_FAILURE; } /* Clear out the if and then context bits */ cmd->jobContext &= ~(IF_TRUE_CONTEXT|IF_FALSE_CONTEXT|THEN_EXP_CONTEXT|ELSE_EXP_CONTEXT); debug_printf(stderr, "Hit an fi -- jobContext=%d\n", cmd->jobContext); - return TRUE; + return EXIT_SUCCESS; } #endif @@ -504,13 +504,13 @@ static int builtin_source(struct job *cmd, struct jobSet *junk) int status; if (!cmd->progs[0].argv[1] == 1) - return FALSE; + return EXIT_FAILURE; input = fopen(cmd->progs[0].argv[1], "r"); if (!input) { fprintf(stdout, "Couldn't open file '%s'\n", cmd->progs[0].argv[1]); - return FALSE; + return EXIT_FAILURE; } /* Now run the file */ @@ -524,10 +524,10 @@ static int builtin_unset(struct job *cmd, struct jobSet *junk) { if (!cmd->progs[0].argv[1] == 1) { fprintf(stdout, "unset: parameter required.\n"); - return FALSE; + return EXIT_FAILURE; } unsetenv(cmd->progs[0].argv[1]); - return TRUE; + return EXIT_SUCCESS; } /* free up all memory from a job */ @@ -32,7 +32,7 @@ extern int sleep_main(int argc, char **argv) if (sleep(atoi(*(++argv))) != 0) { perror("sleep"); - exit(FALSE); + return EXIT_FAILURE; } - return(TRUE); + return EXIT_SUCCESS; } diff --git a/swaponoff.c b/swaponoff.c index 4a1c8f93f..0ae0c36ee 100644 --- a/swaponoff.c +++ b/swaponoff.c @@ -50,7 +50,7 @@ static void swap_enable_disable(char *device) if (status != 0) { perror(applet_name); - exit(FALSE); + exit(EXIT_FAILURE); } } @@ -69,7 +69,7 @@ static void do_em_all() } } endmntent(f); - exit(TRUE); + exit(EXIT_SUCCESS); } @@ -105,9 +105,8 @@ extern int swap_on_off_main(int argc, char **argv) } } swap_enable_disable(*argv); - exit(TRUE); + return EXIT_SUCCESS; usage_and_exit: usage((whichApp == SWAPON_APP) ? swapon_usage : swapoff_usage); - exit(FALSE); } diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 9bedc84f2..a5071583d 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -568,7 +568,7 @@ extern int syslogd_main(int argc, char **argv) doSyslogd(); } - return(TRUE); + return EXIT_SUCCESS; } /* @@ -568,7 +568,7 @@ extern int syslogd_main(int argc, char **argv) doSyslogd(); } - return(TRUE); + return EXIT_SUCCESS; } /* @@ -156,6 +156,7 @@ extern int tar_main(int argc, char **argv) int tostdoutFlag = FALSE; int firstOpt = TRUE; int stopIt; + int status; if (argc <= 1) @@ -227,16 +228,21 @@ extern int tar_main(int argc, char **argv) #ifndef BB_FEATURE_TAR_CREATE fatalError( "This version of tar was not compiled with tar creation support.\n"); #else - exit(writeTarFile(tarName, verboseFlag, argv, excludeList)); + status = writeTarFile(tarName, verboseFlag, argv, excludeList); #endif } if (listFlag == TRUE || extractFlag == TRUE) { if (*argv) extractList = argv; - exit(readTarFile(tarName, extractFlag, listFlag, tostdoutFlag, - verboseFlag, extractList, excludeList)); + status = readTarFile(tarName, extractFlag, listFlag, tostdoutFlag, + verboseFlag, extractList, excludeList); } + if (status == TRUE) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; + flagError: fatalError( "Exactly one of 'c', 'x' or 't' must be specified\n"); } @@ -43,7 +43,6 @@ extern int touch_main(int argc, char **argv) break; default: usage(touch_usage); - exit(FALSE); } } } @@ -57,7 +56,7 @@ extern int touch_main(int argc, char **argv) S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if (fd < 0) { if (create == FALSE && errno == ENOENT) - exit(TRUE); + return EXIT_SUCCESS; else { fatalError("%s", strerror(errno)); } @@ -70,5 +69,5 @@ extern int touch_main(int argc, char **argv) argv++; } - return(TRUE); + return EXIT_SUCCESS; } diff --git a/true_false.c b/true_false.c index b3b221e1f..333541c9b 100644 --- a/true_false.c +++ b/true_false.c @@ -27,10 +27,10 @@ extern int true_main(int argc, char **argv) { - return(TRUE); + return EXIT_SUCCESS; } extern int false_main(int argc, char **argv) { - return(FALSE); + return EXIT_FAILURE; } @@ -38,5 +38,5 @@ extern int tty_main(int argc, char **argv) else puts("not a tty"); } - return(isatty(0) ? TRUE : FALSE); + return(isatty(0) ? EXIT_SUCCESS : EXIT_FAILURE); } @@ -273,11 +273,14 @@ extern int umount_main(int argc, char **argv) mtab_read(); if (umountAll == TRUE) { - exit(umount_all(useMtab)); + if (umount_all(useMtab) == TRUE) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; } if (do_umount(*argv, useMtab) == 0) - exit(TRUE); + return EXIT_SUCCESS; perror("umount"); - return(FALSE); + return EXIT_FAILURE; } @@ -138,7 +138,7 @@ int uname_main(int argc, char **argv) print_element(PRINT_MACHINE, name.machine); print_element(PRINT_PROCESSOR, processor); - return(TRUE); + return EXIT_SUCCESS; } /* If the name element set in MASK is selected for printing in `toprint', @@ -67,7 +67,7 @@ extern int update_main(int argc, char **argv) pid = fork(); if (pid < 0) - exit(FALSE); + return EXIT_FAILURE; else if (pid == 0) { /* Become a proper daemon */ setsid(); @@ -99,12 +99,12 @@ extern int update_main(int argc, char **argv) syslog(LOG_INFO, "This kernel does not need update(8). Exiting."); closelog(); - exit(TRUE); + return EXIT_SUCCESS; } } } } - return( TRUE); + return EXIT_SUCCESS; } /* @@ -70,5 +70,5 @@ extern int uptime_main(int argc, char **argv) LOAD_INT(info.loads[1]), LOAD_FRAC(info.loads[1]), LOAD_INT(info.loads[2]), LOAD_FRAC(info.loads[2])); - return(TRUE); + return EXIT_SUCCESS; } @@ -32,5 +32,5 @@ extern int usleep_main(int argc, char **argv) } usleep(atoi(*(++argv))); /* return void */ - return(TRUE); + return EXIT_SUCCESS; } diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 88b5d1393..a32ca79dc 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c @@ -73,7 +73,7 @@ int dmesg_main(int argc, char **argv) if (n < 0) { goto klogctl_error; } - exit(TRUE); + return EXIT_SUCCESS; } if (bufsize < 4096) @@ -98,11 +98,11 @@ int dmesg_main(int argc, char **argv) } if (lastc != '\n') putchar('\n'); - exit(TRUE); + return EXIT_SUCCESS; end: usage(dmesg_usage); - exit(FALSE); + return EXIT_FAILURE; klogctl_error: perror("klogctl"); - return(FALSE); + return EXIT_FAILURE; } diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 8307f262d..47130e355 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -434,7 +434,7 @@ extern int fbset_main(int argc, char **argv) if (g_options & OPT_READMODE) { if (!readmode(&var, modefile, mode)) { errorMsg("Unknown video mode `%s'\n", mode); - exit(1); + return EXIT_FAILURE; } } @@ -446,5 +446,5 @@ extern int fbset_main(int argc, char **argv) /* Don't close the file, as exiting will take care of that */ /* close(fh); */ - return (TRUE); + return EXIT_SUCCESS; } diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c index 6633e1212..380015dde 100644 --- a/util-linux/fdflush.c +++ b/util-linux/fdflush.c @@ -40,7 +40,7 @@ extern int fdflush_main(int argc, char **argv) fd = open(*argv, 0); if (fd < 0) { perror(*argv); - exit(FALSE); + return EXIT_FAILURE; } value = ioctl(fd, FDFLUSH, 0); @@ -50,7 +50,7 @@ extern int fdflush_main(int argc, char **argv) if (value) { perror(*argv); - exit(FALSE); + return EXIT_FAILURE; } - return(TRUE); + return EXIT_SUCCESS; } diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index 22fc3e643..567151455 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c @@ -51,7 +51,7 @@ freeramdisk_main(int argc, char **argv) /* Don't bother closing. Exit does * that, so we can save a few bytes */ /* close(f); */ - return(TRUE); + return EXIT_SUCCESS; } /* diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 627d04f60..4757e15f8 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -176,7 +176,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr) void die(const char *str) { errorMsg("%s\n", str); - exit(FALSE); + exit(EXIT_FAILURE); } void page_ok(int page) @@ -325,7 +325,7 @@ int mkswap_main(int argc, char **argv) } else if (PAGES > sz && !force) { errorMsg("error: size %ld is larger than device size %d\n", PAGES * (pagesize / 1024), sz * (pagesize / 1024)); - exit(FALSE); + return EXIT_FAILURE; } if (version == -1) { @@ -369,7 +369,7 @@ int mkswap_main(int argc, char **argv) DEV = open(device_name, O_RDWR); if (DEV < 0 || fstat(DEV, &statbuf) < 0) { perror(device_name); - exit(FALSE); + return EXIT_FAILURE; } if (!S_ISBLK(statbuf.st_mode)) check = 0; @@ -393,7 +393,7 @@ int mkswap_main(int argc, char **argv) "This probably means creating v0 swap would destroy your partition table\n" "No swap created. If you really want to create swap v0 on that device, use\n" "the -f option to force it.\n", device_name); - exit(FALSE); + return EXIT_FAILURE; } } } @@ -429,5 +429,5 @@ int mkswap_main(int argc, char **argv) */ if (fsync(DEV)) die("fsync failed"); - return(TRUE); + return EXIT_SUCCESS; } diff --git a/util-linux/mount.c b/util-linux/mount.c index 8b115c9f5..34dbb5eee 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -330,7 +330,7 @@ extern int mount_main(int argc, char **argv) int fakeIt = FALSE; int useMtab = TRUE; int i; - int rc = FALSE; + int rc = EXIT_FAILURE; int fstabmount = FALSE; #if defined BB_FEATURE_USE_DEVPS_PATCH @@ -367,7 +367,7 @@ extern int mount_main(int argc, char **argv) free( mntentlist); close(fd); #endif - exit(TRUE); + return EXIT_SUCCESS; } #else if (argc == 1) { @@ -388,7 +388,7 @@ extern int mount_main(int argc, char **argv) } else { perror(mtab_file); } - exit(TRUE); + return EXIT_SUCCESS; } #endif @@ -489,7 +489,7 @@ singlemount: &extra_opts, &string_flags, 1); if ( rc != 0) { fatalError("nfsmount failed: %s\n", strerror(errno)); - rc = FALSE; + rc = EXIT_FAILURE; } } #endif @@ -499,7 +499,7 @@ singlemount: if (all == FALSE) break; - rc = TRUE; // Always return 0 for 'all' + rc = EXIT_SUCCESS; // Always return 0 for 'all' } if (fstabmount == TRUE) endmntent(f); @@ -512,8 +512,6 @@ singlemount: goto singlemount; - exit(FALSE); - goodbye: usage(mount_usage); } diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 80b37de37..7c8d54117 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c @@ -101,7 +101,6 @@ int rdate_main(int argc, char **argv) default: case 'H': usage(rdate_usage); - return(FALSE); break; case 's': setdate++; @@ -117,11 +116,10 @@ int rdate_main(int argc, char **argv) if (optind == argc) { usage(rdate_usage); - return(FALSE); } if ((time= askremotedate(argv[optind])) == (time_t)-1) { - return(FALSE); + return EXIT_FAILURE; } if (setdate) { if (stime(&time) < 0) @@ -131,5 +129,5 @@ int rdate_main(int argc, char **argv) fprintf(stdout, "%s", ctime(&time)); } - return(TRUE); + return EXIT_SUCCESS; } diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 4a1c8f93f..0ae0c36ee 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -50,7 +50,7 @@ static void swap_enable_disable(char *device) if (status != 0) { perror(applet_name); - exit(FALSE); + exit(EXIT_FAILURE); } } @@ -69,7 +69,7 @@ static void do_em_all() } } endmntent(f); - exit(TRUE); + exit(EXIT_SUCCESS); } @@ -105,9 +105,8 @@ extern int swap_on_off_main(int argc, char **argv) } } swap_enable_disable(*argv); - exit(TRUE); + return EXIT_SUCCESS; usage_and_exit: usage((whichApp == SWAPON_APP) ? swapon_usage : swapoff_usage); - exit(FALSE); } diff --git a/util-linux/umount.c b/util-linux/umount.c index 1d9c6bb32..5f3e59caf 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -273,11 +273,14 @@ extern int umount_main(int argc, char **argv) mtab_read(); if (umountAll == TRUE) { - exit(umount_all(useMtab)); + if (umount_all(useMtab) == TRUE) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; } if (do_umount(*argv, useMtab) == 0) - exit(TRUE); + return EXIT_SUCCESS; perror("umount"); - return(FALSE); + return EXIT_FAILURE; } diff --git a/uudecode.c b/uudecode.c index 78ca0968d..825fdb562 100644 --- a/uudecode.c +++ b/uudecode.c @@ -294,16 +294,16 @@ int uudecode_main (int argc, } if (optind == argc) - exit_status = decode ("stdin", outname) == 0 ? TRUE : FALSE; + exit_status = decode ("stdin", outname) == 0 ? EXIT_SUCCESS : EXIT_FAILURE; else { - exit_status = TRUE; + exit_status = EXIT_SUCCESS; do { if (freopen (argv[optind], "r", stdin) != NULL) { if (decode (argv[optind], outname) != 0) exit_status = FALSE; } else { errorMsg("%s: %s\n", argv[optind], strerror(errno)); - exit_status = FALSE; + exit_status = EXIT_FAILURE; } optind++; } diff --git a/uuencode.c b/uuencode.c index aea99ed87..8d15adbf6 100644 --- a/uuencode.c +++ b/uuencode.c @@ -179,7 +179,7 @@ int uuencode_main (int argc, /* Optional first argument is input file. */ if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { errorMsg("%s: %s\n", argv[optind], strerror(errno)); - exit FALSE; + return EXIT_FAILURE; } mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); optind++; @@ -200,9 +200,9 @@ int uuencode_main (int argc, printf(trans_ptr == uu_std ? "end\n" : "====\n"); if (ferror (stdout)) { errorMsg("Write error\n"); - exit FALSE; + return EXIT_FAILURE; } - return( TRUE); + return EXIT_SUCCESS; } /* Copyright (c) 1983 Regents of the University of California. |