From bb44f0089b0ec7a2e9109f9d299ab52a39c78f86 Mon Sep 17 00:00:00 2001 From: Josef Karthauser Date: Tue, 16 Jan 2001 20:31:53 +0000 Subject: [PATCH] Deprecate the use of the CD_DRIVE, CDPLAY, DISC and MUSIC_CD environment variables in favour of CDROM. Discussed on: stable@FreeBSD.org --- usr.sbin/cdcontrol/cdcontrol.1 | 12 ++++-------- usr.sbin/cdcontrol/cdcontrol.c | 20 ++++++++++++++++---- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/usr.sbin/cdcontrol/cdcontrol.1 b/usr.sbin/cdcontrol/cdcontrol.1 index 71c4ebfe156..0b1022b1632 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 7af88374e04..c22bad333dd 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:")) {