Stop using TRUE and FALSE for exit status.

This commit is contained in:
Matt Kraai
2000-12-01 02:55:13 +00:00
parent b558e76eb1
commit 3e856ce428
132 changed files with 375 additions and 373 deletions

View File

@@ -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;
}

View File

@@ -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));

View File

@@ -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')

View File

@@ -241,5 +241,5 @@ extern int cut_main(int argc, char **argv)
}
}
return 0;
return EXIT_SUCCESS;
}

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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;
}
/*

View File

@@ -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;
}

View File

@@ -41,5 +41,5 @@ int dos2unix_main( int argc, char **argv ) {
putchar(c);
c = getchar();
}
return 0;
return EXIT_SUCCESS;
}

View File

@@ -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"

View File

@@ -107,7 +107,7 @@ just_echo:
putchar('\n');
fflush(stdout);
return 0;
return EXIT_SUCCESS;
}
/*-

View File

@@ -26,5 +26,5 @@
extern int hostid_main(int argc, char **argv)
{
printf("%lx\n", gethostid());
return(TRUE);
return EXIT_SUCCESS;
}

View File

@@ -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;
}

View File

@@ -878,5 +878,4 @@ extern int ls_main(int argc, char **argv)
print_usage_message:
usage(ls_usage);
return(FALSE);
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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',

View File

@@ -32,5 +32,5 @@ extern int usleep_main(int argc, char **argv)
}
usleep(atoi(*(++argv))); /* return void */
return(TRUE);
return EXIT_SUCCESS;
}

View File

@@ -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++;
}

View File

@@ -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.