diff options
author | Remi Collet <fedora@famillecollet.com> | 2013-02-13 10:10:07 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2013-02-13 10:10:07 +0100 |
commit | e68a21750a6e17015341329e50f12726177358d0 (patch) | |
tree | 5887108896073d631c36ffc400a1db5eeaef2f19 /scriptstub.c | |
parent | 2f57d8a449a2177cdb6098e738dbb595ad41cb70 (diff) |
mysql 5.6, first work
Diffstat (limited to 'scriptstub.c')
-rw-r--r-- | scriptstub.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scriptstub.c b/scriptstub.c new file mode 100644 index 0000000..de942c1 --- /dev/null +++ b/scriptstub.c @@ -0,0 +1,32 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +/* Translate call of myself into call of same-named script in LIBDIR */ +/* The macro LIBDIR must be defined as a double-quoted string */ + +int main (int argc, char **argv) +{ + char *basename; + char *fullname; + char **newargs; + int i; + + basename = strrchr(argv[0], '/'); + if (basename) + basename++; + else + basename = argv[0]; + fullname = malloc(strlen(LIBDIR) + strlen(basename) + 2); + sprintf(fullname, "%s/%s", LIBDIR, basename); + newargs = malloc((argc+1) * sizeof(char *)); + newargs[0] = fullname; + for (i = 1; i < argc; i++) + newargs[i] = argv[i]; + newargs[argc] = NULL; + + execvp(fullname, newargs); + + return 1; +} |