Separate echo from shell
This commit is contained in:
parent
0804766a40
commit
0a11ea3e50
@ -175,6 +175,7 @@ SConscript('lib/libc/SConscript', variant_dir='build/lib/libc')
|
||||
#SConscript('lib/liblwip/SConscript', variant_dir='build/lib/liblwip')
|
||||
SConscript('bin/cat/SConscript', variant_dir='build/bin/cat')
|
||||
SConscript('bin/date/SConscript', variant_dir='build/bin/date')
|
||||
SConscript('bin/echo/SConscript', variant_dir='build/bin/echo')
|
||||
SConscript('bin/ethdump/SConscript', variant_dir='build/bin/ethdump')
|
||||
SConscript('bin/ethinject/SConscript', variant_dir='build/bin/ethinject')
|
||||
SConscript('bin/ls/SConscript', variant_dir='build/bin/ls')
|
||||
@ -203,6 +204,7 @@ if env["BOOTDISK"] == "1":
|
||||
Depends(bootdisk, "#build/tools/newfs_o2fs/newfs_o2fs")
|
||||
Depends(bootdisk, "#build/bin/cat/cat")
|
||||
Depends(bootdisk, "#build/bin/date/date")
|
||||
Depends(bootdisk, "#build/bin/echo/echo")
|
||||
Depends(bootdisk, "#build/bin/ethdump/ethdump")
|
||||
Depends(bootdisk, "#build/bin/ethinject/ethinject")
|
||||
Depends(bootdisk, "#build/bin/ls/ls")
|
||||
|
23
bin/echo/SConscript
Normal file
23
bin/echo/SConscript
Normal file
@ -0,0 +1,23 @@
|
||||
import sys
|
||||
|
||||
Import('env')
|
||||
|
||||
init_env = env.Clone()
|
||||
|
||||
src = [ ]
|
||||
|
||||
src_common = [
|
||||
"echo.c"
|
||||
]
|
||||
|
||||
src.append(env["CRTBEGIN"])
|
||||
src.append(src_common)
|
||||
src.append(env["CRTEND"])
|
||||
|
||||
init_env.Append(LINKFLAGS = ['-nostdlib'])
|
||||
init_env.Append(CPPFLAGS = ['-fno-builtin', '-nostdinc'])
|
||||
init_env.Append(CPPPATH = ['#build/include'])
|
||||
init_env.Append(LIBPATH = ['#build/lib/libc'], LIBS = ['c'])
|
||||
|
||||
init_env.Program("echo", src)
|
||||
|
14
bin/echo/echo.c
Normal file
14
bin/echo/echo.c
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
for (int i = 0; i < argc; i++)
|
||||
printf("%s ", argv[i]);
|
||||
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,23 +32,10 @@ void
|
||||
Cmd_Help(int argc, const char *argv[])
|
||||
{
|
||||
printf("bkpt Trigger a kernel breakpoint\n");
|
||||
printf("echo Echo arguments\n");
|
||||
printf("exit Exit shell\n");
|
||||
printf("help Display the list of commands\n");
|
||||
}
|
||||
|
||||
void
|
||||
Cmd_Echo(int argc, const char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
printf("%s ", argv[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
const char *searchpath[] = {
|
||||
"",
|
||||
"/sbin/",
|
||||
@ -125,8 +112,6 @@ DispatchCommand(char *buf)
|
||||
Cmd_Help(argc, (const char **)argv);
|
||||
} else if (strcmp(argv[0], "bkpt") == 0) {
|
||||
asm volatile("int3");
|
||||
} else if (strcmp(argv[0], "echo") == 0) {
|
||||
Cmd_Echo(argc, (const char **)argv);
|
||||
} else if (strcmp(argv[0], "exit") == 0) {
|
||||
exit(0);
|
||||
} else if (strcmp(argv[0], "#") == 0) {
|
||||
|
@ -7,6 +7,7 @@ DIR /
|
||||
DIR bin
|
||||
FILE cat build/bin/cat/cat
|
||||
FILE date build/bin/date/date
|
||||
FILE echo build/bin/echo/echo
|
||||
FILE ethdump build/bin/ethdump/ethdump
|
||||
FILE ethinject build/bin/ethinject/ethinject
|
||||
FILE ls build/bin/ls/ls
|
||||
|
Loading…
Reference in New Issue
Block a user