Fix -p option parsing and handling

pull/9/head
Scott Allen 8 years ago
parent c8a8175990
commit 45246a6c9a
  1. 10
      miditones.c

@ -494,8 +494,10 @@ does not start with a dash or a slash*/
goto opterror; goto opterror;
break; break;
case 'P': case 'P':
if (argv[i][2] == '\0') if (argv[i][2] == '\0') {
parseonly = true; parseonly = true;
break;
}
else if (toupper (argv[i][2]) == 'I') else if (toupper (argv[i][2]) == 'I')
percussion_ignore = true; percussion_ignore = true;
else if (toupper (argv[i][2]) == 'T') else if (toupper (argv[i][2]) == 'T')
@ -1119,7 +1121,7 @@ int main (int argc, char *argv[]) {
This is not unlike multiway merging used for tape sorting algoritms in the 50's! */ This is not unlike multiway merging used for tape sorting algoritms in the 50's! */
tracknum = 0; tracknum = 0;
if (!parseonly) if (!parseonly) {
do { /* while there are still track notes to process */ do { /* while there are still track notes to process */
struct track_status *trk; struct track_status *trk;
struct tonegen_status *tg; struct tonegen_status *tg;
@ -1331,7 +1333,6 @@ This is not unlike multiway merging used for tape sorting algoritms in the 50's!
} /* !parseonly do */ } /* !parseonly do */
while (tracks_done < num_tracks); while (tracks_done < num_tracks);
if (!parseonly) {
// generate the end-of-score command and some commentary // generate the end-of-score command and some commentary
if (binaryoutput) if (binaryoutput)
putc (CMD_STOP, outfile); putc (CMD_STOP, outfile);
@ -1353,7 +1354,6 @@ This is not unlike multiway merging used for tape sorting algoritms in the 50's!
if (loggen) if (loggen)
fprintf (logfile, "%d note-on commands, %d instrument changes.\n", fprintf (logfile, "%d note-on commands, %d instrument changes.\n",
note_on_commands, instrument_changes); note_on_commands, instrument_changes);
}
if (do_header) { // rewrite the file header with the actual number of tone generators used if (do_header) { // rewrite the file header with the actual number of tone generators used
if (fseek (outfile, file_header_num_tgens_position, SEEK_SET) != 0) if (fseek (outfile, file_header_num_tgens_position, SEEK_SET) != 0)
fprintf (stderr, "Can't seek to number of tone generators in the header\n"); fprintf (stderr, "Can't seek to number of tone generators in the header\n");
@ -1365,6 +1365,8 @@ This is not unlike multiway merging used for tape sorting algoritms in the 50's!
} }
} }
fclose (outfile); fclose (outfile);
} /* if (!parseonly) */
if (loggen || logparse) if (loggen || logparse)
fclose (logfile); fclose (logfile);
printf (" Done.\n"); printf (" Done.\n");

Loading…
Cancel
Save