vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi. There's code in aucat.c which tries to reopen the audio device every time we play a file if it wasn't open, but if we can't open the device at the very beginning we err(), so this code is useless. While here, switch usage to __dead. Pierre Riteau Index: aucat.c ================================================== ================= RCS file: /home/priteau/cvs/src/usr.bin/aucat/aucat.c,v retrieving revision 1.13 diff -p -u -r1.13 aucat.c --- aucat.c 20 Mar 2007 23:35:15 -0000 1.13 +++ aucat.c 3 Apr 2008 20:23:48 -0000 @@ -46,11 +46,11 @@ * uncompressed WAVE RIFF files */ -int playfile(int, char *, audio_info_t *); -int readwaveheader(int, audio_info_t *); -void usage(void) __attribute__((__noreturn__)); +int playfile(int, audio_info_t *); +int readwaveheader(int, audio_info_t *); +__dead void usage(void); -int afd = -1; +int afd; /* * function playfile: given a file which is positioned at the beginning @@ -58,16 +58,11 @@ int afd = -1; * device. Return 0 on success, -1 on failure. */ int -playfile(int fd, char *dev, audio_info_t *audioinfo) +playfile(int fd, audio_info_t *audioinfo) { ssize_t rd; char buf[5120]; - if (afd == -1 && (afd = open(dev, O_WRONLY)) < 0) { - warn("can't open %s", dev); - return(-1); - } - /* * If we don't wait here, the AUDIO_SETINFO ioctl interrupts * the playback of the previous file. @@ -207,7 +202,6 @@ main(int argc, char *argv[]) break; default: usage(); - /* NOTREACHED */ } } argc -= optind; @@ -216,7 +210,7 @@ main(int argc, char *argv[]) if (argc == 0) usage(); - if (afd == -1 && (afd = open(dev, O_WRONLY)) < 0) + if ((afd = open(dev, O_WRONLY)) < 0) err(1, "can't open %s", dev); if (ioctl(afd, AUDIO_GETINFO, &ai_defaults) == -1) @@ -257,7 +251,7 @@ main(int argc, char *argv[]) } } - if (playfile(fd, dev, &ai) < 0) + if (playfile(fd, &ai) < 0) exit(1); (void) close(fd); argc--; @@ -266,7 +260,7 @@ main(int argc, char *argv[]) exit(0); } -void +__dead void usage(void) { extern char *__progname; |