cmdline: new rc_proto commands
[protos/xbee-avr.git] / parse_neighbor.c
index 0285b03..d04092b 100644 (file)
 #include <string.h>
 
 #include <parse.h>
-
-#include "xbee_neighbor.h"
-#include "xbee_atcmd.h"
-#include "xbee_stats.h"
-#include "xbee_buf.h"
-#include "xbee_proto.h"
-#include "xbee.h"
+#include <xbee.h>
 
 #include "parse_neighbor.h"
 
 static int8_t
-parse_neighbor(parse_pgm_token_hdr_t *tk, const char *buf, void *res)
+parse_neighbor(PGM_P tk, const char *buf, void *res)
 {
        struct token_neighbor_data tkd;
        struct xbee_dev *dev;
@@ -76,7 +70,7 @@ parse_neighbor(parse_pgm_token_hdr_t *tk, const char *buf, void *res)
 }
 
 static int8_t
-complete_get_nb_neighbor(parse_pgm_token_hdr_t *tk)
+complete_get_nb_neighbor(PGM_P tk)
 {
        struct token_neighbor_data tkd;
        struct xbee_dev *dev;
@@ -94,7 +88,7 @@ complete_get_nb_neighbor(parse_pgm_token_hdr_t *tk)
 }
 
 static int8_t
-complete_get_elt_neighbor(parse_pgm_token_hdr_t *tk, int8_t idx,
+complete_get_elt_neighbor(PGM_P tk, int8_t idx,
                          char *dstbuf, uint8_t size)
 {
        struct token_neighbor_data tkd;
@@ -114,7 +108,7 @@ complete_get_elt_neighbor(parse_pgm_token_hdr_t *tk, int8_t idx,
        if (neigh == NULL)
                return -1;
 
-       len = snprintf(dstbuf, size, "%s", neigh->name);
+       len = snprintf_P(dstbuf, size, PSTR("%s"), neigh->name);
        if (len < 0 || len >= size)
                return -1;
 
@@ -123,10 +117,10 @@ complete_get_elt_neighbor(parse_pgm_token_hdr_t *tk, int8_t idx,
 
 
 static int8_t
-help_neighbor(parse_pgm_token_hdr_t *tk, char *dstbuf,
-             uint8_t size)
+help_neighbor(PGM_P tk, char *dstbuf, uint8_t size)
 {
-       snprintf(dstbuf, size, "Neighbor");
+       (void)tk;
+       snprintf_P(dstbuf, size, PSTR("Neighbor"));
        return 0;
 }