summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Medinas <metalgod@gentoo.org>2006-03-25 18:32:52 +0000
committerLuis Medinas <metalgod@gentoo.org>2006-03-25 18:32:52 +0000
commitabb2d8d21298a176bdc090b7d2c200f6675ab6be (patch)
tree93d4e441f853d4bdc7b3f68f27b9437aa4173c70 /app-cdr
parentRemoved CVS ebuilds, version bump (manual CVS snapshot) (diff)
downloadgentoo-2-abb2d8d21298a176bdc090b7d2c200f6675ab6be.tar.gz
gentoo-2-abb2d8d21298a176bdc090b7d2c200f6675ab6be.tar.bz2
gentoo-2-abb2d8d21298a176bdc090b7d2c200f6675ab6be.zip
Added a patch to fix a problem with files bigger than 2.4GB. Thanks to Szabo Bence <szbence@gmail.com> on bug #127372.
(Portage version: 2.1_pre6-r7)
Diffstat (limited to 'app-cdr')
-rw-r--r--app-cdr/mdf2iso/ChangeLog11
-rw-r--r--app-cdr/mdf2iso/Manifest27
-rw-r--r--app-cdr/mdf2iso/files/digest-mdf2iso-0.3.0-r13
-rw-r--r--app-cdr/mdf2iso/files/mdf2iso-0.3.0-bigfiles.patch684
-rw-r--r--app-cdr/mdf2iso/mdf2iso-0.3.0-r1.ebuild33
5 files changed, 753 insertions, 5 deletions
diff --git a/app-cdr/mdf2iso/ChangeLog b/app-cdr/mdf2iso/ChangeLog
index 2d4385e21e99..f3aa7e5f1eab 100644
--- a/app-cdr/mdf2iso/ChangeLog
+++ b/app-cdr/mdf2iso/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for app-cdr/mdf2iso
-# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-cdr/mdf2iso/ChangeLog,v 1.6 2005/07/21 21:10:49 pylon Exp $
+# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-cdr/mdf2iso/ChangeLog,v 1.7 2006/03/25 18:32:52 metalgod Exp $
+
+*mdf2iso-0.3.0-r1 (25 Mar 2006)
+
+ 25 Mar 2006; Luis Medinas <metalgod@gentoo.org>
+ +files/mdf2iso-0.3.0-bigfiles.patch, +mdf2iso-0.3.0-r1.ebuild:
+ Added a patch to fix a problem with files bigger than 2.4GB. Thanks to Szabo
+ Bence <szbence@gmail.com> on bug #127372.
*mdf2iso-0.3.0 (21 Jul 2005)
diff --git a/app-cdr/mdf2iso/Manifest b/app-cdr/mdf2iso/Manifest
index 54b9f0e93198..a0df96c24bf5 100644
--- a/app-cdr/mdf2iso/Manifest
+++ b/app-cdr/mdf2iso/Manifest
@@ -1,6 +1,27 @@
-MD5 9564ca00299f6c63a91cf1adb6960e45 mdf2iso-0.3.0.ebuild 683
MD5 19d7f530bb193d5b5c636d84eb5322f9 ChangeLog 896
-MD5 1ddb20a68fa272a1344659de28a87486 mdf2iso-0.2.1.ebuild 670
-MD5 5a58b0180af8e7db6a33d5c73ace3408 metadata.xml 293
+RMD160 7d5b4558369625cc55d2b9c23db611bd9586e298 ChangeLog 896
+SHA256 3921ea22075cffa7bb00db2bf827631c30de0f7825937e07c306056237851fda ChangeLog 896
MD5 21c7873a3387ed12e7d9ddd8eeb024ca files/digest-mdf2iso-0.2.1 68
+RMD160 8888970d58d321b959261d7ad6025b7e355018ca files/digest-mdf2iso-0.2.1 68
+SHA256 26f3a3eeefae08c73cc083d833b0273a694a9558bda4e1466baed58339e7f661 files/digest-mdf2iso-0.2.1 68
MD5 f4ab406594d880779dd70ba750b1d5a2 files/digest-mdf2iso-0.3.0 69
+RMD160 a26e322a15a4e562410a8e99b0a3736fa0772793 files/digest-mdf2iso-0.3.0 69
+SHA256 6cf6fe0ea95b7f4ca0bac10141f4927259ec9e0e4cd177d586caa78bf9c474f6 files/digest-mdf2iso-0.3.0 69
+MD5 49248d9031118c6d4722925b62fd396d files/digest-mdf2iso-0.3.0-r1 253
+RMD160 66a44d8b724ca4e63dd05f9a3236b97c3a6d6380 files/digest-mdf2iso-0.3.0-r1 253
+SHA256 ebbb8f02d66f71048a9fd296a9848bdd0428403d6a345de2d03a458b4023f4cf files/digest-mdf2iso-0.3.0-r1 253
+MD5 6eb096bf6b81f297fa0c02fd5d200f8d files/mdf2iso-0.3.0-bigfiles.patch 17632
+RMD160 587d65fd5786ce788682c528bb96474d4e7b5b51 files/mdf2iso-0.3.0-bigfiles.patch 17632
+SHA256 bc6646a8d190f629a911532161de5329229f78e7fc4957ce288c89e204c57b45 files/mdf2iso-0.3.0-bigfiles.patch 17632
+MD5 1ddb20a68fa272a1344659de28a87486 mdf2iso-0.2.1.ebuild 670
+RMD160 cda583eb9782fa7b8f6687ae6d01aa86e6cd167c mdf2iso-0.2.1.ebuild 670
+SHA256 a0612e8d13a459cd1f0c5d0dac341b92551398940dd14c93e8b440275d1a99e5 mdf2iso-0.2.1.ebuild 670
+MD5 19a5d993fc64348bd1d569c2ab571c0f mdf2iso-0.3.0-r1.ebuild 771
+RMD160 7b8e62af6dcd9308af505ff905a8d09bfc0c0015 mdf2iso-0.3.0-r1.ebuild 771
+SHA256 b8b11d80349d62a361bd61e6258378ac99c15ed9015825a357c03f738e55a324 mdf2iso-0.3.0-r1.ebuild 771
+MD5 9564ca00299f6c63a91cf1adb6960e45 mdf2iso-0.3.0.ebuild 683
+RMD160 ebeb61b49ea9b759637a681fe35b75e226bf07a0 mdf2iso-0.3.0.ebuild 683
+SHA256 ef9efb764312e79b2fbcdef6c9ac876cbd1e5d41ccf5cda741543c9457f96c3b mdf2iso-0.3.0.ebuild 683
+MD5 5a58b0180af8e7db6a33d5c73ace3408 metadata.xml 293
+RMD160 dc52325de0fd6a15879a10dcd6e0d69299fed65b metadata.xml 293
+SHA256 d1e6fa3144863213c53e76c692c49b9e2f2ac945b3cee7713c4c3684722eb0c1 metadata.xml 293
diff --git a/app-cdr/mdf2iso/files/digest-mdf2iso-0.3.0-r1 b/app-cdr/mdf2iso/files/digest-mdf2iso-0.3.0-r1
new file mode 100644
index 000000000000..65eac5e099e6
--- /dev/null
+++ b/app-cdr/mdf2iso/files/digest-mdf2iso-0.3.0-r1
@@ -0,0 +1,3 @@
+MD5 a190625318476a196930ac66acd8fd07 mdf2iso-0.3.0-src.tar.bz2 97723
+RMD160 ffb295133265197846758ea6746711a260969cef mdf2iso-0.3.0-src.tar.bz2 97723
+SHA256 7b6622c58bc6a5111eba719d2b55cdfab54cbb26f3aea98b7e5db0eb0062be84 mdf2iso-0.3.0-src.tar.bz2 97723
diff --git a/app-cdr/mdf2iso/files/mdf2iso-0.3.0-bigfiles.patch b/app-cdr/mdf2iso/files/mdf2iso-0.3.0-bigfiles.patch
new file mode 100644
index 000000000000..60923a713ba7
--- /dev/null
+++ b/app-cdr/mdf2iso/files/mdf2iso-0.3.0-bigfiles.patch
@@ -0,0 +1,684 @@
+Only in mdf2iso/src: .deps
+Only in mdf2iso.new/src: .kdbgrc.mdf2iso
+diff -bur mdf2iso/src/Makefile.am mdf2iso.new/src/Makefile.am
+--- mdf2iso/src/Makefile.am 2005-05-19 11:24:11.000000000 +0200
++++ mdf2iso.new/src/Makefile.am 2005-07-31 17:47:36.000000000 +0200
+@@ -1,2 +1,3 @@
+ bin_PROGRAMS = mdf2iso
+ mdf2iso_SOURCES = mdf2iso.c
++AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall
+diff -bur mdf2iso/src/Makefile.in mdf2iso.new/src/Makefile.in
+--- mdf2iso/src/Makefile.in 2005-05-22 21:42:09.000000000 +0200
++++ mdf2iso.new/src/Makefile.in 2005-07-31 17:49:16.000000000 +0200
+@@ -136,6 +136,7 @@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
+ mdf2iso_SOURCES = mdf2iso.c
++AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall
+ all: all-am
+
+ .SUFFIXES:
+@@ -149,9 +150,9 @@
+ exit 1;; \
+ esac; \
+ done; \
+- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ cd $(top_srcdir) && \
+- $(AUTOMAKE) --foreign src/Makefile
++ $(AUTOMAKE) --gnu src/Makefile
+ .PRECIOUS: Makefile
+ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+diff -bur mdf2iso/src/mdf2iso.c mdf2iso.new/src/mdf2iso.c
+--- mdf2iso/src/mdf2iso.c 2005-05-22 21:52:08.000000000 +0200
++++ mdf2iso.new/src/mdf2iso.c 2005-07-31 19:41:56.000000000 +0200
+@@ -1,4 +1,4 @@
+- /* $Id: mdf2iso.c, 22/05/05
++/* $Id: mdf2iso.c, 22/05/05
+
+ Copyright (C) 2004,2005 Salvatore Santagati <salvatore.santagati@gmail.com>
+
+@@ -16,19 +16,14 @@
+ along with this program; if not, write to the
+ Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+- */
++*/
+
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+
+-#define VERSION "0.3.0"
+-
+-/* Support Large File */
+-
+-#define _FILE_OFFSET_BITS 64
+-
++#define VERSION "0.3.1"
+
+
+ const char SYNC_HEADER[12] = { (char) 0x00,
+@@ -83,14 +78,21 @@
+ (char) 0x00
+ };
+
++#define ISO9660 0
++#define SYNC 1
++#define SYNC_MDF 2
++#define MDF_AUDIO 3
++#define UNKNOWN -1
+
+-void
+-toc_file (char *destfilename, int sub)
++int toc_file (char *destfilename, int sub)
+ {
+- char destfiletoc[1024], destfiledat[1024];
++ int ret=0;
++ char *destfiletoc;
++ char *destfiledat;
+ FILE *ftoc;
+- strcpy (destfiletoc, destfilename);
+- strcpy (destfiledat, destfilename);
++
++ destfiletoc=strdup(destfilename);
++ destfiledat=strdup(destfilename);
+ strcpy (destfiletoc + strlen (destfilename) - 4, ".toc");
+ strcpy (destfiledat + strlen (destfilename) - 4, ".dat");
+
+@@ -100,11 +102,8 @@
+ fprintf (ftoc, "// Track 1\n");
+ fprintf (ftoc, "TRACK MODE1_RAW");
+
+- if (sub == 1)
+- fprintf (ftoc, " RW_RAW\n");
+-
+- else
+- fprintf (ftoc, "\n");
++ if (sub == 1) fprintf (ftoc, " RW_RAW\n");
++ else fprintf (ftoc, "\n");
+
+ fprintf (ftoc, "NO COPY\n");
+ fprintf (ftoc, "DATAFILE \"%s\"\n", destfiledat);
+@@ -114,26 +113,27 @@
+ }
+ else
+ {
+- printf ("%s\n", strerror (errno));
+- exit (EXIT_FAILURE);
++ printf ("Error opening %s for output: %s\n",destfiletoc,strerror(errno));
++ ret=-1;
+ };
+-
++ free(destfiletoc);
++ free(destfiledat);
++ return ret;
+ }
+
+-int
+-number_file (char *destfilename)
++/*
++int number_file (char *destfilename)
+ {
+ int i = 1, test_mdf = 0;
+ int n_mdf;
+ char mdf[2], destfilemdf[2354];
+ FILE *fsource;
++
+ strcpy (destfilemdf, destfilename);
+ strcpy (destfilemdf + strlen (destfilename) - 1, ".0");
+ for (i = 0; test_mdf == 0; i++)
+-
+ {
+ if ((fsource = fopen (destfilemdf, "rb")) != NULL)
+-
+ {
+ printf ("\nCheck : ");
+ sprintf (mdf, "md%d", i);
+@@ -141,203 +141,219 @@
+ printf ("%s, ", destfilemdf);
+ fclose (fsource);
+ }
+-
+ else
+ {
+ test_mdf = 1;
+ }
+- };
++ }
+ printf ("\r \n");
+ n_mdf = i - 1;
+ return (n_mdf);
+ }
++*/
+
+-void
+-cuesheets (char *destfilename)
++int cuesheets (char *destfilename)
+ {
+- char destfilecue[1024], destfilebin[1024];
++ int ret=0;
++ char *destfilecue;
++ char *destfilebin;
+ FILE *fcue;
+- strcpy (destfilecue, destfilename);
+- strcpy (destfilebin, destfilename);
++
++ destfilecue=strdup(destfilename);
++ destfilebin=strdup(destfilename);
+ strcpy (destfilecue + strlen (destfilename) - 4, ".cue");
+ strcpy (destfilebin + strlen (destfilename) - 4, ".bin");
+- fcue = fopen (destfilecue, "w");
++ if ((fcue = fopen (destfilecue, "w"))!=NULL)
++ {
+ fprintf (fcue, "FILE \"%s\" BINARY\n", destfilebin);
+ fprintf (fcue, "TRACK 1 MODE1/2352\n");
+ fprintf (fcue, "INDEX 1 00:00:00\n");
+ rename (destfilename, destfilebin);
+ printf ("Create Cuesheets : %s\n", destfilecue);
+ fclose (fcue);
++ }
++ else
++ {
++ printf ("Error opening %s for output: %s\n",destfilecue,strerror(errno));
++ ret=-1;
++ }
++ return ret;
+ }
+
+-void
+-main_percent (int percent_bar)
++int previous_percent=-1;
++void main_percent (int percent_bar)
++// Prints a progress bar, takes a percentage as argument.
+ {
+- int progress_bar, progress_space;
++ //int progress_bar, progress_space;
++
++ if (percent_bar==previous_percent) return; // Nothing changed, don't waste CPU cycles.
++
++ printf("%3d%% [:%.*s>%.*s:]\r",percent_bar,20-(percent_bar/5)," ",
++ percent_bar/5,"====================");
++ /*
+ printf ("%d%% [:", percent_bar);
+- for (progress_bar = 1; progress_bar <= (int) (percent_bar / 5);
+- progress_bar++)
++ for (progress_bar = 1; progress_bar <= (int) (percent_bar / 5); progress_bar++)
+ printf ("=");
+ printf (">");
+
+- for (progress_space = 0; progress_space < (20 - progress_bar);
+- progress_space++)
+- printf (" ");
++ for (; progress_bar <= 20; ++progress_bar) printf (" ");
+ printf (":]\r");
++ */
+ }
+
+-void
+-usage ()
++void usage ()
++// Prints the command line syntax
+ {
+- printf ("mdf2iso v%s by Salvatore Santagati\n", VERSION);
+- printf ("Web : http//mdf2iso.berlios.de\n");
+- printf ("Email : salvatore.santagati@gmail.com\n");
+- printf ("Irc : irc.freenode.net #ignus\n");
+- printf ("Note : iodellavitanonhocapitouncazzo\n");
+- printf ("License : released under the GNU GPL v2 or later\n\n");
++ printf (" Web : http//mdf2iso.berlios.de\n");
++ printf (" Email : salvatore.santagati@gmail.com\n");
++ printf (" Irc : irc.freenode.net #ignus\n");
++ printf (" Note : iodellavitanonhocapitouncazzo\n\n");
+ printf ("Usage :\n");
+- printf ("mdf2iso [OPTION] [BASENAME.MDF] [DESTINATION]\n\n");
+- printf ("OPTION\n");
+- printf ("\t--toc Generate toc file\n");
+- printf ("\t--cue Generate cue file\n");
+- printf ("\t--help display this notice\n\n");
++ printf ("mdf2iso [--cue|--toc|--help] <sourcefile> [destfile]\n\n");
++ printf ("Options:\n");
++ printf (" --toc Generate toc/dat files\n");
++ printf (" --cue Generate cue/bin files\n");
++ printf (" --help Display this notice\n");
++ printf (" sourcefile\tFilename of the .mdf file to be converted\n");
++ printf (" destfile\tFilename of the target ISO9660 file.\n"\
++ "\t\tIf none given, one is derived from sourcefile.\n\n");
+ }
+
+-int
+-main (int argc, char **argv)
++char mdftype(FILE *f)
++/* returns
++ -1 for unknown
++ 0 for ISO9660
++ 1 for SYNC
++ 2 for SYNC MDF
++ 3 for MDF Audio
++ (see #defines above)
++*/
+ {
+- int seek_ecc, sector_size, seek_head, sector_data, n_mdf;
++ char buf[12];
++
++ fseek(f, 32768, SEEK_SET);
++ fread(buf, sizeof (char), 8, f);
++ if (!memcmp (ISO_9660, buf, 8)) return ISO9660; // File is ISO9660
++
++ fseek(f, 0L, SEEK_SET);
++ fread(buf, sizeof (char), 12, f);
++
++ fseek (f, 2352, SEEK_SET);
++
++ if (!memcmp (SYNC_HEADER, buf, 12)) // Has SYNC_HEADER
++ {
++ fread (buf, sizeof (char), 12, f);
++ if (!memcmp (SYNC_HEADER_MDF, buf, 12)) return SYNC_MDF; // File is SYNC MDF
++ if (!memcmp (SYNC_HEADER, buf, 12)) return SYNC; // File is SYNC
++ }
++ else // Does not have SYNC_HEADER
++ {
++ fread(buf, sizeof (char), 12, f);
++ if (!memcmp (SYNC_HEADER_MDF_AUDIO, buf, 12)) return MDF_AUDIO; // File is MDF Audio
++ }
++
++ // Reached a point where nothing else matters.
++ return UNKNOWN; // Unknown format
++}
++
++
++// === Main program code ===
++
++int main (int argc, char **argv)
++{
++ int seek_ecc, sector_size, seek_head, sector_data;//, n_mdf;
+ int cue = 0, cue_mode = 0, sub = 1, toc = 0, sub_toc = 0;
+ int opts = 0;
+- double size_iso, write_iso;
+- long percent = 0;
+- long i, source_length, progressbar;
+- char buf[2448], destfilename[2354];
++ long i, source_length;
++ char buf[2448];
++ char *destfilename=NULL;
++ char *basefilename=NULL;
+ FILE *fdest, *fsource;
+
++ // Print identification
++ printf ("mdf2iso v%s by Salvatore Santagati\n", VERSION);
++ printf ("Licensed under GPL v2 or later\n");
+
+- if (argc < 2)
+
++ // *** Process command line options ***
++
++ if (argc < 2)
+ {
+- usage ();
+- exit (EXIT_FAILURE);
++ // Not enough parameters; print help
++ usage();
++ exit(EXIT_FAILURE);
+ }
+
+- else
+-
+- {
++ // Search for options --cue and --toc
+ for (i = 0; i < argc; i++)
+-
+ {
+-
+ if (!strcmp (argv[i], "--help"))
+-
+ {
+ usage ();
+ exit (EXIT_SUCCESS);
+ }
+ if (!strcmp (argv[i], "--cue"))
+-
+ {
+ cue = 1;
+ opts++;
+ }
+ if (!strcmp (argv[i], "--toc"))
+-
+ {
+ toc = 1;
+ opts++;
+ }
+ }
+
+- if ((cue == 1) && (toc == 1))
+-
+- {
+- usage ();
+- exit (EXIT_FAILURE);
+- }
+- if ((opts == 1) && (argc <= 2))
+-
++ // Catch impossible parameter combinations
++ if (((cue == 1) && (toc == 1)) ||
++ ((opts == 1) && (argc <= 2)))
+ {
+- usage ();
+- exit (EXIT_FAILURE);
++ usage();
++ exit(EXIT_FAILURE);
+ }
+
++ // Get the base filename
++ basefilename=argv[1+opts]; // simple pointer, but makes life easier.
+
++ // Get the destination filename
+ if (argc >= (3 + opts))
+- strcpy (destfilename, argv[2 + opts]);
+-
+- else
+-
+- {
+- strcpy (destfilename, argv[1 + opts]);
+- if (strlen (argv[1 + cue]) < 5
+- || strcmp (destfilename + strlen (argv[1 + opts]) - 4, ".mdf"))
+- strcpy (destfilename + strlen (argv[1 + opts]), ".iso");
+-
++ // The destination filename is explicitly entered at the prompt
++ destfilename=strdup(argv[2 + opts]);
+ else
+- strcpy (destfilename + strlen (argv[1 + opts]) - 4, ".iso");
+- }
+- if ((fsource = fopen (argv[1 + opts], "rb")) != NULL)
+-
+ {
+- fseek (fsource, 32768, SEEK_CUR);
+- fread (buf, sizeof (char), 8, fsource);
+- if (memcmp (ISO_9660, buf, 8))
+-
++ // Derive destination filename from the basename:
++ // If basename is "*.mdf" use "*.iso" als destname
++ // otherwise simply append ".iso" to the basename to create destname.
++ destfilename=strdup(basefilename);
++ i=strlen(destfilename); // Reusing 'i' here as temporary variable
++ if (i < 5 || strcmp(destfilename + i - 4, ".mdf"))
+ {
+- fseek (fsource, 0L, SEEK_SET);
+- fread (buf, sizeof (char), 12, fsource);
+- if (!memcmp (SYNC_HEADER, buf, 12))
+-
+- {
+- fseek (fsource, 0L, SEEK_SET);
+- fseek (fsource, 2352, SEEK_CUR);
+- fread (buf, sizeof (char), 12, fsource);
+- if (!memcmp (SYNC_HEADER_MDF, buf, 12))
+-
+- {
+- if (cue == 1)
+- {
+- cue_mode = 1;
+-
+- /* BAD SECTOR TO NORMAL IMAGE */
+- seek_ecc = 96;
+- sector_size = 2448;
+- sector_data = 2352;
+- seek_head = 0;
+- }
+-
+- else if (toc == 0)
+-
+- {
+-
+- /*BAD SECTOR */
+- seek_ecc = 384;
+- sector_size = 2448;
+- sector_data = 2048;
+- seek_head = 16;
++ destfilename=realloc(destfilename,i+5);
++ strcat(destfilename, ".iso");
+ }
+-
+ else
+-
+- {
+-
+- /*BAD SECTOR */
+- seek_ecc = 0;
+- sector_size = 2448;
+- sector_data = 2448;
+- seek_head = 0;
+- sub_toc = 1;
+- }
++ strcpy(destfilename + i - 3, "iso");
+ }
+
+- else
++ // *** Preprocess basefile ***
+
++ // Try opening basefile
++ if ((fsource = fopen(basefilename, "rb")) == NULL)
+ {
+- if (!memcmp (SYNC_HEADER, buf, 12))
++ free(destfilename);
++ printf ("Could not open %s: %s\n", basefilename, strerror(errno));
++ exit (EXIT_FAILURE);
++ }
+
++ // Determine filetype & set some stuff accordingly (or exit)
++ switch (mdftype(fsource))
+ {
++ case ISO9660:
++ printf("%s is already ISO9660.\n",basefilename);
++ fclose(fsource);
++ free(destfilename);
++ exit(EXIT_SUCCESS);
++ case SYNC:
+ if (cue == 1)
+ {
+ cue_mode = 1;
+@@ -348,129 +364,134 @@
+ seek_head = 0;
+ }
+ if (toc == 0)
+-
+ {
+-
+ /*NORMAL IMAGE */
+ seek_ecc = 288;
+ sector_size = 2352;
+ sector_data = 2048;
+ seek_head = 16;
+ }
+-
+ else
+-
+ {
+ seek_ecc = 0;
+ sector_size = 2352;
+ sector_data = 2352;
+ seek_head = 0;
+ }
+- }
+-
+- else
+-
+- {
+- printf ("Sorry I don't know this format :(\n");
+- exit (EXIT_FAILURE);
+- }
+- }
+- }
+-
+- else
+-
++ break;
++ case SYNC_MDF:
++ if (cue == 1)
+ {
+- fseek (fsource, 0L, SEEK_SET);
+- fseek (fsource, 2352, SEEK_CUR);
+- fread (buf, sizeof (char), 12, fsource);
+- if (memcmp (SYNC_HEADER_MDF_AUDIO, buf, 12))
++ cue_mode = 1;
+
++ /* BAD SECTOR TO NORMAL IMAGE */
++ seek_ecc = 96;
++ sector_size = 2448;
++ sector_data = 2352;
++ seek_head = 0;
++ }
++ else if (toc == 0)
+ {
+- printf ("Sorry I don't know this format :(\n");
+- exit (EXIT_FAILURE);
++ /*BAD SECTOR */
++ seek_ecc = 384;
++ sector_size = 2448;
++ sector_data = 2048;
++ seek_head = 16;
+ }
+-
+ else
+-
+ {
+-
++ /*BAD SECTOR */
++ seek_ecc = 0;
++ sector_size = 2448;
++ sector_data = 2448;
++ seek_head = 0;
++ sub_toc = 1;
++ }
++ break;
++ case MDF_AUDIO:
+ /*BAD SECTOR AUDIO */
+ seek_head = 0;
+ sector_size = 2448;
+ seek_ecc = 96;
+ sector_data = 2352;
+ cue = 0;
++ break;
++ default:printf("Unknown format for %s.\n",basefilename);
++ fclose(fsource);
++ free(destfilename);
++ exit (EXIT_FAILURE);
+ }
+- }
+- if ((fdest = fopen (destfilename, "wb")) != NULL);
+
+- else
++ // *** Create destination file ***
++
++ // Try opening the destination file for output
++ if ((fdest = fopen (destfilename, "wb")) == NULL)
+ {
+- printf ("%s\n", strerror (errno));
++ printf ("Unable to open %s for output: %s\n",destfilename,strerror(errno));
++ free(destfilename);
++ fclose(fsource);
+ exit (EXIT_FAILURE);
+- };
++ }
++
++
+ fseek (fsource, 0L, SEEK_END);
+ source_length = ftell (fsource) / sector_size;
+- size_iso = (int) (source_length * sector_data);
+- progressbar = 100 / source_length;
+ fseek (fsource, 0L, SEEK_SET);
+-
+ {
+ for (i = 0; i < source_length; i++)
+-
+ {
+ fseek (fsource, seek_head, SEEK_CUR);
+- if (fread (buf, sizeof (char), sector_data, fsource));
+-
+- else
++ if (fread(buf, sizeof (char), sector_data, fsource)!=sector_data)
+ {
+- printf ("%s\n", strerror (errno));
++ printf ("Error reading from %s: %s\n",basefilename, strerror (errno));
++ fclose(fsource);
++ fclose(fdest);
++ remove(destfilename);
++ free(destfilename);
+ exit (EXIT_FAILURE);
+- };
+- if (fwrite (buf, sizeof (char), sector_data, fdest));
+-
+- else
++ }
++ if (fwrite (buf, sizeof (char), sector_data, fdest)!=sector_data)
+ {
+- printf ("%s\n", strerror (errno));
++ printf ("Error writing to %s: %s\n",destfilename, strerror (errno));
++ fclose(fsource);
++ fclose(fdest);
++ remove(destfilename);
++ free(destfilename);
+ exit (EXIT_FAILURE);
+- };
++ }
+ fseek (fsource, seek_ecc, SEEK_CUR);
+- write_iso = (int) (sector_data * i);
+- if (i != 0)
+- percent = (int) (write_iso * 100 / size_iso);
+- main_percent (percent);
+- }} printf ("100%%[:====================:]\n");
++ main_percent(i*100/source_length);
++ }
++ } printf ("100%% [:=====================:]\n");
+
+ fclose (fsource);
+ fclose (fdest);
+
+- if (cue == 1)
+- cuesheets (destfilename);
+- if (toc == 1)
+- toc_file (destfilename, sub_toc);
++ // *** create Toc or Cue file is requested ***
++ if (cue == 1) if (cuesheets(destfilename))
++ {
++ free(destfilename);
++ exit(EXIT_FAILURE);
++ }
++ if (toc == 1) if (toc_file(destfilename, sub_toc))
++ {
++ free(destfilename);
++ exit(EXIT_FAILURE);
++ }
+ if ((toc == 0) && (cue == 0))
+- printf ("Create iso9660: %s\n", destfilename);
++ printf("Created iso9660: %s\n", destfilename);
++
++ free(destfilename);
+
+ exit (EXIT_SUCCESS);
+- }
+
+- else
+- printf ("This is file iso9660 ;)\n");
++/*
+ n_mdf = number_file (destfilename) - 1;
+- /* if (n_mdf > 1)
+-
++ / * if (n_mdf > 1)
+ {
+ printf ("\rDetect %d md* file and now emerge this\n", n_mdf);
+ }
+- */
++ * /
+ fclose (fsource);
+- exit (EXIT_SUCCESS);
+- }
+-
+- else
+- {
+- printf ("%s\n", strerror (errno));
+- exit (EXIT_FAILURE);
+- };
+- }
++ exit (EXIT_SUCCESS);*/
+ }
+
diff --git a/app-cdr/mdf2iso/mdf2iso-0.3.0-r1.ebuild b/app-cdr/mdf2iso/mdf2iso-0.3.0-r1.ebuild
new file mode 100644
index 000000000000..4c2a433e791b
--- /dev/null
+++ b/app-cdr/mdf2iso/mdf2iso-0.3.0-r1.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-cdr/mdf2iso/mdf2iso-0.3.0-r1.ebuild,v 1.1 2006/03/25 18:32:52 metalgod Exp $
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Alcohol 120% bin image to ISO image file converter"
+HOMEPAGE="http://mdf2iso.berlios.de/"
+SRC_URI="http://download.berlios.de/${PN}/${P}-src.tar.bz2"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~ppc ~amd64"
+IUSE=""
+DEPEND="virtual/libc"
+
+S=${WORKDIR}/${PN}
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+
+ epatch ${FILESDIR}/${P}-bigfiles.patch
+}
+
+src_compile() {
+ econf CFLAGS="${CFLAGS}" || die "configure failed"
+ emake || die "make failed"
+}
+
+src_install() {
+ dodoc ChangeLog
+ dobin src/${PN} || die "dobin failed"
+}