sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit b5a511dacf26655f9eee051ea7bd5fd6709087cf
parent ac033652fe384da13cfae1b3791c1488c4a59f8c
Author: sin <sin@2f30.org>
Date:   Mon,  7 Oct 2013 16:41:55 +0100

Exit with EXIT_SUCCESS/EXIT_FAILURE instead of 0 and 1

Fixed for consistency purposes.

Diffstat:
basename.c | 2+-
cal.c | 2+-
cat.c | 2+-
chgrp.c | 3++-
chmod.c | 2+-
chown.c | 2+-
chroot.c | 2+-
comm.c | 4++--
date.c | 2+-
dirname.c | 2+-
echo.c | 2+-
env.c | 2+-
expand.c | 2+-
fold.c | 2+-
head.c | 2+-
hostname.c | 3++-
id.c | 3++-
kill.c | 2+-
ln.c | 2+-
ls.c | 2+-
mc.c | 4++--
mkdir.c | 2+-
mkfifo.c | 2+-
mknod.c | 2+-
mv.c | 2+-
nl.c | 2+-
paste.c | 2+-
printenv.c | 4++--
pwd.c | 2+-
readlink.c | 4++--
renice.c | 6+++---
rm.c | 2+-
rmdir.c | 3++-
seq.c | 2+-
setsid.c | 2+-
sleep.c | 2+-
sort.c | 2+-
split.c | 2+-
sponge.c | 4++--
stat.c | 5+++--
strings.c | 2+-
sync.c | 3++-
tail.c | 2+-
tar.c | 2+-
tee.c | 2+-
touch.c | 2+-
tty.c | 2+-
uname.c | 2+-
uniq.c | 2+-
unlink.c | 3++-
util/crypt.c | 2+-
who.c | 2+-
52 files changed, 67 insertions(+), 60 deletions(-)

diff --git a/basename.c b/basename.c @@ -37,6 +37,6 @@ main(int argc, char *argv[]) puts(s); - return 0; + return EXIT_SUCCESS; } diff --git a/cal.c b/cal.c @@ -189,6 +189,6 @@ main(int argc, char *argv[]) drawcal(year, month, day, ncols, nmons, fday); - exit(0); + return EXIT_SUCCESS; } diff --git a/cat.c b/cat.c @@ -33,5 +33,5 @@ main(int argc, char *argv[]) fclose(fp); } - return 0; + return EXIT_SUCCESS; } diff --git a/chgrp.c b/chgrp.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <ftw.h> @@ -55,7 +56,7 @@ main(int argc, char **argv) while(*++argv) ftw(*argv, chgrp, FOPEN_MAX); - return 0; + return EXIT_SUCCESS; } while(*++argv) { if(stat(*argv, &st) == -1) { diff --git a/chmod.c b/chmod.c @@ -37,7 +37,7 @@ main(int argc, char *argv[]) parsemode(argv[0]); for(++argv; argc > 0; argc--) chmodr(argv[0]); - return 0; + return EXIT_SUCCESS; } void diff --git a/chown.c b/chown.c @@ -59,7 +59,7 @@ main(int argc, char *argv[]) for(; argc > 0; argc--, argv++) chownpwgr(argv[0]); - return 0; + return EXIT_SUCCESS; } void diff --git a/chroot.c b/chroot.c @@ -28,7 +28,7 @@ main(int argc, char **argv) } eprintf("chroot: '%s':", argv[2]); - return 1; + return EXIT_FAILURE; } void diff --git a/comm.c b/comm.c @@ -63,7 +63,7 @@ main(int argc, char *argv[]) printline((2-dif) % 3, lines[MAX(0, dif)]); } - return 0; + return EXIT_SUCCESS; } void @@ -101,6 +101,6 @@ finish(int pos, FILE *f, char *name) while(nextline(buf, sizeof(buf), f, name)) printline(pos, buf); - exit(1); + exit(EXIT_FAILURE); } diff --git a/date.c b/date.c @@ -41,6 +41,6 @@ main(int argc, char *argv[]) strftime(buf, sizeof buf, fmt, now); puts(buf); - return 0; + return EXIT_SUCCESS; } diff --git a/dirname.c b/dirname.c @@ -24,6 +24,6 @@ main(int argc, char *argv[]) puts(dirname(argv[0])); - return 0; + return EXIT_SUCCESS; } diff --git a/echo.c b/echo.c @@ -29,6 +29,6 @@ main(int argc, char *argv[]) if(!nflag) putchar('\n'); - return 0; + return EXIT_SUCCESS; } diff --git a/env.c b/env.c @@ -35,7 +35,7 @@ main(int argc, char **argv) while(environ && *environ) printf("%s\n", *environ++); - return 0; + return EXIT_SUCCESS; } void diff --git a/expand.c b/expand.c @@ -50,7 +50,7 @@ main(int argc, char *argv[]) argv++; } } - return 0; + return EXIT_SUCCESS; } static wint_t diff --git a/fold.c b/fold.c @@ -48,7 +48,7 @@ main(int argc, char *argv[]) fclose(fp); } - return 0; + return EXIT_SUCCESS; } void diff --git a/head.c b/head.c @@ -36,7 +36,7 @@ main(int argc, char *argv[]) fclose(fp); } - return 0; + return EXIT_SUCCESS; } void diff --git a/hostname.c b/hostname.c @@ -1,6 +1,7 @@ /* See LICENSE file for copyright and license details. */ #include <unistd.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include "util.h" @@ -29,5 +30,5 @@ main(int argc, char *argv[]) eprintf("sethostname:"); } - return 0; + return EXIT_SUCCESS; } diff --git a/id.c b/id.c @@ -4,6 +4,7 @@ #include <pwd.h> #include <grp.h> #include <stdio.h> +#include <stdlib.h> #include <limits.h> #include "util.h" @@ -66,5 +67,5 @@ main(int argc, char *argv[]) printf("(%s)", gr->gr_name); } putchar('\n'); - return 0; + return EXIT_SUCCESS; } diff --git a/kill.c b/kill.c @@ -74,6 +74,6 @@ main(int argc, char *argv[]) eprintf("kill %d:", pid); } - return 0; + return EXIT_SUCCESS; } diff --git a/ln.c b/ln.c @@ -33,7 +33,7 @@ main(int argc, char *argv[]) enmasse(argc, &argv[0], ln); - return 0; + return EXIT_SUCCESS; } int diff --git a/ls.c b/ls.c @@ -89,7 +89,7 @@ main(int argc, char *argv[]) for(i = 0; i < argc; i++) ls(&ents[rflag ? argc-i-1 : i]); - return 0; + return EXIT_SUCCESS; } int diff --git a/mc.c b/mc.c @@ -63,7 +63,7 @@ main(int argc, char *argv[]) for(l = 0; l < b.nlines; ++l) { fputs(b.lines[l], stdout); } - return 0; + return EXIT_SUCCESS; } if(!(space = malloc(maxlen + 2))) @@ -82,6 +82,6 @@ main(int argc, char *argv[]) fputs("\n", stdout); } - return 0; + return EXIT_SUCCESS; } diff --git a/mkdir.c b/mkdir.c @@ -50,7 +50,7 @@ main(int argc, char *argv[]) eprintf("chmod %s:", argv[0]); } - return 0; + return EXIT_SUCCESS; } void diff --git a/mkfifo.c b/mkfifo.c @@ -28,6 +28,6 @@ main(int argc, char *argv[]) eprintf("mkfifo %s:", argv[0]); } } - return 0; + return EXIT_SUCCESS; } diff --git a/mknod.c b/mknod.c @@ -38,5 +38,5 @@ main(int argc, char **argv) if(mknod(argv[0], type|mode, dev) == -1) eprintf("mknod: '%s':", argv[0]); - return 0; + return EXIT_SUCCESS; } diff --git a/mv.c b/mv.c @@ -34,7 +34,7 @@ main(int argc, char *argv[]) eprintf("%s: not a directory\n", argv[argc-1]); enmasse(argc, &argv[0], mv); - return 0; + return EXIT_SUCCESS; } int diff --git a/nl.c b/nl.c @@ -56,7 +56,7 @@ main(int argc, char *argv[]) fclose(fp); } - return 0; + return EXIT_SUCCESS; } void diff --git a/paste.c b/paste.c @@ -100,7 +100,7 @@ main(int argc, char *argv[]) free(delim); free(dsc); - return 0; + return EXIT_SUCCESS; } diff --git a/printenv.c b/printenv.c @@ -12,13 +12,13 @@ main(int argc, char **argv) while(*environ) printf("%s\n", *environ++); - return 0; + return EXIT_SUCCESS; } while(*++argv) { if((var = getenv(*argv))) printf("%s\n", var); } - return 0; + return EXIT_SUCCESS; } diff --git a/pwd.c b/pwd.c @@ -31,7 +31,7 @@ main(int argc, char *argv[]) cwd = agetcwd(); puts((mode == 'L') ? getpwd(cwd) : cwd); - return 0; + return EXIT_SUCCESS; } const char * diff --git a/readlink.c b/readlink.c @@ -40,7 +40,7 @@ main(int argc, char *argv[]) usage(); if (strlen(argv[0]) > PATH_MAX - 1) - exit(1); + return EXIT_FAILURE; if (fflag) { if (realpath(argv[0], buf) == NULL) @@ -55,5 +55,5 @@ main(int argc, char *argv[]) if (!nflag) putchar('\n'); - return 0; + return EXIT_SUCCESS; } diff --git a/renice.c b/renice.c @@ -18,7 +18,7 @@ main(int argc, char **argv) { const char *adj = NULL; long val; - int i, which = PRIO_PROCESS, status = 0; + int i, which = PRIO_PROCESS, status = EXIT_SUCCESS; ARGBEGIN { case 'n': @@ -55,7 +55,7 @@ main(int argc, char **argv) who = pwd->pw_uid; else if(errno != 0) { perror("can't read passwd"); - status = 1; + status = EXIT_FAILURE; continue; } } @@ -63,7 +63,7 @@ main(int argc, char **argv) who = strtop(argv[i]); if(who < 0 || !renice(which, who, val)) - status = 1; + status = EXIT_FAILURE; } return status; diff --git a/rm.c b/rm.c @@ -33,6 +33,6 @@ main(int argc, char *argv[]) for(; argc > 0; argc--, argv++) rm(argv[0]); - return 0; + return EXIT_SUCCESS; } diff --git a/rmdir.c b/rmdir.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <errno.h> @@ -23,6 +24,6 @@ main(int argc, char **argv) argv[-1], strerror(errno)); } - return 0; + return EXIT_SUCCESS; } diff --git a/seq.c b/seq.c @@ -86,7 +86,7 @@ main(int argc, char *argv[]) } printf("\n"); - return 0; + return EXIT_SUCCESS; } int diff --git a/setsid.c b/setsid.c @@ -31,7 +31,7 @@ main(int argc, char *argv[]) case 0: break; default: - exit(0); + return EXIT_SUCCESS; } } if(setsid() < 0) diff --git a/sleep.c b/sleep.c @@ -25,6 +25,6 @@ main(int argc, char *argv[]) seconds = estrtol(argv[0], 0); while((seconds = sleep(seconds)) > 0) ; - return 0; + return EXIT_SUCCESS; } diff --git a/sort.c b/sort.c @@ -55,7 +55,7 @@ main(int argc, char *argv[]) } } - return 0; + return EXIT_SUCCESS; } int diff --git a/split.c b/split.c @@ -94,7 +94,7 @@ Nextfile: fclose(out); break; } - return 0; + return EXIT_SUCCESS; } diff --git a/sponge.c b/sponge.c @@ -1,6 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include <stdio.h> - +#include <stdlib.h> #include "text.h" #include "util.h" @@ -36,5 +36,5 @@ main(int argc, char *argv[]) fclose(fp); fclose(tmpfp); - return 0; + return EXIT_SUCCESS; } diff --git a/stat.c b/stat.c @@ -5,6 +5,7 @@ #include <errno.h> #include <inttypes.h> #include <stdio.h> +#include <stdlib.h> #include <time.h> #include "util.h" @@ -20,7 +21,7 @@ int main(int argc, char *argv[]) { struct stat st; - int i, ret = 0; + int i, ret = EXIT_SUCCESS; int Lflag = 0; int (*fn)(const char *, struct stat *); @@ -44,7 +45,7 @@ main(int argc, char *argv[]) fprintf(stderr, "%s %s: ", Lflag ? "stat" : "lstat", argv[i]); perror(NULL); - ret = 1; + ret = EXIT_FAILURE; continue; } show_stat(argv[i], &st); diff --git a/strings.c b/strings.c @@ -31,7 +31,7 @@ main(int argc, char *argv[]) dostrings(stdin, "<stdin>"); } - return 0; + return EXIT_SUCCESS; } static void diff --git a/sync.c b/sync.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include "util.h" @@ -15,6 +16,6 @@ main(int argc, char **argv) usage(); sync(); - return 0; + return EXIT_SUCCESS; } diff --git a/tail.c b/tail.c @@ -43,7 +43,7 @@ main(int argc, char *argv[]) } else usage(); - return 0; + return EXIT_SUCCESS; } void diff --git a/tar.c b/tar.c @@ -140,7 +140,7 @@ main(int argc, char *argv[]) xt((mode == 'x') ? unarchive : print); } - return 0; + return EXIT_SUCCESS; } void diff --git a/tee.c b/tee.c @@ -47,6 +47,6 @@ main(int argc, char *argv[]) if(ferror(stdin)) eprintf("<stdin>: read error:"); - return 0; + return EXIT_SUCCESS; } diff --git a/touch.c b/touch.c @@ -42,7 +42,7 @@ main(int argc, char *argv[]) for(; argc > 0; argc--, argv++) touch(argv[0]); - return 0; + return EXIT_SUCCESS; } void diff --git a/tty.c b/tty.c @@ -22,5 +22,5 @@ main(int argc, char *argv[]) tty = ttyname(STDIN_FILENO); puts(tty ? tty : "not a tty"); - return tty ? 0 : 1; + return tty ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/uname.c b/uname.c @@ -59,6 +59,6 @@ main(int argc, char *argv[]) putword(u.machine); putchar('\n'); - return 0; + return EXIT_SUCCESS; } diff --git a/uniq.c b/uniq.c @@ -57,7 +57,7 @@ main(int argc, char *argv[]) usage(); uniq_finish(); - return 0; + return EXIT_SUCCESS; } void diff --git a/unlink.c b/unlink.c @@ -1,4 +1,5 @@ #include <unistd.h> +#include <stdlib.h> #include "util.h" static void @@ -16,6 +17,6 @@ main(int argc, char **argv) if(unlink(argv[1]) == -1) eprintf("unlink: '%s':", argv[1]); - return 0; + return EXIT_SUCCESS; } diff --git a/util/crypt.c b/util/crypt.c @@ -23,7 +23,7 @@ cryptmain(int argc, char *argv[], argv++; } } - return 0; + return EXIT_SUCCESS; } int diff --git a/who.c b/who.c @@ -57,6 +57,6 @@ main(int argc, char **argv) printf("%-8s %-12s %-16s\n", usr.ut_name, usr.ut_line, timebuf); } fclose(ufp); - return 0; + return EXIT_SUCCESS; }