summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-01-14 16:31:21 -0500
committerJakob Kaivo <jkk@ung.org>2020-01-14 16:31:21 -0500
commitbf65292b5bb29f3cbea114e3c03e058fe8f14f85 (patch)
tree6a33347e05cb2d49d08b3ec755b30ad80a0bc52a
parentb533431c665381fe178dc8c339c3ef72d9d087c9 (diff)
default to exec()ing make when finished
-rw-r--r--maje.c16
1 files 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);
}