summaryrefslogtreecommitdiffstats
path: root/source/d/slacktrack/slacktrack-project/ln-wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/d/slacktrack/slacktrack-project/ln-wrapper.c')
-rw-r--r--source/d/slacktrack/slacktrack-project/ln-wrapper.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/d/slacktrack/slacktrack-project/ln-wrapper.c b/source/d/slacktrack/slacktrack-project/ln-wrapper.c
new file mode 100644
index 000000000..225c75767
--- /dev/null
+++ b/source/d/slacktrack/slacktrack-project/ln-wrapper.c
@@ -0,0 +1,19 @@
+// ln-wrapper.c by Jim Hawkins <jawkins@armedslack.org>
+// Call /bin/ln with the -f operator.
+// This file lives in /usr/libexec/slacktrack & is called by having this
+// directory as the first dir in your $PATH
+//
+
+#include <string.h>
+#include <unistd.h>
+
+#define LN_PATH "/bin/ln"
+
+int main(int argc, char *argv[])
+{
+ char *argv2[argc + 2];
+ memcpy(&argv2[2], &argv[1], sizeof(*argv) * argc);
+ argv2[0] = LN_PATH;
+ argv2[1] = "-f";
+ return execv(LN_PATH, argv2);
+}