cbmem: Exit with an errorlevel of 0 after printing help

cbmem --help should not return an error to the OS.

Change-Id: Id00091c679dbb109bc352cf8a81d67c2ae5666ec
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/16574
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Martin Roth 2016-09-11 15:43:22 -06:00
parent fbce31a2cc
commit 8448ac47d2
1 changed files with 5 additions and 4 deletions

View File

@ -886,7 +886,7 @@ static void print_version(void)
"GNU General Public License for more details.\n\n"); "GNU General Public License for more details.\n\n");
} }
static void print_usage(const char *name) static void print_usage(const char *name, int exit_code)
{ {
printf("usage: %s [-cCltTxVvh?]\n", name); printf("usage: %s [-cCltTxVvh?]\n", name);
printf("\n" printf("\n"
@ -901,7 +901,7 @@ static void print_usage(const char *name)
" -v | --version: print the version\n" " -v | --version: print the version\n"
" -h | --help: print this help\n" " -h | --help: print this help\n"
"\n"); "\n");
exit(1); exit(exit_code);
} }
#ifdef __arm__ #ifdef __arm__
@ -1086,10 +1086,11 @@ int main(int argc, char** argv)
exit(0); exit(0);
break; break;
case 'h': case 'h':
print_usage(argv[0], 0);
break;
case '?': case '?':
default: default:
print_usage(argv[0]); print_usage(argv[0], 1);
exit(0);
break; break;
} }
} }