1 /* $Id: innconfval.c 5962 2002-12-08 19:52:13Z rra $
3 ** Get a config value from INN.
9 #include "inn/innconf.h"
10 #include "inn/messages.h"
14 ** Print the INN version string with appropriate quoting.
17 print_version(FILE *file, enum innconf_quoting quoting)
20 case INNCONF_QUOTE_NONE:
21 fprintf(file, "%s\n", inn_version_string);
23 case INNCONF_QUOTE_SHELL:
24 fprintf(file, "VERSION='%s'; export VERSION\n", inn_version_string);
26 case INNCONF_QUOTE_PERL:
27 fprintf(file, "$version = '%s';\n", inn_version_string);
29 case INNCONF_QUOTE_TCL:
30 fprintf(file, "set inn_version \"%s\"\n", inn_version_string);
37 ** Main routine. Most of the real work is done by the innconf library
41 main(int argc, char *argv[])
45 enum innconf_quoting quoting = INNCONF_QUOTE_NONE;
48 bool checking = false;
50 message_program_name = "innconfval";
52 while ((option = getopt(argc, argv, "Ci:pstv")) != EOF)
64 quoting = INNCONF_QUOTE_PERL;
67 quoting = INNCONF_QUOTE_SHELL;
70 quoting = INNCONF_QUOTE_TCL;
80 print_version(stdout, quoting);
84 exit(innconf_check(file) ? 0 : 1);
86 /* Read in the inn.conf file specified. */
87 if (!innconf_read(file))
90 /* Perform the specified action. */
91 if (argv[0] == NULL) {
92 innconf_dump(stdout, quoting);
93 print_version(stdout, quoting);
95 for (i = 0; i < argc; i++)
96 if (strcmp(argv[i], "version") == 0)
97 print_version(stdout, quoting);
98 else if (!innconf_print_value(stdout, argv[i], quoting))