Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 115059
Collapse All | Expand All

(-)cdtool-2.1.5.orig/Makefile (-9 / +11 lines)
Lines 26-33 Link Here
26
26
27
# Where do we install the binaries and unformatted manual pages?
27
# Where do we install the binaries and unformatted manual pages?
28
# -- These are for installation in the local tree:
28
# -- These are for installation in the local tree:
29
BINDIR = /usr/local/bin
29
PREFIX = $(DESTDIR)/usr
30
MANDIR = /usr/local/man
30
BINDIR = $(PREFIX)/bin
31
MANDIR = $(PREFIX)/share/man
32
REALBINDIR = /usr/bin
31
33
32
# -- These are for installation in the system tree (e.g., with distributions).
34
# -- These are for installation in the system tree (e.g., with distributions).
33
#BINDIR = /usr/bin
35
#BINDIR = /usr/bin
Lines 57-64 Link Here
57
# Note, the cdp package includes a program, /usr/bin/cdplay which
59
# Note, the cdp package includes a program, /usr/bin/cdplay which
58
# would interfere with the usage here.
60
# would interfere with the usage here.
59
#
61
#
60
#LINKS = cdplay cdpause cdstop cdeject cdir cdinfo cdreset
62
LINKS = cdplay cdpause cdstop cdeject cdir cdinfo cdreset cdvolume cdshuffle
61
LINKS = cdstart cdpause cdstop cdeject cdir cdinfo cdreset cdshuffle
63
#LINKS = cdstart cdpause cdstop cdeject cdir cdinfo cdreset cdshuffle
62
64
63
# We seem to need GCC
65
# We seem to need GCC
64
CC = gcc $(DEBUG_FLAGS)
66
CC = gcc $(DEBUG_FLAGS)
Lines 122-128 Link Here
122
	$(CC) -o cdctrl $(OBJS1)
124
	$(CC) -o cdctrl $(OBJS1)
123
125
124
cdadd: cdadd.sh
126
cdadd: cdadd.sh
125
	sed s,@BINDIR@,$(BINDIR),g < $< > $@
127
	sed s,@BINDIR@,$(REALBINDIR),g < $< > $@
126
	chmod a+x $@
128
	chmod a+x $@
127
	
129
	
128
links:
130
links:
Lines 141-153 Link Here
141
	install cdown.1  $(MANDIR)/man1
143
	install cdown.1  $(MANDIR)/man1
142
	install cdtool.1 $(MANDIR)/man1
144
	install cdtool.1 $(MANDIR)/man1
143
	install cdctrl.1 $(MANDIR)/man1
145
	install cdctrl.1 $(MANDIR)/man1
146
	install cdloop.1 $(MANDIR)/man1
144
	for i in $(LINKS); do \
147
	for i in $(LINKS); do \
145
		if test -h $(BINDIR)/$$i; then true; else \
148
		if test -h $(BINDIR)/$$i; then true; else \
146
			rm -f $(BINDIR)/$$i; ln -s ./cdtool $(BINDIR)/$$i; \
149
			rm -f $(BINDIR)/$$i; ln -s cdtool $(BINDIR)/$$i; \
147
		fi; \
150
		fi; \
148
		if test -h $(MANDIR)/man1/$$i.1; then true; else \
151
		if test -h $(MANDIR)/man1/$$i; then true; else \
149
			rm -f $(MANDIR)/man1/$$i.1; \
152
			rm -f $(MANDIR)/man1/$$i; ln -s cdtool.1 $(MANDIR)/man1/$$i; \
150
			ln $(MANDIR)/man1/cdtool.1 $(MANDIR)/man1/$$i.1; \
151
		fi; \
153
		fi; \
152
	done
154
	done
153
155
(-)cdtool-2.1.5.orig/cdadd.sh (-5 / +5 lines)
Lines 19-29 Link Here
19
  *) usage;;
19
  *) usage;;
20
esac
20
esac
21
21
22
@BINDIR@/cdir $DRIVE -t > /tmp/cdadd-$$
22
@BINDIR@/cdir $DRIVE -t > ~/.cdadd-$$
23
23
24
if [ -z $EDITOR ]; then
24
if [ -z $EDITOR ]; then
25
  EDITOR=vi
25
  EDITOR=editor
26
fi
26
fi
27
$EDITOR /tmp/cdadd-$$
27
$EDITOR ~/.cdadd-$$
28
cat /tmp/cdadd-$$ >>~/.cdtooldb
28
cat ~/.cdadd-$$ >>~/.cdtooldb
29
rm /tmp/cdadd-$$
29
rm ~/.cdadd-$$
(-)cdtool-2.1.5.orig/cdctrl.c (-2 / +2 lines)
Lines 246-252 Link Here
246
246
247
	case '-':
247
	case '-':
248
	    do_play(progname, cdfile, SKIPBACK, 0, FALSE);
248
	    do_play(progname, cdfile, SKIPBACK, 0, FALSE);
249
	    pszCmd = "prevous";
249
	    pszCmd = "previous";
250
	    break;
250
	    break;
251
251
252
	case '+':
252
	case '+':
Lines 337-343 Link Here
337
    dup2 (1, 2);
337
    dup2 (1, 2);
338
    
338
    
339
    /* try to open the CD device(s) */
339
    /* try to open the CD device(s) */
340
    if ( (cdfile=open(cd_device, O_RDONLY)) == -1 ) {
340
    if ( (cdfile=open(cd_device, O_RDONLY | O_NONBLOCK)) == -1 ) {
341
	fprintf(stderr, "%s: can't open cdrom (%s)", progname, cd_device);
341
	fprintf(stderr, "%s: can't open cdrom (%s)", progname, cd_device);
342
	DoCr(docr);
342
	DoCr(docr);
343
	exit(1);
343
	exit(1);
(-)cdtool-2.1.5.orig/cdloop.1 (+58 lines)
Line 0 Link Here
1
.\" cdloop - restart a CD when it ceases playing
2
.\" Copyright (c) 1999  Roland Rosenfeld <roland@debian.org>
3
.\"
4
.\" This manual page is free software; you can redistribute it and/or modify
5
.\" it under the terms of the GNU General Public License as published by
6
.\" the Free Software Foundation; either version 2 of the License, or
7
.\" (at your option) any later version.
8
.\"
9
.\" This program is distributed in the hope that it will be useful,
10
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
11
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
.\" GNU General Public License for more details.
13
.\"
14
.\" You should have received a copy of the GNU General Public License
15
.\" along with this program; if not, write to the Free Software
16
.\" Foundation, Inc.,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
.\"
18
.\" This manual page is written especially for Debian Linux.
19
.\"
20
.TH CDLOOP 1 "June 1999" "Debian Project" "Debian GNU/Linux"
21
.SH NAME
22
cdloop \- Restart a CD when it ceases playing
23
.SH SYNOPSIS
24
.B cdloop
25
.I [v] [1]
26
.SH DESCRIPTION
27
.B cdloop
28
is a tiny shell script for endless looping an audio CD using
29
.BR cdplay (1).
30
.SH OPTIONS
31
.IP v
32
Print verbose output on screen and write a log to
33
.IR cdloop.log .
34
.IP 1
35
Use second CDROM drive.
36
.SH FILES
37
.I cdloop.log
38
.RS
39
The log file created in verbose mode, written to the actual directory.
40
.SH BUGS
41
This program only works with SCSI or other drives accessed via
42
.I /dev/scd0
43
or
44
.IR /dev/scd1 .
45
This program isn't able to use
46
.I /dev/cdrom
47
and it ignores the
48
.B
49
CDTOOLDEV
50
environment variable.
51
.SH AUTHOR
52
.B cdloop
53
was written by M. M. Eccles.
54
.PP
55
This manual page was created by Roland Rosenfeld <roland@debian.org>
56
for the Debian GNU/Linux system (but may be used by others).
57
.SH "SEE ALSO"
58
.BR cdplay (1).
(-)cdtool-2.1.5.orig/cdown.1 (-2 / +2 lines)
Lines 15-21 Link Here
15
.I cdown
15
.I cdown
16
command is a command to query the CD-ROM for track information, 
16
command is a command to query the CD-ROM for track information, 
17
use this to fetch information on this CD-ROM from the CDDB
17
use this to fetch information on this CD-ROM from the CDDB
18
databases (www.cddb.com), and then output the information in 
18
databases (freedb.freedb.org), and then output the information in 
19
a form suitable for cdir(1).
19
a form suitable for cdir(1).
20
20
21
.I cdown 
21
.I cdown 
Lines 32-38 Link Here
32
.IP \fB-d device\fR
32
.IP \fB-d device\fR
33
specify the cdrom device
33
specify the cdrom device
34
.IP \fB-H host\fR
34
.IP \fB-H host\fR
35
get database using HOST (def=cddb.cddb.com)
35
get database using HOST (def=freedb.freedb.org)
36
.IP \fB-P port\fR
36
.IP \fB-P port\fR
37
get database using PORT (def=888)
37
get database using PORT (def=888)
38
.IP \fB-l\fR
38
.IP \fB-l\fR
(-)cdtool-2.1.5.orig/cdown.c (-4 / +5 lines)
Lines 63-69 Link Here
63
#define VERSIONSTRING "0.2"
63
#define VERSIONSTRING "0.2"
64
64
65
/* default query host and port:  */
65
/* default query host and port:  */
66
#define CDDB_HOST  "cddb.cddb.com"
66
#define CDDB_HOST  "freedb.freedb.org"
67
#define CDDB_PORT 888
67
#define CDDB_PORT 888
68
68
69
/* default CD-ROM:  */
69
/* default CD-ROM:  */
Lines 429-437 Link Here
429
	if (cdtitle == NULL) {
429
	if (cdtitle == NULL) {
430
	  cdtitle = firstword+1;
430
	  cdtitle = firstword+1;
431
	} else {
431
	} else {
432
	  *cdtitle = '\0';
432
	  *cdtitle = ' ';
433
	  cdtitle += 1;
433
	  while(*--cdtitle == ' ') ;
434
	  while (*cdtitle == ' ') cdtitle++;
434
	  *++cdtitle = '\0';
435
	  while (*++cdtitle == ' ') ;
435
	}
436
	}
436
        printf("cdname %s\n", cdtitle);
437
        printf("cdname %s\n", cdtitle);
437
	printf("artist %s\n", firstword+1);
438
	printf("artist %s\n", firstword+1);
(-)cdtool-2.1.5.orig/cdtool.1 (+6 lines)
Lines 17-22 Link Here
17
\fBcdplay\fR    [-[0..9]|-d device]  [start|stop|resume|eject|info|dir] 
17
\fBcdplay\fR    [-[0..9]|-d device]  [start|stop|resume|eject|info|dir] 
18
\fBcdplay\fR    [-[0..9]|-d device]  [-V|-?|-h]
18
\fBcdplay\fR    [-[0..9]|-d device]  [-V|-?|-h]
19
\fBcdstop\fR    [-[0..9]|-d device]  [-V|-?|-h]
19
\fBcdstop\fR    [-[0..9]|-d device]  [-V|-?|-h]
20
\fBcdvolume\fR  [-[0..9]|-d device]  [-V|-?|-h|\fIlevel\fR]
20
\fBcdshuffle\fR [-[0..9]|-d device]  [-V|-?|-h]
21
\fBcdshuffle\fR [-[0..9]|-d device]  [-V|-?|-h]
21
22
22
.fi
23
.fi
Lines 99-104 Link Here
99
.I cdstop
100
.I cdstop
100
command stops the compact disc, if it is playing.
101
command stops the compact disc, if it is playing.
101
.PP
102
.PP
103
The
104
.I cdvolume
105
command sets the output volume level of the CD player.  The level is an 
106
integer from 0 to 255.
107
.PP
102
The 
108
The 
103
.I cdshuffle
109
.I cdshuffle
104
command plays the audio tracks on the disc in random order.
110
command plays the audio tracks on the disc in random order.
(-)cdtool-2.1.5.orig/commands.c (-2 / +49 lines)
Lines 151-158 Link Here
151
#ifndef SCSI
151
#ifndef SCSI
152
  if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 ) 
152
  if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 ) 
153
    {
153
    {
154
      fprintf(stderr, "%s: ioctl cdromplaytrkind\n", progname);
154
      /* patch by <Ingo.Wilken@Informatik.Uni-Oldenburg.DE> for Plextor */
155
      EXIT(1);
155
      /* PX-32TSI drive */
156
      /* retry with all indices set to 1 */
157
      ti.cdti_ind1 = 1;
158
      if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
159
      {
160
      	fprintf(stderr, "%s: ioctl cdromplaytrkind\n", progname);
161
      	EXIT(1);
162
      }
156
    }
163
    }
157
#else
164
#else
158
  /* SCSI - convert track index into MSF format */
165
  /* SCSI - convert track index into MSF format */
Lines 333-335 Link Here
333
  if (iVerbose == TRUE)
340
  if (iVerbose == TRUE)
334
      printf ("Reseting CDROM\n");
341
      printf ("Reseting CDROM\n");
335
}
342
}
343
344
/************************************************************************/
345
/* Procedure:  do_volume
346
 * Purpose:    to adjust CD-ROM volume level
347
 * 
348
 * Inputs:     program name, CD file des., volume level (uchar)
349
 * Outputs:    to CD-ROM, to stdout
350
 * Returns:    0 on success, -1 on failure
351
 * Notes:  
352
 *   1.
353
 */
354
/************************************************************************/
355
int do_volume(char *progname, int cdfile, int level, int iVerbose)
356
{
357
  struct cdrom_volctrl volctrl;
358
359
#ifdef DEBUG
360
  fprintf(stderr,"do_volume:  called, name=%s, volume=%d, cdfile=%d\n",
361
	  progname, level, cdfile);
362
#endif
363
364
  if ((level<0) || (level>255)) {
365
    fprintf(stderr, "%s: illegal volume value (allowed values 0-255)\n", progname);
366
    return -1;
367
  }
368
369
  if(iVerbose == TRUE)
370
    printf("Setting volume to level %d\n", level);
371
372
  volctrl.channel0=
373
  volctrl.channel1=
374
  volctrl.channel2=
375
  volctrl.channel3=level;
376
377
  if ( ioctl(cdfile, CDROMVOLCTRL, &volctrl) == -1 ) {
378
    fprintf(stderr, "%s: CDROMVOLCTRL ioctl failed\n", progname);
379
    return -1;
380
  }
381
  return 0;
382
}
(-)cdtool-2.1.5.orig/commands.h (+1 lines)
Lines 30-35 Link Here
30
void do_stop(char *progname, int cdfile, int iCDNum, int iVerbose);
30
void do_stop(char *progname, int cdfile, int iCDNum, int iVerbose);
31
void do_eject(char *progname, int cdfile, int iVerbose);
31
void do_eject(char *progname, int cdfile, int iVerbose);
32
void do_reset(char *progname, int cdfile, int iVerbose);
32
void do_reset(char *progname, int cdfile, int iVerbose);
33
int  do_volume(char *progname, int cdfile, int volume, int iVerbose);
33
/*
34
/*
34
 * Copyright (C) 1997, 1998 Wade Hampton
35
 * Copyright (C) 1997, 1998 Wade Hampton
35
 */
36
 */
(-)cdtool-2.1.5.orig/database.c (-3 / +28 lines)
Lines 11-16 Link Here
11
11
12
static char rcsid[] = "$Id: database.c,v 1.3 1998/07/15 13:35:20 wadeh Exp wadeh $";
12
static char rcsid[] = "$Id: database.c,v 1.3 1998/07/15 13:35:20 wadeh Exp wadeh $";
13
13
14
/* chomp(): conceptually similar to the Perl function of that name.
15
 * Removes any number of CR or NL chars from the end of a string.
16
 */
17
static inline char *chomp(char *c)
18
{
19
    int l=strlen(c)-1;
20
    while (l>=0 && c[l]=='\n' || c[l]=='\r')
21
	c[l--]='\0';
22
    return c;
23
}
24
14
/************************************************************************/
25
/************************************************************************/
15
/* Procedure:  read_db
26
/* Procedure:  read_db
16
 * Purpose:    to read database info for this CD-ROM
27
 * Purpose:    to read database info for this CD-ROM
Lines 38-48 Link Here
38
    char *path_bit;
49
    char *path_bit;
39
    int  dbpath_count=1, cur_file=0, found_it=0;
50
    int  dbpath_count=1, cur_file=0, found_it=0;
40
    struct passwd *prec = getpwuid(getuid());
51
    struct passwd *prec = getpwuid(getuid());
41
    cd_t *temp_cd = (cd_t *)malloc(sizeof(cd_t));
52
    cd_t *temp_cd = (cd_t *)calloc(1,sizeof(cd_t));
42
    char dbpath[10][255];
53
    char dbpath[10][255];
43
54
44
    if (!usedb) {
55
    if (!usedb) {
45
        free ((void *)temp_cd);
56
        /* free ((void *)temp_cd);  * can't free this, we're returning it */
46
        return temp_cd;
57
        return temp_cd;
47
    }
58
    }
48
59
Lines 82-89 Link Here
82
            }
93
            }
83
        }
94
        }
84
95
85
	if (fred)
96
	if (fred) {
86
	    fclose(fred);
97
	    fclose(fred);
98
	    chomp(temp_cd->cdname);
99
	    chomp(temp_cd->artist);
100
	    while(cur_track--)
101
		chomp(temp_cd->track_names[cur_track]);
102
	}
103
    	else
104
    	{
105
		int i;
106
107
		temp_cd->cdname[0] = '\0';
108
		temp_cd->artist[0] = '\0';
109
		for (i=0 ; i<100 ; i++ )
110
			temp_cd->track_names[i][0] = '\0';
111
	}
87
    } /*while*/
112
    } /*while*/
88
    return temp_cd;
113
    return temp_cd;
89
}
114
}
(-)cdtool-2.1.5.orig/hardware.c (-5 / +56 lines)
Lines 8-13 Link Here
8
#include <sys/ioctl.h>
8
#include <sys/ioctl.h>
9
#include <sys/file.h>
9
#include <sys/file.h>
10
#include <sys/types.h>
10
#include <sys/types.h>
11
#include <sys/stat.h>
12
#include <pwd.h>
13
#include <grp.h>
11
#include <fcntl.h>
14
#include <fcntl.h>
12
#include <string.h>
15
#include <string.h>
13
#include <mntent.h>
16
#include <mntent.h>
Lines 298-309 Link Here
298
301
299
  /* try to open the CD-ROM.  If we fail, report error */
302
  /* try to open the CD-ROM.  If we fail, report error */
300
  if (cd_fd < 0) {
303
  if (cd_fd < 0) {
301
    if ((cd_fd = open(cdname, 0)) < 0) {
304
    if ((cd_fd = open(cdname, O_RDONLY | O_NONBLOCK)) < 0) {
302
      if (errno == EACCES) {
305
      if (errno == EACCES) {
303
	fprintf(stderr, "%s error opening %s\n", progname, cdname);
306
	struct stat sb;
304
	fprintf(stderr,
307
	struct group *g;
305
		"As root, please run\n\nchmod 666 %s\n\n%s\n", "<yourname>",
308
	gid_t groups[1024];
306
		"to give yourself permission to access the CD-ROM device.");
309
	int ngroups;
310
	
311
	fprintf(stderr, "%s: error opening %s\n", progname, cdname);
312
	if(stat(cdname, &sb) < 0)
313
	  fprintf(stderr, "%s: cannot stat %s: %s\n", progname, cdname);
314
	else {
315
	  if(!(sb.st_mode & 0040))
316
	    fprintf(stderr,
317
		    "%s is not group-readable\n"
318
		    "Try, as root: chmod g+r %s\n", cdname, cdname);
319
	  if(!(g = getgrgid(sb.st_gid)))
320
	    fprintf(stderr, "%s is owned by unknown group %lu\n",
321
		    "Try, as root: chgrp--dereference cdrom %s\n",
322
		    cdname,
323
		    (unsigned long)sb.st_gid,
324
		    cdname);
325
	  else if(strcmp(g->gr_name, "cdrom"))
326
	    fprintf(stderr, "%s is owned by group \"%s\"\n"
327
		    "Try, as root: chgrp --dereference cdrom %s\n",
328
		    cdname,
329
		    g->gr_name,
330
		    cdname);
331
	}
332
	if(!(g = getgrnam("cdrom")))
333
	  fprintf(stderr, "This system appears to have no cdrom group!\n"
334
		  "Try, as root: addgroup cdrom\n");
335
	else {
336
	  if((ngroups = getgroups(sizeof groups / sizeof *groups, groups)) < 0)
337
	    fprintf(stderr, "%s: cannot get group list: %s\n",
338
		    progname, strerror(errno));
339
	  else {
340
	    int found = 0;
341
	    while(ngroups--) {
342
	      if(groups[ngroups] == g->gr_gid) {
343
		found = 1;
344
		break;
345
	      }
346
	    }
347
	    if(!found) {
348
	      struct passwd *p;
349
350
	      p = getpwuid(getuid());
351
	      fprintf(stderr, "You are not in the \"cdrom\" group.\n"
352
		      "Try, as root: adduser %s cdrom\n"
353
		      "You will need to log in again before this takes effect\n",
354
		      p ? p->pw_name : "<your username>");
355
	    }
356
	  }
357
	}
307
      }
358
      }
308
    }
359
    }
309
    else if (errno==ENOENT) {
360
    else if (errno==ENOENT) {
(-)cdtool-2.1.5.orig/info.c (-42 / +16 lines)
Lines 260-288 Link Here
260
		putchar(tracks_buffer[i]);
260
		putchar(tracks_buffer[i]);
261
	    DoCr(docr);
261
	    DoCr(docr);
262
	    
262
	    
263
	    if (cd->cdname[0])
263
	    printf("cdname %s", cd->cdname);
264
		printf("cdname %s", cd->cdname);
264
	    DoCr(docr);
265
	    else {
266
		printf("cdname ");
267
		DoCr(docr);
268
	    }
269
	    
265
	    
270
	    if (cd->artist[0])
266
	    printf("artist %s", cd->artist);
271
		printf("artist %s", cd->artist);
267
	    DoCr(docr);
272
	    else {
273
		printf("artist ");
274
		DoCr(docr);
275
	    }
276
	    
268
	    
277
	} else if (p_format != P_RAW) {
269
	} else if (p_format != P_RAW) {
278
	    if (cd->artist[0])
270
	    printf("%s", cd->artist);
279
		for (i=0; i<strlen(cd->artist)-1; i++) 
280
		    putchar(cd->artist[i]);
281
	    if (cd->cdname[0] && cd->artist[0])
271
	    if (cd->cdname[0] && cd->artist[0])
282
		printf(" - ");
272
		printf(" - ");
283
	    if (cd->cdname[0])
273
	    printf("%s", cd->cdname);
284
		for (i=0; i<strlen(cd->cdname)-1; i++) 
285
		    putchar(cd->cdname[i]);
286
	    if (!cd->artist[0] && !cd->cdname[0])
274
	    if (!cd->artist[0] && !cd->cdname[0])
287
		printf("unknown cd");
275
		printf("unknown cd");
288
	    if (p_format == P_LONG)
276
	    if (p_format == P_LONG)
Lines 328-338 Link Here
328
		    else if (hw->subchnl.cdsc_audiostatus == CDROM_AUDIO_PAUSED)
316
		    else if (hw->subchnl.cdsc_audiostatus == CDROM_AUDIO_PAUSED)
329
			printf("[PAUSED] ");
317
			printf("[PAUSED] ");
330
		}
318
		}
331
		if (usedb && cd->track_names[i-1][0] != 0)
319
		if (usedb)
332
		    printf("%s",cd->track_names[i-1]);
320
		    printf("%s",cd->track_names[i-1]);
333
		else {
321
		DoCr(docr);
334
		    DoCr(docr);
335
		}
336
	    }
322
	    }
337
	    break; /* P_LONG */
323
	    break; /* P_LONG */
338
	    
324
	    
Lines 340-363 Link Here
340
	    switch(hw->subchnl.cdsc_audiostatus) {
326
	    switch(hw->subchnl.cdsc_audiostatus) {
341
	    case CDROM_AUDIO_PLAY: 
327
	    case CDROM_AUDIO_PLAY: 
342
		printf(" - ");
328
		printf(" - ");
343
		if (cd->track_names[hw->subchnl.cdsc_trk-1][0]) {
329
		if (cd->track_names[hw->subchnl.cdsc_trk-1][0])
344
		    for (i=0; 
330
		    printf("%s ", cd->track_names[hw->subchnl.cdsc_trk-1]);
345
			 i<strlen(cd->track_names[hw->subchnl.cdsc_trk - 1])-1;
346
			 i++)
347
			putchar(cd->track_names[hw->subchnl.cdsc_trk-1][i]);
348
		    printf(" ");
349
		}
350
		printf("[%u]", hw->subchnl.cdsc_trk);
331
		printf("[%u]", hw->subchnl.cdsc_trk);
351
		DoCr(docr);
332
		DoCr(docr);
352
		break;
333
		break;
353
	    case CDROM_AUDIO_PAUSED:
334
	    case CDROM_AUDIO_PAUSED:
354
		printf(" - paused on ");
335
		printf(" - paused on ");
355
		if (cd->track_names[hw->subchnl.cdsc_trk-1][0]) {
336
		if (cd->track_names[hw->subchnl.cdsc_trk-1][0])
356
		    for (i=0; 
337
		    printf("%s ", cd->track_names[hw->subchnl.cdsc_trk-1]);
357
			 i<strlen(cd->track_names[hw->subchnl.cdsc_trk - 1])-1; i++)
358
			putchar(cd->track_names[hw->subchnl.cdsc_trk-1][i]);
359
		    printf(" ");
360
		}
361
		printf("[%u]", hw->subchnl.cdsc_trk);
338
		printf("[%u]", hw->subchnl.cdsc_trk);
362
		DoCr(docr);
339
		DoCr(docr);
363
		break;
340
		break;
Lines 367-379 Link Here
367
	    break; /* P_QUICK */
344
	    break; /* P_QUICK */
368
	    
345
	    
369
	case P_TEMPL:
346
	case P_TEMPL:
370
	    for (i = hw->tochdr.cdth_trk0; i<=hw->tochdr.cdth_trk1; i++)
347
	    for (i = hw->tochdr.cdth_trk0; i<=hw->tochdr.cdth_trk1; i++) {
371
		if (usedb && cd->track_names[i-1][0] != 0)
348
	        printf("track %s", cd->track_names[i-1]);
372
		    printf("track %s", cd->track_names[i-1]);
349
		DoCr(docr);
373
		else {
350
	    }
374
		    printf("track ");
375
		    DoCr(docr);
376
		}
377
	    break; /* P_TEMPL */
351
	    break; /* P_TEMPL */
378
	    
352
	    
379
	} /* switch */
353
	} /* switch */
(-)cdtool-2.1.5.orig/main.c (-2 / +23 lines)
Lines 176-181 Link Here
176
	  iVerbose = TRUE;
176
	  iVerbose = TRUE;
177
	  error = 1;
177
	  error = 1;
178
	  if (( strcmp(progname, "cdshuffle") == 0 ) ||
178
	  if (( strcmp(progname, "cdshuffle") == 0 ) ||
179
	      ( strcmp(progname, "cdvolume") == 0 ) ||
179
	      ( strcmp(progname, "cdplay") == 0 ) ||
180
	      ( strcmp(progname, "cdplay") == 0 ) ||
180
	      ( strcmp(progname, "cdstart") == 0 )) {
181
	      ( strcmp(progname, "cdstart") == 0 )) {
181
	      error = 0;
182
	      error = 0;
Lines 235-241 Link Here
235
      exit(0);
236
      exit(0);
236
    }
237
    }
237
238
238
  if ( (cdfile=open(cd_device, O_RDONLY)) == -1 ) 
239
  if ( (cdfile=open(cd_device, O_RDONLY | O_NONBLOCK)) == -1 ) 
239
    {
240
    {
240
      cdhw_t hw;
241
      cdhw_t hw;
241
      int    iResult;
242
      int    iResult;
Lines 359-364 Link Here
359
             do_shuffle(progname, cdfile, iCDNum, iTracks, 
360
             do_shuffle(progname, cdfile, iCDNum, iTracks, 
360
			iRepeat, iVerbose, cd_device, DOLF);
361
			iRepeat, iVerbose, cd_device, DOLF);
361
        }
362
        }
363
	if (strcmp(argv[optind],"volume") == 0) {
364
	     if(++optind < argc) {
365
		  int vol=atoi(argv[optind]);
366
#ifdef DEBUG
367
fprintf (stderr,"main:     called as \"%s\", volume\n",
368
	 progname);
369
#endif
370
		  exit( do_volume(progname, cdfile, vol, iVerbose) );
371
	     }
372
	}
362
373
363
	/* block to play a CD if it is an audio cd */
374
	/* block to play a CD if it is an audio cd */
364
	{
375
	{
Lines 388-393 Link Here
388
  }
399
  }
389
  else if ( strcmp(progname, "cdir") == 0 )
400
  else if ( strcmp(progname, "cdir") == 0 )
390
    do_dir(progname, cdfile, p_format, usedb, cd_device, DOLF);
401
    do_dir(progname, cdfile, p_format, usedb, cd_device, DOLF);
402
  else if ( strcmp(progname, "cdvolume") == 0 ) {
403
    if ( optind < argc ) {
404
      int vol=atoi(argv[optind]);
405
      exit( do_volume(progname, cdfile, vol, iVerbose) );
406
    }
407
    else
408
      do_usage(progname);
409
  }
391
  else do_usage(progname);
410
  else do_usage(progname);
392
411
393
  close(cdfile);
412
  close(cdfile);
Lines 445-450 Link Here
445
    fprintf(stderr, "usage: cdstop  [options]\n");
464
    fprintf(stderr, "usage: cdstop  [options]\n");
446
  else if ( strcmp(progname, "cdeject") == 0 )
465
  else if ( strcmp(progname, "cdeject") == 0 )
447
    fprintf(stderr, "usage: cdeject  [options]\n");
466
    fprintf(stderr, "usage: cdeject  [options]\n");
467
  else if ( strcmp(progname, "cdvolume") == 0 ) 
468
      fprintf(stderr, "usage: cdvolume [0-255]\n");
448
  else if ( strcmp(progname, "cdpause") == 0 )
469
  else if ( strcmp(progname, "cdpause") == 0 )
449
    {
470
    {
450
      fprintf(stderr, "usage: cdpause  [options]\n");
471
      fprintf(stderr, "usage: cdpause  [options]\n");
Lines 469-475 Link Here
469
    }
490
    }
470
  else 
491
  else 
471
    fprintf(stderr, "Please call as cdplay/cdstart, cdstop, cdeject, \n\
492
    fprintf(stderr, "Please call as cdplay/cdstart, cdstop, cdeject, \n\
472
cdpause, cdir, cdinfo, or cdshuffle\n");
493
cdvolume, cdpause, cdir, cdinfo, or cdshuffle\n");
473
494
474
  /* standard options below here: */
495
  /* standard options below here: */
475
  fprintf(stderr, " -V            build, version, and this help\n");
496
  fprintf(stderr, " -V            build, version, and this help\n");
(-)cdtool-2.1.5.orig/shuffle.c (-3 / +20 lines)
Lines 12-18 Link Here
12
#include <fcntl.h>
12
#include <fcntl.h>
13
#include <errno.h>
13
#include <errno.h>
14
#include <time.h>
14
#include <time.h>
15
#include <pwd.h>
15
#include <sys/time.h>
16
#include <sys/time.h>
17
#include <sys/types.h>
16
18
17
#ifdef sun
19
#ifdef sun
18
#  include <sundev/srreg.h>
20
#  include <sundev/srreg.h>
Lines 184-190 Link Here
184
186
185
  pid_t my_pid;
187
  pid_t my_pid;
186
  FILE  *fpPID;
188
  FILE  *fpPID;
187
  char  caBuf[40];
189
  char  caBuf[255];
190
  struct passwd	*pw;
191
  char	*homedir;
188
192
189
  iSaveTracks = iTracks;
193
  iSaveTracks = iTracks;
190
  pszName = progname;
194
  pszName = progname;
Lines 214-220 Link Here
214
      signal (SIGINT, inthdl);
218
      signal (SIGINT, inthdl);
215
      signal (SIGHUP, huphdl);
219
      signal (SIGHUP, huphdl);
216
      my_pid = getpid();
220
      my_pid = getpid();
217
      sprintf (caBuf, "%s%d", PID_FILE, iCDNum);
221
      pw=getpwuid(getuid());
222
      if (!pw)
223
      {
224
      	fprintf(stderr, "Username not in passwd database - aborting\n");
225
      	EXIT(1);
226
      }
227
      homedir=malloc(strlen(pw->pw_dir)+1);
228
      if (!homedir)
229
      {
230
      	fprintf(stderr, "Error allocating memory\n");
231
      	EXIT(1);
232
      }
233
      strcpy(homedir, pw->pw_dir);
234
      sprintf (caBuf, "%s%s%d", homedir, PID_FILE, iCDNum);
218
      fpPID = fopen (caBuf, "w");
235
      fpPID = fopen (caBuf, "w");
219
      if (fpPID == NULL)
236
      if (fpPID == NULL)
220
	  fprintf(stderr,"%s:  Error opening pid file %s\n", 
237
	  fprintf(stderr,"%s:  Error opening pid file %s\n", 
Lines 306-312 Link Here
306
      fprintf(stderr, "%s: ioctl cdromstop\n", progname);
323
      fprintf(stderr, "%s: ioctl cdromstop\n", progname);
307
  }
324
  }
308
325
309
  sprintf (caBuf, "%s%d", PID_FILE, iCDNum);
326
  sprintf (caBuf, "%s%s%d", homedir, PID_FILE, iCDNum);
310
  if (iBEVerbose)
327
  if (iBEVerbose)
311
      fprintf (stderr, "%s:  removing lock file %s\n", 
328
      fprintf (stderr, "%s:  removing lock file %s\n", 
312
	       progname, caBuf);
329
	       progname, caBuf);
(-)cdtool-2.1.5.orig/shuffle.h (-1 / +1 lines)
Lines 1-7 Link Here
1
#ifndef __SHUFFLE_H__
1
#ifndef __SHUFFLE_H__
2
#define __SHUFFLE_H__
2
#define __SHUFFLE_H__
3
3
4
#define PID_FILE "/tmp/cdshuffle_"  /* add number 0..9 */
4
#define PID_FILE "/.cdshuffle_"  /* add number 0..9 */
5
5
6
void do_shuffle(
6
void do_shuffle(
7
		char *progname,  /* name of progarm */ 
7
		char *progname,  /* name of progarm */ 

Return to bug 115059