projects
/
project
/
uci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a652efc
)
more comments
author
Felix Fietkau
<nbd@openwrt.org>
Sat, 19 Jan 2008 17:10:48 +0000
(18:10 +0100)
committer
Felix Fietkau
<nbd@openwrt.org>
Sat, 19 Jan 2008 17:10:48 +0000
(18:10 +0100)
parse.c
patch
|
blob
|
history
test.c
patch
|
blob
|
history
diff --git
a/parse.c
b/parse.c
index
9c9dc59
..
3a8a2ca
100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-80,12
+80,19
@@
static void uci_parse_cleanup(struct uci_context *ctx)
free(pctx);
}
free(pctx);
}
+/*
+ * move the string pointer forward until a non-whitespace character or
+ * EOL is reached
+ */
static void skip_whitespace(char **str)
{
while (**str && isspace(**str))
*str += 1;
}
static void skip_whitespace(char **str)
{
while (**str && isspace(**str))
*str += 1;
}
+/*
+ * parse a double quoted string argument from the command line
+ */
static char *parse_double_quote(char **str)
{
char *val;
static char *parse_double_quote(char **str)
{
char *val;
@@
-112,12
+119,18
@@
static char *parse_double_quote(char **str)
return NULL;
}
return NULL;
}
+/*
+ * parse a single quoted string argument from the command line
+ */
static char *parse_single_quote(char **str)
{
/* TODO: implement */
return NULL;
}
static char *parse_single_quote(char **str)
{
/* TODO: implement */
return NULL;
}
+/*
+ * extract the next word from the command line (unquoted argument)
+ */
static char *parse_unquoted(char **str)
{
char *val;
static char *parse_unquoted(char **str)
{
char *val;
@@
-135,6
+148,9
@@
static char *parse_unquoted(char **str)
return val;
}
return val;
}
+/*
+ * extract the next argument from the command line
+ */
static char *next_arg(struct uci_context *ctx, char **str, bool required)
{
char *val;
static char *next_arg(struct uci_context *ctx, char **str, bool required)
{
char *val;
@@
-159,6
+175,10
@@
static char *next_arg(struct uci_context *ctx, char **str, bool required)
return val;
}
return val;
}
+/*
+ * verify that the end of the line or command is reached.
+ * throw an error if extra arguments are given on the command line
+ */
static void assert_eol(struct uci_context *ctx, char **str)
{
char *tmp;
static void assert_eol(struct uci_context *ctx, char **str)
{
char *tmp;
@@
-170,6
+190,9
@@
static void assert_eol(struct uci_context *ctx, char **str)
}
}
}
}
+/*
+ * parse the 'config' uci command (open a section)
+ */
static void uci_parse_config(struct uci_context *ctx, char **str)
{
char *type, *name;
static void uci_parse_config(struct uci_context *ctx, char **str)
{
char *type, *name;
@@
-188,6
+211,9
@@
static void uci_parse_config(struct uci_context *ctx, char **str)
DPRINTF("Section<%s>: %s\n", type, name);
}
DPRINTF("Section<%s>: %s\n", type, name);
}
+/*
+ * parse the 'option' uci command (open a value)
+ */
static void uci_parse_option(struct uci_context *ctx, char **str)
{
char *name, *value;
static void uci_parse_option(struct uci_context *ctx, char **str)
{
char *name, *value;
@@
-201,6
+227,9
@@
static void uci_parse_option(struct uci_context *ctx, char **str)
DPRINTF("\tOption: %s=\"%s\"\n", name, value);
}
DPRINTF("\tOption: %s=\"%s\"\n", name, value);
}
+/*
+ * parse a complete input line, split up combined commands by ';'
+ */
static void uci_parse_line(struct uci_context *ctx)
{
struct uci_parse_context *pctx = ctx->pctx;
static void uci_parse_line(struct uci_context *ctx)
{
struct uci_parse_context *pctx = ctx->pctx;
diff --git
a/test.c
b/test.c
index
9b0b106
..
44e2dc8
100644
(file)
--- a/
test.c
+++ b/
test.c
@@
-1,5
+1,4
@@
/*
/*
- * libuci - Library for the Unified Configuration Interface
* Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify
* Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify