diff options
author | ache <ache@FreeBSD.org> | 1996-02-02 22:03:37 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-02-02 22:03:37 +0000 |
commit | 8b50fd992ab3d2101642ca708dca94e7abb58c19 (patch) | |
tree | 5f8ab330ea6454bd7b6f356d7c7179b51b1a4371 /usr.sbin | |
parent | f690ea66dea370a497cdebf8ab4817b0614a3f5c (diff) | |
download | FreeBSD-src-8b50fd992ab3d2101642ca708dca94e7abb58c19.zip FreeBSD-src-8b50fd992ab3d2101642ca708dca94e7abb58c19.tar.gz |
Implement 'inject' command
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/cdcontrol/cdcontrol.1 | 5 | ||||
-rw-r--r-- | usr.sbin/cdcontrol/cdcontrol.c | 33 |
2 files changed, 25 insertions, 13 deletions
diff --git a/usr.sbin/cdcontrol/cdcontrol.1 b/usr.sbin/cdcontrol/cdcontrol.1 index 8c62d65..9ef306f 100644 --- a/usr.sbin/cdcontrol/cdcontrol.1 +++ b/usr.sbin/cdcontrol/cdcontrol.1 @@ -85,6 +85,9 @@ Stop the disc. .It Cm eject Eject the disc. +.It Cm inject +Inject the disc. + .It Cm volume Ar left_channel Ar right_channel Set the volume of left channel to .Nm left_channel @@ -136,7 +139,7 @@ Quit the program. .El .Sh AUTHORS Jean-Marc Zucconi, -Andrew A.\ Chernov, +Andrey A.\ Chernov, Serge V.\ Vakulenko .Sh HISTORY The diff --git a/usr.sbin/cdcontrol/cdcontrol.c b/usr.sbin/cdcontrol/cdcontrol.c index 518e35e..d66933b 100644 --- a/usr.sbin/cdcontrol/cdcontrol.c +++ b/usr.sbin/cdcontrol/cdcontrol.c @@ -37,20 +37,22 @@ struct cmdtab { { CMD_HELP, "?", 0, }, { CMD_HELP, "Help", "", }, #define CMD_INFO 4 - { CMD_INFO, "Info", "", }, -#define CMD_PAUSE 5 + { CMD_INFO, "INFo", "", }, +#define CMD_INJECT 5 + { CMD_INJECT, "INJect", "", }, +#define CMD_PAUSE 6 { CMD_PAUSE, "PAuse", "", }, -#define CMD_PLAY 6 - { CMD_PLAY, "Play", "min1:sec1[.fr1] [min2:sec2[.fr2]]", }, - { CMD_PLAY, "Play", "track1[.index1] [track2.[index2]]", }, - { CMD_PLAY, "Play", "[#block [len]]", }, -#define CMD_QUIT 7 +#define CMD_PLAY 7 + { CMD_PLAY, "PLay", "min1:sec1[.fr1] [min2:sec2[.fr2]]", }, + { CMD_PLAY, "PLay", "track1[.index1] [track2.[index2]]", }, + { CMD_PLAY, "PLay", "[#block [len]]", }, +#define CMD_QUIT 8 { CMD_QUIT, "Quit", "", }, -#define CMD_RESUME 8 +#define CMD_RESUME 9 { CMD_RESUME, "Resume", "", }, -#define CMD_STOP 9 +#define CMD_STOP 10 { CMD_STOP, "Stop", "", }, -#define CMD_VOLUME 10 +#define CMD_VOLUME 11 { CMD_VOLUME, "Volume", "<l> <r> | left | right | mute | mono | stereo", }, { 0, 0, }, }; @@ -178,7 +180,7 @@ int main (int argc, char **argv) arg = input (&cmd); if (run (cmd, arg) < 0) { if (verbose) - perror ("cdplay"); + perror ("cdcontrol"); close (fd); fd = -1; } @@ -232,7 +234,14 @@ int run (int cmd, char *arg) rc = ioctl (fd, CDIOCEJECT); if (rc < 0) return (rc); - close (fd); + return (0); + + case CMD_INJECT: + if (fd<0 && ! open_cd ()) return (0); + rc = ioctl (fd, CDIOCCLOSE); + if (rc < 0) + return (rc); + close(fd); fd = -1; return (0); |