Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 74414 Details for
Bug 115059
media-sound/cdtool - cdir prints garbage on some CDs
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Debian patch from cdtool_2.1.5-4.1.diff (sanitized for gentoo)
cdtool-2.1.5-debian-4.1.patch (text/plain), 20.49 KB, created by
Philippe Troin
on 2005-12-09 22:50:29 UTC
(
hide
)
Description:
Debian patch from cdtool_2.1.5-4.1.diff (sanitized for gentoo)
Filename:
MIME Type:
Creator:
Philippe Troin
Created:
2005-12-09 22:50:29 UTC
Size:
20.49 KB
patch
obsolete
>diff -ruN cdtool-2.1.5.orig/Makefile cdtool-2.1.5/Makefile >--- cdtool-2.1.5.orig/Makefile 1998-07-16 07:00:14.000000000 -0700 >+++ cdtool-2.1.5/Makefile 2005-12-09 21:51:54.000000000 -0800 >@@ -26,8 +26,10 @@ > > # Where do we install the binaries and unformatted manual pages? > # -- These are for installation in the local tree: >-BINDIR = /usr/local/bin >-MANDIR = /usr/local/man >+PREFIX = $(DESTDIR)/usr >+BINDIR = $(PREFIX)/bin >+MANDIR = $(PREFIX)/share/man >+REALBINDIR = /usr/bin > > # -- These are for installation in the system tree (e.g., with distributions). > #BINDIR = /usr/bin >@@ -57,8 +59,8 @@ > # 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 >-LINKS = cdstart cdpause cdstop cdeject cdir cdinfo cdreset cdshuffle >+LINKS = cdplay cdpause cdstop cdeject cdir cdinfo cdreset cdvolume cdshuffle >+#LINKS = cdstart cdpause cdstop cdeject cdir cdinfo cdreset cdshuffle > > # We seem to need GCC > CC = gcc $(DEBUG_FLAGS) >@@ -122,7 +124,7 @@ > $(CC) -o cdctrl $(OBJS1) > > cdadd: cdadd.sh >- sed s,@BINDIR@,$(BINDIR),g < $< > $@ >+ sed s,@BINDIR@,$(REALBINDIR),g < $< > $@ > chmod a+x $@ > > links: >@@ -141,13 +143,13 @@ > install cdown.1 $(MANDIR)/man1 > install cdtool.1 $(MANDIR)/man1 > install cdctrl.1 $(MANDIR)/man1 >+ install cdloop.1 $(MANDIR)/man1 > for i in $(LINKS); do \ > if test -h $(BINDIR)/$$i; then true; else \ >- rm -f $(BINDIR)/$$i; ln -s ./cdtool $(BINDIR)/$$i; \ >+ rm -f $(BINDIR)/$$i; ln -s cdtool $(BINDIR)/$$i; \ > fi; \ >- if test -h $(MANDIR)/man1/$$i.1; then true; else \ >- rm -f $(MANDIR)/man1/$$i.1; \ >- ln $(MANDIR)/man1/cdtool.1 $(MANDIR)/man1/$$i.1; \ >+ if test -h $(MANDIR)/man1/$$i; then true; else \ >+ rm -f $(MANDIR)/man1/$$i; ln -s cdtool.1 $(MANDIR)/man1/$$i; \ > fi; \ > done > >diff -ruN cdtool-2.1.5.orig/cdadd.sh cdtool-2.1.5/cdadd.sh >--- cdtool-2.1.5.orig/cdadd.sh 1996-11-01 14:20:16.000000000 -0800 >+++ cdtool-2.1.5/cdadd.sh 2005-12-09 21:38:52.000000000 -0800 >@@ -19,11 +19,11 @@ > *) usage;; > esac > >-@BINDIR@/cdir $DRIVE -t > /tmp/cdadd-$$ >+@BINDIR@/cdir $DRIVE -t > ~/.cdadd-$$ > > if [ -z $EDITOR ]; then >- EDITOR=vi >+ EDITOR=editor > fi >-$EDITOR /tmp/cdadd-$$ >-cat /tmp/cdadd-$$ >>~/.cdtooldb >-rm /tmp/cdadd-$$ >+$EDITOR ~/.cdadd-$$ >+cat ~/.cdadd-$$ >>~/.cdtooldb >+rm ~/.cdadd-$$ >diff -ruN cdtool-2.1.5.orig/cdctrl.c cdtool-2.1.5/cdctrl.c >--- cdtool-2.1.5.orig/cdctrl.c 1998-07-15 19:00:08.000000000 -0700 >+++ cdtool-2.1.5/cdctrl.c 2005-12-09 21:38:52.000000000 -0800 >@@ -246,7 +246,7 @@ > > case '-': > do_play(progname, cdfile, SKIPBACK, 0, FALSE); >- pszCmd = "prevous"; >+ pszCmd = "previous"; > break; > > case '+': >@@ -337,7 +337,7 @@ > dup2 (1, 2); > > /* try to open the CD device(s) */ >- if ( (cdfile=open(cd_device, O_RDONLY)) == -1 ) { >+ if ( (cdfile=open(cd_device, O_RDONLY | O_NONBLOCK)) == -1 ) { > fprintf(stderr, "%s: can't open cdrom (%s)", progname, cd_device); > DoCr(docr); > exit(1); >diff -ruN cdtool-2.1.5.orig/cdloop.1 cdtool-2.1.5/cdloop.1 >--- cdtool-2.1.5.orig/cdloop.1 1969-12-31 16:00:00.000000000 -0800 >+++ cdtool-2.1.5/cdloop.1 2005-12-09 21:38:52.000000000 -0800 >@@ -0,0 +1,58 @@ >+.\" cdloop - restart a CD when it ceases playing >+.\" Copyright (c) 1999 Roland Rosenfeld <roland@debian.org> >+.\" >+.\" This manual page is free software; you can redistribute it and/or modify >+.\" it under the terms of the GNU General Public License as published by >+.\" the Free Software Foundation; either version 2 of the License, or >+.\" (at your option) any later version. >+.\" >+.\" This program is distributed in the hope that it will be useful, >+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of >+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+.\" GNU General Public License for more details. >+.\" >+.\" You should have received a copy of the GNU General Public License >+.\" along with this program; if not, write to the Free Software >+.\" Foundation, Inc.,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. >+.\" >+.\" This manual page is written especially for Debian Linux. >+.\" >+.TH CDLOOP 1 "June 1999" "Debian Project" "Debian GNU/Linux" >+.SH NAME >+cdloop \- Restart a CD when it ceases playing >+.SH SYNOPSIS >+.B cdloop >+.I [v] [1] >+.SH DESCRIPTION >+.B cdloop >+is a tiny shell script for endless looping an audio CD using >+.BR cdplay (1). >+.SH OPTIONS >+.IP v >+Print verbose output on screen and write a log to >+.IR cdloop.log . >+.IP 1 >+Use second CDROM drive. >+.SH FILES >+.I cdloop.log >+.RS >+The log file created in verbose mode, written to the actual directory. >+.SH BUGS >+This program only works with SCSI or other drives accessed via >+.I /dev/scd0 >+or >+.IR /dev/scd1 . >+This program isn't able to use >+.I /dev/cdrom >+and it ignores the >+.B >+CDTOOLDEV >+environment variable. >+.SH AUTHOR >+.B cdloop >+was written by M. M. Eccles. >+.PP >+This manual page was created by Roland Rosenfeld <roland@debian.org> >+for the Debian GNU/Linux system (but may be used by others). >+.SH "SEE ALSO" >+.BR cdplay (1). >diff -ruN cdtool-2.1.5.orig/cdown.1 cdtool-2.1.5/cdown.1 >--- cdtool-2.1.5.orig/cdown.1 1998-07-15 06:47:59.000000000 -0700 >+++ cdtool-2.1.5/cdown.1 2005-12-09 21:38:52.000000000 -0800 >@@ -15,7 +15,7 @@ > .I cdown > command is a command to query the CD-ROM for track information, > use this to fetch information on this CD-ROM from the CDDB >-databases (www.cddb.com), and then output the information in >+databases (freedb.freedb.org), and then output the information in > a form suitable for cdir(1). > > .I cdown >@@ -32,7 +32,7 @@ > .IP \fB-d device\fR > specify the cdrom device > .IP \fB-H host\fR >-get database using HOST (def=cddb.cddb.com) >+get database using HOST (def=freedb.freedb.org) > .IP \fB-P port\fR > get database using PORT (def=888) > .IP \fB-l\fR >diff -ruN cdtool-2.1.5.orig/cdown.c cdtool-2.1.5/cdown.c >--- cdtool-2.1.5.orig/cdown.c 1998-07-15 06:47:46.000000000 -0700 >+++ cdtool-2.1.5/cdown.c 2005-12-09 21:38:52.000000000 -0800 >@@ -63,7 +63,7 @@ > #define VERSIONSTRING "0.2" > > /* default query host and port: */ >-#define CDDB_HOST "cddb.cddb.com" >+#define CDDB_HOST "freedb.freedb.org" > #define CDDB_PORT 888 > > /* default CD-ROM: */ >@@ -429,9 +429,10 @@ > if (cdtitle == NULL) { > cdtitle = firstword+1; > } else { >- *cdtitle = '\0'; >- cdtitle += 1; >- while (*cdtitle == ' ') cdtitle++; >+ *cdtitle = ' '; >+ while(*--cdtitle == ' ') ; >+ *++cdtitle = '\0'; >+ while (*++cdtitle == ' ') ; > } > printf("cdname %s\n", cdtitle); > printf("artist %s\n", firstword+1); >diff -ruN cdtool-2.1.5.orig/cdtool.1 cdtool-2.1.5/cdtool.1 >--- cdtool-2.1.5.orig/cdtool.1 1998-07-14 05:48:46.000000000 -0700 >+++ cdtool-2.1.5/cdtool.1 2005-12-09 21:38:52.000000000 -0800 >@@ -17,6 +17,7 @@ > \fBcdplay\fR [-[0..9]|-d device] [start|stop|resume|eject|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] > \fBcdshuffle\fR [-[0..9]|-d device] [-V|-?|-h] > > .fi >@@ -99,6 +100,11 @@ > .I cdstop > command stops the compact disc, if it is playing. > .PP >+The >+.I cdvolume >+command sets the output volume level of the CD player. The level is an >+integer from 0 to 255. >+.PP > The > .I cdshuffle > command plays the audio tracks on the disc in random order. >diff -ruN cdtool-2.1.5.orig/commands.c cdtool-2.1.5/commands.c >--- cdtool-2.1.5.orig/commands.c 1998-07-15 07:21:14.000000000 -0700 >+++ cdtool-2.1.5/commands.c 2005-12-09 21:38:52.000000000 -0800 >@@ -151,8 +151,15 @@ > #ifndef SCSI > if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 ) > { >- fprintf(stderr, "%s: ioctl cdromplaytrkind\n", progname); >- EXIT(1); >+ /* patch by <Ingo.Wilken@Informatik.Uni-Oldenburg.DE> for Plextor */ >+ /* PX-32TSI drive */ >+ /* retry with all indices set to 1 */ >+ ti.cdti_ind1 = 1; >+ if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 ) >+ { >+ fprintf(stderr, "%s: ioctl cdromplaytrkind\n", progname); >+ EXIT(1); >+ } > } > #else > /* SCSI - convert track index into MSF format */ >@@ -333,3 +340,43 @@ > if (iVerbose == TRUE) > printf ("Reseting CDROM\n"); > } >+ >+/************************************************************************/ >+/* Procedure: do_volume >+ * Purpose: to adjust CD-ROM volume level >+ * >+ * Inputs: program name, CD file des., volume level (uchar) >+ * Outputs: to CD-ROM, to stdout >+ * Returns: 0 on success, -1 on failure >+ * Notes: >+ * 1. >+ */ >+/************************************************************************/ >+int do_volume(char *progname, int cdfile, int level, int iVerbose) >+{ >+ struct cdrom_volctrl volctrl; >+ >+#ifdef DEBUG >+ fprintf(stderr,"do_volume: called, name=%s, volume=%d, cdfile=%d\n", >+ progname, level, cdfile); >+#endif >+ >+ if ((level<0) || (level>255)) { >+ fprintf(stderr, "%s: illegal volume value (allowed values 0-255)\n", progname); >+ return -1; >+ } >+ >+ if(iVerbose == TRUE) >+ printf("Setting volume to level %d\n", level); >+ >+ volctrl.channel0= >+ volctrl.channel1= >+ volctrl.channel2= >+ volctrl.channel3=level; >+ >+ if ( ioctl(cdfile, CDROMVOLCTRL, &volctrl) == -1 ) { >+ fprintf(stderr, "%s: CDROMVOLCTRL ioctl failed\n", progname); >+ return -1; >+ } >+ return 0; >+} >diff -ruN cdtool-2.1.5.orig/commands.h cdtool-2.1.5/commands.h >--- cdtool-2.1.5.orig/commands.h 1998-07-15 07:17:35.000000000 -0700 >+++ cdtool-2.1.5/commands.h 2005-12-09 21:38:52.000000000 -0800 >@@ -30,6 +30,7 @@ > void do_stop(char *progname, int cdfile, int iCDNum, int iVerbose); > void do_eject(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); > /* > * Copyright (C) 1997, 1998 Wade Hampton > */ >diff -ruN cdtool-2.1.5.orig/database.c cdtool-2.1.5/database.c >--- cdtool-2.1.5.orig/database.c 1998-07-15 06:35:41.000000000 -0700 >+++ cdtool-2.1.5/database.c 2005-12-09 21:38:52.000000000 -0800 >@@ -11,6 +11,17 @@ > > static char rcsid[] = "$Id: database.c,v 1.3 1998/07/15 13:35:20 wadeh Exp wadeh $"; > >+/* chomp(): conceptually similar to the Perl function of that name. >+ * Removes any number of CR or NL chars from the end of a string. >+ */ >+static inline char *chomp(char *c) >+{ >+ int l=strlen(c)-1; >+ while (l>=0 && c[l]=='\n' || c[l]=='\r') >+ c[l--]='\0'; >+ return c; >+} >+ > /************************************************************************/ > /* Procedure: read_db > * Purpose: to read database info for this CD-ROM >@@ -38,11 +49,11 @@ > char *path_bit; > int dbpath_count=1, cur_file=0, found_it=0; > struct passwd *prec = getpwuid(getuid()); >- cd_t *temp_cd = (cd_t *)malloc(sizeof(cd_t)); >+ cd_t *temp_cd = (cd_t *)calloc(1,sizeof(cd_t)); > char dbpath[10][255]; > > if (!usedb) { >- free ((void *)temp_cd); >+ /* free ((void *)temp_cd); * can't free this, we're returning it */ > return temp_cd; > } > >@@ -82,8 +93,22 @@ > } > } > >- if (fred) >+ if (fred) { > fclose(fred); >+ chomp(temp_cd->cdname); >+ chomp(temp_cd->artist); >+ while(cur_track--) >+ chomp(temp_cd->track_names[cur_track]); >+ } >+ else >+ { >+ int i; >+ >+ temp_cd->cdname[0] = '\0'; >+ temp_cd->artist[0] = '\0'; >+ for (i=0 ; i<100 ; i++ ) >+ temp_cd->track_names[i][0] = '\0'; >+ } > } /*while*/ > return temp_cd; > } >diff -ruN cdtool-2.1.5.orig/hardware.c cdtool-2.1.5/hardware.c >--- cdtool-2.1.5.orig/hardware.c 1998-07-15 18:52:56.000000000 -0700 >+++ cdtool-2.1.5/hardware.c 2005-12-09 21:38:52.000000000 -0800 >@@ -8,6 +8,9 @@ > #include <sys/ioctl.h> > #include <sys/file.h> > #include <sys/types.h> >+#include <sys/stat.h> >+#include <pwd.h> >+#include <grp.h> > #include <fcntl.h> > #include <string.h> > #include <mntent.h> >@@ -298,12 +301,60 @@ > > /* try to open the CD-ROM. If we fail, report error */ > if (cd_fd < 0) { >- if ((cd_fd = open(cdname, 0)) < 0) { >+ if ((cd_fd = open(cdname, O_RDONLY | O_NONBLOCK)) < 0) { > if (errno == EACCES) { >- fprintf(stderr, "%s error opening %s\n", progname, cdname); >- fprintf(stderr, >- "As root, please run\n\nchmod 666 %s\n\n%s\n", "<yourname>", >- "to give yourself permission to access the CD-ROM device."); >+ struct stat sb; >+ struct group *g; >+ gid_t groups[1024]; >+ int ngroups; >+ >+ fprintf(stderr, "%s: error opening %s\n", progname, cdname); >+ if(stat(cdname, &sb) < 0) >+ fprintf(stderr, "%s: cannot stat %s: %s\n", progname, cdname); >+ else { >+ if(!(sb.st_mode & 0040)) >+ fprintf(stderr, >+ "%s is not group-readable\n" >+ "Try, as root: chmod g+r %s\n", cdname, cdname); >+ if(!(g = getgrgid(sb.st_gid))) >+ fprintf(stderr, "%s is owned by unknown group %lu\n", >+ "Try, as root: chgrp--dereference cdrom %s\n", >+ cdname, >+ (unsigned long)sb.st_gid, >+ cdname); >+ else if(strcmp(g->gr_name, "cdrom")) >+ fprintf(stderr, "%s is owned by group \"%s\"\n" >+ "Try, as root: chgrp --dereference cdrom %s\n", >+ cdname, >+ g->gr_name, >+ cdname); >+ } >+ if(!(g = getgrnam("cdrom"))) >+ fprintf(stderr, "This system appears to have no cdrom group!\n" >+ "Try, as root: addgroup cdrom\n"); >+ else { >+ if((ngroups = getgroups(sizeof groups / sizeof *groups, groups)) < 0) >+ fprintf(stderr, "%s: cannot get group list: %s\n", >+ progname, strerror(errno)); >+ else { >+ int found = 0; >+ while(ngroups--) { >+ if(groups[ngroups] == g->gr_gid) { >+ found = 1; >+ break; >+ } >+ } >+ if(!found) { >+ struct passwd *p; >+ >+ p = getpwuid(getuid()); >+ fprintf(stderr, "You are not in the \"cdrom\" group.\n" >+ "Try, as root: adduser %s cdrom\n" >+ "You will need to log in again before this takes effect\n", >+ p ? p->pw_name : "<your username>"); >+ } >+ } >+ } > } > } > else if (errno==ENOENT) { >diff -ruN cdtool-2.1.5.orig/info.c cdtool-2.1.5/info.c >--- cdtool-2.1.5.orig/info.c 1998-07-15 07:09:48.000000000 -0700 >+++ cdtool-2.1.5/info.c 2005-12-09 21:38:52.000000000 -0800 >@@ -260,29 +260,17 @@ > putchar(tracks_buffer[i]); > DoCr(docr); > >- if (cd->cdname[0]) >- printf("cdname %s", cd->cdname); >- else { >- printf("cdname "); >- DoCr(docr); >- } >+ printf("cdname %s", cd->cdname); >+ DoCr(docr); > >- if (cd->artist[0]) >- printf("artist %s", cd->artist); >- else { >- printf("artist "); >- DoCr(docr); >- } >+ printf("artist %s", cd->artist); >+ DoCr(docr); > > } else if (p_format != P_RAW) { >- if (cd->artist[0]) >- for (i=0; i<strlen(cd->artist)-1; i++) >- putchar(cd->artist[i]); >+ printf("%s", cd->artist); > if (cd->cdname[0] && cd->artist[0]) > printf(" - "); >- if (cd->cdname[0]) >- for (i=0; i<strlen(cd->cdname)-1; i++) >- putchar(cd->cdname[i]); >+ printf("%s", cd->cdname); > if (!cd->artist[0] && !cd->cdname[0]) > printf("unknown cd"); > if (p_format == P_LONG) >@@ -328,11 +316,9 @@ > else if (hw->subchnl.cdsc_audiostatus == CDROM_AUDIO_PAUSED) > printf("[PAUSED] "); > } >- if (usedb && cd->track_names[i-1][0] != 0) >+ if (usedb) > printf("%s",cd->track_names[i-1]); >- else { >- DoCr(docr); >- } >+ DoCr(docr); > } > break; /* P_LONG */ > >@@ -340,24 +326,15 @@ > switch(hw->subchnl.cdsc_audiostatus) { > case CDROM_AUDIO_PLAY: > printf(" - "); >- if (cd->track_names[hw->subchnl.cdsc_trk-1][0]) { >- for (i=0; >- i<strlen(cd->track_names[hw->subchnl.cdsc_trk - 1])-1; >- i++) >- putchar(cd->track_names[hw->subchnl.cdsc_trk-1][i]); >- printf(" "); >- } >+ if (cd->track_names[hw->subchnl.cdsc_trk-1][0]) >+ printf("%s ", cd->track_names[hw->subchnl.cdsc_trk-1]); > printf("[%u]", hw->subchnl.cdsc_trk); > DoCr(docr); > break; > case CDROM_AUDIO_PAUSED: > printf(" - paused on "); >- if (cd->track_names[hw->subchnl.cdsc_trk-1][0]) { >- for (i=0; >- i<strlen(cd->track_names[hw->subchnl.cdsc_trk - 1])-1; i++) >- putchar(cd->track_names[hw->subchnl.cdsc_trk-1][i]); >- printf(" "); >- } >+ if (cd->track_names[hw->subchnl.cdsc_trk-1][0]) >+ printf("%s ", cd->track_names[hw->subchnl.cdsc_trk-1]); > printf("[%u]", hw->subchnl.cdsc_trk); > DoCr(docr); > break; >@@ -367,13 +344,10 @@ > break; /* P_QUICK */ > > case P_TEMPL: >- for (i = hw->tochdr.cdth_trk0; i<=hw->tochdr.cdth_trk1; i++) >- if (usedb && cd->track_names[i-1][0] != 0) >- printf("track %s", cd->track_names[i-1]); >- else { >- printf("track "); >- DoCr(docr); >- } >+ for (i = hw->tochdr.cdth_trk0; i<=hw->tochdr.cdth_trk1; i++) { >+ printf("track %s", cd->track_names[i-1]); >+ DoCr(docr); >+ } > break; /* P_TEMPL */ > > } /* switch */ >diff -ruN cdtool-2.1.5.orig/main.c cdtool-2.1.5/main.c >--- cdtool-2.1.5.orig/main.c 1998-07-15 07:19:02.000000000 -0700 >+++ cdtool-2.1.5/main.c 2005-12-09 21:38:52.000000000 -0800 >@@ -176,6 +176,7 @@ > iVerbose = TRUE; > error = 1; > if (( strcmp(progname, "cdshuffle") == 0 ) || >+ ( strcmp(progname, "cdvolume") == 0 ) || > ( strcmp(progname, "cdplay") == 0 ) || > ( strcmp(progname, "cdstart") == 0 )) { > error = 0; >@@ -235,7 +236,7 @@ > exit(0); > } > >- if ( (cdfile=open(cd_device, O_RDONLY)) == -1 ) >+ if ( (cdfile=open(cd_device, O_RDONLY | O_NONBLOCK)) == -1 ) > { > cdhw_t hw; > int iResult; >@@ -359,6 +360,16 @@ > do_shuffle(progname, cdfile, iCDNum, iTracks, > iRepeat, iVerbose, cd_device, DOLF); > } >+ if (strcmp(argv[optind],"volume") == 0) { >+ if(++optind < argc) { >+ int vol=atoi(argv[optind]); >+#ifdef DEBUG >+fprintf (stderr,"main: called as \"%s\", volume\n", >+ progname); >+#endif >+ exit( do_volume(progname, cdfile, vol, iVerbose) ); >+ } >+ } > > /* block to play a CD if it is an audio cd */ > { >@@ -388,6 +399,14 @@ > } > else if ( strcmp(progname, "cdir") == 0 ) > do_dir(progname, cdfile, p_format, usedb, cd_device, DOLF); >+ else if ( strcmp(progname, "cdvolume") == 0 ) { >+ if ( optind < argc ) { >+ int vol=atoi(argv[optind]); >+ exit( do_volume(progname, cdfile, vol, iVerbose) ); >+ } >+ else >+ do_usage(progname); >+ } > else do_usage(progname); > > close(cdfile); >@@ -445,6 +464,8 @@ > fprintf(stderr, "usage: cdstop [options]\n"); > else if ( strcmp(progname, "cdeject") == 0 ) > fprintf(stderr, "usage: cdeject [options]\n"); >+ else if ( strcmp(progname, "cdvolume") == 0 ) >+ fprintf(stderr, "usage: cdvolume [0-255]\n"); > else if ( strcmp(progname, "cdpause") == 0 ) > { > fprintf(stderr, "usage: cdpause [options]\n"); >@@ -469,7 +490,7 @@ > } > else > fprintf(stderr, "Please call as cdplay/cdstart, cdstop, cdeject, \n\ >-cdpause, cdir, cdinfo, or cdshuffle\n"); >+cdvolume, cdpause, cdir, cdinfo, or cdshuffle\n"); > > /* standard options below here: */ > fprintf(stderr, " -V build, version, and this help\n"); >diff -ruN cdtool-2.1.5.orig/shuffle.c cdtool-2.1.5/shuffle.c >--- cdtool-2.1.5.orig/shuffle.c 1998-07-15 07:21:59.000000000 -0700 >+++ cdtool-2.1.5/shuffle.c 2005-12-09 21:38:52.000000000 -0800 >@@ -12,7 +12,9 @@ > #include <fcntl.h> > #include <errno.h> > #include <time.h> >+#include <pwd.h> > #include <sys/time.h> >+#include <sys/types.h> > > #ifdef sun > # include <sundev/srreg.h> >@@ -184,7 +186,9 @@ > > pid_t my_pid; > FILE *fpPID; >- char caBuf[40]; >+ char caBuf[255]; >+ struct passwd *pw; >+ char *homedir; > > iSaveTracks = iTracks; > pszName = progname; >@@ -214,7 +218,20 @@ > signal (SIGINT, inthdl); > signal (SIGHUP, huphdl); > my_pid = getpid(); >- sprintf (caBuf, "%s%d", PID_FILE, iCDNum); >+ pw=getpwuid(getuid()); >+ if (!pw) >+ { >+ fprintf(stderr, "Username not in passwd database - aborting\n"); >+ EXIT(1); >+ } >+ homedir=malloc(strlen(pw->pw_dir)+1); >+ if (!homedir) >+ { >+ fprintf(stderr, "Error allocating memory\n"); >+ EXIT(1); >+ } >+ strcpy(homedir, pw->pw_dir); >+ sprintf (caBuf, "%s%s%d", homedir, PID_FILE, iCDNum); > fpPID = fopen (caBuf, "w"); > if (fpPID == NULL) > fprintf(stderr,"%s: Error opening pid file %s\n", >@@ -306,7 +323,7 @@ > fprintf(stderr, "%s: ioctl cdromstop\n", progname); > } > >- sprintf (caBuf, "%s%d", PID_FILE, iCDNum); >+ sprintf (caBuf, "%s%s%d", homedir, PID_FILE, iCDNum); > if (iBEVerbose) > fprintf (stderr, "%s: removing lock file %s\n", > progname, caBuf); >diff -ruN cdtool-2.1.5.orig/shuffle.h cdtool-2.1.5/shuffle.h >--- cdtool-2.1.5.orig/shuffle.h 1998-07-15 07:02:47.000000000 -0700 >+++ cdtool-2.1.5/shuffle.h 2005-12-09 21:38:52.000000000 -0800 >@@ -1,7 +1,7 @@ > #ifndef __SHUFFLE_H__ > #define __SHUFFLE_H__ > >-#define PID_FILE "/tmp/cdshuffle_" /* add number 0..9 */ >+#define PID_FILE "/.cdshuffle_" /* add number 0..9 */ > > void do_shuffle( > char *progname, /* name of progarm */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 115059
: 74414 |
74415