shell: implement version command

This commit is contained in:
S.J.R. van Schaik 2017-07-27 10:51:54 +02:00
parent 149281f694
commit 6570ab27c9
3 changed files with 20 additions and 0 deletions

View file

@ -12,6 +12,7 @@ all: $(BUILD)/tbm
-include scripts/Makefile.${TARGET}
CFLAGS += -DTBM_VERSION=\"2017-07-27-dev\"
CFLAGS += -Iinclude
CFLAGS += -Wall -Wundef -Wextra -Wshadow -Wimplicit-function-declaration
CFLAGS += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -pedantic
@ -47,6 +48,7 @@ obj-y += source/shell/flash.o
obj-y += source/shell/ftl.o
obj-y += source/shell/mufs.o
obj-y += source/shell/rtc.o
obj-y += source/shell/version.o
obj = $(addprefix $(BUILD)/, $(obj-y))

3
include/shell/version.h Normal file
View file

@ -0,0 +1,3 @@
#pragma once
void shell_version(struct console *con, const char **argv, size_t argc);

15
source/shell/version.c Normal file
View file

@ -0,0 +1,15 @@
#include <stdio.h>
#include <console.h>
#include <shell/version.h>
void shell_version(struct console *con, const char **argv, size_t argc)
{
(void)argv;
if (argc < 1)
return;
fprintf(con->fp, "hello,%s\n", TBM_VERSION);
}