Add CLI arguments

This commit is contained in:
Miloslav Ciz 2025-03-05 17:10:01 +01:00
parent 5c8e4c4c2b
commit ffbc647024
5 changed files with 70 additions and 3 deletions

View file

@ -115,10 +115,34 @@ void LCR_log(const char *str)
printf("LOG: %s\n",str);
}
void printHelp(void)
{
printf(
"Licar, 3D racing game, version " LCR_VERSION ", arguments:\n"
" -h print help and quit\n"
LCR_ARG_HELP_STR);
}
int main(int argc, char *argv[])
{
uint8_t running = 1;
for (int i = 0; i < argc; ++i)
if (argv[i][0] == '-')
switch (argv[i][1])
{
case 'h':
if (argv[i][2] == 0)
{
printHelp();
return 0;
}
break;
default: break;
}
dataFile = fopen(DATA_FILE_NAME,"r");
if (!dataFile)