Index: cdcontrol.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/cdcontrol/cdcontrol.c,v retrieving revision 1.30 diff -u -r1.30 cdcontrol.c --- cdcontrol.c 2001/01/16 20:31:53 1.30 +++ cdcontrol.c 2001/02/16 11:42:27 @@ -46,10 +46,6 @@ #define ASTS_ERROR 0x14 /* Audio play operation stopped due to error */ #define ASTS_VOID 0x15 /* No current audio status to return */ -#ifndef DEFAULT_CD_DRIVE -# define DEFAULT_CD_DRIVE "/dev/cd0c" -#endif - #ifndef DEFAULT_CD_PARTITION # define DEFAULT_CD_PARTITION "c" #endif @@ -213,11 +209,6 @@ cdname = getenv("CDROM"); } - if (! cdname) { - cdname = DEFAULT_CD_DRIVE; - warnx("no CD device name specified, defaulting to %s", cdname); - } - if (argc > 0) { char buf[80], *p; int len; @@ -1151,9 +1142,34 @@ int open_cd () { char devbuf[MAXPATHLEN]; + static char *cdnames[] = { + "cd0", + "acd0", + "wcd0", + NULL + }; + char **cdnamep; if (fd > -1) return (1); + + if (! cdname) { + fprintf(stderr, "cdcontrol: probing CD device: "); + for (cdnamep = cdnames; (cdname = *cdnamep); cdnamep++) { + fprintf(stderr, "%s", cdname); + fflush(stderr); + snprintf(devbuf, MAXPATHLEN, "%s%sc", _PATH_DEV, + cdname); + if ((fd = open (devbuf, O_RDONLY)) >= 0) { + fprintf(stderr, " - found!\n"); + return (1); + } + fprintf(stderr, " .. "); + } + fprintf(stderr, "\n"); + warnx("Unable to find a usable CD device"); + return (0); + } if (*cdname == '/') { snprintf (devbuf, MAXPATHLEN, "%s", cdname);