Merge remote-tracking branch 'origin/d6/binary' into d6/binary

This commit is contained in:
~d6 2024-04-18 14:22:49 -04:00
commit 055829dc07
1 changed files with 14 additions and 4 deletions

View File

@ -217,12 +217,22 @@ main(int argc, char **argv)
{ {
FILE *f; FILE *f;
char c, *w = bank_a; char c, *w = bank_a;
int i;
if(argc < 2) if(argc < 2)
return !printf("usage: modal [-v] source.modal\n"); return !printf("usage: modal [-v] source.modal\n");
if(argc < 3 && argv[1][0] == '-' && argv[1][1] == 'v') for(i = 1; i < argc && argv[i][0] == '-'; i++) {
if(argv[i][1] == 'v') {
return !printf("Modal Interpreter, 17 Apr 2024.\n"); return !printf("Modal Interpreter, 17 Apr 2024.\n");
if(!(f = fopen(argv[1], "r"))) } else if(argv[i][1] == 'q') {
return !fprintf(stderr, "Invalid Modal file: %s.\n", argv[1]); fclose(stderr);
} else if(argv[i][1] == 'n') {
cycles = 0xffffffff;
} else {
break;
}
}
if(!(f = fopen(argv[i], "r")))
return !fprintf(stderr, "Invalid Modal file: %s.\n", argv[i]);
while(fread(&c, 1, 1, f)) { while(fread(&c, 1, 1, f)) {
c = c <= 0x20 ? 0x20 : c; c = c <= 0x20 ? 0x20 : c;
if(w > bank_a) { if(w > bank_a) {