Update main.c

changed indendation and declared and initialized yyin after file opening
This commit is contained in:
SirTalksalot75 2024-04-25 14:02:12 +02:00 committed by GitHub
parent 520520e576
commit 5f53d1dce4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -41,12 +41,12 @@ void setup(void)
// actual setup // actual setup
DEBUG("finished starting up gemstone..."); DEBUG("finished starting up gemstone...");
atexit(close_file(filename));
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
setup(); setup();
atexit(close_file(filename));
// Check for file input as argument // Check for file input as argument
if (2 != argc) if (2 != argc)
@ -58,13 +58,14 @@ int main(int argc, char *argv[]) {
// filename as first argument // filename as first argument
char *filename = argv[1]; char *filename = argv[1];
FILE *file = fopen(filename, "r");
if (NULL == file) if (NULL == file)
{ {
PANIC("File couldn't be opened!"); PANIC("File couldn't be opened!");
} }
FILE *file = fopen(filename, "r");
*file = yyin;
yyparse(); yyparse();
return 0; return 0;