Add internal command echo
This commit is contained in:
parent
858eb84444
commit
ace246133e
2
makefile
2
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)')
|
||||
|
13
src/icmd.c
13
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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user