aboutsummaryrefslogtreecommitdiff
path: root/src/pies.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-10-12 23:41:21 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-10-12 23:42:04 +0300
commit8a4ba77068e5d7f6eab2cc1c1c10f31dcbccf7a6 (patch)
treec70f38d943c778684bb9dbfc7db018e7efb21bf1 /src/pies.c
parentaf04ed630f18e9003756317cc627a11084d0d59a (diff)
downloadpies-8a4ba77068e5d7f6eab2cc1c1c10f31dcbccf7a6.tar.gz
pies-8a4ba77068e5d7f6eab2cc1c1c10f31dcbccf7a6.tar.bz2
Fix make distcheck and check-docs.
* doc/Makefile.am: Fix `check-*' goals. * doc/pies.texi: Update and rearrange material. Document new configuration. * lib/Makefile.am (libpies_a_SOURCES): Remove nls.c * src/Makefile.am (EXTRA_DIST): Remove pies.rc, add pp-setup. (INCLUDES): Add $(top_builddir)/gnu * src/pies.c: Minor changes. * src/progman.c: Minor changes. * README-hacking: New file.
Diffstat (limited to 'src/pies.c')
-rw-r--r--src/pies.c68
1 files changed, 50 insertions, 18 deletions
diff --git a/src/pies.c b/src/pies.c
index f36c21f..87ddad3 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -15,6 +15,8 @@
along with Pies. If not, see <http://www.gnu.org/licenses/>. */
#include "pies.h"
+#include <locale.h>
+#include <configmake.h>
#include "meta1lex.h"
char *conffile = SYSCONFDIR "/pies.conf";
@@ -106,7 +108,7 @@ _cb_action (enum grecs_callback_command cmd,
return 0;
}
-struct grecs_keyword return_code_cfg_param[] = {
+struct grecs_keyword return_code_keywords[] = {
{"action",
/* TRANSLATORS: disable and restart are keywords, do not translate them. */
N_("arg: {disable | restart}"),
@@ -718,7 +720,7 @@ _cb_limits (enum grecs_callback_command cmd,
return 0;
}
-struct grecs_keyword component_cfg_param[] = {
+struct grecs_keyword component_keywords[] = {
{"mode",
/* TRANSLATORS: The words between '{' and '}' are keywords, do not
translate them. */
@@ -868,7 +870,7 @@ struct grecs_keyword component_cfg_param[] = {
N_("<tag: exit-code-list>"),
NULL, /* FIXME: Docstring? */
grecs_type_section, NULL, 0,
- return_code_section_parser, NULL, return_code_cfg_param},
+ return_code_section_parser, NULL, return_code_keywords},
{NULL}
};
@@ -877,7 +879,7 @@ find_component_keyword (const char *ident)
{
struct grecs_keyword *kwp;
- for (kwp = component_cfg_param; kwp->ident; kwp++)
+ for (kwp = component_keywords; kwp->ident; kwp++)
if (strcmp (kwp->ident, ident) == 0)
return kwp;
return NULL;
@@ -1028,6 +1030,10 @@ component_section_parser (enum grecs_callback_command cmd,
case grecs_callback_section_end:
comp = *(struct component **) section_data;
component_finish (comp, locus);
+ break;
+
+ case grecs_callback_set_value:
+ grecs_error (locus, 0, _("expected block statement"));
}
return 0;
}
@@ -1064,13 +1070,13 @@ _cm_include_meta1 (enum grecs_callback_command cmd,
return 0;
}
-struct grecs_keyword pies_cfg_param[] = {
+struct grecs_keyword pies_keywords[] = {
/* FIXME */
{"component",
N_("<tag: string>"),
NULL, /* FIXME: Docstring */
grecs_type_section, NULL, 0,
- component_section_parser, NULL, component_cfg_param},
+ component_section_parser, NULL, component_keywords},
{"syslog",
NULL,
N_("Configure syslog logging"),
@@ -1140,7 +1146,7 @@ struct grecs_keyword pies_cfg_param[] = {
N_("<tag: exit-code-list>"),
NULL, /* FIXME: Docstring? */
grecs_type_section, &default_component, 0,
- return_code_section_parser, NULL, return_code_cfg_param},
+ return_code_section_parser, NULL, return_code_keywords},
{"acl",
N_("name: string"),
N_("Define ACL."),
@@ -1164,7 +1170,7 @@ struct grecs_keyword pies_cfg_param[] = {
void
config_init ()
{
- grecs_set_keywords (pies_cfg_param);
+ grecs_set_keywords (pies_keywords);
grecs_include_path_setup (DEFAULT_VERSION_INCLUDE_DIR,
DEFAULT_INCLUDE_DIR, NULL);
grecs_preprocessor = DEFAULT_PREPROCESSOR;
@@ -1178,19 +1184,18 @@ config_help ()
N_("Configuration file structure for pies.\n"
"For more information, use `info pies configuration'.");
grecs_format_docstring (stdout, docstring, 0);
- grecs_format_statement_array (stdout, pies_cfg_param, 1, 0);
+ grecs_format_statement_array (stdout, pies_keywords, 1, 0);
}
const char *program_version = "pies (" PACKAGE_STRING ")";
-const char *package_bugreport = "<" PACKAGE_BUGREPORT ">";
+const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
static char doc[] = N_("pies -- process invocation and execution supervisor");
static char args_doc[] = "";
enum
{
OPT_FOREGROUND = 256,
- OPT_LOG_TAG,
OPT_SYSLOG,
OPT_STDERR,
OPT_DUMP_PREREQ,
@@ -1210,8 +1215,6 @@ static struct argp_option options[] = {
{"foreground", OPT_FOREGROUND, 0, 0, N_("remain in foreground"), GRP + 1},
{"stderr", OPT_STDERR, NULL, 0, N_("log to stderr"),},
{"syslog", OPT_SYSLOG, NULL, 0, N_("log to syslog"),},
- {"log-tag", OPT_LOG_TAG, N_("STRING"), 0,
- N_("set the identifier used in syslog messages to STRING"), GRP + 1},
{"debug", 'x', N_("LEVEL"), 0,
N_("set debug verbosity level"), GRP + 1},
{"source-info", OPT_SOURCE_INFO, NULL, 0,
@@ -1304,10 +1307,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
force_option = 1;
break;
- case OPT_LOG_TAG:
- log_tag = arg;
- break;
-
case ARGP_KEY_INIT:
break;
@@ -1672,6 +1671,33 @@ remove_pidfile (char *name)
name, strerror (errno));
}
+const char version_etc_copyright[] =
+ /* Do *not* mark this string for translation. %s is a copyright
+ symbol suitable for this locale */
+ "Copyright %s 2009 Sergey Poznyakoff";
+
+
+static void
+version (FILE *stream, struct argp_state *state)
+{
+ fprintf (stream, "%s (%s) %s\n", "pies", PACKAGE, PACKAGE_VERSION);
+ /* TRANSLATORS: Translate "(C)" to the copyright symbol
+ (C-in-a-circle), if this symbol is available in the user's
+ locale. Otherwise, do not translate "(C)"; leave it as-is. */
+ fprintf (stream, version_etc_copyright, _("(C)"));
+
+ fputs (_("\
+\n\
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
+This is free software: you are free to change and redistribute it.\n\
+There is NO WARRANTY, to the extent permitted by law.\n\
+\n\
+"),
+ stream);
+
+ /* TRANSLATORS: %s denotes an author name. */
+ fprintf (stream, _("Written by %s.\n"), "Sergey Poznyakoff");
+}
int
main (int argc, char **argv)
@@ -1681,12 +1707,18 @@ main (int argc, char **argv)
extern char **environ;
set_program_name (argv[0]);
- mf_init_nls ();
+#ifdef ENABLE_NLS
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ bindtextdomain ("mailfromd", LOCALEDIR);
+ textdomain (PACKAGE);
+#endif
mf_proctitle_init (argc, argv, environ);
/* Set default logging */
log_setup (!stderr_closed_p ());
config_init ();
+ argp_program_version_hook = version;
if (argp_parse (&argp, argc, argv, 0, &index, NULL))
exit (EX_USAGE);

Return to:

Send suggestions and report system problems to the System administrator.