From 4379433f23d663e4aa142089221f7ff2bc234e1b Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Fri, 12 Feb 2021 11:18:43 +0200 Subject: Fix preprocessor use and config file precedence in piesctl * NEWS: Document changes. * doc/pies.texi: Document changes. * src/cmdline.opt: Don't set preprocessor if DEFAULT_PREPROCESSOR is NULL. * src/piesctl-cl.opt: New options: --preprocessor, --no-preprocessor. * src/piesctl.c (parse_config): If either client.url or default_url is set in the program-specific config, use it and don't parse pies.conf. This is consistent with the documented behavior. (main): Initialize grecs_preprocessor. --- src/cmdline.opt | 3 ++- src/piesctl-cl.opt | 14 ++++++++++++++ src/piesctl.c | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cmdline.opt b/src/cmdline.opt index 95ede4c..83c8819 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt @@ -132,7 +132,8 @@ GROUP(Preprocessor) OPTION(preprocessor,,COMMAND, []) BEGIN - grecs_preprocessor = optarg; + if (DEFAULT_PREPROCESSOR) + grecs_preprocessor = optarg; END OPTION(no-preprocessor,,, diff --git a/src/piesctl-cl.opt b/src/piesctl-cl.opt index ea71d59..8a72703 100644 --- a/src/piesctl-cl.opt +++ b/src/piesctl-cl.opt @@ -77,6 +77,19 @@ END GROUP(Preprocessor) +OPTION(preprocessor,,COMMAND, + []) +BEGIN + if (DEFAULT_PREPROCESSOR) + grecs_preprocessor = optarg; +END + +OPTION(no-preprocessor,,, + []) +BEGIN + grecs_preprocessor = NULL; +END + OPTION(include-directory,I,DIR, []) BEGIN @@ -95,6 +108,7 @@ BEGIN pp_add_option ("-U", optarg); END + OPTIONS_END void diff --git a/src/piesctl.c b/src/piesctl.c index 44b3d0f..d88c441 100644 --- a/src/piesctl.c +++ b/src/piesctl.c @@ -168,7 +168,7 @@ parse_config (void) program_name, file_name); } - if (!client.url) + if (!client.url && !default_url) { /* Try local instance configuration */ file_name = mkfilename (SYSCONFDIR, instance, ".conf"); @@ -2322,6 +2322,7 @@ main (int argc, char **argv) textdomain (PACKAGE); #endif grecs_print_diag_fun = piesctl_diag; + grecs_preprocessor = DEFAULT_PREPROCESSOR; proginfo.print_help_hook = command_help; parse_options (argc, argv, &i); -- cgit v1.2.1