diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-06-02 17:05:46 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-06-02 17:05:46 +0000 |
commit | 4f92cff25e1dfa784687da8cbd132f619aadefd0 (patch) | |
tree | d0852fe3c98ac6c3744673fc4294a1a52173c0a7 /usr.bin | |
parent | 7acbe9bac02644fe71bdcff64b6608a143684ea9 (diff) |
(remove -d, second part) use strtonum() instead of sscanf() and inlined
checks
suggested and ok jakemsr
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/aucat/aucat.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c index 5424d37292d..3c96eef7f3c 100644 --- a/usr.bin/aucat/aucat.c +++ b/usr.bin/aucat/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.20 2008/06/02 17:05:12 ratchov Exp $ */ +/* $OpenBSD: aucat.c,v 1.21 2008/06/02 17:05:45 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -356,13 +356,14 @@ main(int argc, char **argv) struct aproc *rec, *play, *mix, *sub, *conv; struct file *dev, *f; struct abuf *buf, *cbuf; + const char *errstr; int fd; dbgenv = getenv("AUCAT_DEBUG"); if (dbgenv) { - if (sscanf(dbgenv, "%u", &debug_level) != 1 || - debug_level > 4) - err(1, "%s: not an integer in the 0..4 range", dbgenv); + debug_level = strtonum(dbgenv, 0, 4, &errstr); + if (errstr) + errx(1, "AUCAT_DEBUG is %s: %s", errstr, dbgenv); } aparams_init(&ipar, 0, 1, 44100); |