-.\" $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
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
-/* $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 <vak@cronyx.ru>.
* Based on the non-X based CD player by Jean-Marc Zucconi and
#define CMD_STATUS 14
#define CMD_NEXT 15
#define CMD_PREV 16
+#define CMD_REPLAY 17
struct cmdtab {
int command;
{ 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, "" },
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,
return play_prev (arg);
+ case CMD_REPLAY:
+ if (fd < 0 && ! open_cd ())
+ return 0;
+
+ return play_same (arg);
default:
case CMD_HELP:
help ();
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;
{