From: Keith Packard Date: Fri, 1 Apr 2011 21:07:23 +0000 (-0700) Subject: altos: Provide for a pre-filter on commands X-Git-Tag: 0.9.3~74 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=01952da35a57ae4da062facb26b3c6d7de29190f altos: Provide for a pre-filter on commands This allows for external code to see each command line before it is processed and potentially skip it. Signed-off-by: Keith Packard --- diff --git a/src/ao.h b/src/ao.h index 2d2bbf82..77f3259e 100644 --- a/src/ao.h +++ b/src/ao.h @@ -403,6 +403,14 @@ ao_cmd_register(__code struct ao_cmds *cmds); void ao_cmd_init(void); +#if HAS_CMD_FILTER +/* + * Provided by an external module to filter raw command lines + */ +uint8_t +ao_cmd_filter(void); +#endif + /* * ao_dma.c */ diff --git a/src/ao_cmd.c b/src/ao_cmd.c index 6007773c..50d5b96f 100644 --- a/src/ao_cmd.c +++ b/src/ao_cmd.c @@ -275,6 +275,11 @@ ao_cmd(void) lex_echo = 1; for (;;) { readline(); +#if HAS_CMD_FILTER + if (ao_cmd_filter()) + continue; + cmd_i = 0; +#endif ao_cmd_lex(); ao_cmd_white(); c = ao_cmd_lex_c;