summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-10 12:03:43 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-05-10 14:21:54 (GMT)
commit8b04169265fb9762b2c1dfca3f43068f5b8233be (patch) (side-by-side diff)
tree43049c1809b2b70b21ed9300ebdd286d18833c8b
parentbb242e454d5cf8b0c6bb1ca5d009ec18e86c0c2b (diff)
downloadwydawca-8b04169265fb9762b2c1dfca3f43068f5b8233be.tar.gz
wydawca-8b04169265fb9762b2c1dfca3f43068f5b8233be.tar.bz2
Update grecs.
* Makefile.am (ChangeLog): Use git2chg.awk. * bootstrap.conf (gnulib_modules): Don't access grecs/gnulib.modules. * configure.ac (GRECS_SETUP): Add options. * gnulib.modules (getopt,gitlog-to-changelog) (hash,error,version-etc): Remove. * src/Makefile.am: Remove getopt.m4, use one from grecs. * src/getopt.m4: Remove. * src/cmdline.opt: Rewrite. * src/config.c: Update. * src/wydawca.h (spool) <aliases>: Change data type. (all_spool_aliases): Change data type. (config_finish): New proto. * src/wydawca.c: Use grecs functions. * src/dictionary.c: Likewise. * src/net.c: Likewise. * src/process.c: Likewise. * src/mail.c: Use grecs_symtab. * src/timer.c: Likewise. * src/triplet.c: Likewise.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile.am18
-rw-r--r--bootstrap.conf2
-rw-r--r--configure.ac9
-rw-r--r--doc/wydawca.texi2
-rw-r--r--gnulib.modules5
m---------grecs0
-rw-r--r--src/Makefile.am4
-rw-r--r--src/cmdline.opt41
-rw-r--r--src/config.c73
-rw-r--r--src/dictionary.c4
-rw-r--r--src/diskio.c2
-rw-r--r--src/getopt.m4517
-rw-r--r--src/mail.c78
-rw-r--r--src/net.c2
-rw-r--r--src/process.c2
-rw-r--r--src/timer.c79
-rw-r--r--src/triplet.c84
-rw-r--r--src/wydawca.c13
-rw-r--r--src/wydawca.h10
19 files changed, 186 insertions, 759 deletions
diff --git a/Makefile.am b/Makefile.am
index 95051ba..a182931 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,16 +25,8 @@ distuninstallcheck_listfiles = \
gen_start_date = 2009-01-25
.PHONY: ChangeLog
-ChangeLog:
- if test -d .git; then \
- $(top_srcdir)/build-aux/gitlog-to-changelog \
- --since=$(gen_start_date) | \
- sed '/<unknown>$$/d' | fmt -s > ChangeLog; \
- cat ChangeLog.svn | sed '/^Local Variables:/,/^End:/d' \
- >> ChangeLog; \
- echo "Local Variables:" >> ChangeLog; \
- echo "mode: change-log" >> ChangeLog; \
- echo "version-control: never" >> ChangeLog; \
- echo "buffer-read-only: t" >> ChangeLog; \
- echo "End:" >> ChangeLog; \
- fi
+ChangeLog:
+ $(AM_V_GEN)if test -d .git; then \
+ git log --pretty='format:%ct %an <%ae>%n%n%s%n%n%b%n' | \
+ awk -f $(top_srcdir)/@GRECS_SUBDIR@/build-aux/git2chg.awk > ChangeLog; \
+ fi
diff --git a/bootstrap.conf b/bootstrap.conf
index 6cdbbc4..8464d0d 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -32,7 +32,7 @@ avoided_gnulib_modules='
'
# gnulib modules used by this package.
-gnulib_modules="`grep -h '^[^#]' gnulib.modules grecs/gnulib.modules | sort | uniq`"
+gnulib_modules="`grep -h '^[^#]' gnulib.modules | sort | uniq`"
# Additional xgettext options to use. Use "\\\newline" to break lines.
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
diff --git a/configure.ac b/configure.ac
index b72348b..0005006 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,12 +15,11 @@
# along with wydawca. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ(2.63)
-AC_INIT([wydawca], 2.1, [bug-wydawca@gnu.org.ua])
+AC_INIT([wydawca], 2.1.90, [bug-wydawca@gnu.org.ua])
AC_CONFIG_SRCDIR([src/wydawca.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADER([config.h])
-AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 dist-lzma dist-xz std-options
-silent-rules])
+AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 dist-xz std-options silent-rules])
# Enable silent rules by default:
AM_SILENT_RULES([yes])
@@ -112,7 +111,7 @@ if test "$status_tcpwrap" = yes; then
fi
# Grecs subsystem
-GRECS_SETUP
+GRECS_SETUP([grecs],[git2chg getopt tests])
AH_BOTTOM([
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
@@ -137,8 +136,6 @@ fi
AC_CONFIG_FILES([Makefile
doc/Makefile
gnu/Makefile
- grecs/Makefile
- grecs/src/Makefile
src/Makefile
etc/Makefile])
diff --git a/doc/wydawca.texi b/doc/wydawca.texi
index 7a2e3a7..961c2dc 100644
--- a/doc/wydawca.texi
+++ b/doc/wydawca.texi
@@ -3026,7 +3026,7 @@ command line options, in alphabetical order.
@opsummary{config-file}
@item --config-file=@var{file}
@itemx -c @var{file}
-Use @var{FILE} instead of the default configuration
+Use @var{file} instead of the default configuration
file.
@xref{config-file, The @option{--config-file} option}.
diff --git a/gnulib.modules b/gnulib.modules
index 3dbc445..f274913 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -2,10 +2,6 @@ xalloc
c-ctype
fnmatch
obstack
-getopt
-gitlog-to-changelog
-hash
-error
progname
getline
mkdtemp
@@ -16,5 +12,4 @@ sysexits
vasprintf
inttostr
strftime
-version-etc
xgethostname
diff --git a/grecs b/grecs
-Subproject edcc575bcdc9e50bdb79f422ad0f11dc79f3eaa
+Subproject 8bd6f1e59b1663089bf8c81d8d2b14e20010c6e
diff --git a/src/Makefile.am b/src/Makefile.am
index a523a1a..b79e0ec 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,12 +48,12 @@ wydawca_SOURCES=\
report.c
BUILT_SOURCES=cmdline.h
-EXTRA_DIST=cmdline.opt getopt.m4 pp-setup update-2.0.awk
+EXTRA_DIST=cmdline.opt pp-setup update-2.0.awk
SUFFIXES=.opt .c .h
.opt.h:
- m4 -s $(srcdir)/getopt.m4 $< | sed '1d' > $@
+ $(AM_V_GEN)m4 -s $(top_srcdir)/@GRECS_SUBDIR@/build-aux/getopt.m4 $< > $@
incdir=$(pkgdatadir)/$(VERSION)/include
inc_DATA = $(PP_SETUP_FILE)
diff --git a/src/cmdline.opt b/src/cmdline.opt
index 29eff3a..4c3d22f 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -1,4 +1,4 @@
-/* wydawca - automatic release submission daemon
+/* wydawca - automatic release submission daemon -*- c -*-
Copyright (C) 2007, 2009, 2010 Sergey Poznyakoff
Wydawca is free software; you can redistribute it and/or modify it
@@ -17,13 +17,13 @@
static struct obstack pp_cmd_stack;
static int pp_cmd_stack_init;
-static gl_list_t source_list;
-static gl_list_t tag_list;
+static struct grecs_list *source_list;
+static struct grecs_list *tag_list;
-static bool
-string_eq (const void *elt1, const void *elt2)
+static int
+string_cmp (const void *elt1, const void *elt2)
{
- return strcmp ((const char *)elt1, (const char *)elt2) == 0;
+ return strcmp ((const char *)elt1, (const char *)elt2);
}
int
@@ -36,14 +36,17 @@ int
enabled_spool_p (const struct spool *spool)
{
if (source_list || tag_list)
- return (source_list && gl_list_search (source_list, spool->source_dir))
- || (tag_list && gl_list_search (tag_list, spool->tag));
+ return (source_list && grecs_list_locate (source_list, spool->source_dir))
+ || (tag_list && grecs_list_locate (tag_list, spool->tag));
return 1;
}
-OPTIONS_BEGIN(gnu, "wydawca",
+OPTIONS_BEGIN("wydawca",
[<wydawca synchronizes files from a set of upload directories with the corresponding distribution sites>],
- [<UID [UID...]>])
+ [<UID [UID...]>],
+ [<gnu>],
+ [<copyright_year=2011>],
+ [<copyright_holder=Sergey Poznyakoff>])
GROUP(Selecting program mode)
@@ -104,20 +107,22 @@ OPTION(spool,S,TAG,
[<process only spool with the given tag (may be used multiple times)>])
BEGIN
if (!tag_list)
- tag_list = gl_list_create_empty (&gl_linked_list_implementation,
- string_eq, NULL,
- NULL, false);
- gl_list_add_last (tag_list, optarg);
+ {
+ tag_list = grecs_list_create ();
+ tag_list->cmp = string_cmp;
+ }
+ grecs_list_append (tag_list, optarg);
END
OPTION(source,s,SOURCE-DIR,
[<process only spool with the given source (may be used multiple times)>])
BEGIN
if (!source_list)
- source_list = gl_list_create_empty (&gl_linked_list_implementation,
- string_eq, NULL,
- NULL, false);
- gl_list_add_last (source_list, optarg);
+ {
+ source_list = grecs_list_create ();
+ source_list->cmp = string_cmp;
+ }
+ grecs_list_append (source_list, optarg);
END
GROUP(Logging)
diff --git a/src/config.c b/src/config.c
index 9c75df6..7353f29 100644
--- a/src/config.c
+++ b/src/config.c
@@ -248,7 +248,7 @@ get_arg (grecs_locus_t *locus, grecs_value_t *value, unsigned n, int type)
grecs_error (locus, 0, _("not enough arguments"));
return NULL;
}
- value = value->v.arg.v + n;
+ value = value->v.arg.v[n];
if (value->type != type)
{
grecs_error (locus, 0, _("argument %d has wrong type"), n);
@@ -300,12 +300,11 @@ cb_email_address (enum grecs_callback_command cmd,
case GRECS_TYPE_LIST:
{
- const void *p;
- gl_list_iterator_t itr = gl_list_iterator (value->v.list);
-
- while (gl_list_iterator_next (&itr, &p, NULL))
+ struct grecs_list_entry *ep;
+
+ for (ep = value->v.list->head; ep; ep = ep->next)
{
- const grecs_value_t *vp = p;
+ const grecs_value_t *vp = ep->data;
mu_address_t a;
if (assert_string_arg (locus, cmd, vp))
return 1;
@@ -500,7 +499,7 @@ parse_statmask (grecs_locus_t *loc, grecs_value_t *val, unsigned long *pmask)
for (i = 0; i < val->v.arg.c; i++)
{
unsigned long x;
- if (parse_single_statmask (loc, &val->v.arg.v[i], &x, &invert))
+ if (parse_single_statmask (loc, val->v.arg.v[i], &x, &invert))
err = 1;
else if (invert)
mask &= ~x;
@@ -512,12 +511,11 @@ parse_statmask (grecs_locus_t *loc, grecs_value_t *val, unsigned long *pmask)
case GRECS_TYPE_LIST:
{
- const void *p;
- gl_list_iterator_t itr = gl_list_iterator (val->v.list);
+ struct grecs_list_entry *ep;
- while (gl_list_iterator_next (&itr, &p, NULL))
+ for (ep = val->v.list->head; ep; ep = ep->next)
{
- const grecs_value_t *vp = p;
+ const grecs_value_t *vp = ep->data;
unsigned long x;
if (parse_single_statmask (loc, vp, &x, &invert))
@@ -686,20 +684,20 @@ cb_define_message (enum grecs_callback_command cmd,
return 1;
}
- if (value->v.arg.v[0].type != GRECS_TYPE_STRING)
+ if (value->v.arg.v[0]->type != GRECS_TYPE_STRING)
{
grecs_error (locus, 0, _("first argument not a string"));
return 1;
}
- ident = value->v.arg.v[0].v.string;
+ ident = value->v.arg.v[0]->v.string;
- if (value->v.arg.v[1].type != GRECS_TYPE_STRING)
+ if (value->v.arg.v[1]->type != GRECS_TYPE_STRING)
{
grecs_error (locus, 0, _("second argument not a string"));
return 1;
}
- register_message_template (ident, value->v.arg.v[1].v.string);
+ register_message_template (ident, value->v.arg.v[1]->v.string);
return 0;
}
@@ -992,10 +990,10 @@ cb_dictionary_type (enum grecs_callback_command cmd,
static int
cb_dictionary_params (enum grecs_callback_command cmd,
- grecs_locus_t *locus,
- void *varptr,
- grecs_value_t *value,
- void *cb_data)
+ grecs_locus_t *locus,
+ void *varptr,
+ grecs_value_t *value,
+ void *cb_data)
{
struct dictionary *meth = varptr;
size_t size;
@@ -1011,7 +1009,7 @@ cb_dictionary_params (enum grecs_callback_command cmd,
return 1;
}
- size = gl_list_size (value->v.list);
+ size = grecs_list_size (value->v.list);
if (size == 0)
{
meth->parmc = 0;
@@ -1020,22 +1018,20 @@ cb_dictionary_params (enum grecs_callback_command cmd,
else
{
int i;
- const void *p;
- gl_list_iterator_t itr = gl_list_iterator (value->v.list);
+ struct grecs_list_entry *ep;
meth->parmc = size;
meth->parmv = xcalloc (size + 1, sizeof (meth->parmv[0]));
- for (i = 0; gl_list_iterator_next (&itr, &p, NULL); i++)
+ for (i = 0, ep = value->v.list->head; ep; ep = ep->next, i++)
{
- const grecs_value_t *vp = p;
+ const grecs_value_t *vp = ep->data;
if (assert_string_arg (locus, cmd, vp))
break;
meth->parmv[i] = xstrdup (vp->v.string);
}
- gl_list_iterator_free (&itr);
meth->parmv[i] = NULL;
}
return 0;
@@ -1314,21 +1310,20 @@ cb_supp_groups (enum grecs_callback_command cmd,
return 1;
}
- wydawca_supp_groupc = gl_list_size (value->v.list);
+ wydawca_supp_groupc = grecs_list_size (value->v.list);
if (wydawca_supp_groupc == 0)
wydawca_supp_groups = NULL;
else
{
int i;
- gl_list_iterator_t itr;
- const void *p;
+ struct grecs_list_entry *ep;
wydawca_supp_groups = xcalloc (wydawca_supp_groupc,
sizeof (wydawca_supp_groups[0]));
- itr = gl_list_iterator (value->v.list);
- for (i = 0; gl_list_iterator_next (&itr, &p, NULL); i++)
+
+ for (i = 0, ep = value->v.list->head; ep; ep = ep->next, i++)
{
- const grecs_value_t *vp = p;
+ const grecs_value_t *vp = ep->data;
struct group *grp;
if (assert_string_arg (locus, cmd, vp))
@@ -1341,7 +1336,6 @@ cb_supp_groups (enum grecs_callback_command cmd,
}
wydawca_supp_groups[i] = grp->gr_gid;
}
- gl_list_iterator_free (&itr);
}
return 0;
}
@@ -1480,8 +1474,8 @@ config_help ()
static char docstring[] =
N_("Configuration file structure for wydawca.\n"
"For more information, use `info wydawca configuration'.");
- grecs_format_docstring (stdout, docstring, 0);
- grecs_format_statement_array (stdout, wydawca_kw, 1, 0);
+ grecs_format_docstring (docstring, 0, stdout);
+ grecs_format_statement_array (wydawca_kw, 1, 0, stdout);
}
void
@@ -1490,11 +1484,10 @@ config_init()
int i;
struct servent *serv;
- grecs_set_keywords (wydawca_kw);
grecs_include_path_setup (DEFAULT_VERSION_INCLUDE_DIR,
DEFAULT_INCLUDE_DIR, NULL);
grecs_preprocessor = DEFAULT_PREPROCESSOR;
- grecs_log_to_stderr = true;
+ grecs_log_to_stderr = 1;
serv = getservbyname (PACKAGE, "tcp");
if (serv != NULL)
@@ -1503,3 +1496,11 @@ config_init()
for (i = 0; i < dictionary_count; i++)
default_dictionary[i] = dictionary_new (i, dictionary_builtin);
}
+
+void
+config_finish (struct grecs_node *tree)
+{
+ if (grecs_tree_process (tree, wydawca_kw))
+ exit (EX_CONFIG);
+}
+
diff --git a/src/dictionary.c b/src/dictionary.c
index 7060cec..b7baf05 100644
--- a/src/dictionary.c
+++ b/src/dictionary.c
@@ -215,9 +215,9 @@ dictionary_quote_string (struct dictionary *dict, void *handle,
if (mp->quote)
return mp->quote (dict, handle, input, poutput, psize);
- size = wordsplit_quoted_length (input, 0, &quote);
+ size = wordsplit_c_quoted_length (input, 0, &quote);
output = xmalloc (size + 1);
- wordsplit_quote_copy (output, input, 0);
+ wordsplit_c_quote_copy (output, input, 0);
output[size] = 0;
*poutput = output;
diff --git a/src/diskio.c b/src/diskio.c
index 46526d0..ed16e35 100644
--- a/src/diskio.c
+++ b/src/diskio.c
@@ -372,8 +372,6 @@ do_archive_file (const char *dst_file, const char *dst_dir, const char *file,
const struct archive_descr *archive,
const char *reldir)
{
- int rc = 0;
-
switch (archive->type)
{
case archive_none:
diff --git a/src/getopt.m4 b/src/getopt.m4
deleted file mode 100644
index fc50ff9..0000000
--- a/src/getopt.m4
+++ b/dev/null
@@ -1,517 +0,0 @@
-dnl This file is part of GNU Rush.
-dnl Copyright (C) 2007, 2008, 2009, 2010 Sergey Poznyakoff.
-dnl
-dnl GNU Rush is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 3, or (at your option)
-dnl any later version.
-dnl
-dnl GNU Rush is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with GNU Rush. If not, see <http://www.gnu.org/licenses/>.
-divert(-1)
-changequote([<,>])
-changecom(/*,*/)
-
-dnl upcase(ARGS...)
-dnl Concatenate and convert ARGS to upper case.
-dnl
-define([<upcase>], [<translit([<$*>], [<a-z>], [<A-Z>])>])
-
-dnl concat(ARGS...)
-dnl Concatenate arguments, inserting ", " between each of pair of them.
-dnl
-define([<concat>],[<ifelse([<$#>],1,[<$1>],[<$1, concat(shift($@))>])>])
-
-dnl flushleft(ARGS...)
-dnl Concatenate ARGS and remove any leading whitespace
-dnl
-define([<flushleft>],
- [<patsubst([<concat($*)>], [<^[ ]+>])>])
-
-dnl chop(ARGS...)
-dnl Concatenate ARGS and remove any trailing whitespace
-dnl
-define([<chop>],
- [<patsubst([<$*>], [<[ ]+$>])>])
-
-dnl escape(ARGS...)
-dnl Concatenate ARGS and escape any occurrences of double-quotes with
-dnl backslashes.
-dnl
-define([<escape>],
-[<patsubst([<concat($*)>],[<[\"]>],[<\\\&>])>])
-
-dnl prep(ARG)
-dnl Prepare ARG for including in C strings: replace newlines with any amount
-dnl of preceding and following whitespace by a single space character, remove
-dnl leading whitespace, and escape double-quotes.
-dnl
-define([<prep>],
- [<escape(flushleft(patsubst([<$1>],[<[ ]*
-+[ ]*>],[< >])))>])
-
-dnl SHORT_OPTS
-dnl Accumulator for the 3rd argument of getopt_long
-dnl
-define([<SHORT_OPTS>],[<>])
-
-dnl GROUP(STRING)
-dnl Begin a named group of options
-dnl
-define([<GROUP>],[<dnl
-divert(3)
- { NULL, NULL, 0, N_("prep([<$1>])") },
-divert(-1)>])
-
-define([<__GATHER_OPTIONS>],[<
-define([<KEY>],ifelse([<$2>],,[<OPTION_>]upcase(patsubst($1,-,_)),'$2'))
-ifelse([<$2>],,[<
-divert(1)
- KEY,
-divert(-1)
->])
-define([<SELECTOR>],ifdef([<SELECTOR>],SELECTOR) case KEY:)
-ifelse([<$1>],,,[<
-divert(2)
- { "$1", ARGTYPE, 0, KEY },
-divert(-1)>])
-dnl
-define([<SHORT_OPTS>],SHORT_OPTS[<>]dnl
-ifelse([<$2>],,,$2[<>]ifelse(ARGTYPE,[<no_argument>],,ARGTYPE,[<required_argument>],:,ARGTYPE,[<optional_argument>],::)))
-dnl
-ifelse([<$1>],,,dnl
-[<define([<LONG_TAG>],ifelse(LONG_TAG,,[<--$1>],[<LONG_TAG; --$1>]))>])
-ifelse([<$2>],,,dnl
-[<define([<SHORT_TAG>],ifelse(SHORT_TAG,,[<-$2>],[<SHORT_TAG; -$2>]))>])
->])
-
-dnl OPTION(long-opt, short-opt, [arg], [descr])
-dnl Introduce a command line option. Arguments:
-dnl long-opt Long option.
-dnl short-opt Short option (a single char)
-dnl (At least one of long-opt or short-opt must be present)
-dnl
-dnl Optional arguments:
-dnl arg Option argument.
-dnl descr Option description
-dnl
-dnl If arg is absent, the option does not take any arguments. If arg is
-dnl enclosed in square brackets, the option takes an optional argument.
-dnl Otherwise, the argument is required.
-dnl
-dnl If descr is not given the option will not appear in the --help and
-dnl --usage outputs.
-dnl
-define([<OPTION>],[<
-pushdef([<LONG_TAG>])
-pushdef([<SHORT_TAG>])
-pushdef([<ARGNAME>],[<$3>])
-pushdef([<DOCSTRING>],[<prep([<$4>])>])
-pushdef([<ARGTYPE>],[<ifelse([<$3>],,[<no_argument>],dnl
-patsubst([<$3>],[<\[.*\]>]),,[<optional_argument>],dnl
-[<required_argument>])>])
-__GATHER_OPTIONS($@)
->])
-
-dnl ALIAS(long-opt, short-opt)
-dnl Declare aliases for the previous OPTION statement.
-dnl long-opt Long option.
-dnl short-opt Short option (a single char)
-dnl (At least one of long-opt or short-opt must be present)
-dnl An OPTION statement may be followed by any number of ALIAS statements.
-dnl
-define([<ALIAS>],[<
-__GATHER_OPTIONS($1,$2)
->])
-
-dnl BEGIN
-dnl Start an action associated with the declared option. Must follow OPTION
-dnl statement, with optional ALIAS statements in between.
-dnl
-define([<BEGIN>],[<
-ifelse([<DOCSTRING>],,,[<
-divert(3)
- { "translit(dnl
-ifelse(SHORT_TAG,,LONG_TAG,[<SHORT_TAG[<>]ifelse(LONG_TAG,,,; LONG_TAG)>]),
- [<;>],[<,>])", ifelse(ARGNAME,,[<NULL, 0>],
-[<ifelse(ARGTYPE,[<optional_argument>],
-[<patsubst(ARGNAME,[<\[\(.*\)\]>],[<N_("\1"), 1>])>],[<N_("ARGNAME"), 0>])>]), N_("DOCSTRING") },
-divert(-1)>])
-popdef([<ARGTYPE>])
-popdef([<ARGNAME>])
-popdef([<DOCSTRING>])
-divert(4)dnl
-popdef([<LONG_TAG>])dnl
-popdef([<SHORT_TAG>])dnl
- SELECTOR
- {
->])
-
-dnl END
-dnl Finish the associated action
-dnl
-define([<END>],[<
- break;
- }
-divert(-1)
-undefine([<SELECTOR>])>])
-
-dnl GETOPT(argc, argv, [default])
-dnl Emit option parsing code. Arguments:
-dnl
-dnl argc Name of the 1st argument to getopt_long.
-dnl argv Name of the 2nd argument to getopt_long.
-dnl default Code for the default branch
-dnl
-define([<GETOPT>],[<
- {
- int c;
-
-ifelse([<$#>],3,opterr = 0;)
- while ((c = getopt_long($1, $2, "SHORT_OPTS",
- long_options, NULL)) != EOF)
- {
- switch (c)
- {
- default:
- ifelse([<$#>],3,$3,[<exit (EX_USAGE)>]);
-
- undivert(4)
- }
- }
- }
->])
-
-define([<STDFUNC>],[<
-divert(0)
-void print_help(void);
-void print_usage(void);
-divert(5)
-const char *program_version = [<$1>];
-static char doc[] = N_("[<$3>]");
-static char args_doc[] = N_("[<$4>]");
-const char *program_bug_address = "<" PACKAGE_BUGREPORT ">";
-
-#define DESCRCOLUMN 30
-#define RMARGIN 79
-#define GROUPCOLUMN 2
-#define USAGECOLUMN 13
-
-static void
-indent (size_t start, size_t col)
-{
- for (; start < col; start++)
- putchar (' ');
-}
-
-static void
-print_option_descr (const char *descr, size_t lmargin, size_t rmargin)
-{
- while (*descr)
- {
- size_t s = 0;
- size_t i;
- size_t width = rmargin - lmargin;
-
- for (i = 0; ; i++)
- {
- if (descr[i] == 0 || isspace (descr[i]))
- {
- if (i > width)
- break;
- s = i;
- if (descr[i] == 0)
- break;
- }
- }
- printf ("%*.*s\n", s, s, descr);
- descr += s;
- if (*descr)
- {
- indent (0, lmargin);
- descr++;
- }
- }
-}
-
-void
-print_help(void)
-{
- unsigned i;
-
- printf ("%s %s [%s]... %s\n", _("Usage:"), [<$2>], _("[<OPTION>]"),
- gettext (args_doc));
- if (doc[0])
- print_option_descr(gettext (doc), 0, RMARGIN);
- putchar ('\n');
-
- for (i = 0; i < sizeof (opthelp) / sizeof (opthelp[0]); i++)
- {
- unsigned n;
- if (opthelp[i].opt)
- {
- n = printf (" %s", opthelp[i].opt);
- if (opthelp[i].arg)
- {
- char *cb, *ce, *sep = "";
- if (opthelp[i].is_optional)
- {
- cb = "[";
- ce = "]";
- }
- else
- cb = ce = "";
-
- if (strlen (opthelp[i].opt) == 2)
- {
- if (!opthelp[i].is_optional)
- sep = " ";
- }
- else
- sep = "=";
- n += printf ("%s%s%s%s", cb, sep, gettext (opthelp[i].arg), ce);
- }
- if (n >= DESCRCOLUMN)
- {
- putchar ('\n');
- n = 0;
- }
- indent (n, DESCRCOLUMN);
- print_option_descr (gettext (opthelp[i].descr), DESCRCOLUMN, RMARGIN);
- }
- else
- {
- if (i)
- putchar ('\n');
- indent (0, GROUPCOLUMN);
- print_option_descr (gettext (opthelp[i].descr),
- GROUPCOLUMN, RMARGIN);
- putchar ('\n');
- }
- }
-
- putchar ('\n');
-dnl **************************************************************************
-dnl This string cannot be split over several lines, because this would trigger
-dnl a bug in GNU M4 (version 1.4.9 and 1.4.10), which would insert #line
-dnl directives between the lines.
-dnl **************************************************************************
- print_option_descr (_("Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options."), 0, RMARGIN);
- putchar ('\n');
- printf (_("Report bugs to %s.\n"), program_bug_address);
-}
-
-void
-print_usage(void)
-{
- unsigned i;
- int f = 0;
- unsigned n;
- char buf[RMARGIN+1];
-
-#define FLUSH dnl
- do dnl
- { dnl
- buf[n] = 0; dnl
- printf ("%s\n", buf); dnl
- n = USAGECOLUMN; dnl
- memset (buf, ' ', n); dnl
- } dnl
- while (0)
-#define ADDC(c) dnl
- do { if (n == RMARGIN) FLUSH; buf[n++] = c; } while (0)
-
- n = snprintf (buf, sizeof buf, "%s %s ", _("Usage:"), [<$2>]);
-
- /* Print a list of short options without arguments. */
- for (i = 0; i < sizeof (opthelp) / sizeof (opthelp[0]); i++)
- {
- if (opthelp[i].opt && opthelp[i].descr && opthelp[i].opt[1] != '-'
- && opthelp[i].arg == NULL)
- {
- if (f == 0)
- {
- ADDC('[');
- ADDC('-');
- f = 1;
- }
- ADDC(opthelp[i].opt[1]);
- }
- }
- if (f)
- ADDC(']');
-
- /* Print a list of short options with arguments. */
- for (i = 0; i < sizeof (opthelp) / sizeof (opthelp[0]); i++)
- {
- if (opthelp[i].opt && opthelp[i].descr && opthelp[i].opt[1] != '-'
- && opthelp[i].arg)
- {
- size_t len = 5
- + strlen (opthelp[i].arg)
- + (opthelp[i].is_optional ? 2 : 1);
- if (n + len > RMARGIN) FLUSH;
- buf[n++] = ' ';
- buf[n++] = '[';
- buf[n++] = '-';
- buf[n++] = opthelp[i].opt[1];
- if (opthelp[i].is_optional)
- {
- buf[n++] = '[';
- strcpy (&buf[n], opthelp[i].arg);
- n += strlen (opthelp[i].arg);
- buf[n++] = ']';
- }
- else
- {
- buf[n++] = ' ';
- strcpy (&buf[n], opthelp[i].arg);
- n += strlen (opthelp[i].arg);
- }
- buf[n++] = ']';
- }
- }
-
- /* Print a list of long options */
- for (i = 0; i < sizeof (opthelp) / sizeof (opthelp[0]); i++)
- {
- if (opthelp[i].opt && opthelp[i].descr)
- {
- size_t len;
- const char *longopt;
-
- if (opthelp[i].opt[1] == '-')
- longopt = opthelp[i].opt;
- else if (opthelp[i].opt[2] == ',')
- longopt = opthelp[i].opt + 4;
- else
- continue;
-
- len = 3 + strlen (longopt)
- + (opthelp[i].arg ? 1 + strlen (opthelp[i].arg)
- + (opthelp[i].is_optional ? 2 : 0) : 0);
- if (n + len > RMARGIN) FLUSH;
- buf[n++] = ' ';
- buf[n++] = '[';
- strcpy (&buf[n], longopt);
- n += strlen (longopt);
- if (opthelp[i].arg)
- {
- buf[n++] = '=';
- if (opthelp[i].is_optional)
- {
- buf[n++] = '[';
- strcpy (&buf[n], opthelp[i].arg);
- n += strlen (opthelp[i].arg);
- buf[n++] = ']';
- }
- else
- {
- strcpy (&buf[n], opthelp[i].arg);
- n += strlen (opthelp[i].arg);
- }
- }
- buf[n++] = ']';
- }
- }
- FLUSH;
-
-}
-
-const char version_etc_copyright[] =
- /* Do *not* mark this string for translation. %s is a copyright
- symbol suitable for this locale, and %d is the copyright
- year. */
- "Copyright %s 2005, 2006, 2007, 2008, 2009 Sergey Poznyakoff";
-
-void
-print_version_only(const char *program_version, FILE *stream)
-{
- fprintf (stream, "%s\n", program_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)"));
- fputc ('\n', stream);
-}
-
-void
-print_version(const char *program_version, FILE *stream)
-{
- print_version_only(program_version, stream);
-
-dnl **************************************************************************
-dnl This string cannot be split over serveal lines, because this would trigger
-dnl a bug in GNU M4 (version 1.4.9 and 1.4.10), which would insert #line
-dnl directives between the lines.
-dnl **************************************************************************
- fputs (_("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\n"),
- stream);
-
-dnl /* TRANSLATORS: %s denotes an author name. */
-dnl fprintf (stream, _("Written by %s.\n"), "Sergey Poznyakoff");
-}
-
-divert(-1)
-popdef([<ADDC>])
-popdef([<FLUSH>])
->])
-
-define([<OPTIONS_BEGIN>],
- [<divert(-1)
- define([<GETOPT_STYLE>],[<$1>])
- ifelse([<$1>],[<gnu>],
- [<STDFUNC([<$2 " (" PACKAGE_NAME ") " PACKAGE_VERSION>], [<$2>], [<$3>], [<$4>])>])
->])
-
-define([<OPTIONS_END>],[<
-ifelse(GETOPT_STYLE,[<gnu>],[<
- GROUP([<Other options>])
- OPTION([<help>],h,,[<Give this help list>])
- BEGIN
- print_help ();
- exit (0);
- END
- OPTION([<usage>],,,[<Give a short usage message>])
- BEGIN
- print_usage ();
- exit (0);
- END
- OPTION([<version>],,,[<Print program version>])
- BEGIN
- /* Give version */
- print_version(program_version, stdout);
- exit (0);
- END>])
-divert
-/* Option codes */
-enum {
- _OPTION_INIT=255,
- undivert(1)
- MAX_OPTION
-};
-static struct option long_options[] = {
- undivert(2)
- {0, 0, 0, 0}
-};
-static struct opthelp {
- const char *opt;
- const char *arg;
- int is_optional;
- const char *descr;
-} opthelp[] = {
- undivert(3)
-};
-undivert(5)
->])
-
-divert(0)dnl
-/* -*- buffer-read-only: t -*- vi: set ro:
- THIS FILE IS GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT.
-*/
-
diff --git a/src/mail.c b/src/mail.c
index afcf29e..bac0381 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -16,7 +16,6 @@
#include "wydawca.h"
#include <mail.h>
-#include <hash.h>
#include <gpgme.h>
int mailer_opened;
@@ -365,66 +364,29 @@ struct message_template
/* int mime; for future use */
};
-static Hash_table *tmpl_table;
+static struct grecs_symtab *tmpl_table;
-/* Calculate the hash of a string. */
-static size_t
-tmpl_hasher (void const *data, unsigned n_buckets)
-{
- struct message_template const *tmpl = data;
- return hash_string (tmpl->name, n_buckets);
-}
-
-/* Compare two strings for equality. */
-static bool
-tmpl_compare (void const *data1, void const *data2)
-{
- struct message_template const *tmpl1 = data1;
- struct message_template const *tmpl2 = data2;
- return strcmp (tmpl1->name, tmpl2->name) == 0;
-}
-
-static void
-tmpl_free (void *data)
-{
- free (data);
-}
-
-struct message_template *
-alloc_message_template (const char *name, const char *text)
-{
- struct message_template *tmpl = xmalloc (sizeof (tmpl[0])
- + strlen (name) + 1
- + strlen (text) + 1);
- char *p = (char*) (tmpl + 1);
- tmpl->name = p;
- strcpy (tmpl->name, name);
-
- p += strlen (p) + 1;
- tmpl->text = p;
- strcpy (tmpl->text, text);
- return tmpl;
-}
-
-/* Register a template.
- FIXME: Issue a warning if it is already registered. */
+/* Register a template. */
void
register_message_template (const char *name, const char *text)
{
- struct message_template *tmpl, *s;
-
- s = alloc_message_template (name, text);
+ struct message_template key, *tmpl;
+ int install = 1;
+
+ key.name = (char*) text;
- if (!((tmpl_table
- || (tmpl_table = hash_initialize (0, 0,
- tmpl_hasher,
- tmpl_compare,
- tmpl_free)))
- && (tmpl = hash_insert (tmpl_table, s))))
- xalloc_die ();
+ if (!tmpl_table)
+ {
+ tmpl_table = grecs_symtab_create_default (sizeof (key));
+ if (!tmpl_table)
+ grecs_alloc_die ();
+ }
- if (s != tmpl)
- tmpl_free (s);
+ tmpl = grecs_symtab_lookup_or_install (tmpl_table, &key, &install);
+ if (!tmpl)
+ grecs_alloc_die();
+ if (!install)
+ grecs_warning (NULL, 0, "template %s already registered", text);
}
const char *
@@ -438,10 +400,10 @@ resolve_message_template (const char *name)
return NULL;
else
{
- struct message_template *p, tmpl;
+ struct message_template *p, key;
- tmpl.name = (char*) name + 1;
- p = hash_lookup (tmpl_table, &tmpl);
+ key.name = (char*) name + 1;
+ p = grecs_symtab_lookup_or_install (tmpl_table, &key, NULL);
return p ? p->text : NULL;
}
}
diff --git a/src/net.c b/src/net.c
index e6bb4ab..3e9fe30 100644
--- a/src/net.c
+++ b/src/net.c
@@ -111,7 +111,7 @@ handle_connection (FILE *in, FILE *out)
spool = wydawca_find_spool (buf);
if (!spool)
{
- if (all_spool_aliases && gl_list_search (all_spool_aliases, buf))
+ if (all_spool_aliases && grecs_list_locate (all_spool_aliases, buf))
fprintf (out, "+ OK, all spools\r\n");
else
{
diff --git a/src/process.c b/src/process.c
index 676e565..281c26b 100644
--- a/src/process.c
+++ b/src/process.c
@@ -36,7 +36,7 @@ register_spool (struct spool *spool)
static int
spool_check_alias (struct spool *spool, const char *name)
{
- if (spool->aliases && gl_list_search (spool->aliases, name))
+ if (spool->aliases && grecs_list_locate (spool->aliases, name))
return 1;
return 0;
}
diff --git a/src/timer.c b/src/timer.c
index bb00e17..71f63f9 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -19,7 +19,6 @@
#include <sys/resource.h>
#include <unistd.h>
#include <string.h>
-#include <hash.h>
#include <ctype.h>
#include <xalloc.h>
@@ -36,11 +35,11 @@ struct timer_slot
struct rusage children_mark;
};
-static Hash_table *timer_table;
+static struct grecs_symtab *timer_table;
static size_t _timer_count;
-static size_t
-hash_string_ci (const char *string, size_t n_buckets)
+static unsigned
+hash_string_ci (const char *string, unsigned long n_buckets)
{
size_t value = 0;
unsigned char ch;
@@ -50,52 +49,38 @@ hash_string_ci (const char *string, size_t n_buckets)
return value;
}
-/* Calculate the hash of a string. */
-static size_t
-timer_hasher (void const *data, unsigned n_buckets)
+static unsigned
+timer_hasher (void *ptr, unsigned long n_buckets)
{
- const struct timer_slot *t = data;
- return hash_string_ci (t->name, n_buckets);
-}
-
-/* Compare two strings for equality. */
-static bool
-timer_compare (void const *data1, void const *data2)
-{
- const struct timer_slot *t1 = data1;
- const struct timer_slot *t2 = data2;
- return strcasecmp (t1->name, t2->name) == 0;
-}
-
-/* Allocate a timer structure */
-static wydawca_timer_t
-timer_alloc (const char *name)
-{
- wydawca_timer_t t = xmalloc (sizeof (*t) + strlen (name) + 1);
- memset (t, 0, sizeof (*t));
- t->name = (char *) (t + 1);
- strcpy (t->name, name);
- return t;
+ struct timer_slot *tp = ptr;
+ return hash_string_ci (tp->name, n_buckets);
}
/* Lookup a timer by its name. If it does not exist, create it. */
wydawca_timer_t
timer_get (const char *name)
{
- wydawca_timer_t tp, ret;
-
- tp = timer_alloc (name);
+ struct timer_slot key, *ret;
+ int install = 1;
+
+ key.name = (char*) name;
- if (!((timer_table
- || (timer_table = hash_initialize (0, 0,
- timer_hasher,
- timer_compare, 0)))
- && (ret = hash_insert (timer_table, tp))))
- xalloc_die ();
+ if (!timer_table)
+ {
+ timer_table = grecs_symtab_create (sizeof (key),
+ timer_hasher,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ if (!timer_table)
+ grecs_alloc_die ();
+ }
- if (ret != tp)
- free (tp);
- else
+ ret = grecs_symtab_lookup_or_install (timer_table, &key, &install);
+ if (!ret)
+ grecs_alloc_die();
+ if (install)
_timer_count++;
return ret;
}
@@ -210,11 +195,11 @@ struct timer_data
size_t num;
};
-bool
-_fill_meta (void *data, void *proc_data)
+int
+_fill_meta (void *sym, void *data)
{
- struct timer_slot *slot = data;
- struct timer_data *tp = proc_data;
+ struct timer_slot *slot = sym;
+ struct timer_data *tp = data;
#define CREATE_DEF(arg) \
if (tp->num) \
{ \
@@ -230,7 +215,7 @@ _fill_meta (void *data, void *proc_data)
CREATE_DEF(real);
CREATE_DEF(user);
- return tp->num > 0;
+ return tp->num <= 0;
}
void
@@ -241,7 +226,7 @@ timer_fill_meta (struct metadef *def, size_t num)
return;
td.def = def;
td.num = num;
- hash_do_for_each (timer_table, _fill_meta, &td);
+ grecs_symtab_enumerate (timer_table, _fill_meta, &td);
}
void
diff --git a/src/triplet.c b/src/triplet.c
index ea57a08..6bd9e6a 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -15,25 +15,24 @@
with wydawca. If not, see <http://www.gnu.org/licenses/>. */
#include "wydawca.h"
-#include "hash.h"
#include <time.h>
-static Hash_table *triplet_table;
+static struct grecs_symtab *triplet_table;
-static size_t
-hash_triplet_hasher (void const *data, unsigned n_buckets)
+static unsigned
+hash_triplet_hasher (void *data, unsigned long n_buckets)
{
struct file_triplet const *t = data;
- return hash_string (t->name, n_buckets);
+ return grecs_hash_string (t->name, n_buckets);
}
/* Compare two strings for equality. */
-static bool
+static int
hash_triplet_compare (void const *data1, void const *data2)
{
struct file_triplet const *t1 = data1;
struct file_triplet const *t2 = data2;
- return t1->name && t2->name && strcmp (t1->name, t2->name) == 0;
+ return strcmp (t1->name, t2->name);
}
/* Reclaim memory storage associated with a table entry */
@@ -44,6 +43,8 @@ hash_triplet_free (void *data)
struct file_triplet *tp = data;
struct uploader_info *up;
+ free (tp->name);
+
for (i = 0; i < FILE_TYPE_COUNT; i++)
{
if (tp->file[i].name)
@@ -78,40 +79,47 @@ triplet_strdup (struct file_triplet *tp, const char *str)
void
register_file (struct file_info *finfo, const struct spool *spool)
{
- struct file_triplet *tp, *ret;
+ struct file_triplet key, *ret;
+ int install = 1;
- tp = xmalloc (sizeof(*tp) + finfo->root_len + 1);
- memset (tp, 0, sizeof (*tp));
- tp->name = (char*)(tp + 1);
- memcpy (tp->name, finfo->name, finfo->root_len);
- tp->name[finfo->root_len] = 0;
- tp->spool = spool;
-
- if (! ((triplet_table
- || (triplet_table = hash_initialize (0, 0,
- hash_triplet_hasher,
- hash_triplet_compare,
- hash_triplet_free)))
- && (ret = hash_insert (triplet_table, tp))))
- xalloc_die ();
-
- if (ret == tp)
- obstack_init (&tp->obstk);
- else
- free (tp);
+ if (!triplet_table)
+ {
+ triplet_table = grecs_symtab_create (sizeof (struct file_triplet),
+ hash_triplet_hasher,
+ hash_triplet_compare,
+ NULL,
+ NULL,
+ hash_triplet_free);
+ if (!triplet_table)
+ grecs_alloc_die ();
+ }
+
+ key.name = xmalloc (finfo->root_len + 1);
+ memcpy (key.name, finfo->name, finfo->root_len);
+ key.name[finfo->root_len] = 0;
+
+ ret = grecs_symtab_lookup_or_install (triplet_table, &key, &install);
+ if (!ret)
+ grecs_alloc_die ();
+ free (key.name);
+ if (install)
+ {
+ ret->spool = spool;
+ obstack_init (&ret->obstk);
+ }
ret->file[finfo->type] = *finfo;
}
/* Return true if any part of the triplet TRP was modified more than
TTL seconds ago */
-static bool
+static int
triplet_expired_p (struct file_triplet *trp, time_t ttl)
{
int i;
time_t now = time (NULL);
if (ttl == 0)
- return false;
+ return 0;
for (i = 0; i < FILE_TYPE_COUNT; i++)
{
@@ -120,10 +128,10 @@ triplet_expired_p (struct file_triplet *trp, time_t ttl)
{
if (debug_level)
logmsg (LOG_DEBUG, _("file %s expired"), trp->file[i].name);
- return true;
+ return 1;
}
}
- return false;
+ return 0;
}
enum triplet_state
@@ -191,7 +199,7 @@ remove_triplet (struct file_triplet *trp)
}
/* Process a single triplet from the table */
-static bool
+static int
triplet_processor (void *data, void *proc_data)
{
struct file_triplet *trp = data;
@@ -211,7 +219,7 @@ triplet_processor (void *data, void *proc_data)
logmsg (LOG_DEBUG, _("processing triplet `%s'"), trp->name);
if (process_directives (trp))
remove_triplet (trp);
- return true;
+ return 0;
case triplet_incomplete:
if (debug_level)
@@ -223,7 +231,7 @@ triplet_processor (void *data, void *proc_data)
case triplet_bad:
UPDATE_STATS (STAT_BAD_TRIPLETS);
remove_triplet (trp);
- return true;
+ return 0;
}
if (triplet_expired_p (trp, trp->spool->file_sweep_time))
@@ -232,7 +240,7 @@ triplet_processor (void *data, void *proc_data)
remove_triplet (trp);
}
- return true;
+ return 0;
}
/* Process all triplets from the table according to the SPOOL */
@@ -244,15 +252,15 @@ enumerate_triplets (const struct spool *spool)
spool->tag, mu_url_to_string (spool->dest_url));
if (triplet_table)
{
- hash_do_for_each (triplet_table, triplet_processor, NULL);
- hash_clear (triplet_table);
+ grecs_symtab_enumerate (triplet_table, triplet_processor, NULL);
+ grecs_symtab_clear (triplet_table);
}
}
size_t
count_collected_triplets ()
{
- return triplet_table ? hash_get_n_entries (triplet_table) : 0;
+ return triplet_table ? grecs_symtab_count_entries (triplet_table) : 0;
}
diff --git a/src/wydawca.c b/src/wydawca.c
index e693bb2..12649d3 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -17,7 +17,6 @@
#include "wydawca.h"
#include "mail.h"
#include "argmatch.h"
-#include "version-etc.h"
uid_t wydawca_uid;
gid_t wydawca_gid;
@@ -44,7 +43,7 @@ int daemon_mode = 0;
int foreground;
int single_process;
time_t wakeup_interval;
-gl_list_t all_spool_aliases;
+struct grecs_list *all_spool_aliases;
char *wydawca_gpg_homedir;
char *default_check_script;
struct grecs_sockaddr listen_sockaddr;
@@ -298,6 +297,8 @@ wydawca_daemon ()
int
main (int argc, char **argv)
{
+ struct grecs_node *tree;
+
program_name = argv[0];
mu_register_all_mailer_formats ();
config_init ();
@@ -313,9 +314,13 @@ main (int argc, char **argv)
if (preprocess_only)
exit (grecs_preproc_run (conffile, grecs_preprocessor) ? EX_CONFIG : 0);
-
- if (grecs_parse (conffile))
+
+ tree = grecs_parse (conffile);
+ if (!tree)
exit (EX_CONFIG);
+
+ config_finish (tree);
+ grecs_tree_free (tree);
if (lint_mode)
exit (0);
diff --git a/src/wydawca.h b/src/wydawca.h
index da093c3..030b16f 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -55,13 +55,8 @@
#include "backupfile.h"
#include "inttostr.h"
#include "grecs.h"
-#include "gl_list.h"
#include "wordsplit.h"
-#define gettext(s) s
-#define _(s) s
-#define N_(s) s
-
#define SP(s) ((s) ? (s) : "NONE")
#define WYDAWCA_EX_AGAIN 1
@@ -214,7 +209,7 @@ struct virt_tab
struct spool
{
char *tag;
- gl_list_t aliases;
+ struct grecs_list *aliases;
char *url; /* Download URL */
char *source_dir; /* Source directory */
mu_url_t dest_url; /* Destination URL */
@@ -357,7 +352,7 @@ extern int foreground;
extern int single_process;
extern struct grecs_sockaddr listen_sockaddr;
-extern gl_list_t all_spool_aliases;
+extern struct grecs_list *all_spool_aliases;
extern char *wydawca_gpg_homedir;
extern char *default_check_script;
@@ -465,6 +460,7 @@ int parse_time_interval (const char *str, time_t *pint, const char **endp);
/* config.c */
void config_init (void);
+void config_finish (struct grecs_node *);
void config_help (void);
int assert_string_arg (grecs_locus_t *, enum grecs_callback_command,
const grecs_value_t *);

Return to:

Send suggestions and report system problems to the System administrator.