Skip to content
Snippets Groups Projects
Commit 36e5af33 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Added -c option to sieve-test to force compile.

parent fbbe6f49
No related branches found
No related tags found
No related merge requests found
...@@ -41,7 +41,7 @@ Otherwise, the dump is printed to stdout. ...@@ -41,7 +41,7 @@ Otherwise, the dump is printed to stdout.
-- --
sieve-test [-r <recipient address>][-s <envelope sender>] sieve-test [-r <recipient address>][-s <envelope sender>]
[-m <mailbox>][-d <dump filename>] <scriptfile> <mailfile> [-m <mailbox>][-d <dump filename>][-c] <scriptfile> <mailfile>
Reads mail message from the specified mailfile and executes the specified sieve Reads mail message from the specified mailfile and executes the specified sieve
script to produce a verdict. This prints an execution dump with the instructions script to produce a verdict. This prints an execution dump with the instructions
...@@ -54,6 +54,7 @@ Options: ...@@ -54,6 +54,7 @@ Options:
-m the mailbox where the keep action should store -m the mailbox where the keep action should store
-d causes a dump of the generated code to be written to the specified -d causes a dump of the generated code to be written to the specified
file. Using - as filename causes the dump to be written to stdout file. Using - as filename causes the dump to be written to stdout
-c force compilation (ignore any existing binary)
-- --
......
...@@ -22,7 +22,7 @@ static void print_help(void) ...@@ -22,7 +22,7 @@ static void print_help(void)
{ {
printf( printf(
"Usage: sieve-test [-r <recipient address>][-s <envelope sender>]\n" "Usage: sieve-test [-r <recipient address>][-s <envelope sender>]\n"
" [-m <mailbox>][-d <dump filename>] <scriptfile> <mailfile>\n" " [-m <mailbox>][-d <dump filename>][-c] <scriptfile> <mailfile>\n"
); );
} }
...@@ -37,6 +37,7 @@ int main(int argc, char **argv) ...@@ -37,6 +37,7 @@ int main(int argc, char **argv)
struct sieve_message_data msgdata; struct sieve_message_data msgdata;
struct sieve_script_env scriptenv; struct sieve_script_env scriptenv;
struct sieve_error_handler *ehandler; struct sieve_error_handler *ehandler;
bool force_compile = FALSE;
bin_init(); bin_init();
...@@ -67,6 +68,9 @@ int main(int argc, char **argv) ...@@ -67,6 +68,9 @@ int main(int argc, char **argv)
if (i == argc) if (i == argc)
i_fatal("Missing -d argument"); i_fatal("Missing -d argument");
dumpfile = argv[i]; dumpfile = argv[i];
} else if (strcmp(argv[i], "-c") == 0) {
/* force compile */
force_compile = TRUE;
} else if ( scriptfile == NULL ) { } else if ( scriptfile == NULL ) {
scriptfile = argv[i]; scriptfile = argv[i];
} else if ( mailfile == NULL ) { } else if ( mailfile == NULL ) {
...@@ -91,8 +95,12 @@ int main(int argc, char **argv) ...@@ -91,8 +95,12 @@ int main(int argc, char **argv)
mfd = bin_open_mail_file(mailfile); mfd = bin_open_mail_file(mailfile);
/* Compile sieve script */ /* Compile sieve script */
sbin = bin_open_sieve_script(scriptfile); if ( force_compile ) {
sbin = bin_compile_sieve_script(scriptfile);
} else {
sbin = bin_open_sieve_script(scriptfile);
}
/* Dump script */ /* Dump script */
bin_dump_sieve_binary_to(sbin, dumpfile); bin_dump_sieve_binary_to(sbin, dumpfile);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.