add help option

This commit is contained in:
Joseph Poirier 2015-06-16 22:49:54 -05:00
parent 68c470a275
commit e3e4ca1d68

13
picoc.c
View file

@ -23,13 +23,14 @@ int main(int argc, char **argv)
int StackSize = getenv("STACKSIZE") ? atoi(getenv("STACKSIZE")) : PICOC_STACK_SIZE;
Picoc pc;
if (argc < 2) {
if (argc < 2 || strcmp(argv[ParamCount], "-h") == 0) {
printf(PICOC_VERSION " \n"
"Format: picoc <file1.c>... [- <arg1>...] : run a program (calls main() to start it)\n"
" picoc -s <file1.c>... [- <arg1>...] : script mode - runs the program without calling main()\n"
" picoc -i : interactive mode (Ctrl+D to exit)\n"
" picoc -c : print the copyright info to stdout\n");
exit(1);
"Format: picoc <file1.c>... [- <arg1>...] : run a program, calls main() as the entry point\n"
" picoc -s <file1.c>... [- <arg1>...] : run a script, runs the program without calling main()\n"
" picoc -i : interactive mode, Ctrl+d to exit\n"
" picoc -c : copyright info\n"
" picoc -h : this help message\n");
return 0;
}
if (strcmp(argv[ParamCount], "-c") == 0) {