Skip to content

Commit

Permalink
Update testargv.c to work on older compilers, added 16-bit .exe of it.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 8, 2018
1 parent 085b1c7 commit d82dd93
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions tests/testargv.c
@@ -1,20 +1,23 @@
#include <stdio.h>

int main(int argc, char **argv, char **envp) {
int i;

printf("Command line: (argc == %d)\n", argc);
for (i = 0; i <= argc; i++) {
printf("argv[%d] = '%s'\n", i, argv[i]);
} // for

printf("\nEnvironment:\n");
for (i = 0; envp[i]; i++) {
printf("envp[%d] = '%s'\n", i, envp[i]);
} // for

return 0;
} // main

// end of testargv.c ...

#include <stdio.h>

extern char **environ;

int main(int argc, char **argv) {
int i;
char **envp = environ;

printf("Command line: (argc == %d)\n", argc);
for (i = 0; i <= argc; i++) {
printf("argv[%d] = '%s'\n", i, argv[i] ? argv[i] : "(null)");
} // for

printf("\nEnvironment:\n");
for (i = 0; envp[i]; i++) {
printf("envp[%d] = '%s'\n", i, envp[i] ? envp[i] : "(null)");
} // for

return 0;
} // main

// end of testargv.c ...

Binary file added tests/testargv16.exe
Binary file not shown.

0 comments on commit d82dd93

Please sign in to comment.