From 298f5ad9040c0b93ccd39f1e110caab2684070a4 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Wed, 23 May 2012 19:25:12 +0000 Subject: Make the "default" string a valid device name that has the same effect as NULL has. This will (hopefully) simplify ports where the user passes the device string. --- usr.bin/aucat/aucat.c | 5 +++-- usr.bin/aucat/miofile.c | 6 ++---- usr.bin/aucat/siofile.c | 10 ++++------ 3 files changed, 9 insertions(+), 12 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c index 1412980c4a1..82fff7b408b 100644 --- a/usr.bin/aucat/aucat.c +++ b/usr.bin/aucat/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.134 2012/04/11 06:05:43 ratchov Exp $ */ +/* $OpenBSD: aucat.c,v 1.135 2012/05/23 19:25:11 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -349,7 +350,7 @@ mkdev(char *path, int mode, int bufsz, int round, int hold, int autovol) } else { if (dev_list) return dev_list; - path = "default"; + path = SIO_DEVANY; } if (!bufsz && !round) { round = DEFAULT_ROUND; diff --git a/usr.bin/aucat/miofile.c b/usr.bin/aucat/miofile.c index 6238bbb5065..3acdc2eb2b7 100644 --- a/usr.bin/aucat/miofile.c +++ b/usr.bin/aucat/miofile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: miofile.c,v 1.7 2012/04/11 06:05:43 ratchov Exp $ */ +/* $OpenBSD: miofile.c,v 1.8 2012/05/23 19:25:11 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -64,12 +64,10 @@ struct fileops miofile_ops = { struct miofile * miofile_new(struct fileops *ops, char *path, unsigned int mode) { - char *siopath; struct mio_hdl *hdl; struct miofile *f; - siopath = (strcmp(path, "default") == 0) ? NULL : path; - hdl = mio_open(siopath, mode, 1); + hdl = mio_open(path, mode, 1); if (hdl == NULL) return NULL; f = (struct miofile *)file_new(ops, path, mio_nfds(hdl)); diff --git a/usr.bin/aucat/siofile.c b/usr.bin/aucat/siofile.c index 2517f0f9734..426c9e34281 100644 --- a/usr.bin/aucat/siofile.c +++ b/usr.bin/aucat/siofile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siofile.c,v 1.10 2012/04/11 06:05:43 ratchov Exp $ */ +/* $OpenBSD: siofile.c,v 1.11 2012/05/23 19:25:11 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -209,22 +209,20 @@ siofile_new(struct fileops *ops, char *path, unsigned int *rmode, struct aparams *ipar, struct aparams *opar, unsigned int *bufsz, unsigned int *round) { - char *siopath; struct sio_par par; struct sio_hdl *hdl; struct siofile *f; unsigned int mode = *rmode; - siopath = (strcmp(path, "default") == 0) ? NULL : path; - hdl = sio_open(siopath, mode, 1); + hdl = sio_open(path, mode, 1); if (hdl == NULL) { if (mode != (SIO_PLAY | SIO_REC)) return NULL; - hdl = sio_open(siopath, SIO_PLAY, 1); + hdl = sio_open(path, SIO_PLAY, 1); if (hdl != NULL) mode = SIO_PLAY; else { - hdl = sio_open(siopath, SIO_REC, 1); + hdl = sio_open(path, SIO_REC, 1); if (hdl != NULL) mode = SIO_REC; else -- cgit v1.2.3