diff -u -r cdtool-2.1.5-debian-orig/Makefile cdtool-2.1.5-debian-close/Makefile --- cdtool-2.1.5-debian-orig/Makefile Sat Feb 22 12:05:48 2003 +++ cdtool-2.1.5-debian-close/Makefile Sat Feb 22 12:09:20 2003 @@ -59,7 +59,7 @@ # Note, the cdp package includes a program, /usr/bin/cdplay which # would interfere with the usage here. # -LINKS = cdplay cdpause cdstop cdeject cdir cdinfo cdreset cdvolume cdshuffle +LINKS = cdplay cdpause cdstop cdclose cdeject cdir cdinfo cdreset cdvolume cdshuffle #LINKS = cdstart cdpause cdstop cdeject cdir cdinfo cdreset cdshuffle # We seem to need GCC @@ -126,7 +126,7 @@ cdadd: cdadd.sh sed s,@BINDIR@,$(REALBINDIR),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-debian-orig/README cdtool-2.1.5-debian-close/README --- cdtool-2.1.5-debian-orig/README Thu Jul 16 04:07:48 1998 +++ cdtool-2.1.5-debian-close/README Sat Feb 22 13:14:20 2003 @@ -135,6 +135,9 @@ 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-debian-close/: build Only in cdtool-2.1.5-debian-orig/: cdadd diff -u -r cdtool-2.1.5-debian-orig/cdctrl.1 cdtool-2.1.5-debian-close/cdctrl.1 --- cdtool-2.1.5-debian-orig/cdctrl.1 Mon Jun 22 19:07:26 1998 +++ cdtool-2.1.5-debian-close/cdctrl.1 Mon Feb 24 11:37:52 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-debian-orig/cdctrl.c cdtool-2.1.5-debian-close/cdctrl.c --- cdtool-2.1.5-debian-orig/cdctrl.c Sat Feb 22 12:05:48 2003 +++ cdtool-2.1.5-debian-close/cdctrl.c Sat Feb 22 11:39:27 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-debian-orig/cdtool-2.1.5-1.spec cdtool-2.1.5-debian-close/cdtool-2.1.5-1.spec --- cdtool-2.1.5-debian-orig/cdtool-2.1.5-1.spec Thu Jul 16 15:57:57 1998 +++ cdtool-2.1.5-debian-close/cdtool-2.1.5-1.spec Mon Feb 24 11:40:29 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-debian-orig/cdtool-2.1.5.lsm cdtool-2.1.5-debian-close/cdtool-2.1.5.lsm --- cdtool-2.1.5-debian-orig/cdtool-2.1.5.lsm Tue Jul 14 14:46:50 1998 +++ cdtool-2.1.5-debian-close/cdtool-2.1.5.lsm Mon Feb 24 11:41:06 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-debian-orig/cdtool.1 cdtool-2.1.5-debian-close/cdtool.1 --- cdtool-2.1.5-debian-orig/cdtool.1 Sat Feb 22 12:05:48 2003 +++ cdtool-2.1.5-debian-close/cdtool.1 Mon Feb 24 11:47:29 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] \fBcdvolume\fR [-[0..9]|-d device] [-V|-?|-h|\fIlevel\fR] @@ -34,6 +35,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-debian-orig/commands.c cdtool-2.1.5-debian-close/commands.c --- cdtool-2.1.5-debian-orig/commands.c Sat Feb 22 12:05:48 2003 +++ cdtool-2.1.5-debian-close/commands.c Sat Feb 22 10:50:36 2003 @@ -310,6 +310,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-debian-orig/commands.h cdtool-2.1.5-debian-close/commands.h --- cdtool-2.1.5-debian-orig/commands.h Sat Feb 22 12:05:48 2003 +++ cdtool-2.1.5-debian-close/commands.h Sat Feb 22 10:56:58 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); int do_volume(char *progname, int cdfile, int volume, int iVerbose); /* diff -u -r cdtool-2.1.5-debian-orig/main.c cdtool-2.1.5-debian-close/main.c --- cdtool-2.1.5-debian-orig/main.c Sat Feb 22 12:05:48 2003 +++ cdtool-2.1.5-debian-close/main.c Mon Feb 24 11:07:16 2003 @@ -324,6 +324,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", @@ -386,6 +395,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 ) @@ -446,6 +457,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"); @@ -464,6 +476,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, "cdvolume") == 0 ) fprintf(stderr, "usage: cdvolume [0-255]\n"); else if ( strcmp(progname, "cdpause") == 0 ) @@ -489,7 +503,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\ cdvolume, cdpause, cdir, cdinfo, or cdshuffle\n"); /* standard options below here: */