exit with EXIT_SUCCESS/EXIT_FAILURE

This commit is contained in:
s-p-k 2013-10-07 21:11:40 +03:00 committed by sin
parent 64744bd6f1
commit e340e1373e
25 changed files with 42 additions and 33 deletions

2
chvt.c
View File

@ -53,5 +53,5 @@ VTfound:
eprintf("chvt: VT_WAITACTIVE '%d':", n);
close(fd);
return 0;
return EXIT_SUCCESS;
}

View File

@ -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;
}

2
df.c
View File

@ -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

View File

@ -76,7 +76,7 @@ main(int argc, char *argv[])
eprintf("klogctl:");
free(buf);
return 0;
return EXIT_SUCCESS;
}
static int

View File

@ -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;
}

View File

@ -40,5 +40,5 @@ main(int argc, char *argv[])
eprintf("posix_fallocate:");
close(fd);
return 0;
return EXIT_SUCCESS;
}

2
free.c
View File

@ -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;
}

3
halt.c
View File

@ -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;
}

View File

@ -66,5 +66,5 @@ main(int argc, char *argv[])
free(opts);
free(buf);
return 0;
return EXIT_SUCCESS;
}

View File

@ -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

View File

@ -21,7 +21,7 @@ main(int argc, char *argv[])
} ARGEND;
recurse("/sys/bus/usb/devices", lsusb);
return 0;
return EXIT_SUCCESS;
}
static void

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -109,5 +109,5 @@ out:
onode = tmp;
}
return 0;
return EXIT_SUCCESS;
}

View File

@ -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;
}

2
ps.c
View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -42,5 +42,5 @@ main(int argc, char *argv[])
eprintf("ftruncate: %s:", argv[i]);
close(fd);
}
return 0;
return EXIT_SUCCESS;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -64,5 +64,5 @@ main(int argc, char *argv[])
info.loads[1] / 65536.0f,
info.loads[2] / 65536.0f);
return 0;
return EXIT_SUCCESS;
}

View File

@ -43,5 +43,5 @@ main(int argc, char *argv[])
system(cmd);
sleep(interval);
}
return 0;
return EXIT_SUCCESS;
}