sbase

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

commit 0c5b7b91554823a4b2e97e23108f342d7263be34
parent 7305786244816e10926fc637aecc5ebc046f26f3
Author: sin <sin@2f30.org>
Date:   Thu,  2 Oct 2014 23:46:04 +0100

Stop using EXIT_{SUCCESS,FAILURE}

Diffstat:
Mbasename.c | 2+-
Mcal.c | 2+-
Mcat.c | 2+-
Mchmod.c | 6+++---
Mchown.c | 4++--
Mchroot.c | 2+-
Mcksum.c | 2+-
Mcol.c | 4++--
Mcols.c | 4++--
Mcomm.c | 4++--
Mcut.c | 2+-
Mdate.c | 2+-
Mdirname.c | 2+-
Mdu.c | 2+-
Mecho.c | 2+-
Menv.c | 2+-
Mexpand.c | 2+-
Mfalse.c | 2+-
Mfold.c | 2+-
Mhead.c | 2+-
Mhostname.c | 2+-
Mkill.c | 2+-
Mln.c | 2+-
Mls.c | 2+-
Mmkdir.c | 2+-
Mmkfifo.c | 2+-
Mmktemp.c | 6+++---
Mmv.c | 2+-
Mnl.c | 2+-
Mpaste.c | 2+-
Mprintenv.c | 4++--
Mpwd.c | 2+-
Mreadlink.c | 4++--
Mrenice.c | 6+++---
Mrm.c | 4++--
Mrmdir.c | 2+-
Mseq.c | 4++--
Msetsid.c | 2+-
Msleep.c | 2+-
Msort.c | 2+-
Msplit.c | 2+-
Msponge.c | 2+-
Mstrings.c | 2+-
Msync.c | 2+-
Mtail.c | 2+-
Mtar.c | 2+-
Mtee.c | 2+-
Mtest.c | 2+-
Mtouch.c | 2+-
Mtr.c | 2+-
Mtrue.c | 2+-
Mtty.c | 2+-
Muname.c | 2+-
Munexpand.c | 2+-
Muniq.c | 2+-
Munlink.c | 2+-
Mutil/cp.c | 14+++++++-------
Mutil/crypt.c | 14+++++++-------
Mutil/eprintf.c | 2+-
Muudecode.c | 2+-
Muuencode.c | 2+-
Mwc.c | 2+-
Myes.c | 2+-
63 files changed, 89 insertions(+), 89 deletions(-)

diff --git a/basename.c b/basename.c @@ -37,5 +37,5 @@ main(int argc, char *argv[]) puts(s); - return EXIT_SUCCESS; + return 0; } diff --git a/cal.c b/cal.c @@ -179,5 +179,5 @@ main(int argc, char *argv[]) drawcal(year, month, day, ncols, nmons, fday); - return EXIT_SUCCESS; + return 0; } diff --git a/cat.c b/cat.c @@ -39,5 +39,5 @@ main(int argc, char *argv[]) fclose(fp); } } - return EXIT_SUCCESS; + return 0; } diff --git a/chmod.c b/chmod.c @@ -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); diff --git a/chown.c b/chown.c @@ -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); diff --git a/chroot.c b/chroot.c @@ -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; } diff --git a/cksum.c b/cksum.c @@ -90,7 +90,7 @@ main(int argc, char *argv[]) fclose(fp); } } - return EXIT_SUCCESS; + return 0; } static void diff --git a/col.c b/col.c @@ -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 diff --git a/cols.c b/cols.c @@ -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; } diff --git a/comm.c b/comm.c @@ -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); } diff --git a/cut.c b/cut.c @@ -192,5 +192,5 @@ main(int argc, char *argv[]) } } freelist(); - return EXIT_SUCCESS; + return 0; } diff --git a/date.c b/date.c @@ -41,5 +41,5 @@ main(int argc, char *argv[]) strftime(buf, sizeof buf, fmt, now); puts(buf); - return EXIT_SUCCESS; + return 0; } diff --git a/dirname.c b/dirname.c @@ -24,5 +24,5 @@ main(int argc, char *argv[]) puts(dirname(argv[0])); - return EXIT_SUCCESS; + return 0; } diff --git a/du.c b/du.c @@ -78,7 +78,7 @@ main(int argc, char *argv[]) print(n, xrealpath(argv[0], file)); } } - return EXIT_SUCCESS; + return 0; } static void diff --git a/echo.c b/echo.c @@ -28,5 +28,5 @@ main(int argc, char *argv[]) if(!nflag) putchar('\n'); - return EXIT_SUCCESS; + return 0; } diff --git a/env.c b/env.c @@ -40,5 +40,5 @@ main(int argc, char *argv[]) while(environ && *environ) printf("%s\n", *environ++); - return EXIT_SUCCESS; + return 0; } diff --git a/expand.c b/expand.c @@ -54,7 +54,7 @@ main(int argc, char *argv[]) fclose(fp); } } - return EXIT_SUCCESS; + return 0; } static wint_t diff --git a/false.c b/false.c @@ -4,5 +4,5 @@ int main(void) { - return EXIT_FAILURE; + return 1; } diff --git a/fold.c b/fold.c @@ -55,7 +55,7 @@ main(int argc, char *argv[]) } } - return EXIT_SUCCESS; + return 0; } static void diff --git a/head.c b/head.c @@ -44,7 +44,7 @@ main(int argc, char *argv[]) } } - return EXIT_SUCCESS; + return 0; } static void diff --git a/hostname.c b/hostname.c @@ -42,5 +42,5 @@ main(int argc, char *argv[]) free(host); - return EXIT_SUCCESS; + return 0; } diff --git a/kill.c b/kill.c @@ -74,5 +74,5 @@ main(int argc, char *argv[]) eprintf("kill %d:", pid); } - return EXIT_SUCCESS; + return 0; } diff --git a/ln.c b/ln.c @@ -52,5 +52,5 @@ main(int argc, char *argv[]) if (flink(argv[0], to) < 0) eprintf("%s:", fname); - return EXIT_SUCCESS; + return 0; } diff --git a/ls.c b/ls.c @@ -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 diff --git a/mkdir.c b/mkdir.c @@ -50,7 +50,7 @@ main(int argc, char *argv[]) eprintf("chmod %s:", argv[0]); } - return EXIT_SUCCESS; + return 0; } static void diff --git a/mkfifo.c b/mkfifo.c @@ -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; } diff --git a/mktemp.c b/mktemp.c @@ -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; } 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 EXIT_SUCCESS; + return 0; } static int diff --git a/nl.c b/nl.c @@ -58,7 +58,7 @@ main(int argc, char *argv[]) fclose(fp); } - return EXIT_SUCCESS; + return 0; } void diff --git a/paste.c b/paste.c @@ -96,7 +96,7 @@ main(int argc, char *argv[]) free(delim); free(dsc); - return EXIT_SUCCESS; + return 0; } static size_t diff --git a/printenv.c b/printenv.c @@ -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; } 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 EXIT_SUCCESS; + return 0; } static 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) - 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; } diff --git a/renice.c b/renice.c @@ -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; diff --git a/rm.c b/rm.c @@ -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; } diff --git a/rmdir.c b/rmdir.c @@ -28,5 +28,5 @@ main(int argc, char *argv[]) fprintf(stderr, "rmdir: '%s': %s\n", argv[0], strerror(errno)); - return EXIT_SUCCESS; + return 0; } diff --git a/seq.c b/seq.c @@ -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 diff --git a/setsid.c b/setsid.c @@ -32,7 +32,7 @@ main(int argc, char *argv[]) case 0: break; default: - return EXIT_SUCCESS; + return 0; } } if(setsid() < 0) diff --git a/sleep.c b/sleep.c @@ -25,5 +25,5 @@ main(int argc, char *argv[]) seconds = estrtol(argv[0], 0); while((seconds = sleep(seconds)) > 0) ; - return EXIT_SUCCESS; + return 0; } diff --git a/sort.c b/sort.c @@ -107,7 +107,7 @@ main(int argc, char *argv[]) } freelist(); - return EXIT_SUCCESS; + return 0; } static void diff --git a/split.c b/split.c @@ -105,7 +105,7 @@ Nextfile: fclose(out); break; } - return EXIT_SUCCESS; + return 0; } int diff --git a/sponge.c b/sponge.c @@ -36,5 +36,5 @@ main(int argc, char *argv[]) fclose(fp); fclose(tmpfp); - return EXIT_SUCCESS; + return 0; } diff --git a/strings.c b/strings.c @@ -35,7 +35,7 @@ main(int argc, char *argv[]) } } - return EXIT_SUCCESS; + return 0; } static void diff --git a/sync.c b/sync.c @@ -17,5 +17,5 @@ main(int argc, char *argv[]) usage(); sync(); - return EXIT_SUCCESS; + return 0; } diff --git a/tail.c b/tail.c @@ -49,7 +49,7 @@ main(int argc, char *argv[]) } } - return EXIT_SUCCESS; + return 0; } static void diff --git a/tar.c b/tar.c @@ -138,7 +138,7 @@ main(int argc, char *argv[]) xt((mode == 'x') ? unarchive : print); } - return EXIT_SUCCESS; + return 0; } static void diff --git a/tee.c b/tee.c @@ -47,5 +47,5 @@ main(int argc, char *argv[]) eprintf("<stdin>: read error:"); free(fps); - return EXIT_SUCCESS; + return 0; } diff --git a/test.c b/test.c @@ -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 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 EXIT_SUCCESS; + return 0; } static void diff --git a/tr.c b/tr.c @@ -352,5 +352,5 @@ main(int argc, char *argv[]) if(ferror(stdin)) eprintf("<stdin>: read error:"); - return EXIT_SUCCESS; + return 0; } diff --git a/true.c b/true.c @@ -4,5 +4,5 @@ int main(void) { - return EXIT_SUCCESS; + return 0; } 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 ? EXIT_SUCCESS : EXIT_FAILURE; + return tty ? 0 : 1; } diff --git a/uname.c b/uname.c @@ -59,5 +59,5 @@ main(int argc, char *argv[]) putword(u.machine); putchar('\n'); - return EXIT_SUCCESS; + return 0; } diff --git a/unexpand.c b/unexpand.c @@ -57,7 +57,7 @@ main(int argc, char *argv[]) } } - return EXIT_SUCCESS; + return 0; } static wint_t diff --git a/uniq.c b/uniq.c @@ -57,7 +57,7 @@ main(int argc, char *argv[]) usage(); uniqfinish(); - return EXIT_SUCCESS; + return 0; } static void diff --git a/unlink.c b/unlink.c @@ -18,5 +18,5 @@ main(int argc, char *argv[]) if(unlink(argv[1]) == -1) eprintf("unlink: '%s':", argv[1]); - return EXIT_SUCCESS; + return 0; } diff --git a/util/cp.c b/util/cp.c @@ -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; diff --git a/util/crypt.c b/util/crypt.c @@ -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); diff --git a/util/eprintf.c b/util/eprintf.c @@ -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); } diff --git a/uudecode.c b/uudecode.c @@ -58,7 +58,7 @@ main(int argc, char *argv[]) if (nfp) fclose(nfp); - return EXIT_SUCCESS; + return 0; } static FILE * diff --git a/uuencode.c b/uuencode.c @@ -37,7 +37,7 @@ main(int argc, char *argv[]) uuencode(fp, argv[1], argv[0]); fclose(fp); } - return EXIT_SUCCESS; + return 0; } static void diff --git a/wc.c b/wc.c @@ -57,7 +57,7 @@ main(int argc, char *argv[]) if (argc > 1) output("total", tc, tl, tw); } - return EXIT_SUCCESS; + return 0; } void diff --git a/yes.c b/yes.c @@ -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 */ }