From e49cd53e159a2481612d6040e68657ce20750c3b Mon Sep 17 00:00:00 2001 From: jow Date: Sun, 2 May 2010 00:45:51 +0000 Subject: [PATCH] [backfire] merge r21288 git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@21289 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/nvram/Makefile | 2 +- package/nvram/src/cli.c | 38 +++++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/package/nvram/Makefile b/package/nvram/Makefile index 6ac11a9be..f064b5fe3 100644 --- a/package/nvram/Makefile +++ b/package/nvram/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nvram -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/nvram/src/cli.c b/package/nvram/src/cli.c index 953910cd6..44d4b88fd 100644 --- a/package/nvram/src/cli.c +++ b/package/nvram/src/cli.c @@ -165,20 +165,32 @@ int main( int argc, const char *argv[] ) stat = do_info(nvram); done++; } - else if( !strcmp(argv[i], "get") && ++i < argc ) + else if( !strcmp(argv[i], "get") || !strcmp(argv[i], "unset") || !strcmp(argv[i], "set") ) { - stat = do_get(nvram, argv[i]); - done++; - } - else if( !strcmp(argv[i], "unset") && ++i < argc ) - { - stat = do_unset(nvram, argv[i]); - done++; - } - else if( !strcmp(argv[i], "set") && ++i < argc ) - { - stat = do_set(nvram, argv[i]); - done++; + if( (i+1) < argc ) + { + switch(argv[i++][0]) + { + case 'g': + stat = do_get(nvram, argv[i]); + break; + + case 'u': + stat = do_unset(nvram, argv[i]); + break; + + case 's': + stat = do_set(nvram, argv[i]); + break; + } + done++; + } + else + { + fprintf(stderr, "Command '%s' requires an argument!\n", argv[i]); + done = 0; + break; + } } else if( !strcmp(argv[i], "commit") ) {