diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-07-09 09:25:15 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-07-09 13:38:24 -0700 |
commit | 2260adb1b956dcb2a526bf3eca5adc3fdeabf465 (patch) | |
tree | bf31b3dfee7b338a1dd317384781e300ae34203e /common/system_common.c | |
parent | 0249b50dd2c27b1c1831bb679bbbf86ec2cf2d3e (diff) | |
download | chrome-ec-2260adb1b956dcb2a526bf3eca5adc3fdeabf465.tar.gz |
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
Diffstat (limited to 'common/system_common.c')
-rw-r--r-- | common/system_common.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/common/system_common.c b/common/system_common.c index 141abcfdb7..0792edcb68 100644 --- a/common/system_common.c +++ b/common/system_common.c @@ -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"); |