From: Andre Noll Date: Mon, 23 Jun 2008 13:59:14 +0000 (+0200) Subject: Implement the interactive "run" command to run the select query. X-Git-Tag: v0.0.3~1 X-Git-Url: http://git.tuebingen.mpg.de/?p=adu.git;a=commitdiff_plain;h=e2fe978a3fa04160d60a4d39659f05798d356fab Implement the interactive "run" command to run the select query. This was a straight-forward task, given the preparations of the past few patches. --- diff --git a/interactive.c b/interactive.c index 376ab48..494a4f8 100644 --- a/interactive.c +++ b/interactive.c @@ -10,11 +10,14 @@ struct interactive_command { const char *desc; }; +static struct uid_range *admissible_uids; + #define INTERACTIVE_COMMANDS \ INTERACTIVE_COMMAND(dump, "dump the current configuration") \ INTERACTIVE_COMMAND(set, "change the current configuration") \ INTERACTIVE_COMMAND(reset, "reset configuration to defaults") \ INTERACTIVE_COMMAND(help, "show list of commands and one-line descriptions") \ + INTERACTIVE_COMMAND(run, "start the query according to the current options") #define INTERACTIVE_COMMAND(name, desc) \ @@ -43,6 +46,11 @@ static int read_input_line(char *line, size_t size) return fgets(line, size, stdin)? 1 : -1; } +static int icom_run(__a_unused char *line) +{ + return run_select_query(admissible_uids); +} + static int icom_help(__a_unused char *line) { struct interactive_command *c; @@ -58,8 +66,6 @@ static int icom_reset(__a_unused char *line) return 1; } -static struct uid_range *admissible_uids; - static int icom_set(char *line) { struct select_cmdline_parser_params params = { @@ -109,6 +115,7 @@ int com_interactive(void) char line[255]; int ret = 1; + select_cmdline_parser_init(&select_conf); while (read_input_line(line, sizeof(line)) >= 0) { size_t len = strlen(line); if (!len)