Stop using EXIT_{SUCCESS,FAILURE}

This commit is contained in:
sin 2014-10-02 23:46:04 +01:00
parent 7305786244
commit 0c5b7b9155
63 changed files with 89 additions and 89 deletions

View File

@ -37,5 +37,5 @@ main(int argc, char *argv[])
puts(s);
return EXIT_SUCCESS;
return 0;
}

2
cal.c
View File

@ -179,5 +179,5 @@ main(int argc, char *argv[])
drawcal(year, month, day, ncols, nmons, fday);
return EXIT_SUCCESS;
return 0;
}

2
cat.c
View File

@ -39,5 +39,5 @@ main(int argc, char *argv[])
fclose(fp);
}
}
return EXIT_SUCCESS;
return 0;
}

View File

@ -11,7 +11,7 @@ static void chmodr(const char *);
static bool rflag = false;
static char *modestr = "";
static mode_t mask = 0;
static int ret = EXIT_SUCCESS;
static int ret = 0;
static void
usage(void)
@ -67,14 +67,14 @@ chmodr(const char *path)
if(stat(path, &st) == -1) {
weprintf("stat %s:", path);
ret = EXIT_FAILURE;
ret = 1;
return;
}
m = parsemode(modestr, st.st_mode, mask);
if(chmod(path, m) == -1) {
weprintf("chmod %s:", path);
ret = EXIT_FAILURE;
ret = 1;
}
if(rflag)
recurse(path, chmodr);

View File

@ -13,7 +13,7 @@ static void chownpwgr(const char *);
static bool rflag = false;
static struct passwd *pw = NULL;
static struct group *gr = NULL;
static int ret = EXIT_SUCCESS;
static int ret = 0;
static void
usage(void)
@ -76,7 +76,7 @@ chownpwgr(const char *path)
if(chown(path, pw ? pw->pw_uid : (uid_t)-1,
gr ? gr->gr_gid : (gid_t)-1) == -1) {
weprintf("chown %s:", path);
ret = EXIT_FAILURE;
ret = 1;
}
if(rflag)
recurse(path, chownpwgr);

View File

@ -44,5 +44,5 @@ main(int argc, char *argv[])
savederrno = errno;
weprintf("execvp %s:", p);
_exit(savederrno == ENOENT ? 127 : 126);
return EXIT_FAILURE;
return 1;
}

View File

@ -90,7 +90,7 @@ main(int argc, char *argv[])
fclose(fp);
}
}
return EXIT_SUCCESS;
return 0;
}
static void

4
col.c
View File

@ -280,7 +280,7 @@ main(int argc, char *argv[])
cur_col++;
}
if (max_line == 0)
exit(EXIT_SUCCESS); /* no lines, so just exit */
exit(0); /* no lines, so just exit */
/* goto the last line that had a character on it */
for (; l->l_next; l = l->l_next)
@ -299,7 +299,7 @@ main(int argc, char *argv[])
/* missing a \n on the last line? */
nblank_lines = 2;
flush_blanks();
exit(EXIT_SUCCESS);
exit(0);
}
void

4
cols.c
View File

@ -73,7 +73,7 @@ main(int argc, char *argv[])
for(l = 0; l < b.nlines; ++l) {
fputs(b.lines[l], stdout);
}
return EXIT_SUCCESS;
return 0;
}
n_rows = (b.nlines + (n_columns - 1)) / n_columns;
@ -87,5 +87,5 @@ main(int argc, char *argv[])
fputs("\n", stdout);
}
return EXIT_SUCCESS;
return 0;
}

4
comm.c
View File

@ -63,7 +63,7 @@ main(int argc, char *argv[])
printline((2-diff) % 3, lines[MAX(0, diff)]);
}
return EXIT_SUCCESS;
return 0;
}
static void
@ -101,5 +101,5 @@ finish(int pos, FILE *f, char *name)
while(nextline(buf, sizeof(buf), f, name))
printline(pos, buf);
exit(EXIT_FAILURE);
exit(1);
}

2
cut.c
View File

@ -192,5 +192,5 @@ main(int argc, char *argv[])
}
}
freelist();
return EXIT_SUCCESS;
return 0;
}

2
date.c
View File

@ -41,5 +41,5 @@ main(int argc, char *argv[])
strftime(buf, sizeof buf, fmt, now);
puts(buf);
return EXIT_SUCCESS;
return 0;
}

View File

@ -24,5 +24,5 @@ main(int argc, char *argv[])
puts(dirname(argv[0]));
return EXIT_SUCCESS;
return 0;
}

2
du.c
View File

@ -78,7 +78,7 @@ main(int argc, char *argv[])
print(n, xrealpath(argv[0], file));
}
}
return EXIT_SUCCESS;
return 0;
}
static void

2
echo.c
View File

@ -28,5 +28,5 @@ main(int argc, char *argv[])
if(!nflag)
putchar('\n');
return EXIT_SUCCESS;
return 0;
}

2
env.c
View File

@ -40,5 +40,5 @@ main(int argc, char *argv[])
while(environ && *environ)
printf("%s\n", *environ++);
return EXIT_SUCCESS;
return 0;
}

View File

@ -54,7 +54,7 @@ main(int argc, char *argv[])
fclose(fp);
}
}
return EXIT_SUCCESS;
return 0;
}
static wint_t

View File

@ -4,5 +4,5 @@
int
main(void)
{
return EXIT_FAILURE;
return 1;
}

2
fold.c
View File

@ -55,7 +55,7 @@ main(int argc, char *argv[])
}
}
return EXIT_SUCCESS;
return 0;
}
static void

2
head.c
View File

@ -44,7 +44,7 @@ main(int argc, char *argv[])
}
}
return EXIT_SUCCESS;
return 0;
}
static void

View File

@ -42,5 +42,5 @@ main(int argc, char *argv[])
free(host);
return EXIT_SUCCESS;
return 0;
}

2
kill.c
View File

@ -74,5 +74,5 @@ main(int argc, char *argv[])
eprintf("kill %d:", pid);
}
return EXIT_SUCCESS;
return 0;
}

2
ln.c
View File

@ -52,5 +52,5 @@ main(int argc, char *argv[])
if (flink(argv[0], to) < 0)
eprintf("%s:", fname);
return EXIT_SUCCESS;
return 0;
}

2
ls.c
View File

@ -96,7 +96,7 @@ main(int argc, char *argv[])
for(i = 0; i < argc; i++)
ls(&ents[rflag ? argc-i-1 : i]);
return EXIT_SUCCESS;
return 0;
}
static int

View File

@ -50,7 +50,7 @@ main(int argc, char *argv[])
eprintf("chmod %s:", argv[0]);
}
return EXIT_SUCCESS;
return 0;
}
static void

View File

@ -31,5 +31,5 @@ main(int argc, char *argv[])
for(; argc > 0; argc--, argv++)
if(mkfifo(argv[0], mode) == -1)
eprintf("mkfifo %s:", argv[0]);
return EXIT_SUCCESS;
return 0;
}

View File

@ -62,16 +62,16 @@ main(int argc, char *argv[])
if (!mkdtemp(path)) {
if (!qflag)
eprintf("mkdtemp %s:", path);
exit(EXIT_FAILURE);
exit(1);
}
} else {
if ((fd = mkstemp(path)) < 0) {
if (!qflag)
eprintf("mkstemp %s:", path);
exit(EXIT_FAILURE);
exit(1);
}
close(fd);
}
puts(path);
return EXIT_SUCCESS;
return 0;
}

2
mv.c
View File

@ -34,7 +34,7 @@ main(int argc, char *argv[])
eprintf("%s: not a directory\n", argv[argc-1]);
enmasse(argc, &argv[0], mv);
return EXIT_SUCCESS;
return 0;
}
static int

2
nl.c
View File

@ -58,7 +58,7 @@ main(int argc, char *argv[])
fclose(fp);
}
return EXIT_SUCCESS;
return 0;
}
void

View File

@ -96,7 +96,7 @@ main(int argc, char *argv[])
free(delim);
free(dsc);
return EXIT_SUCCESS;
return 0;
}
static size_t

View File

@ -25,12 +25,12 @@ main(int argc, char *argv[])
while(*environ)
printf("%s\n", *environ++);
return EXIT_SUCCESS;
return 0;
}
while(*++argv) {
if((var = getenv(*argv)))
printf("%s\n", var);
}
return EXIT_SUCCESS;
return 0;
}

2
pwd.c
View File

@ -31,7 +31,7 @@ main(int argc, char *argv[])
cwd = agetcwd();
puts((mode == 'L') ? getpwd(cwd) : cwd);
return EXIT_SUCCESS;
return 0;
}
static const char *

View File

@ -40,7 +40,7 @@ main(int argc, char *argv[])
usage();
if (strlen(argv[0]) > PATH_MAX - 1)
return EXIT_FAILURE;
return 1;
if (fflag) {
if (realpath(argv[0], buf) == NULL)
@ -55,5 +55,5 @@ main(int argc, char *argv[])
if (!nflag)
putchar('\n');
return EXIT_SUCCESS;
return 0;
}

View File

@ -23,7 +23,7 @@ main(int argc, char *argv[])
{
const char *adj = NULL;
long val;
int i, which = PRIO_PROCESS, status = EXIT_SUCCESS;
int i, which = PRIO_PROCESS, status = 0;
ARGBEGIN {
case 'n':
@ -60,7 +60,7 @@ main(int argc, char *argv[])
who = pwd->pw_uid;
else if(errno != 0) {
perror("can't read passwd");
status = EXIT_FAILURE;
status = 1;
continue;
}
}
@ -68,7 +68,7 @@ main(int argc, char *argv[])
who = strtop(argv[i]);
if(who < 0 || !renice(which, who, val))
status = EXIT_FAILURE;
status = 1;
}
return status;

4
rm.c
View File

@ -32,11 +32,11 @@ main(int argc, char *argv[])
if (rm_fflag == false)
usage();
else
return EXIT_SUCCESS;
return 0;
}
for(; argc > 0; argc--, argv++)
rm(argv[0]);
return EXIT_SUCCESS;
return 0;
}

View File

@ -28,5 +28,5 @@ main(int argc, char *argv[])
fprintf(stderr, "rmdir: '%s': %s\n",
argv[0], strerror(errno));
return EXIT_SUCCESS;
return 0;
}

4
seq.c
View File

@ -63,7 +63,7 @@ main(int argc, char *argv[])
dir = (step > 0) ? 1.0 : -1.0;
if(step == 0 || start * dir > end * dir)
return EXIT_FAILURE;
return 1;
if(fmt == ftmp) {
right = MAX(digitsright(starts),
@ -85,7 +85,7 @@ main(int argc, char *argv[])
}
printf("\n");
return EXIT_SUCCESS;
return 0;
}
static int

View File

@ -32,7 +32,7 @@ main(int argc, char *argv[])
case 0:
break;
default:
return EXIT_SUCCESS;
return 0;
}
}
if(setsid() < 0)

View File

@ -25,5 +25,5 @@ main(int argc, char *argv[])
seconds = estrtol(argv[0], 0);
while((seconds = sleep(seconds)) > 0)
;
return EXIT_SUCCESS;
return 0;
}

2
sort.c
View File

@ -107,7 +107,7 @@ main(int argc, char *argv[])
}
freelist();
return EXIT_SUCCESS;
return 0;
}
static void

View File

@ -105,7 +105,7 @@ Nextfile:
fclose(out);
break;
}
return EXIT_SUCCESS;
return 0;
}
int

View File

@ -36,5 +36,5 @@ main(int argc, char *argv[])
fclose(fp);
fclose(tmpfp);
return EXIT_SUCCESS;
return 0;
}

View File

@ -35,7 +35,7 @@ main(int argc, char *argv[])
}
}
return EXIT_SUCCESS;
return 0;
}
static void

2
sync.c
View File

@ -17,5 +17,5 @@ main(int argc, char *argv[])
usage();
sync();
return EXIT_SUCCESS;
return 0;
}

2
tail.c
View File

@ -49,7 +49,7 @@ main(int argc, char *argv[])
}
}
return EXIT_SUCCESS;
return 0;
}
static void

2
tar.c
View File

@ -138,7 +138,7 @@ main(int argc, char *argv[])
xt((mode == 'x') ? unarchive : print);
}
return EXIT_SUCCESS;
return 0;
}
static void

2
tee.c
View File

@ -47,5 +47,5 @@ main(int argc, char *argv[])
eprintf("<stdin>: read error:");
free(fps);
return EXIT_SUCCESS;
return 0;
}

2
test.c
View File

@ -52,7 +52,7 @@ main(int argc, char *argv[])
}
if(not)
ret = !ret;
return ret ? EXIT_SUCCESS : EXIT_FAILURE;
return ret ? 0 : 1;
}
static bool

View File

@ -42,7 +42,7 @@ main(int argc, char *argv[])
for(; argc > 0; argc--, argv++)
touch(argv[0]);
return EXIT_SUCCESS;
return 0;
}
static void

2
tr.c
View File

@ -352,5 +352,5 @@ main(int argc, char *argv[])
if(ferror(stdin))
eprintf("<stdin>: read error:");
return EXIT_SUCCESS;
return 0;
}

2
true.c
View File

@ -4,5 +4,5 @@
int
main(void)
{
return EXIT_SUCCESS;
return 0;
}

2
tty.c
View File

@ -22,5 +22,5 @@ main(int argc, char *argv[])
tty = ttyname(STDIN_FILENO);
puts(tty ? tty : "not a tty");
return tty ? EXIT_SUCCESS : EXIT_FAILURE;
return tty ? 0 : 1;
}

View File

@ -59,5 +59,5 @@ main(int argc, char *argv[])
putword(u.machine);
putchar('\n');
return EXIT_SUCCESS;
return 0;
}

View File

@ -57,7 +57,7 @@ main(int argc, char *argv[])
}
}
return EXIT_SUCCESS;
return 0;
}
static wint_t

2
uniq.c
View File

@ -57,7 +57,7 @@ main(int argc, char *argv[])
usage();
uniqfinish();
return EXIT_SUCCESS;
return 0;
}
static void

View File

@ -18,5 +18,5 @@ main(int argc, char *argv[])
if(unlink(argv[1]) == -1)
eprintf("unlink: '%s':", argv[1]);
return EXIT_SUCCESS;
return 0;
}

View File

@ -22,7 +22,7 @@ bool cp_fflag = false;
bool cp_pflag = false;
bool cp_rflag = false;
bool cp_vflag = false;
int cp_status = EXIT_SUCCESS;
int cp_status = 0;
int
cp(const char *s1, const char *s2)
@ -52,7 +52,7 @@ cp(const char *s1, const char *s2)
unlink(s2);
if(symlink(buf, s2) != 0) {
weprintf("%s: can't create '%s'\n", argv0, s2);
cp_status = EXIT_FAILURE;
cp_status = 1;
return 0;
}
}
@ -98,7 +98,7 @@ cp(const char *s1, const char *s2)
unlink(s2);
if(mknod(s2, st.st_mode, st.st_rdev) < 0) {
weprintf("%s: can't create '%s':", argv0, s2);
cp_status = EXIT_FAILURE;
cp_status = 1;
return 0;
}
goto preserve;
@ -107,7 +107,7 @@ cp(const char *s1, const char *s2)
if(!(f1 = fopen(s1, "r"))) {
weprintf("fopen %s:", s1);
cp_status = EXIT_FAILURE;
cp_status = 1;
return 0;
}
@ -116,12 +116,12 @@ cp(const char *s1, const char *s2)
unlink(s2);
if(!(f2 = fopen(s2, "w"))) {
weprintf("fopen %s:", s2);
cp_status = EXIT_FAILURE;
cp_status = 1;
return 0;
}
} else {
weprintf("fopen %s:", s2);
cp_status = EXIT_FAILURE;
cp_status = 1;
return 0;
}
}
@ -145,7 +145,7 @@ preserve:
r = chown(s2, st.st_uid, st.st_gid);
if(r == -1) {
weprintf("cp: can't preserve ownership of '%s':", s2);
cp_status = EXIT_FAILURE;
cp_status = 1;
}
}
return 0;

View File

@ -42,7 +42,7 @@ cryptcheck(char *sumfile, int argc, char *argv[],
{
FILE *cfp, *fp;
char *line = NULL, *file, *p;
int r, nonmatch = 0, formatsucks = 0, noread = 0, ret = EXIT_SUCCESS;
int r, nonmatch = 0, formatsucks = 0, noread = 0, ret = 0;
size_t bufsiz = 0;
if(sumfile == NULL)
@ -85,15 +85,15 @@ cryptcheck(char *sumfile, int argc, char *argv[],
free(line);
if(formatsucks > 0) {
weprintf("%d lines are improperly formatted\n", formatsucks);
ret = EXIT_FAILURE;
ret = 1;
}
if(noread > 0) {
weprintf("%d listed file could not be read\n", noread);
ret = EXIT_FAILURE;
ret = 1;
}
if(nonmatch > 0) {
weprintf("%d computed checksums did NOT match\n", nonmatch);
ret = EXIT_FAILURE;
ret = 1;
}
return ret;
}
@ -103,7 +103,7 @@ cryptmain(int argc, char *argv[],
struct crypt_ops *ops, uint8_t *md, size_t sz)
{
FILE *fp;
int ret = EXIT_SUCCESS;
int ret = 0;
if (argc == 0) {
cryptsum(ops, stdin, "<stdin>", md);
@ -112,11 +112,11 @@ cryptmain(int argc, char *argv[],
for (; argc > 0; argc--) {
if((fp = fopen(*argv, "r")) == NULL) {
weprintf("fopen %s:", *argv);
ret = EXIT_FAILURE;
ret = 1;
continue;
}
if(cryptsum(ops, fp, *argv, md) == 1)
ret = EXIT_FAILURE;
ret = 1;
else
mdprint(md, *argv, sz);
fclose(fp);

View File

@ -16,7 +16,7 @@ eprintf(const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
venprintf(EXIT_FAILURE, fmt, ap);
venprintf(1, fmt, ap);
va_end(ap);
}

View File

@ -58,7 +58,7 @@ main(int argc, char *argv[])
if (nfp)
fclose(nfp);
return EXIT_SUCCESS;
return 0;
}
static FILE *

View File

@ -37,7 +37,7 @@ main(int argc, char *argv[])
uuencode(fp, argv[1], argv[0]);
fclose(fp);
}
return EXIT_SUCCESS;
return 0;
}
static void

2
wc.c
View File

@ -57,7 +57,7 @@ main(int argc, char *argv[])
if (argc > 1)
output("total", tc, tl, tw);
}
return EXIT_SUCCESS;
return 0;
}
void

2
yes.c
View File

@ -19,5 +19,5 @@ main(int argc, char *argv[])
for (;;)
puts(argc >= 1 ? argv[0] : "y");
return EXIT_FAILURE; /* should not reach */
return 1; /* should not reach */
}