VERSION shell command

This commit is contained in:
Arnau Camprubí 2022-06-20 14:17:13 +02:00
pare a930148bee
commit 5ed34dbbe6
S'han modificat 2 arxius amb 13 adicions i 2 eliminacions

Veure arxiu

@ -1,11 +1,13 @@
# CONFIG #
OS_VERSION = "\"dev\""
BUILD_DIR ?= $(abspath build/)
TARGET = i686-elf
TARGET_ASM = nasm
TARGET_ASMFLAGS =
TARGET_CFLAGS = -std=c99 -g
TARGET_CFLAGS = -std=c99 -g -DOS_VERSION=$(OS_VERSION)
TARGET_CC = $(TARGET)-gcc
TARGET_CXX = $(TARGET)-g++
TARGET_LD = $(TARGET)-gcc

Veure arxiu

@ -3,11 +3,20 @@
#include "lib/string.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{
printf("SHELL: Unknown command \"%s\"\n", cmd);
return 127;
ret = 127;
}
puts("\x1b[0m");
return ret;
}