aboutsummaryrefslogtreecommitdiff
path: root/user/usr/bin/tests/elf_test-64.c
diff options
context:
space:
mode:
authornthnluu <nate1299@me.com>2024-01-28 21:20:27 -0500
committernthnluu <nate1299@me.com>2024-01-28 21:20:27 -0500
commitc63f340d90800895f007de64b7d2d14624263331 (patch)
tree2c0849fa597dd6da831c8707b6f2603403778d7b /user/usr/bin/tests/elf_test-64.c
Created student weenix repository
Diffstat (limited to 'user/usr/bin/tests/elf_test-64.c')
-rw-r--r--user/usr/bin/tests/elf_test-64.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/user/usr/bin/tests/elf_test-64.c b/user/usr/bin/tests/elf_test-64.c
new file mode 100644
index 0000000..9385ac1
--- /dev/null
+++ b/user/usr/bin/tests/elf_test-64.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+
+typedef struct
+{
+ long int a_type; /* Entry type */
+ union {
+ long int a_val; /* Integer value */
+ void *a_ptr; /* Pointer value */
+ void (*a_fcn)(void); /* Function pointer value */
+ } a_un;
+} Elf64_auxv_t;
+
+int main(int argc, char **argv, char **envp, Elf64_auxv_t *auxv)
+{
+ // print argument count
+ printf("argc: %d\n", argc);
+
+ // print argument vector
+ int i;
+ for (i = 0; argv[i] != 0; i++)
+ {
+ printf("argv[%d] (%p): %s\n", i, argv[i], argv[i]);
+ }
+
+ // print environment vector
+ for (i = 0; envp[i] != 0; i++)
+ {
+ printf("envp[%d] (%p): %s\n", i, envp[i], envp[i]);
+ }
+
+ // print auxiliary vector
+ for (i = 0; auxv[i].a_type != 0; i++)
+ {
+ printf("auxv[%d]: type %ld\n", i, auxv[i].a_type);
+ }
+
+ return 0;
+} \ No newline at end of file