[hackers] [ubase] Stop using EXIT_{SUCCESS,FAILURE} || sin
commit 6f7f387352fd620f58b69859471d60fb1f0eb0ca
Author: sin <sin_AT_2f30.org>
Date: Thu Oct 2 23:45:25 2014 +0100
Stop using EXIT_{SUCCESS,FAILURE}
diff --git a/chvt.c b/chvt.c
index 2dbbdb6..5394588 100644
--- a/chvt.c
+++ b/chvt.c
_AT_@ -57,5 +57,5 @@ VTfound:
eprintf("VT_WAITACTIVE %d:", n);
close(fd);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/clear.c b/clear.c
index 51a2143..8f4a014 100644
--- a/clear.c
+++ b/clear.c
_AT_@ -6,5 +6,5 @@ int
main(void)
{
printf("\x1b[2J\x1b[H");
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/ctrlaltdel.c b/ctrlaltdel.c
index a3893d2..196b4d6 100644
--- a/ctrlaltdel.c
+++ b/ctrlaltdel.c
_AT_@ -40,5 +40,5 @@ main(int argc, char *argv[])
if (syscall(__NR_reboot, LINUX_REBOOT_MAGIC1,
LINUX_REBOOT_MAGIC2, cmd, NULL) < 0)
eprintf("reboot:");
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/df.c b/df.c
index 9c39592..07b0e15 100644
--- a/df.c
+++ b/df.c
_AT_@ -48,7 +48,7 @@ main(int argc, char *argv[])
}
endmntent(fp);
- return EXIT_SUCCESS;
+ return 0;
}
static void
diff --git a/dmesg.c b/dmesg.c
index 76179a9..0401ded 100644
--- a/dmesg.c
+++ b/dmesg.c
_AT_@ -35,7 +35,7 @@ main(int argc, char *argv[])
case 'C':
if (klogctl(SYSLOG_ACTION_CLEAR, NULL, 0) < 0)
eprintf("klogctl:");
- return EXIT_SUCCESS;
+ return 0;
case 'c':
cflag = 1;
break;
_AT_@ -45,7 +45,7 @@ main(int argc, char *argv[])
level = estrtol(EARGF(usage()), 10);
if (klogctl(SYSLOG_ACTION_CONSOLE_LEVEL, NULL, level) < 0)
eprintf("klogctl:");
- return EXIT_SUCCESS;
+ return 0;
default:
usage();
} ARGEND;
_AT_@ -66,7 +66,7 @@ main(int argc, char *argv[])
eprintf("klogctl:");
free(buf);
- return EXIT_SUCCESS;
+ return 0;
}
static void
diff --git a/eject.c b/eject.c
index 837dc76..23a16e8 100644
--- a/eject.c
+++ b/eject.c
_AT_@ -52,5 +52,5 @@ main(int argc, char *argv[])
eprintf("ioctl:");
}
close(fd);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/fallocate.c b/fallocate.c
index 4d4980c..8e20cbb 100644
--- a/fallocate.c
+++ b/fallocate.c
_AT_@ -42,5 +42,5 @@ main(int argc, char *argv[])
eprintf("posix_fallocate:");
close(fd);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/free.c b/free.c
index feceb96..91c2923 100644
--- a/free.c
+++ b/free.c
_AT_@ -68,5 +68,5 @@ main(int argc, char *argv[])
scale(info.totalswap),
scale(info.totalswap - info.freeswap),
scale(info.freeswap));
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/freeramdisk.c b/freeramdisk.c
index 2296e9e..c9943ba 100644
--- a/freeramdisk.c
+++ b/freeramdisk.c
_AT_@ -35,5 +35,5 @@ main(int argc, char *argv[])
if (ioctl(fd, BLKFLSBUF, dev) < 0)
eprintf("BLKFLSBUF %s:", dev);
close(fd);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/fsfreeze.c b/fsfreeze.c
index 5645c8e..ef9344f 100644
--- a/fsfreeze.c
+++ b/fsfreeze.c
_AT_@ -50,5 +50,5 @@ main(int argc, char *argv[])
if (ioctl(fd, fflag == 1 ? FIFREEZE : FITHAW, &p) < 0)
eprintf("%s %s:", fflag == 1 ? "FIFREEZE" : "FITHAW", argv[0]);
close(fd);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/getty.c b/getty.c
index 542f70b..8e0ea4b 100644
--- a/getty.c
+++ b/getty.c
_AT_@ -126,7 +126,7 @@ main(int argc, char *argv[])
if (n < 0)
eprintf("read:");
if (n == 0)
- return EXIT_FAILURE;
+ return 1;
if (i >= sizeof(logname) - 1)
eprintf("login name too long\n");
if (c == '\n' || c == '\r')
_AT_@ -136,6 +136,6 @@ main(int argc, char *argv[])
if (logname[0] == '-')
eprintf("login name cannot start with '-'\n");
if (logname[0] == '\0')
- return EXIT_FAILURE;
+ return 1;
return execlp("/bin/login", "login", "-p", logname, NULL);
}
diff --git a/halt.c b/halt.c
index cc7f1ea..6bab298 100644
--- a/halt.c
+++ b/halt.c
_AT_@ -47,5 +47,5 @@ main(int argc, char *argv[])
if (syscall(__NR_reboot, LINUX_REBOOT_MAGIC1,
LINUX_REBOOT_MAGIC2, cmd, NULL) < 0)
eprintf("reboot:");
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/hwclock.c b/hwclock.c
index 8e111f2..25b4ded 100644
--- a/hwclock.c
+++ b/hwclock.c
_AT_@ -69,7 +69,7 @@ main(int argc, char *argv[])
else if (wflag == 1)
systohc(dev);
- return EXIT_SUCCESS;
+ return 0;
}
static void
diff --git a/id.c b/id.c
index 4463a45..1a45814 100644
--- a/id.c
+++ b/id.c
_AT_@ -31,10 +31,10 @@ main(int argc, char *argv[])
ARGBEGIN {
case 'g':
printf("%d\n", getegid());
- return EXIT_SUCCESS;
+ return 0;
case 'u':
printf("%d\n", geteuid());
- return EXIT_SUCCESS;
+ return 0;
case 'G':
Gflag = 1;
break;
_AT_@ -57,7 +57,7 @@ main(int argc, char *argv[])
usage();
}
- return EXIT_SUCCESS;
+ return 0;
}
static void
diff --git a/insmod.c b/insmod.c
index bddcbcf..33c6ab5 100644
--- a/insmod.c
+++ b/insmod.c
_AT_@ -65,5 +65,5 @@ main(int argc, char *argv[])
free(opts);
free(buf);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/killall5.c b/killall5.c
index 45e2bb8..55e5862 100644
--- a/killall5.c
+++ b/killall5.c
_AT_@ -111,5 +111,5 @@ main(int argc, char *argv[])
free(pe);
}
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/lastlog.c b/lastlog.c
index c9f0949..941a579 100644
--- a/lastlog.c
+++ b/lastlog.c
_AT_@ -74,5 +74,5 @@ main(int argc, char **argv)
if (fclose(last))
eprintf("fclose %s:", _PATH_LASTLOG);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/login.c b/login.c
index 691964f..e0930c5 100644
--- a/login.c
+++ b/login.c
_AT_@ -94,7 +94,7 @@ main(int argc, char *argv[])
if (!pass)
eprintf("getpass:");
if (pw_check(pw, pass) <= 0)
- exit(EXIT_FAILURE);
+ exit(1);
tty = ttyname(STDIN_FILENO);
if (!tty)
diff --git a/lsmod.c b/lsmod.c
index 23e3390..617fda8 100644
--- a/lsmod.c
+++ b/lsmod.c
_AT_@ -53,7 +53,7 @@ main(int argc, char *argv[])
eprintf("%s: read error:", modfile);
free(buf);
fclose(fp);
- return EXIT_SUCCESS;
+ return 0;
}
static void
diff --git a/lsusb.c b/lsusb.c
index 2cbde7c..1667298 100644
--- a/lsusb.c
+++ b/lsusb.c
_AT_@ -23,7 +23,7 @@ main(int argc, char *argv[])
} ARGEND;
recurse("/sys/bus/usb/devices", lsusb);
- return EXIT_SUCCESS;
+ return 0;
}
static void
diff --git a/mesg.c b/mesg.c
index 9942133..c050ea7 100644
--- a/mesg.c
+++ b/mesg.c
_AT_@ -36,7 +36,7 @@ main(int argc, char *argv[])
if (argc == 0) {
puts(sb.st_mode & (S_IWGRP | S_IWOTH) ? "is y" : "is n");
- return EXIT_SUCCESS;
+ return 0;
}
if (argv[0][0] == 'y' && argv[0][1] == '\0')
_AT_@ -49,5 +49,5 @@ main(int argc, char *argv[])
if (fchmod(STDERR_FILENO, mode) < 0)
eprintf("fchmod stderr:");
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/mknod.c b/mknod.c
index 327f81a..28355c1 100644
--- a/mknod.c
+++ b/mknod.c
_AT_@ -41,5 +41,5 @@ main(int argc, char *argv[])
if (mknod(argv[0], type|mode, dev) == -1)
eprintf("mknod: '%s':", argv[0]);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/mkswap.c b/mkswap.c
index de3aa40..79230b1 100644
--- a/mkswap.c
+++ b/mkswap.c
_AT_@ -84,5 +84,5 @@ main(int argc, char *argv[])
close(fd);
free(buf);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/mount.c b/mount.c
index 6b22092..9a13c57 100644
--- a/mount.c
+++ b/mount.c
_AT_@ -122,7 +122,7 @@ catfile(FILE *in, FILE *out)
int
main(int argc, char *argv[])
{
- int aflag = 0, oflag = 0, status = EXIT_SUCCESS, i;
+ int aflag = 0, oflag = 0, status = 0, i;
unsigned long flags = 0;
char *types = NULL, data[512] = "", *resolvpath = NULL;
char *files[] = { "/proc/mounts", "/etc/fstab", NULL };
_AT_@ -162,7 +162,7 @@ main(int argc, char *argv[])
eprintf("fopen %s:", files[0]);
if (catfile(fp, stdout) != 1) {
weprintf("error while reading %s:", files[0]);
- status = EXIT_FAILURE;
+ status = 1;
}
fclose(fp);
return status;
_AT_@ -213,7 +213,7 @@ main(int argc, char *argv[])
mountsingle:
if (mount(source, target, types, flags, data) < 0) {
weprintf("mount: %s:", source);
- status = EXIT_FAILURE;
+ status = 1;
}
if (fp)
endmntent(fp);
_AT_@ -229,7 +229,7 @@ mountall:
if (mount(me->mnt_fsname, me->mnt_dir, me->mnt_type, flags, data) < 0) {
if (mounted(me->mnt_dir) == 0) {
weprintf("mount: %s:", me->mnt_fsname);
- status = EXIT_FAILURE;
+ status = 1;
}
}
}
diff --git a/mountpoint.c b/mountpoint.c
index c23bcb3..0e1bd7e 100644
--- a/mountpoint.c
+++ b/mountpoint.c
_AT_@ -51,7 +51,7 @@ main(int argc, char *argv[])
argv[0]);
printf("%u:%u\n", major(st1.st_rdev),
minor(st1.st_rdev));
- return EXIT_SUCCESS;
+ return 0;
}
if (!S_ISDIR(st1.st_mode))
_AT_@ -60,7 +60,7 @@ main(int argc, char *argv[])
if (dflag) {
printf("%u:%u\n", major(st1.st_dev),
minor(st1.st_dev));
- return EXIT_SUCCESS;
+ return 0;
}
fp = setmntent("/proc/mounts", "r");
diff --git a/pagesize.c b/pagesize.c
index 673f252..3833b90 100644
--- a/pagesize.c
+++ b/pagesize.c
_AT_@ -28,5 +28,5 @@ main(int argc, char *argv[])
eprintf("can't determine pagesize\n");
}
printf("%ld\n", pagesz);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/passwd.c b/passwd.c
index 8f7d28a..b2d19f7 100644
--- a/passwd.c
+++ b/passwd.c
_AT_@ -141,7 +141,7 @@ main(int argc, char *argv[])
struct passwd *pw;
struct spwd *spw = NULL;
FILE *fp = NULL;
- int r = -1, status = EXIT_FAILURE;
+ int r = -1, status = 1;
ARGBEGIN {
default:
_AT_@ -245,7 +245,7 @@ newpass:
weprintf("fopen:");
}
if (!r)
- status = EXIT_SUCCESS;
+ status = 0;
if (fp)
fclose(fp);
diff --git a/pidof.c b/pidof.c
index 115445b..314c17f 100644
--- a/pidof.c
+++ b/pidof.c
_AT_@ -51,7 +51,7 @@ main(int argc, char *argv[])
} ARGEND;
if (!argc)
- return EXIT_FAILURE;
+ return 1;
TAILQ_INIT(&omitpid_head);
_AT_@ -116,5 +116,5 @@ out:
free(pe);
}
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/pivot_root.c b/pivot_root.c
index e0b7b8b..8bbaa48 100644
--- a/pivot_root.c
+++ b/pivot_root.c
_AT_@ -27,5 +27,5 @@ main(int argc, char *argv[])
if (syscall(SYS_pivot_root, argv[0], argv[1]) < 0)
eprintf("pivot_root:");
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/ps.c b/ps.c
index 414412b..aedf7c4 100644
--- a/ps.c
+++ b/ps.c
_AT_@ -60,7 +60,7 @@ main(int argc, char *argv[])
else
printf("UID PID PPID C STIME TTY TIME CMD\n");
recurse("/proc", psr);
- return EXIT_SUCCESS;
+ return 0;
}
static void
diff --git a/readahead.c b/readahead.c
index 350a9b3..dc7850f 100644
--- a/readahead.c
+++ b/readahead.c
_AT_@ -34,5 +34,5 @@ main(int argc, char *argv[])
weprintf("readahead %s:", argv[0]);
fclose(fp);
}
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/respawn.c b/respawn.c
index 14e1ef0..0516912 100644
--- a/respawn.c
+++ b/respawn.c
_AT_@ -19,7 +19,7 @@ sigterm(int sig)
{
if (sig == SIGTERM) {
kill(0, SIGTERM);
- _exit(EXIT_SUCCESS);
+ _exit(0);
}
}
_AT_@ -102,5 +102,5 @@ main(int argc, char *argv[])
sleep(delay);
}
/* not reachable */
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/rmmod.c b/rmmod.c
index 98b4839..b5ce5b7 100644
--- a/rmmod.c
+++ b/rmmod.c
_AT_@ -46,5 +46,5 @@ main(int argc, char *argv[])
eprintf("delete_module:");
}
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/stat.c b/stat.c
index 5d549ff..4523d82 100644
--- a/stat.c
+++ b/stat.c
_AT_@ -23,7 +23,7 @@ int
main(int argc, char *argv[])
{
struct stat st;
- int i, ret = EXIT_SUCCESS;
+ int i, ret = 0;
int (*fn)(const char *, struct stat *) = lstat;
char *fnname = "lstat";
void (*showstat)(const char *, struct stat *) = show_stat;
_AT_@ -49,7 +49,7 @@ main(int argc, char *argv[])
for (i = 0; i < argc; i++) {
if (fn(argv[i], &st) == -1) {
weprintf("%s %s:", fnname, argv[i]);
- ret = EXIT_FAILURE;
+ ret = 1;
continue;
}
showstat(argv[i], &st);
diff --git a/su.c b/su.c
index 71268c1..45867fb 100644
--- a/su.c
+++ b/su.c
_AT_@ -68,7 +68,7 @@ main(int argc, char *argv[])
if (!pass)
eprintf("getpass:");
if (pw_check(pw, pass) <= 0)
- exit(EXIT_FAILURE);
+ exit(1);
}
if (initgroups(usr, pw->pw_gid) < 0)
_AT_@ -101,7 +101,7 @@ main(int argc, char *argv[])
weprintf("execve %s:", shell);
return (errno == ENOENT) ? 127 : 126;
}
- return EXIT_SUCCESS;
+ return 0;
}
static int
diff --git a/swapoff.c b/swapoff.c
index ac9d809..93a77f1 100644
--- a/swapoff.c
+++ b/swapoff.c
_AT_@ -18,7 +18,7 @@ int
main(int argc, char *argv[])
{
int i;
- int ret = EXIT_SUCCESS;
+ int ret = 0;
int all = 0;
ARGBEGIN {
_AT_@ -43,7 +43,7 @@ main(int argc, char *argv[])
if (strcmp(me->mnt_type, MNTTYPE_SWAP) == 0) {
if (swapoff(me->mnt_fsname) < 0) {
weprintf("swapoff %s:", me->mnt_fsname);
- ret = EXIT_FAILURE;
+ ret = 1;
}
}
}
_AT_@ -52,7 +52,7 @@ main(int argc, char *argv[])
for (i = 0; i < argc; i++) {
if (swapoff(argv[i]) < 0) {
weprintf("swapoff %s:", argv[i]);
- ret = EXIT_FAILURE;
+ ret = 1;
}
}
}
diff --git a/swapon.c b/swapon.c
index 8e1b24f..ef31a50 100644
--- a/swapon.c
+++ b/swapon.c
_AT_@ -18,7 +18,7 @@ int
main(int argc, char *argv[])
{
int i;
- int ret = EXIT_SUCCESS;
+ int ret = 0;
int flags = 0;
int all = 0;
_AT_@ -51,7 +51,7 @@ main(int argc, char *argv[])
&& (hasmntopt(me, MNTOPT_NOAUTO) == NULL)) {
if (swapon(me->mnt_fsname, flags) < 0) {
weprintf("swapon %s:", me->mnt_fsname);
- ret = EXIT_FAILURE;
+ ret = 1;
}
}
}
_AT_@ -60,7 +60,7 @@ main(int argc, char *argv[])
for (i = 0; i < argc; i++) {
if (swapon(argv[i], flags) < 0) {
weprintf("swapon %s:", argv[i]);
- ret = EXIT_FAILURE;
+ ret = 1;
}
}
}
diff --git a/switch_root.c b/switch_root.c
index 01a7ae5..b4dd659 100644
--- a/switch_root.c
+++ b/switch_root.c
_AT_@ -129,5 +129,5 @@ main(int argc, char *argv[])
/* execute init */
execv(argv[1], argv);
eprintf("can't execute '%s'\n", argv[1]);
- return EXIT_FAILURE;
+ return 1;
}
diff --git a/sysctl.c b/sysctl.c
index 1210b1a..a98a637 100644
--- a/sysctl.c
+++ b/sysctl.c
_AT_@ -166,7 +166,7 @@ main(int argc, char *argv[])
char *file = NULL;
size_t size = 0;
int i;
- int r = EXIT_SUCCESS;
+ int r = 0;
ARGBEGIN {
case 'p':
_AT_@ -182,7 +182,7 @@ main(int argc, char *argv[])
if (!file) {
for (i = 0; i < argc; i++)
if (parsepair(argv[i]) < 0)
- r = EXIT_FAILURE;
+ r = 1;
} else {
fp = fopen(file, "r");
if (!fp)
_AT_@ -201,7 +201,7 @@ main(int argc, char *argv[])
}
p = buf;
if (parsepair(p) < 0)
- r = EXIT_FAILURE;
+ r = 1;
}
if (ferror(fp))
eprintf("%s: read error:", file);
diff --git a/truncate.c b/truncate.c
index f2fbce4..9947397 100644
--- a/truncate.c
+++ b/truncate.c
_AT_@ -18,7 +18,7 @@ int
main(int argc, char *argv[])
{
int cflag = 0, sflag = 0;
- int fd, i, ret = EXIT_SUCCESS;
+ int fd, i, ret = 0;
long size = 0;
ARGBEGIN {
_AT_@ -40,12 +40,12 @@ main(int argc, char *argv[])
fd = open(argv[i], O_WRONLY | (cflag ? 0 : O_CREAT), 0644);
if (fd < 0) {
weprintf("open: cannot open `%s' for writing:", argv[i]);
- ret = EXIT_FAILURE;
+ ret = 1;
continue;
}
if (ftruncate(fd, size) < 0) {
weprintf("ftruncate: cannot open `%s' for writing:", argv[i]);
- ret = EXIT_FAILURE;
+ ret = 1;
}
close(fd);
}
diff --git a/umount.c b/umount.c
index 344fce0..21d9d26 100644
--- a/umount.c
+++ b/umount.c
_AT_@ -15,7 +15,7 @@ usage(void)
{
weprintf("usage: %s [-lfn] target...\n", argv0);
weprintf("usage: %s -a [-lfn]\n", argv0);
- exit(EXIT_FAILURE);
+ exit(1);
}
int
_AT_@ -24,7 +24,7 @@ main(int argc, char *argv[])
int i;
int aflag = 0;
int flags = 0;
- int ret = EXIT_SUCCESS;
+ int ret = 0;
ARGBEGIN {
case 'a':
_AT_@ -51,7 +51,7 @@ main(int argc, char *argv[])
for (i = 0; i < argc; i++) {
if (umount2(argv[i], flags) < 0) {
weprintf("umount2 %s:", argv[i]);
- ret = EXIT_FAILURE;
+ ret = 1;
}
}
return ret;
_AT_@ -79,7 +79,7 @@ umountall(int flags)
while (--len >= 0) {
if (umount2(mntdirs[len], flags) < 0) {
weprintf("umount2 %s:", mntdirs[len]);
- ret = EXIT_FAILURE;
+ ret = 1;
}
free(mntdirs[len]);
}
diff --git a/unshare.c b/unshare.c
index 0df0355..832c711 100644
--- a/unshare.c
+++ b/unshare.c
_AT_@ -50,5 +50,5 @@ main(int argc, char *argv[])
if (execvp(argv[0], argv) < 0)
eprintf("execvp:");
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/uptime.c b/uptime.c
index 98dec65..015dcad 100644
--- a/uptime.c
+++ b/uptime.c
_AT_@ -69,5 +69,5 @@ main(int argc, char *argv[])
info.loads[1] / 65536.0f,
info.loads[2] / 65536.0f);
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/util/eprintf.c b/util/eprintf.c
index e25ae9f..407c502 100644
--- a/util/eprintf.c
+++ b/util/eprintf.c
_AT_@ -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/watch.c b/watch.c
index 9d8a9ae..46411df 100644
--- a/watch.c
+++ b/watch.c
_AT_@ -46,5 +46,5 @@ main(int argc, char *argv[])
system(cmd);
sleep(interval);
}
- return EXIT_SUCCESS;
+ return 0;
}
diff --git a/who.c b/who.c
index 2b284d7..c508ebb 100644
--- a/who.c
+++ b/who.c
_AT_@ -60,5 +60,5 @@ main(int argc, char *argv[])
printf("%-8s %-12s %-16s\n", usr.ut_name, usr.ut_line, timebuf);
}
fclose(ufp);
- return EXIT_SUCCESS;
+ return 0;
}
Received on Fri Oct 03 2014 - 00:47:45 CEST
This archive was generated by hypermail 2.3.0
: Fri Oct 03 2014 - 00:48:09 CEST