toaruos/userspace/argv-tester.c
Kevin Lange c88d6dcb4f Add or update the heading comments for user apps.
Adds useful descriptions to ones that were lacking them, updates ones
that were innacurate, etc.
2012-07-06 21:08:28 -07:00

27 lines
547 B
C

/*
* Argument processing test tool.
*
* Usage:
* Run as ./argv-tester herp derp etc.
* Evaluate the arguments as they are printed to verify
* they match the input that you provided.
*/
#include <stdio.h>
int main(int argc, char * argv[]) {
printf("argc = %d\n", argc);
for (int i = 0; i < argc; ++i) {
printf("%p argv[%d]= %s\n", argv[i], i, argv[i]);
}
printf("continuing until I hit a 0\n");
int i = argc;
while (1) {
printf("argv[%d] = 0x%x\n", i, argv[i]);
if (argv[i] == 0) {
break;
}
i++;
}
return 0;
}