aboutsummaryrefslogtreecommitdiff
path: root/src/wydawca.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-02-16 16:17:03 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-02-16 16:23:53 +0200
commit6cfe6f8fe1b7506e772403fecc9d7298fc52dc74 (patch)
tree64e579d8895bfecfadceb9914f9f795d75e4ccbb /src/wydawca.c
parent98ca4bb1bc96cc95bdd141cb653b17029957de38 (diff)
downloadwydawca-6cfe6f8fe1b7506e772403fecc9d7298fc52dc74.tar.gz
wydawca-6cfe6f8fe1b7506e772403fecc9d7298fc52dc74.tar.bz2
Improve keyword (meta) expansion, add testsuite framework
* src/meta.c: New file. * src/Makefile.am (wydawca_SOURCES): Add meta.c. * Makefile.am (SUBDIRS): Add tests. * configure.ac: Initialize testsuite. * src/cmdline.opt: Add preprocessor-related options: --[no-]preprocessor, -E * src/mail.c, src/triplet.c, src/verify.c, src/wydawca.c, src/wydawca.h: Use new expansion functions. * src/update-2.0.awk: Replace % markup with $. * etc/wydawca.rc: Switch to new meta-variable syntax. * gnulib.modules: Add c-ctype. * doc/Makefile.am (check-options): Rewrite. * doc/wydawca.texi: Mark unrevised/obsolete material. * tests/: New directory
Diffstat (limited to 'src/wydawca.c')
-rw-r--r--src/wydawca.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/wydawca.c b/src/wydawca.c
index 4e6e635..b265ade 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -32,7 +32,8 @@ char *tar_command_name = "tar";
int enable_sendfile = 1; /* Use sendfile by default */
int archive_signatures = 1; /* Archive sig files by default */
int lint_mode = 0;
-
+int preprocess_only = 0;
+
unsigned wydawca_stat[MAX_STAT];
void
@@ -205,26 +206,28 @@ stat_mask_p (unsigned long mask)
return 0;
}
-static char *
-stat_expand (struct kw_expansion *exp, void *data)
+static const char *
+stat_expand (struct metadef *def, void *data)
{
char sbuf[INT_BUFSIZE_BOUND (wydawca_stat[0])];
- exp->value = xstrdup (uinttostr (wydawca_stat[(int) exp->data], sbuf));
- return exp->value;
+ def->storage = xstrdup (uinttostr (wydawca_stat[(int) def->data], sbuf));
+ def->value = def->storage;
+ return def->value;
}
void
-make_stat_expansion (struct kw_expansion *exp)
+make_stat_expansion (struct metadef *def)
{
int i;
for (i = 0; i < MAX_STAT; i++)
{
- exp[i].kw = stat_kwname[i];
- exp[i].value = NULL;
- exp[i].static_p = 0;
- exp[i].expand = stat_expand;
- exp[i].data = (void*) i;
+ def[i].kw = stat_kwname[i];
+ def[i].value = NULL;
+ def[i].storage = NULL;
+ def[i].expand = stat_expand;
+ def[i].data = (void*) i;
}
+ def[i].kw = NULL;
}
void
@@ -280,6 +283,9 @@ main (int argc, char **argv)
if (argc != optind)
error (1, 0, "extra command line arguments");
+ if (preprocess_only)
+ exit (gconf_preproc_run (conffile, gconf_preprocessor));
+
gconf_parse (conffile);
if (lint_mode)

Return to:

Send suggestions and report system problems to the System administrator.