Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/midiplay if not playing (-q mode), don't call ioctl(...



details:   https://anonhg.NetBSD.org/src/rev/c96478ff923a
branches:  trunk
changeset: 336839:c96478ff923a
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Mar 22 22:47:43 2015 +0000

description:
if not playing (-q mode), don't call ioctl() or try to use the results.
now -q mode works.

diffstat:

 usr.bin/midiplay/midiplay.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r 10f6c899be13 -r c96478ff923a usr.bin/midiplay/midiplay.c
--- a/usr.bin/midiplay/midiplay.c       Sun Mar 22 22:39:05 2015 +0000
+++ b/usr.bin/midiplay/midiplay.c       Sun Mar 22 22:47:43 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: midiplay.c,v 1.29 2011/11/25 01:39:47 jmcneill Exp $   */
+/*     $NetBSD: midiplay.c,v 1.30 2015/03/22 22:47:43 mrg Exp $        */
 
 /*
  * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: midiplay.c,v 1.29 2011/11/25 01:39:47 jmcneill Exp $");
+__RCSID("$NetBSD: midiplay.c,v 1.30 2015/03/22 22:47:43 mrg Exp $");
 #endif
 
 
@@ -404,7 +404,7 @@
 
        /* verify that the requested midi unit exists */
        info.device = unit;
-       if (ioctl(fd, SEQUENCER_INFO, &info) < 0)
+       if (play && ioctl(fd, SEQUENCER_INFO, &info) < 0)
                err(1, "ioctl(SEQUENCER_INFO) failed");
 
        end = buf + tot;
@@ -488,7 +488,9 @@
         * in some cases by frobbing tempo and timebase more obscurely, but this
         * player is meant to be simple and clear.
         */
-       if ((divfmt & 0x80) == 0) {
+       if (!play)
+               /* do nothing */;
+       else if ((divfmt & 0x80) == 0) {
                ticks |= divfmt << 8;
                if (ioctl(fd, SEQUENCER_TMR_TIMEBASE, &(int){ticks}) < 0)
                        err(1, "SEQUENCER_TMR_TIMEBASE");
@@ -681,7 +683,7 @@
                        tp->delta = getvar(tp);
                Heapify(tracks, ntrks, 0);
        }
-       if (ioctl(fd, SEQUENCER_SYNC, 0) < 0)
+       if (play && ioctl(fd, SEQUENCER_SYNC, 0) < 0)
                err(1, "SEQUENCER_SYNC");
 
  ret:



Home | Main Index | Thread Index | Old Index