* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
if (required && !val) {
ctx->pctx->byte = *str - ctx->pctx->buf;
UCI_THROW(ctx, UCI_ERR_PARSE);
if (required && !val) {
ctx->pctx->byte = *str - ctx->pctx->buf;
UCI_THROW(ctx, UCI_ERR_PARSE);
static void assert_eol(struct uci_context *ctx, char **str)
{
char *tmp;
tmp = next_arg(ctx, str, false);
static void assert_eol(struct uci_context *ctx, char **str)
{
char *tmp;
tmp = next_arg(ctx, str, false);
ctx->pctx->byte = tmp - ctx->pctx->buf;
UCI_THROW(ctx, UCI_ERR_PARSE);
}
}
ctx->pctx->byte = tmp - ctx->pctx->buf;
UCI_THROW(ctx, UCI_ERR_PARSE);
}
}
if (!*str) {
ctx->pctx->byte = *str - ctx->pctx->buf;
UCI_THROW(ctx, UCI_ERR_PARSE);
if (!*str) {
ctx->pctx->byte = *str - ctx->pctx->buf;
UCI_THROW(ctx, UCI_ERR_PARSE);
type = next_arg(ctx, str, true);
name = next_arg(ctx, str, false);
type = next_arg(ctx, str, true);
name = next_arg(ctx, str, false);
name = next_arg(ctx, str, true);
value = next_arg(ctx, str, true);
name = next_arg(ctx, str, true);
value = next_arg(ctx, str, true);
for (word = strtok_r(pctx->buf, ";", &brk);
word;
word = strtok_r(NULL, ";", &brk)) {
for (word = strtok_r(pctx->buf, ";", &brk);
word;
word = strtok_r(NULL, ";", &brk)) {
int uci_parse(struct uci_context *ctx, const char *name)
{
struct uci_parse_context *pctx;
int uci_parse(struct uci_context *ctx, const char *name)
{
struct uci_parse_context *pctx;
/* TODO: use /etc/config/ */
pctx->file = fopen(name, "r");
if (!pctx->file)
UCI_THROW(ctx, UCI_ERR_NOTFOUND);
/* TODO: use /etc/config/ */
pctx->file = fopen(name, "r");
if (!pctx->file)
UCI_THROW(ctx, UCI_ERR_NOTFOUND);