this repo has no description
1#include <stdio.h>
2#include <string.h>
3#include <stdlib.h>
4#include <unistd.h>
5
6int main(int argc, char** argv)
7{
8#if DEBUG
9 printf("Invoked with:");
10 for (int i = 0; i < argc; i++)
11 {
12 printf(" %s", argv[i]);
13 }
14 printf("\n");
15#endif
16 const int prefixLength = strlen(argv[0])-strlen("xcrun");
17 char *toolPath = calloc(prefixLength+strlen(argv[1]), sizeof(char));
18 strncpy(toolPath, argv[0], prefixLength);
19 strcpy(toolPath+prefixLength, argv[1]);
20
21#if DEBUG
22 printf("Executing %s\n", toolPath);
23#endif
24
25 argv++;
26 argv[0] = toolPath;
27
28 execvp(argv[0], argv);
29
30 printf("Failed to execute program %s\n", argv[0]);
31
32 return 1;
33}