diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-01-14 16:31:21 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-01-14 16:31:21 -0500 |
commit | bf65292b5bb29f3cbea114e3c03e058fe8f14f85 (patch) | |
tree | 6a33347e05cb2d49d08b3ec755b30ad80a0bc52a | |
parent | b533431c665381fe178dc8c339c3ef72d9d087c9 (diff) |
default to exec()ing make when finished
-rw-r--r-- | maje.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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); } |