Add check if input file specified and if it exists

This commit is contained in:
g1n 2021-10-08 16:56:50 +03:00
parent 021a46c4aa
commit 05f5bf4dcd
1 changed files with 8 additions and 1 deletions

View File

@ -159,9 +159,16 @@ void execute() {
}
}
int main(int argc, char *argv[]) {
if (argc < 2) {
printf("%s: No input file specified\n", "yemu");
return 1;
}
reset();
// TODO make loading from rom
FILE *infile = fopen(argv[1], "rb");
if (infile == NULL) {
perror("yemu");
return 1;
}
char ch;
int pos = 0;
while (1) { // FIXME