(uxnasm.c) Add check for missing output file

This commit is contained in:
Capital 2023-11-03 19:31:42 -04:00 committed by neauoire
parent 798ebafdc8
commit 76732db18a
1 changed files with 3 additions and 3 deletions

View File

@ -498,10 +498,10 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
FILE *src, *dst; FILE *src, *dst;
if(argc == 1) if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'v')
return error("usage", "uxnasm [-v] input.tal output.rom");
if(argv[1][0] == '-' && argv[1][1] == 'v')
return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 27 Oct 2023.\n"); return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 27 Oct 2023.\n");
if (argc != 3)
return error("usage", "uxnasm [-v] input.tal output.rom");
if(!(src = fopen(argv[1], "r"))) if(!(src = fopen(argv[1], "r")))
return !error("Invalid input", argv[1]); return !error("Invalid input", argv[1]);
if(!assemble(src)) if(!assemble(src))