Exit with EXIT_SUCCESS/EXIT_FAILURE instead of 0 and 1

Fixed for consistency purposes.
This commit is contained in:
sin 2013-10-07 16:41:55 +01:00
parent ac033652fe
commit b5a511dacf
52 changed files with 67 additions and 60 deletions

View File

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

2
cal.c
View File

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

2
cat.c
View File

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

View File

@ -1,4 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <ftw.h> #include <ftw.h>
@ -55,7 +56,7 @@ main(int argc, char **argv)
while(*++argv) while(*++argv)
ftw(*argv, chgrp, FOPEN_MAX); ftw(*argv, chgrp, FOPEN_MAX);
return 0; return EXIT_SUCCESS;
} }
while(*++argv) { while(*++argv) {
if(stat(*argv, &st) == -1) { if(stat(*argv, &st) == -1) {

View File

@ -37,7 +37,7 @@ main(int argc, char *argv[])
parsemode(argv[0]); parsemode(argv[0]);
for(++argv; argc > 0; argc--) for(++argv; argc > 0; argc--)
chmodr(argv[0]); chmodr(argv[0]);
return 0; return EXIT_SUCCESS;
} }
void void

View File

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

View File

@ -28,7 +28,7 @@ main(int argc, char **argv)
} }
eprintf("chroot: '%s':", argv[2]); eprintf("chroot: '%s':", argv[2]);
return 1; return EXIT_FAILURE;
} }
void void

4
comm.c
View File

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

2
date.c
View File

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

View File

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

2
echo.c
View File

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

2
env.c
View File

@ -35,7 +35,7 @@ main(int argc, char **argv)
while(environ && *environ) while(environ && *environ)
printf("%s\n", *environ++); printf("%s\n", *environ++);
return 0; return EXIT_SUCCESS;
} }
void void

View File

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

2
fold.c
View File

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

2
head.c
View File

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

View File

@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "util.h" #include "util.h"
@ -29,5 +30,5 @@ main(int argc, char *argv[])
eprintf("sethostname:"); eprintf("sethostname:");
} }
return 0; return EXIT_SUCCESS;
} }

3
id.c
View File

@ -4,6 +4,7 @@
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <limits.h> #include <limits.h>
#include "util.h" #include "util.h"
@ -66,5 +67,5 @@ main(int argc, char *argv[])
printf("(%s)", gr->gr_name); printf("(%s)", gr->gr_name);
} }
putchar('\n'); putchar('\n');
return 0; return EXIT_SUCCESS;
} }

2
kill.c
View File

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

2
ln.c
View File

@ -33,7 +33,7 @@ main(int argc, char *argv[])
enmasse(argc, &argv[0], ln); enmasse(argc, &argv[0], ln);
return 0; return EXIT_SUCCESS;
} }
int int

2
ls.c
View File

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

4
mc.c
View File

@ -63,7 +63,7 @@ main(int argc, char *argv[])
for(l = 0; l < b.nlines; ++l) { for(l = 0; l < b.nlines; ++l) {
fputs(b.lines[l], stdout); fputs(b.lines[l], stdout);
} }
return 0; return EXIT_SUCCESS;
} }
if(!(space = malloc(maxlen + 2))) if(!(space = malloc(maxlen + 2)))
@ -82,6 +82,6 @@ main(int argc, char *argv[])
fputs("\n", stdout); fputs("\n", stdout);
} }
return 0; return EXIT_SUCCESS;
} }

View File

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

View File

@ -28,6 +28,6 @@ main(int argc, char *argv[])
eprintf("mkfifo %s:", argv[0]); eprintf("mkfifo %s:", argv[0]);
} }
} }
return 0; return EXIT_SUCCESS;
} }

View File

@ -38,5 +38,5 @@ main(int argc, char **argv)
if(mknod(argv[0], type|mode, dev) == -1) if(mknod(argv[0], type|mode, dev) == -1)
eprintf("mknod: '%s':", argv[0]); eprintf("mknod: '%s':", argv[0]);
return 0; return EXIT_SUCCESS;
} }

2
mv.c
View File

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

2
nl.c
View File

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

View File

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

View File

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

2
pwd.c
View File

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

View File

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

View File

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

2
rm.c
View File

@ -33,6 +33,6 @@ main(int argc, char *argv[])
for(; argc > 0; argc--, argv++) for(; argc > 0; argc--, argv++)
rm(argv[0]); rm(argv[0]);
return 0; return EXIT_SUCCESS;
} }

View File

@ -1,4 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
@ -23,6 +24,6 @@ main(int argc, char **argv)
argv[-1], strerror(errno)); argv[-1], strerror(errno));
} }
return 0; return EXIT_SUCCESS;
} }

2
seq.c
View File

@ -86,7 +86,7 @@ main(int argc, char *argv[])
} }
printf("\n"); printf("\n");
return 0; return EXIT_SUCCESS;
} }
int int

View File

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

View File

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

2
sort.c
View File

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

View File

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

View File

@ -1,6 +1,6 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include "text.h" #include "text.h"
#include "util.h" #include "util.h"
@ -36,5 +36,5 @@ main(int argc, char *argv[])
fclose(fp); fclose(fp);
fclose(tmpfp); fclose(tmpfp);
return 0; return EXIT_SUCCESS;
} }

5
stat.c
View File

@ -5,6 +5,7 @@
#include <errno.h> #include <errno.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <time.h> #include <time.h>
#include "util.h" #include "util.h"
@ -20,7 +21,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
struct stat st; struct stat st;
int i, ret = 0; int i, ret = EXIT_SUCCESS;
int Lflag = 0; int Lflag = 0;
int (*fn)(const char *, struct stat *); int (*fn)(const char *, struct stat *);
@ -44,7 +45,7 @@ main(int argc, char *argv[])
fprintf(stderr, "%s %s: ", Lflag ? "stat" : "lstat", fprintf(stderr, "%s %s: ", Lflag ? "stat" : "lstat",
argv[i]); argv[i]);
perror(NULL); perror(NULL);
ret = 1; ret = EXIT_FAILURE;
continue; continue;
} }
show_stat(argv[i], &st); show_stat(argv[i], &st);

View File

@ -31,7 +31,7 @@ main(int argc, char *argv[])
dostrings(stdin, "<stdin>"); dostrings(stdin, "<stdin>");
} }
return 0; return EXIT_SUCCESS;
} }
static void static void

3
sync.c
View File

@ -1,4 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include "util.h" #include "util.h"
@ -15,6 +16,6 @@ main(int argc, char **argv)
usage(); usage();
sync(); sync();
return 0; return EXIT_SUCCESS;
} }

2
tail.c
View File

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

2
tar.c
View File

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

2
tee.c
View File

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

View File

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

2
tty.c
View File

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

View File

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

2
uniq.c
View File

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

View File

@ -1,4 +1,5 @@
#include <unistd.h> #include <unistd.h>
#include <stdlib.h>
#include "util.h" #include "util.h"
static void static void
@ -16,6 +17,6 @@ main(int argc, char **argv)
if(unlink(argv[1]) == -1) if(unlink(argv[1]) == -1)
eprintf("unlink: '%s':", argv[1]); eprintf("unlink: '%s':", argv[1]);
return 0; return EXIT_SUCCESS;
} }

View File

@ -23,7 +23,7 @@ cryptmain(int argc, char *argv[],
argv++; argv++;
} }
} }
return 0; return EXIT_SUCCESS;
} }
int int

2
who.c
View File

@ -57,6 +57,6 @@ main(int argc, char **argv)
printf("%-8s %-12s %-16s\n", usr.ut_name, usr.ut_line, timebuf); printf("%-8s %-12s %-16s\n", usr.ut_name, usr.ut_line, timebuf);
} }
fclose(ufp); fclose(ufp);
return 0; return EXIT_SUCCESS;
} }