ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit e340e1373e89ee3c7718b0a6bcff6b4fd8b5afe5
parent 64744bd6f19add425da46eeb880e6b7048e5972d
Author: s-p-k <mr.dwts@gmail.com>
Date:   Mon,  7 Oct 2013 21:11:40 +0300

exit with EXIT_SUCCESS/EXIT_FAILURE

Diffstat:
Mchvt.c | 2+-
Mclear.c | 3++-
Mdf.c | 2+-
Mdmesg.c | 2+-
Meject.c | 3++-
Mfallocate.c | 2+-
Mfree.c | 2+-
Mhalt.c | 3++-
Minsmod.c | 2+-
Mlsmod.c | 2+-
Mlsusb.c | 2+-
Mmkswap.c | 6+++---
Mmount.c | 6+++---
Mmountpoint.c | 4++--
Mpidof.c | 2+-
Mpivot_root.c | 3++-
Mps.c | 2+-
Mrmmod.c | 3++-
Mswapoff.c | 5+++--
Mswapon.c | 5+++--
Mtruncate.c | 2+-
Mumount.c | 5+++--
Munshare.c | 3++-
Muptime.c | 2+-
Mwatch.c | 2+-
25 files changed, 42 insertions(+), 33 deletions(-)

diff --git a/chvt.c b/chvt.c @@ -53,5 +53,5 @@ VTfound: eprintf("chvt: VT_WAITACTIVE '%d':", n); close(fd); - return 0; + return EXIT_SUCCESS; } diff --git a/clear.c b/clear.c @@ -1,9 +1,10 @@ /* See LICENSE file for copyright and license details. */ #include <stdio.h> +#include <stdlib.h> int main(void) { printf("\e[2J\e[H"); - return 0; + return EXIT_SUCCESS; } diff --git a/df.c b/df.c @@ -39,7 +39,7 @@ main(int argc, char *argv[]) mnt_show(minfo[i].fsname, minfo[i].mntdir); free(minfo); - return 0; + return EXIT_SUCCESS; } static void diff --git a/dmesg.c b/dmesg.c @@ -76,7 +76,7 @@ main(int argc, char *argv[]) eprintf("klogctl:"); free(buf); - return 0; + return EXIT_SUCCESS; } static int diff --git a/eject.c b/eject.c @@ -5,6 +5,7 @@ #include <fcntl.h> #include <unistd.h> #include <stdio.h> +#include <stdlib.h> #include "util.h" enum { @@ -49,5 +50,5 @@ main(int argc, char *argv[]) eprintf("ioctl:"); } close(fd); - return 0; + return EXIT_SUCCESS; } diff --git a/fallocate.c b/fallocate.c @@ -40,5 +40,5 @@ main(int argc, char *argv[]) eprintf("posix_fallocate:"); close(fd); - return 0; + return EXIT_SUCCESS; } diff --git a/free.c b/free.c @@ -66,5 +66,5 @@ main(int argc, char *argv[]) scale(info.totalswap), scale(info.totalswap - info.freeswap), scale(info.freeswap)); - return 0; + return EXIT_SUCCESS; } diff --git a/halt.c b/halt.c @@ -2,6 +2,7 @@ #include <sys/syscall.h> #include <unistd.h> #include <stdio.h> +#include <stdlib.h> #include "reboot.h" #include "util.h" @@ -44,5 +45,5 @@ main(int argc, char *argv[]) if (syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, NULL) < 0) eprintf("reboot:"); - return 0; + return EXIT_SUCCESS; } diff --git a/insmod.c b/insmod.c @@ -66,5 +66,5 @@ main(int argc, char *argv[]) free(opts); free(buf); - return 0; + return EXIT_SUCCESS; } diff --git a/lsmod.c b/lsmod.c @@ -48,7 +48,7 @@ main(int argc, char *argv[]) if (ferror(fp)) eprintf("%s: read error:", modfile); fclose(fp); - return 0; + return EXIT_SUCCESS; } static void diff --git a/lsusb.c b/lsusb.c @@ -21,7 +21,7 @@ main(int argc, char *argv[]) } ARGEND; recurse("/sys/bus/usb/devices", lsusb); - return 0; + return EXIT_SUCCESS; } static void diff --git a/mkswap.c b/mkswap.c @@ -59,7 +59,7 @@ main(int argc, char *argv[]) pages = sb.st_size / pagesize; if (pages < SWAP_MIN_PAGES) - enprintf(1, "swap space needs to be at least %ldKiB\n", + enprintf(EXIT_FAILURE, "swap space needs to be at least %ldKiB\n", SWAP_MIN_PAGES * pagesize / 1024); /* Fill up the swap header */ @@ -73,11 +73,11 @@ main(int argc, char *argv[]) /* Write out the signature page */ if (write(fd, buf, pagesize) != pagesize) - enprintf(1, "unable to write signature page\n"); + enprintf(EXIT_FAILURE, "unable to write signature page\n"); fsync(fd); close(fd); free(buf); - return 0; + return EXIT_SUCCESS; } diff --git a/mount.c b/mount.c @@ -119,7 +119,7 @@ main(int argc, char *argv[]) break; } if (oflag && !validopt) - enprintf(1, "unknown option: %s\n", opt->name); + enprintf(EXIT_FAILURE, "unknown option: %s\n", opt->name); source = argv[0]; target = argv[1]; @@ -142,7 +142,7 @@ main(int argc, char *argv[]) } } if (!source) - enprintf(1, "can't find %s mountpoint\n", + enprintf(EXIT_FAILURE, "can't find %s mountpoint\n", target); } @@ -159,5 +159,5 @@ main(int argc, char *argv[]) opt = tmp; } - return 0; + return EXIT_SUCCESS; } diff --git a/mountpoint.c b/mountpoint.c @@ -50,7 +50,7 @@ main(int argc, char *argv[]) argv[0]); printf("%u:%u\n", major(st1.st_rdev), minor(st1.st_rdev)); - return 0; + return EXIT_SUCCESS; } if (!S_ISDIR(st1.st_mode)) @@ -59,7 +59,7 @@ main(int argc, char *argv[]) if (dflag) { printf("%u:%u\n", major(st1.st_dev), minor(st1.st_dev)); - return 0; + return EXIT_SUCCESS; } siz = grabmntinfo(&minfo); diff --git a/pidof.c b/pidof.c @@ -109,5 +109,5 @@ out: onode = tmp; } - return 0; + return EXIT_SUCCESS; } diff --git a/pivot_root.c b/pivot_root.c @@ -2,6 +2,7 @@ #include <sys/syscall.h> #include <unistd.h> #include <stdio.h> +#include <stdlib.h> #include "util.h" static void @@ -24,5 +25,5 @@ main(int argc, char *argv[]) if (syscall(SYS_pivot_root, argv[0], argv[1]) < 0) eprintf("pivot_root:"); - return 0; + return EXIT_SUCCESS; } diff --git a/ps.c b/ps.c @@ -53,7 +53,7 @@ main(int argc, char *argv[]) else printf("UID PID PPID C STIME TTY TIME CMD\n"); recurse("/proc", psr); - return 0; + return EXIT_SUCCESS; } static void diff --git a/rmmod.c b/rmmod.c @@ -3,6 +3,7 @@ #include <unistd.h> #include <fcntl.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <libgen.h> #include "util.h" @@ -43,5 +44,5 @@ main(int argc, char *argv[]) eprintf("delete_module:"); } - return 0; + return EXIT_SUCCESS; } diff --git a/swapoff.c b/swapoff.c @@ -2,6 +2,7 @@ #include <sys/swap.h> #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include "util.h" @@ -15,7 +16,7 @@ int main(int argc, char *argv[]) { int i; - int ret = 0; + int ret = EXIT_SUCCESS; ARGBEGIN { default: @@ -30,7 +31,7 @@ main(int argc, char *argv[]) if (ret < 0) { fprintf(stderr, "swapoff %s: %s\n", argv[i], strerror(errno)); - ret = 1; + ret = EXIT_FAILURE; } } return ret; diff --git a/swapon.c b/swapon.c @@ -2,6 +2,7 @@ #include <sys/swap.h> #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include "util.h" @@ -15,7 +16,7 @@ int main(int argc, char *argv[]) { int i; - int ret = 0; + int ret = EXIT_SUCCESS; int flags = 0; ARGBEGIN { @@ -34,7 +35,7 @@ main(int argc, char *argv[]) if (ret < 0) { fprintf(stderr, "swapon %s: %s\n", argv[i], strerror(errno)); - ret = 1; + ret = EXIT_FAILURE; } } return ret; diff --git a/truncate.c b/truncate.c @@ -42,5 +42,5 @@ main(int argc, char *argv[]) eprintf("ftruncate: %s:", argv[i]); close(fd); } - return 0; + return EXIT_SUCCESS; } diff --git a/umount.c b/umount.c @@ -1,6 +1,7 @@ /* See LICENSE file for copyright and license details. */ #include <sys/mount.h> #include <stdio.h> +#include <stdlib.h> #include "util.h" static void @@ -14,7 +15,7 @@ main(int argc, char *argv[]) { int i; int flags = 0; - int ret = 0; + int ret = EXIT_SUCCESS; ARGBEGIN { case 'f': @@ -35,7 +36,7 @@ main(int argc, char *argv[]) for (i = 0; i < argc; i++) { if (umount2(argv[i], flags) < 0) eprintf("umount2:"); - ret = 1; + ret = EXIT_FAILURE; } return ret; } diff --git a/unshare.c b/unshare.c @@ -3,6 +3,7 @@ #include <errno.h> #include <unistd.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include "util.h" @@ -49,5 +50,5 @@ main(int argc, char *argv[]) if (execvp(argv[0], argv) < 0) eprintf("execvp:"); - return 0; + return EXIT_SUCCESS; } diff --git a/uptime.c b/uptime.c @@ -64,5 +64,5 @@ main(int argc, char *argv[]) info.loads[1] / 65536.0f, info.loads[2] / 65536.0f); - return 0; + return EXIT_SUCCESS; } diff --git a/watch.c b/watch.c @@ -43,5 +43,5 @@ main(int argc, char *argv[]) system(cmd); sleep(interval); } - return 0; + return EXIT_SUCCESS; }