2021-10-04 22:35:09 +02:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
2021-11-09 02:55:26 +01:00
|
|
|
#include <assert.h>
|
2021-10-04 22:35:09 +02:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2022-05-11 23:03:35 +02:00
|
|
|
char **argv_tmp = calloc(4 + argc + 2 + 1, sizeof(*argv_tmp));
|
2021-11-09 02:55:26 +01:00
|
|
|
assert(argv_tmp != NULL);
|
2021-10-04 22:35:09 +02:00
|
|
|
argv_tmp[0] = argv[0];
|
|
|
|
argv_tmp[1] = "-x";
|
|
|
|
argv_tmp[2] = "-y";
|
|
|
|
argv_tmp[3] = "-z";
|
|
|
|
argv_tmp[4] = "-abc";
|
|
|
|
for (int i = 1; i < argc; ++i) {
|
|
|
|
argv_tmp[4 + i] = argv[i];
|
|
|
|
}
|
2022-05-11 23:03:35 +02:00
|
|
|
argv_tmp[4 + argc + 0] = "-foo";
|
|
|
|
argv_tmp[4 + argc + 1] = "-bar";
|
|
|
|
argv_tmp[4 + argc + 2] = NULL;
|
2021-10-04 22:35:09 +02:00
|
|
|
argv = argv_tmp;
|
|
|
|
|
|
|
|
argv[0] = "/send/me/flags";
|
|
|
|
return execv("/send/me/flags", argv);
|
2021-12-07 18:39:38 +01:00
|
|
|
}
|