Honour the -n for -bP config
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Thu, 10 Mar 2016 22:48:48 +0000 (23:48 +0100)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Thu, 10 Mar 2016 23:19:56 +0000 (00:19 +0100)
src/src/exim.c
src/src/functions.h
src/src/readconf.c
test/scripts/0000-Basic/0572
test/stdout/0572

index 3b6a9ba69ec4628d1a25be78e9f6baf2e027c85a..9cafc9a73110ac549c39a0aeee617a2650bfca62 100644 (file)
@@ -4572,7 +4572,7 @@ if (list_options)
 if (list_config)
   {
   set_process_info("listing config");
-  readconf_print(US"config", NULL, FALSE);
+  readconf_print(US"config", NULL, flag_n);
   exim_exit(EXIT_SUCCESS);
   }
 
index 53ed643453c109dcf43ee136841b469f6010fe9e..a5278a620f34fc9d0828f13ed73e1e21297e8bea 100644 (file)
@@ -313,7 +313,7 @@ extern void    readconf_driver_init(uschar *, driver_instance **,
                  driver_info *, int, void *, int, optionlist *, int);
 extern uschar *readconf_find_option(void *);
 extern void    readconf_main(void);
-extern void    readconf_print(uschar *, uschar *, BOOL);
+extern void    readconf_print(uschar *, uschar *, BOOL no_labels);
 extern uschar *readconf_printtime(int);
 extern uschar *readconf_readname(uschar *, int, uschar *);
 extern int     readconf_readtime(const uschar *, int, BOOL);
index d0b8e0bcf87b7737e4a148eb0886550ca45cc542..328d4955841d6515919a332d7987b0c5725f604b 100644 (file)
@@ -16,7 +16,7 @@ extern char **environ;
 static void fn_smtp_receive_timeout(const uschar * name, const uschar * str);
 static void save_config_line(const uschar* line);
 static void save_config_position(const uschar *file, int line);
-static void print_config(BOOL admin);
+static void print_config(BOOL admin, BOOL terse);
 
 
 #define CSTATE_STACK_SIZE 10
@@ -2649,7 +2649,7 @@ if (type == NULL)
 
   if (Ustrcmp(name, "config") == 0)
     {
-    print_config(admin_user);
+    print_config(admin_user, no_labels);
     return;
     }
 
@@ -4303,10 +4303,10 @@ current = next;
 /* List the parsed config lines, care about nice formatting and
 hide the <hide> values unless we're the admin user */
 void
-print_config(BOOL admin)
+print_config(BOOL admin, BOOL terse)
 {
 config_line_item *i;
-const int TS = 2;
+const int TS = terse ? 0 : 2;
 int indent = 0;
 
 for (i = config_lines; i; i = i->next)
@@ -4346,7 +4346,7 @@ for (i = config_lines; i; i = i->next)
   /* begin lines are left aligned */
   else if (Ustrncmp(current, "begin", 5) == 0 && isspace(current[5]))
     {
-    puts("");
+    if (!terse) puts("");
     puts(CCS current);
     indent = TS;
     }
@@ -4354,7 +4354,8 @@ for (i = config_lines; i; i = i->next)
   /* router/acl/transport block names */
   else if (current[Ustrlen(current)-1] == ':' && !Ustrchr(current, '='))
     {
-    printf("\n%*s%s\n", TS, "", current);
+    if (!terse) puts("");
+    printf("%*s%s\n", TS, "", current);
     indent = 2 * TS;
     }
 
index ae31ea027cee329093b7d14011740b2d2c4f0507..2866a23f16464e69d158395e65db2bc7ebfbdd67 100644 (file)
@@ -26,3 +26,6 @@ perl -e 'print "\n";'
 #
 exim -bP config
 ****
+#
+exim -n -bP config
+****
index 3a026977c039a42552aad7ab076f30c16994da99..0c8d6e9b765c3c8a1a4ed653f75a972ab7bbc5b3 100644 (file)
@@ -101,3 +101,31 @@ begin transports
     interface = ip4.ip4.ip4.ip4
     port = 1224
     debug_print = transport_name <$transport_name>
+# Exim Configuration (X)
+# 1 "TESTSUITE/test-config"
+OPT =
+exim_path = TESTSUITE/eximdir/exim
+keep_environment =
+hide host_lookup_order = bydns
+primary_hostname = myhost.test.ex
+spool_directory = TESTSUITE/spool
+log_file_path = TESTSUITE/spool/log/%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+log_selector = +outgoing_port
+domainlist local_domains = test.ex : *.test.ex
+acl_smtp_rcpt = accept
+begin routers
+my_main_router:
+driver = manualroute
+route_list = * 127.0.0.1
+self = send
+transport = my_smtp
+hide debug_print = router_name <$router_name>
+no_more
+begin transports
+my_smtp:
+driver = smtp
+interface = ip4.ip4.ip4.ip4
+port = 1224
+debug_print = transport_name <$transport_name>