From 5e70f7f9054729612b998e4e55bd8827e89a9603 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 14 May 2017 22:12:52 +0200 Subject: runm3uatest: Avoid having to use a ~/.guile script Rather, we can specify the path in which the m3ua-testtool files are located using the '-d ...' command line argument of runm3uatest --- runm3uatest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'runm3uatest.c') diff --git a/runm3uatest.c b/runm3uatest.c index 8b7773e..863759a 100644 --- a/runm3uatest.c +++ b/runm3uatest.c @@ -71,10 +71,11 @@ main(int argc, char *argv[]) { unsigned int timeout; int status, c; char command[COMMAND_LENGTH]; + char *dir = getenv("HOME"); timeout = TIMEOUT; - while ((c = getopt(argc, argv, "t:")) != -1) { + while ((c = getopt(argc, argv, "t:d:")) != -1) { switch(c) { case 'h': print_usage(); @@ -83,6 +84,9 @@ main(int argc, char *argv[]) { case 't': timeout = (unsigned int)atoi(optarg); break; + case 'd': + dir = optarg; + break; default: print_usage(); return (1); @@ -90,7 +94,7 @@ main(int argc, char *argv[]) { } if (optind == argc - 1) { - snprintf(command, COMMAND_LENGTH, command_skel, getenv("HOME"), argv[optind]); + snprintf(command, COMMAND_LENGTH, command_skel, dir, argv[optind]); } else { print_usage(); return (1); @@ -98,9 +102,9 @@ main(int argc, char *argv[]) { if ((pid = fork()) == 0) { #if defined(__APPLE__) || defined(__FreeBSD__) - execlp("/usr/local/bin/guile", "guile", "-c", command, NULL); + execlp("/usr/local/bin/guile", "guile", "-L", dir, "-c", command, NULL); #else - execlp("/usr/bin/guile", "guile", "-c", command, NULL); + execlp("/usr/bin/guile", "guile", "-L", dir, "-c", command, NULL); #endif return (255); } -- cgit v1.2.3