feat: added shutdown command
This commit is contained in:
@@ -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, ' ');
|
||||
|
||||
Reference in New Issue
Block a user