From: Felix Fietkau Date: Sun, 20 Jan 2008 21:16:59 +0000 (+0100) Subject: add support for listing config files X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fuci.git;a=commitdiff_plain;h=99981540182c29049e971a3cb9a772d7f107b2ab add support for listing config files --- diff --git a/.gitignore b/.gitignore index 5d893ce..fabbfaa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -parsetest -*.o +uci +*.[oa] .*.swp diff --git a/Makefile b/Makefile index 645ec65..ec382ed 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,21 @@ +COPTS=-g -O2 +CFLAGS=$(COPTS) -Wall -pedantic -std=gnu99 -Wno-unused -Werror + +AR=ar CC=gcc -CFLAGS=-g -O2 -Wall -pedantic -std=gnu99 -Wno-unused -Werror +RANLIB=ranlib + +all: uci -all: parsetest -parsetest: libuci.o test.o +cli.o: cli.c uci.h +uci: cli.o libuci.a $(CC) $(CFLAGS) -o $@ $^ libuci.o: libuci.c parse.c uci.h list.c err.h -test.o: test.c uci.h +libuci.a: libuci.o + rm -f $@ + $(AR) rc $@ $^ + $(RANLIB) $@ clean: - rm -f parsetest *.o + rm -f uci *.[oa] diff --git a/cli.c b/cli.c new file mode 100644 index 0000000..d83e257 --- /dev/null +++ b/cli.c @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2008 Felix Fietkau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include +#include +#include "uci.h" + +static struct uci_context *ctx; + +static void uci_usage(int argc, char **argv) +{ + fprintf(stderr, + "Usage: %s [options] [arguments]\n\n" + "Commands:\n" + "\tshow [[.
[.