From 48bfee4e5b72db021da3538c97ef68ce2308f12b Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 4 Jan 2005 22:30:15 +0000 Subject: in with the new --- src/lib9/execl.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/lib9/execl.c (limited to 'src/lib9/execl.c') diff --git a/src/lib9/execl.c b/src/lib9/execl.c new file mode 100644 index 00000000..988d2072 --- /dev/null +++ b/src/lib9/execl.c @@ -0,0 +1,29 @@ +#include +#include + +int +execl(char *prog, ...) +{ + int i; + va_list arg; + char **argv; + + va_start(arg, prog); + for(i=0; va_arg(arg, char*) != nil; i++) + ; + va_end(arg); + + argv = malloc((i+1)*sizeof(char*)); + if(argv == nil) + return -1; + + va_start(arg, prog); + for(i=0; (argv[i] = va_arg(arg, char*)) != nil; i++) + ; + va_end(arg); + + exec(prog, argv); + free(argv); + return -1; +} + -- cgit v1.2.3