X-Git-Url: https://git.toastfreeware.priv.at/gregoa/bti.git/blobdiff_plain/6fe2642650486b6ca6c2a6eadbd50246fbdd2edd..a03d5f2cf2ae11fa03f642547bcd3c169e6c9dda:/bti.c diff --git a/bti.c b/bti.c index 873e4f4..4bf6a6c 100644 --- a/bti.c +++ b/bti.c @@ -117,6 +117,7 @@ static void display_help(void) fprintf(stdout, " --proxy PROXY:PORT\n"); fprintf(stdout, " --host HOST\n"); fprintf(stdout, " --logfile logfile\n"); + fprintf(stdout, " --config configfile\n"); fprintf(stdout, " --shrink-urls\n"); fprintf(stdout, " --page PAGENUMBER\n"); fprintf(stdout, " --bash\n"); @@ -1059,6 +1060,7 @@ int main(int argc, char *argv[], char *envp[]) { "dry-run", 0, NULL, 'n' }, { "page", 1, NULL, 'g' }, { "version", 0, NULL, 'v' }, + { "config", 1, NULL, 'c' }, { } }; struct session *session; @@ -1107,7 +1109,7 @@ int main(int argc, char *argv[], char *envp[]) parse_configfile(session); while (1) { - option = getopt_long_only(argc, argv, "dp:P:H:a:A:u:hg:G:snVv", + option = getopt_long_only(argc, argv, "dp:P:H:a:A:u:c:hg:G:snVv", options, NULL); if (option == -1) break; @@ -1203,6 +1205,18 @@ int main(int argc, char *argv[], char *envp[]) case 'b': session->bash = 1; break; + case 'c': + if (session->configfile) + free(session->configfile); + session->configfile = strdup(optarg); + dbg("configfile = %s\n", session->configfile); + + /* + * read the config file now. Yes, this could override previously + * set options from the command line, but the user asked for it... + */ + parse_configfile(session); + break; case 'h': display_help(); goto exit;