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 2a253e7cdb)
This commit is contained in:
BangLang Huang 2017-02-24 10:45:16 +08:00 committed by Jo-Philipp Wich
parent 9e84d333b1
commit c446ee4ad4
1 changed files with 13 additions and 10 deletions

View File

@ -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;
}