commit e00b1032ae00ddad0f616fe096e002437c15b7d1
parent a7a7980ef3fe226a803216fd40e40df3349d1344
Author: sin <sin@2f30.org>
Date: Thu, 9 Jun 2016 15:38:54 +0100
Dump warnings to log file instead
If multiple warnings are generated there's no easy way to visualize
them. Dump them to the log file so they can be tailed -f
if necessary in a separate window.
Diffstat:
M | ncmixer.c | | | 31 | +++++++------------------------ |
1 file changed, 7 insertions(+), 24 deletions(-)
diff --git a/ncmixer.c b/ncmixer.c
@@ -80,23 +80,6 @@ struct output {
};
void
-vprintmsg(char *fmt, va_list ap)
-{
- move(LINES - 1, 0);
- vwprintw(stdscr, fmt, ap);
-}
-
-void
-printwarn(char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vprintmsg(fmt, ap);
- va_end(ap);
-}
-
-void
printerr(int ret, char *fmt, ...)
{
va_list ap;
@@ -116,7 +99,7 @@ audio_open(char *devname)
sio_hdl = sio_open(devname, SIO_PLAY, 0);
if (sio_hdl == NULL) {
- printwarn("%s: failed to open audio device", devname);
+ DPRINTF("%s: failed to open audio device\n", devname);
return NULL;
}
@@ -129,35 +112,35 @@ audio_open(char *devname)
par.appbufsz = RATE;
if (sio_setpar(sio_hdl, &par) == 0) {
- printwarn("%s: failed to set params", devname);
+ DPRINTF("%s: failed to set params\n", devname);
goto err0;
}
if (sio_getpar(sio_hdl, &par) == 0) {
- printwarn("%s: failed to get params", devname);
+ DPRINTF("%s: failed to get params\n", devname);
goto err0;
}
if (par.pchan != CHANS) {
- printwarn("%s: failed to set number of channels", devname);
+ DPRINTF("%s: failed to set number of channels\n", devname);
goto err0;
}
if (par.sig != 1 ||
par.bits != BITS ||
par.le != SIO_LE_NATIVE) {
- printwarn("%s: failed to set format", devname);
+ DPRINTF("%s: failed to set format\n", devname);
goto err0;
}
if (par.rate < RATE * 995 / 1000 ||
par.rate > RATE * 1005 / 1000) {
- printwarn("%s: failed to set rate", devname);
+ DPRINTF("%s: failed to set rate\n", devname);
goto err0;
}
if (sio_start(sio_hdl) == 0) {
- printwarn("%s: failed to start audio device", devname);
+ DPRINTF("%s: failed to start audio device\n", devname);
goto err0;
}