feat: added shutdown command

This commit is contained in:
2021-03-03 22:12:37 +01:00
parent c9102fbc65
commit 300e80c2e8
6 changed files with 71 additions and 25 deletions

View File

@@ -19,6 +19,7 @@
#include <libc/readline.h>
#include <libc/libc.h>
#include <attributes.h>
#include <util/power.h>
#define BOOTLOADER_NAME_MAX_LENGTH 64
#define CMDLINE_MAX_LENGTH 256
@@ -39,16 +40,23 @@ void ide(const char *arg);
void echo(const char *arg);
void help(const char *arg);
void help(const char *args);
void shutdown(const char *args);
cmd_handler cmd_handlers[] = {
{"help\0", help},
{"echo\0", echo},
{"print\0", print},
{"ide\0", ide},
{"help\0", help},
{"echo\0", echo},
{"print\0", print},
{"ide\0", ide},
{"shutdown", shutdown},
{NULL, NULL},
};
void shutdown(const char *args) {
power_shutdown();
}
void print_bootinfo() {
printf("Bootloader name: %s\n"
"cmdline: %s\n",
@@ -124,7 +132,7 @@ void store_bootloader_info(multiboot_info_t *multiboot_info) {
}
}
void noreturn main_loop(void* data) {
void noreturn main_loop(void *data) {
while (true) {
char *msg = readline(NULL);
char *args = strchr(msg, ' ');