diff -u -r cdtool-2.1.5/Makefile cdtool-2.1.5-close/Makefile --- cdtool-2.1.5/Makefile Thu Jul 16 16:00:14 1998 +++ cdtool-2.1.5-close/Makefile Sat Feb 22 13:27:06 2003 @@ -58,7 +58,7 @@ # would interfere with the usage here. # #LINKS = cdplay cdpause cdstop cdeject cdir cdinfo cdreset -LINKS = cdstart cdpause cdstop cdeject cdir cdinfo cdreset cdshuffle +LINKS = cdstart cdpause cdstop cdclose cdeject cdir cdinfo cdreset cdshuffle # We seem to need GCC CC = gcc $(DEBUG_FLAGS) @@ -124,7 +124,7 @@ cdadd: cdadd.sh sed s,@BINDIR@,$(BINDIR),g < $< > $@ chmod a+x $@ - + links: @for i in $(LINKS); do \ if test -L $$i; then true; else rm -f $$i; ln -s cdtool $$i; fi; \ diff -u -r cdtool-2.1.5/README cdtool-2.1.5-close/README --- cdtool-2.1.5/README Thu Jul 16 04:07:48 1998 +++ cdtool-2.1.5-close/README Mon Feb 24 10:55:33 2003 @@ -15,6 +15,7 @@ cdpause -- pause play. cdstop -- stop play. cdeject -- eject the CDROM, if supported. + cdclose -- close the CDROM tray, if supported. cdir -- list tracks on the CDROM. cdinfo -- display information on the CDROM. cdreset -- reset the CDROM device (2.1 experimental). @@ -134,6 +135,11 @@ 2.1.4-2.1.5 changes #7-11 by Daniel Risacher (magnus@mit.edu). Change 14 was by Byron Ellacott. Addition of a PID file and additonal cleanup by Lin Zhe Min. + + +CHANGES SINCE 2.1.5 RELEASE ---------------------------------------------- +(1) Add cdclose command to close the CDROM tray. + Added by Josh Buhl (jbuhl@users.sourceforge.net) CHANGES SINCE BETA RELEASE --------------------------------------------- Only in cdtool-2.1.5/: cdadd diff -u -r cdtool-2.1.5/cdctrl.1 cdtool-2.1.5-close/cdctrl.1 --- cdtool-2.1.5/cdctrl.1 Mon Jun 22 19:07:26 1998 +++ cdtool-2.1.5-close/cdctrl.1 Mon Feb 24 11:36:16 2003 @@ -55,6 +55,8 @@ Resume playing. .IP \fBe\fR Eject CDROM. +.IP \fBc\fR +Close CDROM tray. .IP \fBi\fR Display info string. .IP \fBd\fR diff -u -r cdtool-2.1.5/cdctrl.c cdtool-2.1.5-close/cdctrl.c --- cdtool-2.1.5/cdctrl.c Thu Jul 16 04:00:08 1998 +++ cdtool-2.1.5-close/cdctrl.c Mon Feb 24 10:56:53 2003 @@ -129,6 +129,8 @@ DoCr(docr); printf ("e eject"); DoCr(docr); + printf ("c close"); + DoCr(docr); printf ("i info"); DoCr(docr); printf ("d dir"); @@ -233,6 +235,12 @@ do_eject(progname, cdfile, FALSE); sleep (3); pszCmd = "eject"; + break; + + case 'c': + do_close(progname, cdfile, FALSE); + sleep (3); + pszCmd = "close"; break; case 'i': diff -u -r cdtool-2.1.5/cdtool-2.1.5-1.spec cdtool-2.1.5-close/cdtool-2.1.5-1.spec --- cdtool-2.1.5/cdtool-2.1.5-1.spec Thu Jul 16 15:57:57 1998 +++ cdtool-2.1.5-close/cdtool-2.1.5-1.spec Mon Feb 24 11:33:02 2003 @@ -8,10 +8,11 @@ %description A package of command-line utilities to play and catalog audio CD-ROMs. This package includes -cdstart, cdpause, cdstop, cdeject, and cdshuffle. -Also, cdctrl may be used as a CD-ROM control daemon. -Cdown allows querying of the cddb database to build a -local database of discs usable by cdinfo, etc. +cdstart, cdpause, cdstop, cdeject, cdclose, and +cdshuffle. Also, cdctrl may be used as a CD-ROM +control daemon. Cdown allows querying of the cddb +database to build a local database of discs usable +by cdinfo, etc. %prep @@ -23,7 +24,7 @@ %install BINDIR=/usr/local/bin MANDIR=/usr/local/man -LINKS="cdstart cdpause cdstop cdeject cdir cdinfo cdreset cdshuffle" +LINKS="cdstart cdpause cdstop cdeject cdclose cdir cdinfo cdreset cdshuffle" install -d $BINDIR -o root -m 0755 install cdctrl $BINDIR -s -o root @@ -51,6 +52,7 @@ /usr/local/bin/cdtool /usr/local/bin/cdeject +/usr/local/bin/cdclose /usr/local/bin/cdinfo /usr/local/bin/cdir /usr/local/bin/cdpause @@ -64,6 +66,7 @@ /usr/local/bin/cdloop /usr/local/man/man1/cdtool.1 /usr/local/man/man1/cdeject.1 +/usr/local/man/man1/cdclose.1 /usr/local/man/man1/cdinfo.1 /usr/local/man/man1/cdir.1 /usr/local/man/man1/cdpause.1 diff -u -r cdtool-2.1.5/cdtool-2.1.5.lsm cdtool-2.1.5-close/cdtool-2.1.5.lsm --- cdtool-2.1.5/cdtool-2.1.5.lsm Tue Jul 14 14:46:50 1998 +++ cdtool-2.1.5-close/cdtool-2.1.5.lsm Mon Feb 24 11:28:21 2003 @@ -4,7 +4,7 @@ Entered-date: 16JUL98 Description: A package of command-line utilities to play and catalog audio CD-ROMs. cdplay, cdpause, cdstop, - and cdeject do what they say. cdir lists the + cdeject and cdclose do what they say. cdir lists the tracks and their lengths, and will reference a database of cd names, artists, and track names. cdinfo gives you various data on the disc like diff -u -r cdtool-2.1.5/cdtool.1 cdtool-2.1.5-close/cdtool.1 --- cdtool-2.1.5/cdtool.1 Tue Jul 14 14:48:46 1998 +++ cdtool-2.1.5-close/cdtool.1 Mon Feb 24 11:48:21 2003 @@ -9,12 +9,13 @@ .nf \fBcdadd\fR [-[0..9]|-d device] \fBcdeject\fR [-[0..9]|-d device] [-V|-?|-h] +\fBcdclose\fR [-[0..9]|-d device] [-V|-?|-h] \fBcdir\fR -n [-[0..9]|-d device] [-r|-s|-t|-V|-?|-h] \fBcdinfo\fR [-[0..9]|-d device] [-a|-r|-s|-t|-v|-V|-?|-h] \fBcdpause\fR [-[0..9]|-d device] [-V|-?|-h] \fBcdplay\fR [-[0..9]|-d device] [\fIstart\fR [\fIstop\fR] \fBcdplay\fR [-[0..9]|-d device] [\fI+|-\fR \fInumber\fR] -\fBcdplay\fR [-[0..9]|-d device] [start|stop|resume|eject|info|dir] +\fBcdplay\fR [-[0..9]|-d device] [start|stop|resume|eject|close|info|dir] \fBcdplay\fR [-[0..9]|-d device] [-V|-?|-h] \fBcdstop\fR [-[0..9]|-d device] [-V|-?|-h] \fBcdshuffle\fR [-[0..9]|-d device] [-V|-?|-h] @@ -33,6 +34,10 @@ The .I cdeject command ejects the current compact disc. +.PP +The +.I cdclose +command closes the CDROM tray. .PP The .I cdir diff -u -r cdtool-2.1.5/commands.c cdtool-2.1.5-close/commands.c --- cdtool-2.1.5/commands.c Wed Jul 15 16:21:14 1998 +++ cdtool-2.1.5-close/commands.c Mon Feb 24 11:16:39 2003 @@ -303,6 +303,33 @@ } /************************************************************************/ +/* Procedure: do_close + * Purpose: to close the CD-ROM + * + * Inputs: program name, CD file des. + * Outputs: to CD-ROM, debug output + * Returns: n/a + * Notes: + * 1. + */ +/************************************************************************/ +void do_close(char *progname, int cdfile, int iVerbose) +{ +#ifdef DEBUG +fprintf (stderr,"do_close: called, name=%s, cdfile=%d,\n", + progname, cdfile); +#endif + if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 ) + { + fprintf(stderr, "%s: ioctl cdromclose\n", progname); + EXIT(1); + } + + if (iVerbose == TRUE) + printf ("Closing CD-ROM tray\n"); +} + +/************************************************************************/ /* Procedure: do_reset * Purpose: to reset the CD-ROM * diff -u -r cdtool-2.1.5/commands.h cdtool-2.1.5-close/commands.h --- cdtool-2.1.5/commands.h Wed Jul 15 16:17:35 1998 +++ cdtool-2.1.5-close/commands.h Mon Feb 24 10:58:32 2003 @@ -29,6 +29,7 @@ void do_pause(char *progname, int cdfile, int iVerbose); void do_stop(char *progname, int cdfile, int iCDNum, int iVerbose); void do_eject(char *progname, int cdfile, int iVerbose); +void do_close(char *progname, int cdfile, int iVerbose); void do_reset(char *progname, int cdfile, int iVerbose); /* * Copyright (C) 1997, 1998 Wade Hampton diff -u -r cdtool-2.1.5/main.c cdtool-2.1.5-close/main.c --- cdtool-2.1.5/main.c Wed Jul 15 16:19:02 1998 +++ cdtool-2.1.5-close/main.c Mon Feb 24 11:02:04 2003 @@ -323,6 +323,15 @@ close(cdfile); exit(0); } + if (strcmp(argv[optind],"close") == 0) { +#ifdef DEBUG +fprintf (stderr,"main: called as \"%s\", close\n", + progname); +#endif + do_close(progname, cdfile, iVerbose); + close(cdfile); + exit(0); + } if (strcmp(argv[optind],"info") == 0) { #ifdef DEBUG fprintf (stderr,"main: called as \"%s\", info\n", @@ -375,6 +384,8 @@ do_stop(progname, cdfile, iCDNum, iVerbose); else if ( strcmp(progname, "cdeject") == 0 ) do_eject(progname, cdfile, iVerbose); + else if ( strcmp(progname, "cdclose") == 0 ) + do_close(progname, cdfile, iVerbose); else if ( strcmp(progname, "cdreset") == 0 ) do_reset(progname, cdfile, iVerbose); else if ( strcmp(progname, "cdpause") == 0 ) @@ -427,6 +438,7 @@ fprintf(stderr, " stop stop playing\n"); fprintf(stderr, " resume resume playing\n"); fprintf(stderr, " eject eject CD-ROM\n"); + fprintf(stderr, " close close CD-ROM tray\n"); fprintf(stderr, " info display info\n"); fprintf(stderr, " dir display directory\n"); fprintf(stderr, " shuffle shuffle play\n"); @@ -445,6 +457,8 @@ fprintf(stderr, "usage: cdstop [options]\n"); else if ( strcmp(progname, "cdeject") == 0 ) fprintf(stderr, "usage: cdeject [options]\n"); + else if ( strcmp(progname, "cdclose") == 0 ) + fprintf(stderr, "usage: cdclose [options]\n"); else if ( strcmp(progname, "cdpause") == 0 ) { fprintf(stderr, "usage: cdpause [options]\n"); @@ -468,7 +482,7 @@ fprintf(stderr, " -v print status, track, absolute, relative\n"); } else - fprintf(stderr, "Please call as cdplay/cdstart, cdstop, cdeject, \n\ + fprintf(stderr, "Please call as cdplay/cdstart, cdstop, cdeject, cdclose \n\ cdpause, cdir, cdinfo, or cdshuffle\n"); /* standard options below here: */