diff options
Diffstat (limited to 'plugins/check_smtp.c')
| -rw-r--r-- | plugins/check_smtp.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index f2c7f05c..cb92421c 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
| @@ -115,6 +115,10 @@ int main(int argc, char **argv) { | |||
| 115 | 115 | ||
| 116 | const check_smtp_config config = tmp_config.config; | 116 | const check_smtp_config config = tmp_config.config; |
| 117 | 117 | ||
| 118 | if (config.output_format_is_set) { | ||
| 119 | mp_set_format(config.output_format); | ||
| 120 | } | ||
| 121 | |||
| 118 | /* If localhostname not set on command line, use gethostname to set */ | 122 | /* If localhostname not set on command line, use gethostname to set */ |
| 119 | char *localhostname = config.localhostname; | 123 | char *localhostname = config.localhostname; |
| 120 | if (!localhostname) { | 124 | if (!localhostname) { |
| @@ -578,7 +582,8 @@ int main(int argc, char **argv) { | |||
| 578 | /* process command-line arguments */ | 582 | /* process command-line arguments */ |
| 579 | check_smtp_config_wrapper process_arguments(int argc, char **argv) { | 583 | check_smtp_config_wrapper process_arguments(int argc, char **argv) { |
| 580 | enum { | 584 | enum { |
| 581 | SNI_OPTION = CHAR_MAX + 1 | 585 | SNI_OPTION = CHAR_MAX + 1, |
| 586 | output_format_index, | ||
| 582 | }; | 587 | }; |
| 583 | 588 | ||
| 584 | int option = 0; | 589 | int option = 0; |
| @@ -608,6 +613,7 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) { | |||
| 608 | {"certificate", required_argument, 0, 'D'}, | 613 | {"certificate", required_argument, 0, 'D'}, |
| 609 | {"ignore-quit-failure", no_argument, 0, 'q'}, | 614 | {"ignore-quit-failure", no_argument, 0, 'q'}, |
| 610 | {"proxy", no_argument, 0, 'r'}, | 615 | {"proxy", no_argument, 0, 'r'}, |
| 616 | {"output-format", required_argument, 0, output_format_index}, | ||
| 611 | {0, 0, 0, 0}}; | 617 | {0, 0, 0, 0}}; |
| 612 | 618 | ||
| 613 | check_smtp_config_wrapper result = { | 619 | check_smtp_config_wrapper result = { |
| @@ -809,6 +815,18 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) { | |||
| 809 | exit(STATE_UNKNOWN); | 815 | exit(STATE_UNKNOWN); |
| 810 | case '?': /* help */ | 816 | case '?': /* help */ |
| 811 | usage5(); | 817 | usage5(); |
| 818 | case output_format_index: { | ||
| 819 | parsed_output_format parser = mp_parse_output_format(optarg); | ||
| 820 | if (!parser.parsing_success) { | ||
| 821 | // TODO List all available formats here, maybe add anothoer usage function | ||
| 822 | printf("Invalid output format: %s\n", optarg); | ||
| 823 | exit(STATE_UNKNOWN); | ||
| 824 | } | ||
| 825 | |||
| 826 | result.config.output_format_is_set = true; | ||
| 827 | result.config.output_format = parser.output_format; | ||
| 828 | break; | ||
| 829 | } | ||
| 812 | } | 830 | } |
| 813 | } | 831 | } |
| 814 | 832 | ||
| @@ -1015,6 +1033,8 @@ void print_help(void) { | |||
| 1015 | 1033 | ||
| 1016 | printf(UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | 1034 | printf(UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); |
| 1017 | 1035 | ||
| 1036 | printf(UT_OUTPUT_FORMAT); | ||
| 1037 | |||
| 1018 | printf(UT_VERBOSE); | 1038 | printf(UT_VERBOSE); |
| 1019 | 1039 | ||
| 1020 | printf("\n"); | 1040 | printf("\n"); |
