summaryrefslogtreecommitdiff
path: root/libsieve/sv.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2002-11-12 16:27:47 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2002-11-12 16:27:47 +0000
commit2233fe22de4e6ff71d711b833cff595bd98b2b09 (patch)
tree16120b9787ed52f41dd868e26f70d88d988ed987 /libsieve/sv.c
parent0ba30cb1092adadc9cfef3bb9217f13fe272f612 (diff)
downloadmailutils-2233fe22de4e6ff71d711b833cff595bd98b2b09.tar.gz
mailutils-2233fe22de4e6ff71d711b833cff595bd98b2b09.tar.bz2
Added basic code generation and debugging
Diffstat (limited to 'libsieve/sv.c')
-rw-r--r--libsieve/sv.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/libsieve/sv.c b/libsieve/sv.c
index 03a9157ec..551111e84 100644
--- a/libsieve/sv.c
+++ b/libsieve/sv.c
@@ -24,18 +24,34 @@
#include <sieve.h>
int
+debug_printer (void *unused, const char *fmt, va_list ap)
+{
+ return vfprintf (stderr, fmt, ap);
+}
+
+int
main (int argc, char **argv)
{
- int n;
+ int n, rc, debug = 0;
+ sieve_machine_t mach;
assert (argc > 1);
if (strcmp (argv[1], "-d") == 0)
{
sieve_yydebug++;
n = 2;
+ debug++;
assert (argc > 2);
}
else
n = 1;
- return sieve_parse (argv[n]);
+
+ rc = sieve_compile (&mach, argv[n], NULL, NULL);
+ if (rc == 0)
+ {
+ if (debug)
+ sieve_set_debug (&mach, debug_printer, 100);
+ sieve_run (&mach);
+ }
+ return rc;
}

Return to:

Send suggestions and report system problems to the System administrator.