diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-02-24 23:15:28 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-02-24 23:15:28 +0100 |
commit | fb27e8ed5030e6b5aa8df33cc4d347eacaef76ba (patch) | |
tree | 35f634c605ae01c195408ffb4334da43b89f4c07 /src/blogc-make/exec.c | |
parent | 144f49bdee2dd7d29748d2c3d2e3c0e5cfbfa34d (diff) | |
download | blogc-fb27e8ed5030e6b5aa8df33cc4d347eacaef76ba.tar.gz blogc-fb27e8ed5030e6b5aa8df33cc4d347eacaef76ba.tar.bz2 blogc-fb27e8ed5030e6b5aa8df33cc4d347eacaef76ba.zip |
make: parse runserver arguments from cli, instead of env
this is some over-optimized parser, to celebrate #cloudbleed :D
Diffstat (limited to 'src/blogc-make/exec.c')
-rw-r--r-- | src/blogc-make/exec.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/blogc-make/exec.c b/src/blogc-make/exec.c index dafa6cb..bbba573 100644 --- a/src/blogc-make/exec.c +++ b/src/blogc-make/exec.c @@ -305,7 +305,8 @@ bm_exec_blogc(bm_settings_t *settings, bc_trie_t *variables, bool listing, int -bm_exec_blogc_runserver(const char *output_dir, bool verbose) +bm_exec_blogc_runserver(const char *output_dir, const char *host, + const char *port, const char *threads, bool verbose) { bc_string_t *cmd = bc_string_new(); @@ -320,23 +321,20 @@ bm_exec_blogc_runserver(const char *output_dir, bool verbose) bc_string_append(cmd, "blogc-runserver"); } - const char *runserver_host_tmp = getenv("RUNSERVER_HOST"); - if (runserver_host_tmp != NULL) { - char *tmp = bc_shell_quote(runserver_host_tmp); + if (host != NULL) { + char *tmp = bc_shell_quote(host); bc_string_append_printf(cmd, " -t %s", tmp); free(tmp); } - const char *runserver_port_tmp = getenv("RUNSERVER_PORT"); - if (runserver_port_tmp != NULL) { - char *tmp = bc_shell_quote(runserver_port_tmp); + if (port != NULL) { + char *tmp = bc_shell_quote(port); bc_string_append_printf(cmd, " -p %s", tmp); free(tmp); } - const char *runserver_threads_tmp = getenv("RUNSERVER_THREADS"); - if (runserver_threads_tmp != NULL) { - char *tmp = bc_shell_quote(runserver_threads_tmp); + if (threads != NULL) { + char *tmp = bc_shell_quote(threads); bc_string_append_printf(cmd, " -m %s", tmp); free(tmp); } |