summaryrefslogtreecommitdiff
path: root/klibc/klibc/tests/environ.c
diff options
context:
space:
mode:
Diffstat (limited to 'klibc/klibc/tests/environ.c')
-rw-r--r--klibc/klibc/tests/environ.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/klibc/klibc/tests/environ.c b/klibc/klibc/tests/environ.c
new file mode 100644
index 0000000000..6eeeb9197e
--- /dev/null
+++ b/klibc/klibc/tests/environ.c
@@ -0,0 +1,24 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[], char *envp[])
+{
+ int i;
+
+ /* Verify envp == environ */
+ printf("Verifying envp == environ... %s\n",
+ (envp == environ) ? "ok" : "ERROR");
+
+ /* Test argc/argv */
+ printf("argc = %d, argv = %p\n", argc, argv);
+ for ( i = 0 ; i < argc ; i++ ) {
+ printf("argv[%2d] = %s\n", i, argv[i]);
+ }
+
+ /* Test environ */
+ for ( i = 0 ; envp[i] ; i++ )
+ printf("%s\n", envp[i]);
+
+ return 0;
+}