Add support for comments
authorAneesh V <aneesh@ti.com>
Thu, 16 Oct 2014 00:13:49 +0000 (17:13 -0700)
committerAneesh V <aneesh@ti.com>
Fri, 24 Oct 2014 22:12:46 +0000 (15:12 -0700)
Signed-off-by: Aneesh V <aneesh@ti.com>
bqtool.c

index bfd5d03902b03e3b122482c764cdc1fcd69e86ff..3f98950e72aa17464e90fa8a58a4e6a7b37b7851 100644 (file)
--- a/bqtool.c
+++ b/bqtool.c
@@ -80,6 +80,7 @@ typedef struct {
        } data;
        uint8_t data_len;
        uint32_t line_num;
+       char    *line;
 } __PACKED cmd_t;
 
 static uint32_t line_num;
@@ -456,9 +457,22 @@ static bool get_cmd(FILE *bqfs_file, cmd_t *cmd)
        char *res;
        char *tok;
        char *buf = NULL;
-       int ret;
+       bool ret;
+
+       while ((ret = get_line(bqfs_file, &buf))) {
+               if (buf[0] == ';') {
+                       /*
+                        * Comment line - ignore it and get the
+                        * next line
+                        */
+                       fprintf(stdout, "%s", buf);
+                       free(buf);
+               } else {
+                       break;
+               }
+       }
 
-       if (!get_line(bqfs_file, &buf))
+       if (!ret)
                goto error;
 
        cmd->line_num = line_num;