Use CDPLAY environment variable to not type argument each time
Submitted by: hvd@terry.ping.dk
This commit is contained in:
parent
45e002218d
commit
ae9ad53d84
|
@ -6,13 +6,17 @@
|
|||
.Nd Audio CD player
|
||||
.Sh SYNOPSIS
|
||||
.Nm cdplay
|
||||
.Ar device
|
||||
.Op Ar device
|
||||
.Sh DESCRIPTION
|
||||
.Nm cdplay
|
||||
is a program to control an audio CD player. The device is a name such
|
||||
as cd0 or mcd0.
|
||||
.Pp
|
||||
Currently supported commands are as follows:
|
||||
If the device not specified, the environment variable
|
||||
.Ev CDPLAY
|
||||
will be used to find the cd device.
|
||||
.Pp
|
||||
Currently supported commands are as follows:
|
||||
.Bl -tag -width Cm
|
||||
.It Cm play first_track last_track
|
||||
Play from track
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <sys/file.h>
|
||||
#include <sys/cdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define command(s) strncmp(cmd,s,strlen(s))==0
|
||||
|
||||
|
@ -27,11 +28,16 @@ main (int argc, char **argv)
|
|||
{
|
||||
int rc;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: cdplay <cd>\n<cd> is device name such as cd0 or mcd0\n");
|
||||
exit(1);
|
||||
}
|
||||
cdname = argv[1];
|
||||
switch (argc) {
|
||||
case 2: cdname = argv[1];
|
||||
break;
|
||||
case 1: if(cdname = getenv("CDPLAY"))
|
||||
/* Break if CDPLAY is set */
|
||||
break;
|
||||
default: fprintf(stderr, "Usage: cdplay <cd>\n<cd> is device name such as cd0 or mcd0\n");
|
||||
exit(1);
|
||||
};
|
||||
|
||||
standalone = isatty (0);
|
||||
while (input ()) {
|
||||
rc = 0;
|
||||
|
|
Loading…
Reference in New Issue