Source-Changes-HG archive

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

[src/trunk]: src/usr.bin Use _PATH_SOUND etc, all fall back to _PATH_SOUND0 (...



details:   https://anonhg.NetBSD.org/src/rev/c7cab1287457
branches:  trunk
changeset: 521440:c7cab1287457
user:      augustss <augustss%NetBSD.org@localhost>
date:      Thu Jan 31 00:03:23 2002 +0000

description:
Use _PATH_SOUND etc, all fall back to _PATH_SOUND0 (etc.) if that fails.

diffstat:

 usr.bin/audio/ctl/ctl.c       |  10 ++++------
 usr.bin/audio/play/play.c     |  18 ++++++++----------
 usr.bin/audio/record/record.c |   9 +++++++--
 usr.bin/mixerctl/mixerctl.c   |  18 ++++++++----------
 4 files changed, 27 insertions(+), 28 deletions(-)

diffs (156 lines):

diff -r e0afb08c5c98 -r c7cab1287457 usr.bin/audio/ctl/ctl.c
--- a/usr.bin/audio/ctl/ctl.c   Thu Jan 31 00:02:12 2002 +0000
+++ b/usr.bin/audio/ctl/ctl.c   Thu Jan 31 00:03:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ctl.c,v 1.30 2002/01/27 18:21:52 jdolecek Exp $        */
+/*     $NetBSD: ctl.c,v 1.31 2002/01/31 00:03:23 augustss Exp $        */
 
 /*
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -345,7 +345,7 @@
        const char *sep = "=";
 
        file = getenv("AUDIOCTLDEVICE");
-       if (file == 0)
+       if (file == NULL)
                file = _PATH_AUDIOCTL;
 
        while ((ch = getopt(argc, argv, "ad:f:nw")) != -1) {
@@ -374,15 +374,13 @@
        fd = open(file, O_WRONLY);
        if (fd < 0)
                fd = open(file, O_RDONLY);
-#ifdef _PATH_OAUDIOCTL
-        /* Allow the non-unit device to be used. */
         if (fd < 0 && file == _PATH_AUDIOCTL) {
-               file = _PATH_OAUDIOCTL;
+               file = _PATH_AUDIOCTL0;
                 fd = open(file, O_WRONLY);
                if (fd < 0)
                        fd = open(file, O_RDONLY);
         }
-#endif
+
        if (fd < 0)
                err(1, "%s", file);
 
diff -r e0afb08c5c98 -r c7cab1287457 usr.bin/audio/play/play.c
--- a/usr.bin/audio/play/play.c Thu Jan 31 00:02:12 2002 +0000
+++ b/usr.bin/audio/play/play.c Thu Jan 31 00:03:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: play.c,v 1.31 2002/01/15 17:00:53 mrg Exp $    */
+/*     $NetBSD: play.c,v 1.32 2002/01/31 00:03:23 augustss Exp $       */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -79,8 +79,8 @@
        int     ch;
        int     iflag = 0;
        int     verbose = 0;
-       const char *device = 0;
-       const char *ctldev = 0;
+       const char *device = NULL;
+       const char *ctldev = NULL;
 
        while ((ch = getopt(argc, argv, "b:C:c:d:e:fhip:P:qs:Vv:")) != -1) {
                switch (ch) {
@@ -162,19 +162,17 @@
 
        if (device == NULL && (device = getenv("AUDIODEVICE")) == NULL &&
            (device = getenv("AUDIODEV")) == NULL) /* Sun compatibility */
-               device = _PATH_AUDIO;
+               device = _PATH_SOUND;
        if (ctldev == NULL && (ctldev = getenv("AUDIOCTLDEVICE")) == NULL)
                ctldev = _PATH_AUDIOCTL;
 
        audiofd = open(device, O_WRONLY);
-#ifdef _PATH_OAUDIO
-       /* Allow the non-unit device to be used. */
-       if (audiofd < 0 && device == _PATH_AUDIO) {
-               device = _PATH_OAUDIO;
-               ctldev = _PATH_OAUDIOCTL;
+       if (audiofd < 0 && device == _PATH_SOUND) {
+               device = _PATH_SOUND0;
+               ctldev = _PATH_AUDIOCTL0;
                audiofd = open(device, O_WRONLY);
        }
-#endif
+
        if (audiofd < 0)
                err(1, "failed to open %s", device);
        ctlfd = open(ctldev, O_RDWR);
diff -r e0afb08c5c98 -r c7cab1287457 usr.bin/audio/record/record.c
--- a/usr.bin/audio/record/record.c     Thu Jan 31 00:02:12 2002 +0000
+++ b/usr.bin/audio/record/record.c     Thu Jan 31 00:03:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: record.c,v 1.21 2002/01/15 23:48:53 mrg Exp $  */
+/*     $NetBSD: record.c,v 1.22 2002/01/31 00:03:24 augustss Exp $     */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -188,11 +188,16 @@
         */
        if (device == NULL && (device = getenv("AUDIODEVICE")) == NULL &&
            (device = getenv("AUDIODEV")) == NULL) /* Sun compatibility */
-               device = _PATH_AUDIO;
+               device = _PATH_SOUND;
        if (ctldev == NULL && (ctldev = getenv("AUDIOCTLDEVICE")) == NULL)
                ctldev = _PATH_AUDIOCTL;
 
        audiofd = open(device, O_RDONLY);
+       if (audiofd < 0 && device == _PATH_SOUND) {
+               device = _PATH_SOUND0;
+               ctldev = _PATH_AUDIOCTL0;
+               audiofd = open(device, O_WRONLY);
+       }
        if (audiofd < 0)
                err(1, "failed to open %s", device);
        ctlfd = open(ctldev, O_RDWR);
diff -r e0afb08c5c98 -r c7cab1287457 usr.bin/mixerctl/mixerctl.c
--- a/usr.bin/mixerctl/mixerctl.c       Thu Jan 31 00:02:12 2002 +0000
+++ b/usr.bin/mixerctl/mixerctl.c       Thu Jan 31 00:03:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mixerctl.c,v 1.16 2002/01/27 10:09:55 jdolecek Exp $   */
+/*     $NetBSD: mixerctl.c,v 1.17 2002/01/31 00:03:24 augustss Exp $   */
 
 /*
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -45,8 +45,7 @@
 #include <sys/ioctl.h>
 #include <sys/audioio.h>
 
-#define MIXER "/dev/mixer0"
-#define OLD_MIXER "/dev/mixer"
+#include <paths.h>
 
 FILE *out = stdout;
 int vflag = 0;
@@ -319,8 +318,8 @@
        int ndev;
 
        file = getenv("MIXERDEVICE");
-       if (file == 0)
-               file = MIXER;
+       if (file == NULL)
+               file = _PATH_MIXER;
 
        prog = *argv;
 
@@ -355,13 +354,12 @@
        argv += optind;
     
        fd = open(file, O_RDWR);
-#ifdef OLD_MIXER
-        /* Allow the non-unit device to be used. */
-        if (fd < 0 && file == MIXER) {
-               file = OLD_MIXER;
+        /* Try with mixer0. */
+        if (fd < 0 && file == _PATH_MIXER) {
+               file = _PATH_MIXER0;
                 fd = open(file, O_RDWR);
         }
-#endif
+
        if (fd < 0)
                err(1, "%s", file);
 



Home | Main Index | Thread Index | Old Index