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