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

From: <git_AT_suckless.org>
Date: Tue, 24 Mar 2015 23:53:36 +0100 (CET)

commit 8798b8a867821755a48850bb8dbf7bcbe1e31631
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 Tue Mar 24 2015 - 23:53:36 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 25 2015 - 00:08:19 CET