X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=blobdiff_plain;f=parse_monitor.c;h=1b5bed2f81b56a9e6a8eb3267aad59ae3927ffb9;hp=8f684fb5a88259d397d95ae8dfa9582740dcc1c8;hb=HEAD;hpb=d6014994e06ebe952d51bef2e36a795f624c4b4d diff --git a/parse_monitor.c b/parse_monitor.c index 8f684fb..1b5bed2 100644 --- a/parse_monitor.c +++ b/parse_monitor.c @@ -41,12 +41,13 @@ struct monitor_reg_list xbee_monitor_list = LIST_HEAD_INITIALIZER(); static int8_t -parse_monitor(parse_pgm_token_hdr_t *tk, const char *buf, void *res) +parse_monitor(PGM_P tk, const char *buf, void *res) { struct monitor_reg *m; uint8_t token_len = 0; char bufcopy[32]; + (void)tk; while (!isendoftoken(buf[token_len]) && token_len < (sizeof(bufcopy)-1)) { bufcopy[token_len] = buf[token_len]; @@ -69,11 +70,12 @@ parse_monitor(parse_pgm_token_hdr_t *tk, const char *buf, void *res) } static int8_t -complete_get_nb_monitor(parse_pgm_token_hdr_t *tk) +complete_get_nb_monitor(PGM_P tk) { struct monitor_reg *m; int8_t i = 0; + (void)tk; LIST_FOREACH(m, &xbee_monitor_list, next) { i++; } @@ -81,12 +83,13 @@ complete_get_nb_monitor(parse_pgm_token_hdr_t *tk) } static int8_t -complete_get_elt_monitor(parse_pgm_token_hdr_t *tk, int8_t idx, +complete_get_elt_monitor(PGM_P tk, int8_t idx, char *dstbuf, uint8_t size) { struct monitor_reg *m; int8_t i = 0, len; + (void)tk; LIST_FOREACH(m, &xbee_monitor_list, next) { if (i == idx) break; @@ -95,7 +98,7 @@ complete_get_elt_monitor(parse_pgm_token_hdr_t *tk, int8_t idx, if (m == NULL) return -1; - len = snprintf(dstbuf, size, "%S", m->desc); + len = snprintf_P(dstbuf, size, PSTR("%S"), m->desc); if (len < 0 || len >= size) return -1; @@ -104,10 +107,11 @@ complete_get_elt_monitor(parse_pgm_token_hdr_t *tk, int8_t idx, static int8_t -help_monitor(parse_pgm_token_hdr_t *tk, char *dstbuf, +help_monitor(PGM_P tk, char *dstbuf, uint8_t size) { - snprintf(dstbuf, size, "Monitor-register"); + (void)tk; + snprintf_P(dstbuf, size, PSTR("Monitor-register")); return 0; }