aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBangLang Huang <banglang.huang@foxmail.com>2017-02-24 10:45:16 +0800
committerJo-Philipp Wich <jo@mein.io>2017-12-13 16:23:39 +0100
commitc446ee4ad42731ef99cbefee7dcc2bcab1c26566 (patch)
tree3b2184947962bf5e89d6af7499eeebb93ab4917e
parent9e84d333b19abdfe5effd276421217a64dd98078 (diff)
downloadupstream-c446ee4ad42731ef99cbefee7dcc2bcab1c26566.tar.gz
upstream-c446ee4ad42731ef99cbefee7dcc2bcab1c26566.tar.bz2
upstream-c446ee4ad42731ef99cbefee7dcc2bcab1c26566.zip
nvram: add usage() function
Merge the help message into a single function, so that we can use it somewhere else. Signed-off-by: BangLang Huang <banglang.huang@foxmail.com> (cherry picked from commit 2a253e7cdbacd1bd19da80ea6f35a93b42655c3b)
-rw-r--r--package/utils/nvram/src/cli.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/package/utils/nvram/src/cli.c b/package/utils/nvram/src/cli.c
index 4f9c77804d..149d307474 100644
--- a/package/utils/nvram/src/cli.c
+++ b/package/utils/nvram/src/cli.c
@@ -133,6 +133,18 @@ static int do_info(nvram_handle_t *nvram)
return 0;
}
+static void usage(void)
+{
+ fprintf(stderr,
+ "Usage:\n"
+ " nvram show\n"
+ " nvram info\n"
+ " nvram get variable\n"
+ " nvram set variable=value [set ...]\n"
+ " nvram unset variable [unset ...]\n"
+ " nvram commit\n"
+ );
+}
int main( int argc, const char *argv[] )
{
@@ -233,16 +245,7 @@ int main( int argc, const char *argv[] )
}
else if( !done )
{
- fprintf(stderr,
- "Usage:\n"
- " nvram show\n"
- " nvram info\n"
- " nvram get variable\n"
- " nvram set variable=value [set ...]\n"
- " nvram unset variable [unset ...]\n"
- " nvram commit\n"
- );
-
+ usage();
stat = 1;
}