[hackers] [sbase] Add arg.h-handling to sync(1) and unlink(1) || FRIGN

From: <git_AT_suckless.org>
Date: Sun, 8 Feb 2015 22:22:47 +0100 (CET)

commit 27ab2710faaecc110bd3834fcf45e9c5f29b17af
Author: FRIGN <dev_AT_frign.de>
Date: Sun Feb 8 22:13:50 2015 +0100

    Add arg.h-handling to sync(1) and unlink(1)

diff --git a/sync.c b/sync.c
index b3a3cb1..a766fbc 100644
--- a/sync.c
+++ b/sync.c
_AT_@ -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
index f2a1fff..077959c 100644
--- a/unlink.c
+++ b/unlink.c
_AT_@ -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;
 }
Received on Sun Feb 08 2015 - 22:22:47 CET

This archive was generated by hypermail 2.3.0 : Sun Feb 08 2015 - 22:24:11 CET