summaryrefslogtreecommitdiff
path: root/source/d/slacktrack/slacktrack-project/ln-wrapper.c
blob: 225c757678df9e1fb394f03e4114121da96d8dde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
}