Update main.c
changed indendation and declared and initialized yyin after file opening
This commit is contained in:
parent
520520e576
commit
5f53d1dce4
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue