add code to load/save configuration in eeprom
[protos/xbee-avr.git] / parse_monitor.c
index 8f684fb..1b5bed2 100644 (file)
 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;
 }