Better arg checking for reboot command

Allows 'reboot cold' as an alias for 'reboot hard', since I keep
mis-typing that anyway.  Returns error for any other option.
('reboot' by itself still does a warm reboot).

BUG=none
TEST=manual

reboot -> does warm reboot
reboot hard -> does hard reboot (reason = rtc alarm)
reboot cold -> ditto
reboot foo -> prints error

Change-Id: I183714d4ba09abee3bd9a6f0d5df82389becf410
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26924
This commit is contained in:
Randall Spangler
2012-07-09 09:25:15 -07:00
committed by Gerrit
parent 0249b50dd2
commit 2260adb1b9

View File

@@ -652,9 +652,13 @@ static int command_reboot(int argc, char **argv)
{
int is_hard = 0;
if (argc == 2 && !strcasecmp(argv[1], "hard")) {
ccputs("Hard-");
is_hard = 1;
if (argc == 2) {
if (!strcasecmp(argv[1], "hard") ||
!strcasecmp(argv[1], "cold")) {
ccputs("Hard-");
is_hard = 1;
} else
return EC_ERROR_PARAM1;
}
ccputs("Rebooting!\n\n\n");