aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make/main.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2017-03-01 23:10:54 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2017-03-01 23:11:53 +0100
commit6125e8a367a77684aa245e898f80dac3009a301a (patch)
treedf34817da345ca25441b188403ab9a0ce595a69f /src/blogc-make/main.c
parenta2e4641865f5b1478c4243767abd208772a303b3 (diff)
downloadblogc-6125e8a367a77684aa245e898f80dac3009a301a.tar.gz
blogc-6125e8a367a77684aa245e898f80dac3009a301a.tar.bz2
blogc-6125e8a367a77684aa245e898f80dac3009a301a.zip
make: implement binary lookup in a more portable way
Diffstat (limited to 'src/blogc-make/main.c')
-rw-r--r--src/blogc-make/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/blogc-make/main.c b/src/blogc-make/main.c
index 05b3205..e5a5ac4 100644
--- a/src/blogc-make/main.c
+++ b/src/blogc-make/main.c
@@ -19,6 +19,10 @@
#include "ctx.h"
#include "rules.h"
+// is this beautiful? no. but there's no point in passing something that is
+// essentially global to every function in exec.c
+const char *argv0 = NULL;
+
static void
print_help(void)
@@ -57,6 +61,11 @@ main(int argc, char **argv)
{
setlocale(LC_ALL, "");
+ // i really hope that no operating system omits argv[0], but ...
+ if (argc > 0) {
+ argv0 = argv[0];
+ }
+
int rv = 0;
bc_error_t *err = NULL;