commit 8798b8a867821755a48850bb8dbf7bcbe1e31631
parent 3e7c5498622e0b5e961b097b090adb9f08a43421
Author: FRIGN <dev@frign.de>
Date: Sun, 8 Feb 2015 22:13:50 +0100
Add arg.h-handling to sync(1) and unlink(1)
Diffstat:
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/sync.c b/sync.c
@@ -12,7 +12,12 @@ usage(void)
int
main(int argc, char *argv[])
{
- if (argc != 1)
+ ARGBEGIN {
+ default:
+ usage();
+ } ARGEND;
+
+ if (argc)
usage();
sync();
diff --git a/unlink.c b/unlink.c
@@ -12,11 +12,16 @@ usage(void)
int
main(int argc, char *argv[])
{
- if (argc != 2)
+ ARGBEGIN {
+ default:
usage();
+ } ARGEND;
- if (unlink(argv[1]) < 0)
- eprintf("unlink: '%s':", argv[1]);
+ if (argc != 1)
+ usage();
+
+ if (unlink(argv[0]) < 0)
+ eprintf("unlink: '%s':", argv[0]);
return 0;
}