From: angelos Date: Sun, 9 Mar 1997 01:34:26 +0000 (+0000) Subject: Added the "replay" command. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4efcb1a6759890dc50de11db31fda49cb73bc7fe;p=openbsd Added the "replay" command. --- diff --git a/usr.bin/cdio/cdio.1 b/usr.bin/cdio/cdio.1 index 24794e11126..179e3c92527 100644 --- a/usr.bin/cdio/cdio.1 +++ b/usr.bin/cdio/cdio.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cdio.1,v 1.7 1997/02/26 02:12:42 angelos Exp $ +.\" $OpenBSD: cdio.1,v 1.8 1997/03/09 01:34:26 angelos Exp $ .Dd July 3, 1995 .Dt CDIO 1 .Os OpenBSD 2.0 @@ -77,6 +77,8 @@ Stop playing. Do not stop the disc. Play the next track. If we're at the last track, stop. .It Cm previous Play the previous track. If we're at the first track, restart. +.It Cm replay +Replay the current track again. .It Cm resume Resume playing. Used after the .Nm pause diff --git a/usr.bin/cdio/cdio.c b/usr.bin/cdio/cdio.c index 4e38157ae94..8b5ce98ecaa 100644 --- a/usr.bin/cdio/cdio.c +++ b/usr.bin/cdio/cdio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cdio.c,v 1.5 1997/02/26 02:08:44 angelos Exp $ */ +/* $OpenBSD: cdio.c,v 1.6 1997/03/09 01:34:27 angelos Exp $ */ /* * Compact Disc Control Utility by Serge V. Vakulenko . * Based on the non-X based CD player by Jean-Marc Zucconi and @@ -61,6 +61,7 @@ #define CMD_STATUS 14 #define CMD_NEXT 15 #define CMD_PREV 16 +#define CMD_REPLAY 17 struct cmdtab { int command; @@ -84,6 +85,7 @@ struct cmdtab { { CMD_QUIT, "quit", 1, "" }, { CMD_RESET, "reset", 4, "" }, { CMD_RESUME, "resume", 1, "" }, +{ CMD_REPLAY, "replay", 3, "" }, { CMD_SET, "set", 2, "msf | lba" }, { CMD_STATUS, "status", 1, "" }, { CMD_STOP, "stop", 3, "" }, @@ -112,6 +114,7 @@ int info __P((char *arg)); int pstatus __P((char *arg)); int play_next __P((char *arg)); int play_prev __P((char *arg)); +int play_same __P((char *arg)); char *input __P((int *)); void prtrack __P((struct cd_toc_entry *e, int lastflag)); void lba2msf __P((unsigned long lba, @@ -405,6 +408,11 @@ int run (cmd, arg) return play_prev (arg); + case CMD_REPLAY: + if (fd < 0 && ! open_cd ()) + return 0; + + return play_same (arg); default: case CMD_HELP: help (); @@ -728,6 +736,27 @@ int play_prev (arg) return (0); } +int play_same (arg) + char *arg; +{ + int trk, min, sec, frm, rc; + struct ioc_toc_header h; + + if (status (&trk, &min, &sec, &frm) >= 0) + { + rc = ioctl (fd, CDIOREADTOCHEADER, &h); + if (rc < 0) + { + perror ("getting toc header"); + return (rc); + } + + return play_track (trk, 1, trk + 1, 1); + } + + return (0); +} + int play_next (arg) char *arg; {