From 6dcf58a25dbe9a44a7490c923c06f5e7c713c4df Mon Sep 17 00:00:00 2001 From: "S.J.R. van Schaik" Date: Thu, 27 Jul 2017 10:44:52 +0200 Subject: [PATCH] shell: implement echo command --- Makefile | 1 + include/shell/echo.h | 3 +++ source/shell/echo.c | 15 +++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 include/shell/echo.h create mode 100644 source/shell/echo.c diff --git a/Makefile b/Makefile index ecd1a5f..129a682 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,7 @@ obj-y += source/ftl/map.o obj-y += source/shell/args.o obj-y += source/shell/cmd.o +obj-y += source/shell/echo.o obj-y += source/shell/flash.o obj-y += source/shell/ftl.o obj-y += source/shell/mufs.o diff --git a/include/shell/echo.h b/include/shell/echo.h new file mode 100644 index 0000000..fd63578 --- /dev/null +++ b/include/shell/echo.h @@ -0,0 +1,3 @@ +#pragma once + +void shell_echo(struct console *con, const char **argv, size_t argc); diff --git a/source/shell/echo.c b/source/shell/echo.c new file mode 100644 index 0000000..2bfe0d5 --- /dev/null +++ b/source/shell/echo.c @@ -0,0 +1,15 @@ +#include + +#include + +#include + +void shell_echo(struct console *con, const char **argv, size_t argc) +{ + if (argc < 1) + return; + + fprintf(con->fp, "%s\n", argv[0]); +} + +