summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cdcontrol
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2001-01-16 20:31:53 +0000
committerjoe <joe@FreeBSD.org>2001-01-16 20:31:53 +0000
commit912ac1b805d41a0bb8c087e342021b49ceded32e (patch)
treebb25a307823f9c3c11164d1591afd0f75c0d283e /usr.sbin/cdcontrol
parent6317f7a2c43b3cd0225e5044dd7e0fd0d1637af5 (diff)
downloadFreeBSD-src-912ac1b805d41a0bb8c087e342021b49ceded32e.zip
FreeBSD-src-912ac1b805d41a0bb8c087e342021b49ceded32e.tar.gz
Deprecate the use of the CD_DRIVE, CDPLAY, DISC and MUSIC_CD environment
variables in favour of CDROM. Discussed on: stable@FreeBSD.org
Diffstat (limited to 'usr.sbin/cdcontrol')
-rw-r--r--usr.sbin/cdcontrol/cdcontrol.112
-rw-r--r--usr.sbin/cdcontrol/cdcontrol.c20
2 files changed, 20 insertions, 12 deletions
diff --git a/usr.sbin/cdcontrol/cdcontrol.1 b/usr.sbin/cdcontrol/cdcontrol.1
index 71c4ebf..0b1022b 100644
--- a/usr.sbin/cdcontrol/cdcontrol.1
+++ b/usr.sbin/cdcontrol/cdcontrol.1
@@ -20,14 +20,7 @@ as
or
.Pa mcd0 .
.Pp
-If the device not specified, the environment variables
-.Ev MUSIC_CD ,
-.Ev CD_DRIVE ,
-.Ev DISC
-and
-.Ev CDPLAY
-will be used (in this order) to find the cd device.
-.Pp
+
If no command is given, then
.Nm
enters an interactive mode, reading commands from the standard input.
@@ -157,6 +150,9 @@ The following environment variables affect the execution of
The cd device to use if one isn't specified with the
.Fl f
flag.
+.It Ev CD_DRIVE Ev CDPLAY Ev DISC Ev MUSIC_CD
+These variables have been deprecated in favour of
+.Ev CDROM .
.El
.Sh FILES
.Bl -tag -width /dev/mcd0c -compact
diff --git a/usr.sbin/cdcontrol/cdcontrol.c b/usr.sbin/cdcontrol/cdcontrol.c
index 7af8837..c22bad3 100644
--- a/usr.sbin/cdcontrol/cdcontrol.c
+++ b/usr.sbin/cdcontrol/cdcontrol.c
@@ -159,18 +159,30 @@ void usage ()
exit (1);
}
+char *use_cdrom_instead(char *old_envvar)
+{
+ char *device;
+
+ device = getenv(old_envvar);
+ if (device)
+ warnx("%s environment variable deprecated, "
+ "please use CDROM in the future.", old_envvar);
+ return device;
+}
+
+
int main (int argc, char **argv)
{
int cmd;
char *arg;
- cdname = getenv ("MUSIC_CD");
+ cdname = use_cdrom_instead("MUSIC_CD");
if (! cdname)
- cdname = getenv ("CD_DRIVE");
+ cdname = use_cdrom_instead("CD_DRIVE");
if (! cdname)
- cdname = getenv ("DISC");
+ cdname = use_cdrom_instead("DISC");
if (! cdname)
- cdname = getenv ("CDPLAY");
+ cdname = use_cdrom_instead("CDPLAY");
for (;;) {
switch (getopt (argc, argv, "svhf:")) {
OpenPOWER on IntegriCloud