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