diff --git a/makefile b/makefile index 0340e78..6e87810 100644 --- a/makefile +++ b/makefile @@ -12,7 +12,7 @@ CC = gcc LD = gcc LDFLAGS = -lm -lpthread -CCFLAGS = -std=gnu99 -g -ggdb -Og -Wall -Wextra -pedantic +CCFLAGS = -std=gnu99 -g -ggdb -Og -Wall -Wextra -pedantic -Wno-unused-parameter SRCTREE = $(shell find $(SRCDIR) -type d) INCS = $(shell find $(INCDIR) -type f -name '*$(INCEXT)') diff --git a/src/icmd.c b/src/icmd.c index ef9a603..8683c09 100644 --- a/src/icmd.c +++ b/src/icmd.c @@ -32,6 +32,7 @@ struct icmd } g_icmds[] = { ICMD(help), + ICMD(echo), ICMD(exit), ICMD(cls), ICMD(cd), @@ -98,6 +99,18 @@ icmd_help(int argc, char **argv) } +int +icmd_echo(int argc, char **argv) +{ + int i; + + for (i = 1; i < argc; i++) + printf("%s%c", argv[i], (argc - i != 1) ? ' ' : '\n'); + + return 0; +} + + int icmd_exit(int argc, char **argv) { diff --git a/src/icmd.h b/src/icmd.h index 1cfe9d1..8e2f609 100644 --- a/src/icmd.h +++ b/src/icmd.h @@ -8,6 +8,7 @@ int call_icmd(int argc, char **argv); /* internal commands */ int icmd_help(int argc, char **argv); +int icmd_echo(int argc, char **argv); int icmd_exit(int argc, char **argv); int icmd_cls(int argc, char **argv); int icmd_cd(int argc, char **argv);