From d85acdda0e24c4703d3ee6c1f2ebcd820fb89ae1 Mon Sep 17 00:00:00 2001 From: gdr Date: Sun, 27 Jul 1997 23:58:57 +0000 Subject: [PATCH] added a test for running scripts directly --- lib/libc/tests/sys/script.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/libc/tests/sys/script.c diff --git a/lib/libc/tests/sys/script.c b/lib/libc/tests/sys/script.c new file mode 100644 index 0000000..bfb4b45 --- /dev/null +++ b/lib/libc/tests/sys/script.c @@ -0,0 +1,32 @@ +/* + * This test tries to execute a shell script directly (via execv(2)). + * This *should* work. Under GNO v2.0.4 it doesn't. + * + * Devin Reade, 1997 + * + * $Id: script.c,v 1.1 1997/07/27 23:58:57 gdr Exp $ + */ + +#include +#include +#include +#include +#include + +int +main (int argc, char **argv) { + + char *array[2]; + + if (argc != 2) { + printf("usage: %s /fully/qualified/script/name\n", argv[0]); + return 1; + } + + array[0] = argv[1]; + array[1] = NULL; + + execv(argv[1], array); + printf("exec of %s failed: %s\n", argv[1], strerror(errno)); + return 1; +}