[hackers] [sbase] Simplify ln(1) || sin
commit c6f59aadbdca1ced4eb8478d79d10cca35af3c03
Author: sin <sin_AT_2f30.org>
Date: Mon Feb 17 11:41:37 2014 +0000
Simplify ln(1)
diff --git a/ln.c b/ln.c
index 12be44e..c0bd8f3 100644
--- a/ln.c
+++ b/ln.c
_AT_@ -6,11 +6,6 @@
#include <unistd.h>
#include "util.h"
-static int ln(const char *, const char *);
-
-static bool sflag = false;
-static bool fflag = false;
-
static void
usage(void)
{
_AT_@ -20,6 +15,11 @@ usage(void)
int
main(int argc, char *argv[])
{
+ int (*flink)(const char *, const char *);
+ char *fname;
+ bool sflag = false;
+ bool fflag = false;
+
ARGBEGIN {
case 'f':
fflag = true;
_AT_@ -31,19 +31,14 @@ main(int argc, char *argv[])
usage();
} ARGEND;
- enmasse(argc, &argv[0], ln);
+ flink = sflag ? symlink : link;
+ fname = sflag ? "symlink" : "link";
+
+ if (fflag == true)
+ remove(argv[1]);
+ if (flink(argv[0], argv[1]) < 0)
+ eprintf("%s:", fname);
return EXIT_SUCCESS;
}
-int
-ln(const char *s1, const char *s2)
-{
- int (*flink)(const char *, const char *) = sflag ? symlink : link;
-
- if (fflag)
- remove(s2);
- if(flink(s1, s2) == 0)
- return 0;
- return -1;
-}
Received on Mon Feb 17 2014 - 12:44:24 CET
This archive was generated by hypermail 2.3.0
: Mon Feb 17 2014 - 12:48:20 CET