summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}