diff options
Diffstat (limited to 'src/user/app')
-rw-r--r-- | src/user/app/shell/shell.c | 4 | ||||
-rw-r--r-- | src/user/app/testelf/main.c | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/user/app/shell/shell.c b/src/user/app/shell/shell.c index d002b38..0196d5b 100644 --- a/src/user/app/shell/shell.c +++ b/src/user/app/shell/shell.c @@ -61,7 +61,9 @@ static void execp(const char *cmd) { memcpy(s, "/bin/", 5); memcpy(s + 5, cmd, cmdlen + 1); - execv(s, NULL); + char *argv[] = {(char*)cmd, NULL}; + + execv(s, argv); free(s); } diff --git a/src/user/app/testelf/main.c b/src/user/app/testelf/main.c index a3e54b8..5111791 100644 --- a/src/user/app/testelf/main.c +++ b/src/user/app/testelf/main.c @@ -1,9 +1,12 @@ #include <stdio.h> -const char *str = "Hello!\n", *str2 = "World.\n"; +const char *str = "Hello!", *str2 = "World."; -int main(void) { +int main(int argc, char **argv, char **envp) { printf("elftest's &main == 0x%x\n", &main); - printf("%s%s", str, str2); + printf("%s %s\n", str, str2); + printf("argc == 0x%x\n", argc); + for (int i = 0; i < argc; i++) + printf("argv[0x%x] == 0x%x == \"%s\"\n", i, argv[i], argv[i]); return 0; } |