quark/src/kernel/shell.c
Arnau Camprubí 109b5b17a1 Added debug_printf()
The debug_printf() function works just as any printf-like function. It prints to the serial port using ANSI coloring. Also, debug_vprintf() was implemented, which takes arguments as a va_list instead of as variadic arguments.
2022-08-07 21:58:36 +02:00

30 líneas
587 B
C

#include "shell.h"
#include "lib/stdio.h"
#include "lib/string.h"
#include "lib/memory.h"
int shell_run(char *cmd){
int ret = 0;
puts("\x1b[32m");
if(!strcmp(cmd, "hello")){
printf("Hello!\n");
}
else if(!strcmp(cmd, "version")){
printf("%s\n", OS_VERSION);
}
else if(!strcmp(cmd, "clear")){
clear_screen();
}
else if(!strcmp(cmd, "serial")){
serial_printf("Hello world!\n");
}
else{
printf("SHELL: Unknown command \"%s\"\n", cmd);
ret = 127;
}
puts("\x1b[0m");
return ret;
}