Skip to content

Commit

Permalink
shutdown command -r option complete #125
Browse files Browse the repository at this point in the history
  • Loading branch information
double-fault committed Feb 4, 2017
1 parent 456895e commit f616da3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sbin/shutdown/shutdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <stdio/stdio.h>
#include <stdlib/stdlib.h>
#include <string/string.h>
#include <ctype/ctype.h>
#include <io/io.h>
#include <misc/asm_util.h>
#include <sys/sys_poweroff.h>
Expand Down Expand Up @@ -75,6 +76,16 @@ int cmd_shutdown_handler(char* cmd)
}
else
{
//First checking if the string contains an alphabet
for (int i = 0; i < (int)strlen (opts [2].str); i ++)
{
if (isalpha (opts [2].str [i]))
{
printk (cmd_shutdown.invalid_use_msg);
return STATUS_OK;
}
}

time = atoi (opts [2].str);
}

Expand Down Expand Up @@ -105,6 +116,10 @@ int cmd_shutdown_handler(char* cmd)

cmds [CMD_REBOOT_INDEX]->handler ("reboot");
}
else if (time == 0)
{
cmds [CMD_REBOOT_INDEX]->handler ("reboot");
}
}
else
{
Expand Down

0 comments on commit f616da3

Please sign in to comment.