1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
--- playmidi-2.4.orig/toy.c
+++ playmidi-2.4/toy.c
@@ -98,7 +98,22 @@
fd_set rdfs;
struct timeval tv, start, now, want;
- while ((i = getopt(argc, argv, "c:p:wt:")) != -1)
+ while ((i = getopt(argc, argv, "c:p:wt:H-:")) != -1)
+ {
+ if (i == 'H')
+ {
+ error = -1;
+ break;
+ }
+ else if (i == '-')
+ {
+ if (optarg && !strcmp (optarg, "help"))
+ {
+ error = -1;
+ break;
+ }
+ fprintf (stderr, "%s: invalid option -- -\n", argv[0]);
+ }
switch (i) {
case 'c':
channel = atoi(optarg);
@@ -116,12 +131,13 @@
error++;
break;
}
+ }
if (error || argc - optind != 2) {
- fprintf(stderr, "usage: %s [-t semitones]"
+ printf( "usage: %s [-t semitones]"
" [-c channel] [-p program] [-wait] "
"inputfile.seq outputfile.seq\n", argv[0]);
- exit(1);
+ exit(error >= 0);
}
if ((seqfd = open(SEQUENCER_DEV, O_RDWR, 0)) < 0) {
perror("open " SEQUENCER_DEV);
|