[hackers] [sbase] Audit link(1) || FRIGN

From: <git_AT_suckless.org>
Date: Sat, 28 Feb 2015 20:40:39 +0100 (CET)

commit de564af9ef55c6da4efc8c737c4da90cc7fd80c7
Author: FRIGN <dev_AT_frign.de>
Date: Sat Feb 28 19:42:26 2015 +0100

    Audit link(1)

diff --git a/README b/README
index b4b2d96..4e14de8 100644
--- a/README
+++ b/README
_AT_@ -37,7 +37,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
 =* head yes none
 =* hostname non-posix none
 =* kill yes none
-=* link yes none
+=*| link yes none
 =* ln yes none
 =* logger yes none
 =* logname yes none
diff --git a/link.c b/link.c
index f84e4b5..5ef8e11 100644
--- a/link.c
+++ b/link.c
_AT_@ -3,14 +3,24 @@
 
 #include "util.h"
 
+static void
+usage(void)
+{
+ eprintf("usage: %s target name\n", argv0);
+}
+
 int
 main(int argc, char *argv[])
 {
- argv0 = argv[0];
+ ARGBEGIN {
+ default:
+ usage();
+ } ARGEND;
 
- if (argc != 3)
- eprintf("usage: %s target name\n", argv0);
- if (link(argv[1], argv[2]) < 0)
+ if (argc != 2)
+ usage();
+ if (link(argv[0], argv[1]) < 0)
                 eprintf("link:");
+
         return 0;
 }
Received on Sat Feb 28 2015 - 20:40:39 CET

This archive was generated by hypermail 2.3.0 : Sat Feb 28 2015 - 20:48:10 CET