diff options
author | ache <ache@FreeBSD.org> | 1995-02-22 01:19:06 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-02-22 01:19:06 +0000 |
commit | 63e2101da176970e4135c07765dc6670ba1e43c7 (patch) | |
tree | e7cde62094d1a94690ab177c9b318362e1848c05 /usr.sbin/cdplay | |
parent | 5fb7e070ff8e2f337055898fb132ce5869156ce0 (diff) | |
download | FreeBSD-src-63e2101da176970e4135c07765dc6670ba1e43c7.zip FreeBSD-src-63e2101da176970e4135c07765dc6670ba1e43c7.tar.gz |
Do not close cd after eject, close on each ioctl error instead.
Do not open cd on help and quit commands.
Diffstat (limited to 'usr.sbin/cdplay')
-rw-r--r-- | usr.sbin/cdplay/cdplay.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/usr.sbin/cdplay/cdplay.c b/usr.sbin/cdplay/cdplay.c index 87a2994..2c1cafa 100644 --- a/usr.sbin/cdplay/cdplay.c +++ b/usr.sbin/cdplay/cdplay.c @@ -33,10 +33,10 @@ main (int argc, char **argv) } cdname = argv[1]; standalone = isatty (0); - open_cd (); while (input ()) { rc = 0; - open_cd (); + if (!command ("quit") && !command ("help")) + open_cd (); if (command ("play")) { int start, end; sscanf (cmd+4, "%d%d", &start, &end); @@ -56,8 +56,6 @@ main (int argc, char **argv) rc = clrdebug (); else if (command ("eject")) { rc = eject (); - close (cd_fd); - cd_fd = -1; } else if (command ("setvol")) { int l, r; sscanf (cmd+6, "%d %d", &l, &r); @@ -95,10 +93,7 @@ main (int argc, char **argv) } } else if (command ("status")) { int trk, m, s, f; - if (cd_fd < 0) - rc = -1; /* assume ejected */ - else - rc = status (&trk, &m, &s, &f); + rc = status (&trk, &m, &s, &f); if (standalone) printf("status track minute second frame\n"); printf ("%d %02d %d %d %d\n", rc, trk, m, s, f); @@ -112,8 +107,12 @@ tocentry, status, quit, help\n"); else printf("No such command, enter 'help' for commands list\n"); fflush (stdout); - if (rc < 0 && standalone) - perror("cdplay"); + if (rc < 0) { + if (standalone) + perror("cdplay"); + close (cd_fd); + cd_fd = -1; + } } exit (0); } |