summaryrefslogtreecommitdiff
path: root/n/avr/modules/proto/proto.c
diff options
context:
space:
mode:
Diffstat (limited to 'n/avr/modules/proto/proto.c')
-rw-r--r--n/avr/modules/proto/proto.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/n/avr/modules/proto/proto.c b/n/avr/modules/proto/proto.c
index 5d54b36..72aa251 100644
--- a/n/avr/modules/proto/proto.c
+++ b/n/avr/modules/proto/proto.c
@@ -54,7 +54,8 @@ static uint8_t args[AC_PROTO_ARGS_MAX_SIZE];
* - 1: bang received.
* - 2: command received.
* - 3: command received, and processing a number.
- * - 4: quote received. */
+ * - 4: quote received.
+ * - 5: double quote received. */
static uint8_t step;
/** Accept a new character. */
@@ -94,6 +95,8 @@ proto_accept (uint8_t c)
#if AC_PROTO_QUOTE == 1
else if (c == '\'')
step = 4;
+ else if (c == '"')
+ step = 5;
#endif
else
{
@@ -110,6 +113,17 @@ proto_accept (uint8_t c)
step = 2;
proto_accept_char (c);
break;
+ case 5:
+ if (c == '\r')
+ {
+ AC_PROTO_CALLBACK (cmd, size, args);
+ step = 0;
+ }
+ else
+ {
+ proto_accept_char (c);
+ }
+ break;
#endif
}
}
@@ -151,8 +165,8 @@ proto_accept_digit (uint8_t c)
static void
proto_accept_char (uint8_t c)
{
- /* Test for argument list overflow. */
- if (size >= AC_PROTO_ARGS_MAX_SIZE)
+ /* Test for argument list overflow or unwanted char. */
+ if (size >= AC_PROTO_ARGS_MAX_SIZE || !isprint (c))
{
AC_PROTO_CALLBACK ('?', 0, 0);
step = 0;