From 2b164044a800ca8a33feb65dbf1833a5467af096 Mon Sep 17 00:00:00 2001
From: Jitesh Shah <jiteshs@marvell.com>
Date: Tue, 11 Aug 2009 09:32:39 +0200
Subject: [PATCH] Backport patch from 1.1.9-6 to avoid conflicts with glibc functions

Signed-off-by: Jitesh Shah <jiteshs@marvell.com>
---
 cdrkit-1.1.9-no_mp3.patch |   50 ++++++++++++
 cdrkit-1.1.9-types.patch  |  195 +++++++++++++++++++++++++++++++++++++++++++++
 cdrkit.spec               |   13 +++-
 3 files changed, 256 insertions(+), 2 deletions(-)
 create mode 100644 cdrkit-1.1.9-no_mp3.patch
 create mode 100644 cdrkit-1.1.9-types.patch

diff --git a/cdrkit-1.1.9-no_mp3.patch b/cdrkit-1.1.9-no_mp3.patch
new file mode 100644
index 0000000..6948e4e
--- /dev/null
+++ b/cdrkit-1.1.9-no_mp3.patch
@@ -0,0 +1,50 @@
+diff -up cdrkit-1.1.9/icedax/cdda2ogg.1.no_mp3 cdrkit-1.1.9/icedax/cdda2ogg.1
+--- cdrkit-1.1.9/icedax/cdda2ogg.1.no_mp3	2009-06-15 14:48:44.930637082 +0200
++++ cdrkit-1.1.9/icedax/cdda2ogg.1	2009-06-15 14:50:35.596769274 +0200
+@@ -1,12 +1,11 @@
+ '\"
+ .TH "cdda2ogg" "1"
+ .SH "NAME"
+-cdda2ogg, cdda2mp3 \(em extract audio CD audio tracks and encode them
++cdda2ogg \(em extract audio CD audio tracks and encode them
+ .SH "SYNOPSIS"
+ .PP
+ .B cdda2ogg
+ .PP
+-.B cdda2mp3
+ .SH "DESCRIPTION"
+ .PP
+ .B cdda2ogg is a simple script that uses the
+@@ -15,9 +14,6 @@ command to extract all audio tracks with
+ .B icedax <fileprefix>
+ command and encode them using the
+ .B ogg123
+-respective
+-.I <censored>
+-MP3
+ encoder. The scripts are not intended to be full-featured music archiving
+ programs, but only for quick storing of few audio data.
+ It does not use databases like CDDB or have any extra features. You may look
+@@ -36,8 +32,6 @@ for more information.
+ .SH "CONFIGURATION"
+ .PP
+ .B cdda2ogg
+-and
+-.B cdda2mp3
+ have predefined values for reading and labeling of the target files.
+ You can overwrite them with following environment variables:
+ 
+@@ -65,11 +59,11 @@ Additional options passed to
+ The base part of the filename of resulting audio files. This can also be specified as the first argument to the script.
+ 
+ .PP
+-See cdda2ogg (cdda2mp3) script file to get the default values
++See cdda2ogg script file to get the default values
+ .PP
+ System administrator can also set default values by creating of a shell
+ include file, defining the variables for the POSIX shell, and storing them as
+-/etc/default/cdda2ogg (resp. cdda2mp3).
++/etc/default/cdda2ogg.
+ .SH "EXAMPLES"
+ .PP
+ .B CDDA_DEVICE=/dev/cdrom1 cdda2ogg
diff --git a/cdrkit-1.1.9-types.patch b/cdrkit-1.1.9-types.patch
new file mode 100644
index 0000000..d25b6f3
--- /dev/null
+++ b/cdrkit-1.1.9-types.patch
@@ -0,0 +1,195 @@
+diff -urN cdrkit-1.1.9/include/schily.h cdrkit-1.1.9_getline/include/schily.h
+--- cdrkit-1.1.9/include/schily.h	2009-06-08 13:22:27.000000000 +0200
++++ cdrkit-1.1.9_getline/include/schily.h	2009-06-08 13:46:40.000000000 +0200
+@@ -116,13 +116,13 @@
+ extern	int	fexecle(const char *, FILE *, FILE *, FILE *, const char *, ...);
+ 		/* 6th arg not const, fexecv forces av[ac] = NULL */
+ extern	int	fexecv(const char *, FILE *, FILE *, FILE *, int, char **);
+-extern	int	fexecve(const char *, FILE *, FILE *, FILE *, char * const *, 
++extern	int	cdr_fexecve(const char *, FILE *, FILE *, FILE *, char * const *, 
+ 							  char * const *);
+ extern	int	fspawnv(FILE *, FILE *, FILE *, int, char * const *);
+ extern	int	fspawnl(FILE *, FILE *, FILE *, const char *, const char *, ...);
+ extern	int	fspawnv_nowait(FILE *, FILE *, FILE *, const char *, int, 
+ 										char *const*);
+-extern	int	fgetline(FILE *, char *, int);
++extern	int	cdr_fgetline(FILE *, char *, int);
+ extern	int	fgetstr(FILE *, char *, int);
+ extern	void	file_raise(FILE *, int);
+ extern	int	fileclose(FILE *);
+@@ -190,7 +190,7 @@
+ extern	char	*fillbytes(void *, int, char);
+ extern	char	*findbytes(const void *, int, char);
+ extern	int	findline(const char *, char, const char *, int, char **, int);
+-extern	int	getline(char *, int);
++extern	int	cdr_getline(char *, int);
+ extern	int	getstr(char *, int);
+ extern	int	breakline(char *, char, char **, int);
+ extern	int	getallargs(int *, char * const**, const char *, ...);
+diff -urN cdrkit-1.1.9/librols/fexec.c cdrkit-1.1.9_getline/librols/fexec.c
+--- cdrkit-1.1.9/librols/fexec.c	2009-06-08 13:22:27.000000000 +0200
++++ cdrkit-1.1.9_getline/librols/fexec.c	2009-06-08 13:46:33.000000000 +0200
+@@ -170,7 +170,7 @@
+ 	} while (p != NULL);
+ 	va_end(args);
+ 
+-	ret = fexecve(name, in, out, err, av, env);
++	ret = cdr_fexecve(name, in, out, err, av, env);
+ 	if (av != xav)
+ 		free(av);
+ 	return (ret);
+@@ -184,11 +184,11 @@
+ 	char *av[];
+ {
+ 	av[ac] = NULL;			/*  force list to be null terminated */
+-	return (fexecve(name, in, out, err, av, environ));
++	return (cdr_fexecve(name, in, out, err, av, environ));
+ }
+ 
+ EXPORT int
+-fexecve(name, in, out, err, av, env)
++cdr_fexecve(name, in, out, err, av, env)
+ 	const char *name;
+ 	FILE *in, *out, *err;
+ 	char * const av[], * const env[];
+diff -urN cdrkit-1.1.9/librols/getdomainname.c cdrkit-1.1.9_getline/librols/getdomainname.c
+--- cdrkit-1.1.9/librols/getdomainname.c	2009-06-08 13:22:27.000000000 +0200
++++ cdrkit-1.1.9_getline/librols/getdomainname.c	2009-06-08 13:32:40.000000000 +0200
+@@ -83,7 +83,7 @@
+ 	if (f == NULL)
+ 		return (-1);
+ 
+-	while (fgetline(f, name1, sizeof (name1)) >= 0) {
++	while (cdr_fgetline(f, name1, sizeof (name1)) >= 0) {
+ 		if ((p = strchr(name1, '#')) != NULL)
+ 			*p = '\0';
+ 
+diff -urN cdrkit-1.1.9/librols/stdio/fgetline.c cdrkit-1.1.9_getline/librols/stdio/fgetline.c
+--- cdrkit-1.1.9/librols/stdio/fgetline.c	2009-06-08 13:22:27.000000000 +0200
++++ cdrkit-1.1.9_getline/librols/stdio/fgetline.c	2009-06-08 13:32:19.000000000 +0200
+@@ -37,7 +37,7 @@
+  */
+ 
+ EXPORT int
+-fgetline(f, buf, len)
++cdr_fgetline(f, buf, len)
+ 	register	FILE	*f;
+ 			char	*buf;
+ 	register	int	len;
+@@ -76,9 +76,9 @@
+ }
+ 
+ EXPORT int
+-getline(buf, len)
++cdr_getline(buf, len)
+ 	char	*buf;
+ 	int	len;
+ {
+-	return (fgetline(stdin, buf, len));
++	return (cdr_fgetline(stdin, buf, len));
+ }
+diff -urN cdrkit-1.1.9/libusal/scsitransp.c cdrkit-1.1.9_getline/libusal/scsitransp.c
+--- cdrkit-1.1.9/libusal/scsitransp.c	2009-06-08 13:22:27.000000000 +0200
++++ cdrkit-1.1.9_getline/libusal/scsitransp.c	2009-06-08 13:32:01.000000000 +0200
+@@ -301,7 +301,7 @@
+ 
+ 	printf("%s", msg);
+ 	flush();
+-	if (getline(okbuf, sizeof (okbuf)) == EOF)
++	if (cdr_getline(okbuf, sizeof (okbuf)) == EOF)
+ 		exit(EX_BAD);
+ 	if (streql(okbuf, "y") || streql(okbuf, "yes") ||
+ 	    streql(okbuf, "Y") || streql(okbuf, "YES"))
+diff -urN cdrkit-1.1.9/readom/io.c cdrkit-1.1.9_getline/readom/io.c
+--- cdrkit-1.1.9/readom/io.c	2009-06-08 13:22:27.000000000 +0200
++++ cdrkit-1.1.9_getline/readom/io.c	2009-06-08 13:31:39.000000000 +0200
+@@ -130,7 +130,7 @@
+ 		(*prt)(s, *lp, mini, maxi, dp);
+ 		flush();
+ 		line[0] = '\0';
+-		if (getline(line, 80) == EOF)
++		if (cdr_getline(line, 80) == EOF)
+ 			exit(EX_BAD);
+ 
+ 		linep = skipwhite(line);
+@@ -178,7 +178,7 @@
+ 	vprintf(form, args);
+ 	va_end(args);
+ 	flush();
+-	if (getline(okbuf, sizeof(okbuf)) == EOF)
++	if (cdr_getline(okbuf, sizeof(okbuf)) == EOF)
+ 		exit(EX_BAD);
+ 	if (okbuf[0] == '?') {
+ 		printf("Enter 'y', 'Y', 'yes' or 'YES' if you agree with the previous asked question.\n");
+diff -urN cdrkit-1.1.9/readom/readom.c cdrkit-1.1.9_getline/readom/readom.c
+--- cdrkit-1.1.9/readom/readom.c	2009-06-08 13:22:27.000000000 +0200
++++ cdrkit-1.1.9_getline/readom/readom.c	2009-06-08 13:31:54.000000000 +0200
+@@ -1605,7 +1605,7 @@
+ 		fprintf(stderr, "Copy from SCSI (%d,%d,%d) disk to file\n",
+ 					usal_scsibus(usalp), usal_target(usalp), usal_lun(usalp));
+ 		fprintf(stderr, "Enter filename [%s]: ", defname); flush();
+-		(void) getline(filename, sizeof (filename));
++		(void) cdr_getline(filename, sizeof (filename));
+ 	}
+ 
+ 	if (askrange) {
+@@ -1772,7 +1772,7 @@
+ 		fprintf(stderr, "Copy from file to SCSI (%d,%d,%d) disk\n",
+ 					usal_scsibus(usalp), usal_target(usalp), usal_lun(usalp));
+ 		fprintf(stderr, "Enter filename [%s]: ", defname); flush();
+-		(void) getline(filename, sizeof (filename));
++		(void) cdr_getline(filename, sizeof (filename));
+ 		fprintf(stderr, "Notice: reading from file always starts at file offset 0.\n");
+ 
+ 		getlong("Enter starting sector for copy:", &addr, 0L, end-1);
+diff -urN cdrkit-1.1.9/wodim/cue.c cdrkit-1.1.9_getline/wodim/cue.c
+--- cdrkit-1.1.9/wodim/cue.c	2009-06-08 13:22:27.000000000 +0200
++++ cdrkit-1.1.9_getline/wodim/cue.c	2009-06-08 13:58:59.000000000 +0200
+@@ -253,7 +253,7 @@
+ static	char	*peekword(void);
+ static	char	*lineend(void);
+ static	char	*markword(char *delim);
+-static	char	getdelim(void);
++static	char	cdr_getdelim(void);
+ static	char	*getnextitem(char *delim);
+ static	char	*neednextitem(char *delim);
+ static	char	*nextword(void);
+@@ -746,7 +746,7 @@
+ 	if (kp == NULL)
+ 		cueabort("Unknown filetype '%s'", word);
+ 
+-	if (getdelim() == '/') {
++	if (cdr_getdelim() == '/') {
+ 		word = needitem();
+ 		if (*astol(++word, &secsize) != '\0')
+ 			cueabort("Not a number '%s'", word);
+@@ -1038,7 +1038,7 @@
+ 
+ 	do {
+ 		fillbytes(linebuf, sizeof (linebuf), '\0');
+-		len = fgetline(f, linebuf, sizeof (linebuf));
++		len = cdr_fgetline(f, linebuf, sizeof (linebuf));
+ 		if (len < 0)
+ 			return (NULL);
+ 		if (len > 0 && linebuf[len-1] == '\r') {
+@@ -1128,7 +1128,7 @@
+ }
+ 
+ static char 
+-getdelim()
++cdr_getdelim()
+ {
+ 	return (wordendc);
+ }
+diff -urN cdrkit-1.1.9/wodim/wodim.c cdrkit-1.1.9_getline/wodim/wodim.c
+--- cdrkit-1.1.9/wodim/wodim.c	2009-06-08 13:22:27.000000000 +0200
++++ cdrkit-1.1.9_getline/wodim/wodim.c	2009-06-08 13:33:01.000000000 +0200
+@@ -3964,7 +3964,7 @@
+ #endif
+ 		} else
+ #endif
+-		if (fgetline(tty, ans, 1) < 0)
++		if (cdr_fgetline(tty, ans, 1) < 0)
+ 			comerrno(EX_BAD, "Aborted by EOF on input.\n");
+ 	}
+ 	usalp->silent--;
diff --git a/cdrkit.spec b/cdrkit.spec
index 5642692..5341813 100644
--- a/cdrkit.spec
+++ b/cdrkit.spec
@@ -1,7 +1,7 @@
 Summary: A collection of CD/DVD utilities
 Name: cdrkit
 Version: 1.1.9
-Release: 4%{?dist}
+Release: 4%{?dist}.fa1
 License: GPLv2
 Group: Applications/System
 URL: http://cdrkit.org/
@@ -9,6 +9,8 @@ Source: http://cdrkit.org/releases/cdrkit-%{version}.tar.gz
 
 Patch1: cdrkit-1.1.8-werror.patch
 Patch2: cdrkit-1.1.9-efi-boot.patch
+Patch3: cdrkit-1.1.9-types.patch
+Patch4: cdrkit-1.1.9-no_mp3.patch
 
 BuildRequires: cmake libcap-devel zlib-devel perl file-devel bzip2-devel
 
@@ -71,6 +73,8 @@ rates. Icedax can also be used as a CD player.
 %setup -q 
 %patch1 -p1 -b .werror
 %patch2 -p1 -b .efi
+%patch3 -p1 -b .types
+%patch4 -p1 -b .no_mp3
 
 find . -type f -print0 | xargs -0 perl -pi -e 's#/usr/local/bin/perl#/usr/bin/perl#g'
 find doc -type f -print0 | xargs -0 chmod a-x 
@@ -98,6 +102,9 @@ ln -s icedax $RPM_BUILD_ROOT%{_bindir}/cdda2wav
 ln -s wodim $RPM_BUILD_ROOT%{_bindir}/cdrecord
 ln -s wodim $RPM_BUILD_ROOT%{_bindir}/dvdrecord
 
+# we don't need cdda2mp3 since we don't have any mp3 {en,de}coder
+rm $RPM_BUILD_ROOT%{_bindir}/cdda2mp3
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -178,7 +185,6 @@ fi
 %doc doc/icedax COPYING
 %{_bindir}/icedax
 %ghost %{_bindir}/cdda2wav
-%{_bindir}/cdda2mp3
 %{_bindir}/cdda2ogg
 %{_mandir}/man1/icedax.*
 %{_mandir}/man1/cdda2ogg.*
@@ -208,6 +214,9 @@ fi
 %{_mandir}/man1/readmult.*
 
 %changelog
+* Tue Aug 11 2009 Jitesh Shah <jiteshs@marvell.com> - 1.1.9-4.fa1
+- Backport patch from 1.1.9-6 to avoid conflicts with glibc functions. 
+
 * Wed Feb 25 2009 Peter Jones <pjones@redhat.com> - 1.1.9-4
 - Add support for EFI boot images.
 
-- 
1.5.5.6

