diff options
author | dzwdz | 2023-09-22 23:42:30 +0200 |
---|---|---|
committer | dzwdz | 2023-09-22 23:42:30 +0200 |
commit | 6a4d4a41a664e6a4c406a449ea847abd4a224bcf (patch) | |
tree | 0a637697c8697929beb8f4b7ff69d8b74f9e28bb /src/cmd/testelf/main.c | |
parent | a3d6aa9f8d427b86a33dc05bed98a2e88229a285 (diff) |
build: support single file commands
Diffstat (limited to 'src/cmd/testelf/main.c')
-rw-r--r-- | src/cmd/testelf/main.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/cmd/testelf/main.c b/src/cmd/testelf/main.c deleted file mode 100644 index 0cbe56c..0000000 --- a/src/cmd/testelf/main.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <err.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -const char *str = "Hello!", *str2 = "World."; - -int main(int argc, char **argv) { - printf("elftest's &main == %p\n", &main); - printf("%s %s\n", str, str2); - printf("argc == %u\n", argc); - for (int i = 0; i < argc; i++) - printf("argv[%u] == %p == \"%s\"\n", i, argv[i], argv[i]); - if (argv[1] && strcmp(argv[1], "stackexec") == 0) { - /* exec something with arguments on the stack */ - const char s_d[] = "I am a pretty long string on the stack. Oh my. " \ - "I hope I won't get corrupted.\0"; - char s[sizeof(s_d)]; - memcpy(s, s_d, sizeof(s_d)); - const char *argv2[] = {"/bin/testelf", s, s, "hello", s, s, s, "lol", NULL}; - printf("argv2 == %p, s == %p\n== exec ==\n", argv2, s); - execv((void*)argv2[0], (void*)argv2); - err(1, "execv"); - } - return 0; -} |