From bf65292b5bb29f3cbea114e3c03e058fe8f14f85 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 14 Jan 2020 16:31:21 -0500 Subject: default to exec()ing make when finished --- maje.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/maje.c b/maje.c index 9ba22c2..99f3f04 100644 --- a/maje.c +++ b/maje.c @@ -8,16 +8,21 @@ static void usage(char *progname) { - printf("usage: %s [dir]\n", progname); + printf("usage: %s [-n] [dir]\n", progname); } int main(int argc, char *argv[]) { + int noexec = 0; char *srcdir = NULL; int c; - while ((c = getopt(argc, argv, "")) != -1) { + while ((c = getopt(argc, argv, "n")) != -1) { switch (c) { + case 'n': + noexec = 1; + break; + default: usage(argv[0]); return 1; @@ -53,5 +58,10 @@ int main(int argc, char *argv[]) make_makefile("Makefile", sources, target); - return 0; + if (noexec) { + return 0; + } + + char *args[] = { "make", NULL }; + execvp(args[0], args); } -- cgit v1.2.1