about summary refs log tree commit diff
path: root/pkgs/tools/text/dos2unix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/text/dos2unix')
-rw-r--r--pkgs/tools/text/dos2unix/default.nix41
-rw-r--r--pkgs/tools/text/dos2unix/dos2unix-3.1-manpage-update-57507.patch238
-rw-r--r--pkgs/tools/text/dos2unix/dos2unix-3.1-preserve-file-modes.patch28
-rw-r--r--pkgs/tools/text/dos2unix/dos2unix-3.1-safeconv.patch88
-rw-r--r--pkgs/tools/text/dos2unix/dos2unix-3.1-segfault.patch93
-rw-r--r--pkgs/tools/text/dos2unix/dos2unix-3.1-tmppath.patch141
-rw-r--r--pkgs/tools/text/dos2unix/dos2unix-3.1.patch49
-rw-r--r--pkgs/tools/text/dos2unix/dos2unix-c-missing-arg.patch42
-rw-r--r--pkgs/tools/text/dos2unix/dos2unix-manpage.patch12
-rw-r--r--pkgs/tools/text/dos2unix/dos2unix-missing-proto.patch15
-rw-r--r--pkgs/tools/text/dos2unix/dos2unix-preserve-file-modes.patch28
11 files changed, 12 insertions, 763 deletions
diff --git a/pkgs/tools/text/dos2unix/default.nix b/pkgs/tools/text/dos2unix/default.nix
index 59fb08aad5f08..dcc4116813ba7 100644
--- a/pkgs/tools/text/dos2unix/default.nix
+++ b/pkgs/tools/text/dos2unix/default.nix
@@ -1,41 +1,24 @@
-{stdenv, fetchurl}:
+{stdenv, fetchurl, perl, gettext }:
 
 stdenv.mkDerivation {
-  name = "dos2unix-2.2";
+  name = "dos2unix-5.3.1";
   
   src = fetchurl {
-    url = http://cvs.fedoraproject.org/repo/pkgs/dos2unix/dos2unix-3.1.tar.bz2/f90026a397cf787083ec2e4892c6dcdd/dos2unix-3.1.tar.bz2;
-    md5 = "f90026a397cf787083ec2e4892c6dcdd";
+    url = http://waterlan.home.xs4all.nl/dos2unix/dos2unix-5.3.1.tar.gz;
+    sha256 = "0bwqw3wi0j4f1x8d39xw5v57ac0bc58j41vjx8v2qm1smg9jyci1";
   };
-  
-  patches = [
-    ./dos2unix-3.1.patch
-    ./dos2unix-3.1-segfault.patch
-    ./dos2unix-3.1-safeconv.patch
-    ./dos2unix-3.1-manpage-update-57507.patch
-    ./dos2unix-3.1-preserve-file-modes.patch
-    ./dos2unix-3.1-tmppath.patch
-    ./dos2unix-c-missing-arg.patch
-    ./dos2unix-missing-proto.patch
-    ./dos2unix-manpage.patch
-    ./dos2unix-preserve-file-modes.patch
-  ];
 
-  installPhase = ''
-    ensureDir $out/bin
-    ensureDir $out/share/man/man1
-    install -p -m755 dos2unix $out/bin
-    install  -p -m644 dos2unix.1 $out/share/man/man1
-    ln -s dos2unix $out/bin/mac2unix
+  configurePhase = ''
+    sed -i -e s,/usr,$out, Makefile
   '';
 
-  buildPhase = ''
-    rm -f dos2unix
-    make dos2unix
-  '';
+  buildInputs = [ perl gettext ];
 
   meta = {
-    homepage = http://unknown/;
-    description = "dos2unix tool";
+    homepage = http://waterlan.home.xs4all.nl/dos2unix.html;
+    description = "Tools to transform text files from dos to unix formats and vicervesa";
+    license = "BSD";
+    maintainers = with stdenv.lib.maintainers; [viric];
+    platforms = with stdenv.lib.platforms; all;
   };
 }
diff --git a/pkgs/tools/text/dos2unix/dos2unix-3.1-manpage-update-57507.patch b/pkgs/tools/text/dos2unix/dos2unix-3.1-manpage-update-57507.patch
deleted file mode 100644
index e27096666f241..0000000000000
--- a/pkgs/tools/text/dos2unix/dos2unix-3.1-manpage-update-57507.patch
+++ /dev/null
@@ -1,238 +0,0 @@
-Patch by Bill Anderson, to fix bug:
-	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=57507
-
-
-
-Description of Problem:
-
-The dos2unix man page examples are confusing.
-For instance, one piece of text mentions "c.txt", but that file
-isn't used in the following example.
-
-
-
---- dos2unix-3.1/dos2unix.1	2004-09-28 03:17:29.000000000 -0600
-+++ dos2unix-3.1/dos2unix.1-new	2004-09-28 03:16:32.000000000 -0600
-@@ -1,123 +1,126 @@
- .\" $$Id: dos2unix.1 2.2 1995/03/31 01:50:45 blin Exp blin $$
--.TH dos2unix 1 "dos2unix v3.0" "1995.03.31"
--
--.SH NAME
--
-+.\" 
-+.TH "dos2unix" "1" "dos2unix v3.0" "1995.03.31" ""
-+.SH "NAME"
- dos2unix \- DOS/MAC to UNIX text file format converter
- 
--.SH SYNOPSYS
--
--dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...]
--.PP
-+.SH "SYNOPSYS"
-+dos2unix [options] [\-c convmode] [\-o file ...] [\-n infile outfile ...]
-+.PP 
- Options:
--.PP
--[-hkqV] [--help] [--keepdate] [--quiet] [--version]
--
--.SH DESCRIPTION
-+.PP 
-+[\-hkqV] [\-\-help] [\-\-keepdate] [\-\-quiet] [\-\-version]
- 
--.PP
-+.SH "DESCRIPTION"
-+.PP 
- This manual page documents dos2unix, the program that converts plain text
- files in DOS/MAC format to UNIX format.
- 
--.SH OPTIONS
--
-+.SH "OPTIONS"
- The following options are available:
--.TP
--.B \-h --help
-+.TP 
-+.B \-h \-\-help
- Print online help.
- 
--.TP
--.B \-k --keepdate
-+.TP 
-+.B \-k \-\-keepdate
- Keep the date stamp of output file same as input file.
- 
--.TP
--.B \-q --quiet
-+.TP 
-+.B \-q \-\-quiet
- Quiet mode. Suppress all warning and messages.
- 
--.TP
--.B \-V --version
-+.TP 
-+.B \-V \-\-version
- Prints version information.
- 
--.TP
--.B \-c --convmode convmode
--Sets conversion mode. Simulates dos2unix under SunOS.
-+.TP 
-+.B \-c \-\-convmode convmode
-+Sets conversion mode. Where convmode is one of:
-+.B ASCII, 7bit, ISO, Mac
-+with ASCII being the default.
-+Simulates dos2unix under SunOS.
-+
-+
- 
--.TP
--.B \-o --oldfile file ...
-+.TP 
-+.B \-o \-\-oldfile file ...
- Old file mode. Convert the file and write output to it. The program 
- default to run in this mode. Wildcard names may be used.
- 
--.TP
--.B \-n --newfile infile outfile ...
-+.TP 
-+.B \-n \-\-newfile infile outfile ...
- New file mode. Convert the infile and write output to outfile. File names
- must be given in pairs and wildcard names should NOT be used or you WILL 
- lost your files. 
- 
--.SH EXAMPLES
--
--.LP
-+.SH "EXAMPLES"
-+.LP 
- Get input from stdin and write output to stdout.
--.IP
-+.IP 
- .B dos2unix
- 
--.LP
-+.LP 
- Convert and replace a.txt. Convert and replace b.txt.
--.IP
-+.IP 
- .B dos2unix a.txt b.txt
--.IP
--.B dos2unix -o a.txt b.txt
-+.IP 
-+.B dos2unix \-o a.txt b.txt
- 
--.LP
-+.LP 
- Convert and replace a.txt in ASCII conversion mode. 
-+.IP 
-+.B dos2unix a.txt \-c iso b.txt
-+
-+.LP 
- Convert and replace b.txt in ISO conversion mode.
-+.IP 
-+.B dos2unix \-c ascii a.txt \-c iso b.txt
-+
-+.LP 
- Convert c.txt from Mac to Unix ascii format.
--.IP
--.B dos2unix a.txt -c iso b.txt
--.IP
--.B dos2unix -c ascii a.txt -c iso b.txt
--.IP
--.B dos2unix -c mac a.txt  b.txt
- 
--.LP
-+.IP 
-+.B dos2unix \-c mac c.txt  b.txt
-+
-+.LP 
- Convert and replace a.txt while keeping original date stamp.
--.IP
--.B dos2unix -k a.txt
--.IP
--.B dos2unix -k -o a.txt
-+.IP 
-+.B dos2unix \-k a.txt
-+.IP 
-+.B dos2unix \-k \-o a.txt
- 
--.LP
-+.LP 
- Convert a.txt and write to e.txt.
--.IP
--.B dos2unix -n a.txt e.txt
-+.IP 
-+.B dos2unix \-n a.txt e.txt
- 
--.LP
-+.LP 
- Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt.
--.IP
--.B dos2unix -k -n a.txt e.txt 
-+.IP 
-+.B dos2unix \-k \-n a.txt e.txt 
- 
--.LP
-+.LP 
- Convert and replace a.txt. Convert b.txt and write to e.txt.
--.IP
--.B dos2unix a.txt -n b.txt e.txt
--.IP
--.B dos2unix -o a.txt -n b.txt e.txt
-+.IP 
-+.B dos2unix a.txt \-n b.txt e.txt
-+.IP 
-+.B dos2unix \-o a.txt \-n b.txt e.txt
- 
--.LP
-+.LP 
- Convert c.txt and write to e.txt. Convert and replace a.txt.
- Convert and replace b.txt. Convert d.txt and write to f.txt.
--.IP
--.B dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
-+.IP 
-+.B dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt
- 
--.SH DIAGNOSTICS
--
--.SH BUGS
-+.SH "DIAGNOSTICS"
- 
-+.SH "BUGS"
- The program does not work properly under MSDOS in stdio processing mode. 
- If you know why is that so, please tell me.
- 
--.SH AUTHORS
--
--Benjamin Lin -
-+.SH "AUTHORS"
-+Benjamin Lin \-
- .B <blin@socs.uts.edu.au>
- 
- 
-@@ -125,18 +128,17 @@
- .B <wuebben@kde.org>
- 
- 
--.SH MISCELLANY
--
-+.SH "MISCELLANY"
- Tested environment:
--.IP
-+.IP 
- Linux 1.2.0 with GNU C 2.5.8
--.IP
-+.IP 
- SunOS 4.1.3 with GNU C 2.6.3
--.IP
--MS-DOS 6.20 with Borland C++ 4.02
--.PP
-+.IP 
-+MS\-DOS 6.20 with Borland C++ 4.02
-+.PP 
- Suggestions and bug reports are welcome.
- 
--.SH SEE ALSO
-+.SH "SEE ALSO"
- unix2dos(1) mac2unix(1)
- 
diff --git a/pkgs/tools/text/dos2unix/dos2unix-3.1-preserve-file-modes.patch b/pkgs/tools/text/dos2unix/dos2unix-3.1-preserve-file-modes.patch
deleted file mode 100644
index 7e8f3bdd55d58..0000000000000
--- a/pkgs/tools/text/dos2unix/dos2unix-3.1-preserve-file-modes.patch
+++ /dev/null
@@ -1,28 +0,0 @@
---- dos2unix-3.1/dos2unix.c.mode	2003-05-21 08:09:08.000000000 -0700
-+++ dos2unix-3.1/dos2unix.c	2003-05-21 08:09:56.000000000 -0700
-@@ -345,11 +345,14 @@ int ConvertDosToUnixOldFile(char* ipInFN
-   char TempPath[16];
-   struct stat StatBuf;
-   struct utimbuf UTimeBuf;
-+  mode_t mode = S_IRUSR | S_IWUSR;
-   int fd;
- 
-   /* retrieve ipInFN file date stamp */
--  if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
-+  if (stat(ipInFN, &StatBuf))
-     RetVal = -1;
-+  else
-+    mode = StatBuf.st_mode;
- 
-   strcpy (TempPath, "./u2dtmpXXXXXX");
-   if((fd=mkstemp (TempPath))<0) {
-@@ -357,6 +360,9 @@ int ConvertDosToUnixOldFile(char* ipInFN
- 	  RetVal = -1;
-   }
- 
-+  if (!RetVal && fchmod (fd, mode) && fchmod (fd, S_IRUSR | S_IWUSR))
-+    RetVal = -1;
-+
- #ifdef DEBUG
-   fprintf(stderr, "dos2unix: using %s as temp file\n", TempPath);
- #endif DEBUG
diff --git a/pkgs/tools/text/dos2unix/dos2unix-3.1-safeconv.patch b/pkgs/tools/text/dos2unix/dos2unix-3.1-safeconv.patch
deleted file mode 100644
index 11998be1fddfe..0000000000000
--- a/pkgs/tools/text/dos2unix/dos2unix-3.1-safeconv.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-* Fix http://bugzilla.redhat.com/57508 (make dos2unix not modify Mac
-  files unless in mac2unix mode)
-* Make mac2unix mode not create duplicate Unix line delimiters when
-  run on a DOS file. (mschwendt@users.sf.net)
-
-diff -Nur dos2unix-3.1-orig/dos2unix.c dos2unix-3.1/dos2unix.c
---- dos2unix-3.1-orig/dos2unix.c	1998-11-19 13:19:25.000000000 +0100
-+++ dos2unix-3.1/dos2unix.c	2004-09-26 20:57:41.606587616 +0200
-@@ -153,6 +153,24 @@
- }
- 
- 
-+void StripDelimiter(FILE* ipInF, FILE* ipOutF, CFlag *ipFlag, int CurChar)
-+{
-+  int TempNextChar;
-+  /* Don't modify Mac files when in dos2unix mode. */
-+  if ( (TempNextChar = getc(ipInF)) != EOF) {
-+    ungetc( TempNextChar, ipInF );  /* put back peek char */
-+    if ( TempNextChar != '\x0a' ) {
-+      putc( CurChar, ipOutF );  /* Mac line, put back CR */
-+    }
-+  }
-+  else if ( CurChar == '\x0d' ) {  /* EOF: last Mac line delimiter (CR)? */
-+    putc( CurChar, ipOutF );
-+  }
-+  if (ipFlag->NewLine) {  /* add additional LF? */
-+    putc('\n', ipOutF);
-+  }
-+}
-+
- /* converts stream ipInF to UNIX format text and write to stream ipOutF
-  * RetVal: 0  if success
-  *         -1  otherwise
-@@ -161,6 +179,7 @@
- {
-     int RetVal = 0;
-     int TempChar;
-+    int TempNextChar;
-     
-     if ( macmode )
-       ipFlag->ConvMode = 3;
-@@ -177,9 +196,7 @@
- 		break;
- 	      } 
- 	    } else {
--	      if (ipFlag->NewLine) {
--		putc('\n', ipOutF);
--	      }
-+	      StripDelimiter( ipInF, ipOutF, ipFlag, TempChar );
- 	    }
- 	  }
- 	  break;
-@@ -193,9 +210,7 @@
- 		break;
- 	      }
- 	    } else {
--	      if (ipFlag->NewLine) {
--		putc('\n', ipOutF);
--	      }
-+	      StripDelimiter( ipInF, ipOutF, ipFlag, TempChar );
- 	    }
- 	  }
- 	  break;
-@@ -209,9 +224,7 @@
- 		break;
- 	      }
- 	    } else {
--	      if (ipFlag->NewLine) {
--		putc('\n', ipOutF);
--	      }
-+	      StripDelimiter( ipInF, ipOutF, ipFlag, TempChar );
- 	    }
- 	  }
- 	  break;
-@@ -227,6 +240,13 @@
- 		}
- 	      }
- 	    else{
-+	      if ( (TempNextChar = getc(ipInF)) != EOF) {
-+		ungetc( TempNextChar, ipInF );  /* put back peek char */
-+		/* Don't touch this delimiter if it's a CR,LF pair. */
-+		if ( TempNextChar == '\x0a' ) {
-+		  continue;
-+		}
-+	      }
- 	      if (putc('\x0a', ipOutF) == EOF)
- 		{
- 		  RetVal = -1;
diff --git a/pkgs/tools/text/dos2unix/dos2unix-3.1-segfault.patch b/pkgs/tools/text/dos2unix/dos2unix-3.1-segfault.patch
deleted file mode 100644
index 7c8391bd2bdb2..0000000000000
--- a/pkgs/tools/text/dos2unix/dos2unix-3.1-segfault.patch
+++ /dev/null
@@ -1,93 +0,0 @@
---- dos2unix-3.1/dos2unix.c.segf	Thu Jan 17 17:27:42 2002
-+++ dos2unix-3.1/dos2unix.c	Thu Jan 17 17:28:07 2002
-@@ -147,9 +147,9 @@
-  * RetVal: NULL if failure
-  *         file stream otherwise
-  */
--FILE* OpenOutFile(char *ipFN)
-+FILE* OpenOutFile(int fd)
- {
--  return (fopen(ipFN, W_CNTRL));
-+  return (fdopen(fd, W_CNTRL));
- }
- 
- 
-@@ -260,14 +260,17 @@
-   char TempPath[16];
-   struct stat StatBuf;
-   struct utimbuf UTimeBuf;
-+  int fd;
- 
-   /* retrieve ipInFN file date stamp */
-   if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
-     RetVal = -1;
- 
--  strcpy (TempPath, "./d2utmp");
--  strcat (TempPath, "XXXXXX");
--  mkstemp (TempPath);
-+  strcpy (TempPath, "./d2utmpXXXXXX");
-+  if((fd=mkstemp (TempPath))<0) {
-+	  perror("Failed to open output temp file");
-+	  RetVal = -1;
-+  }
- 
- #ifdef DEBUG
-   fprintf(stderr, "dos2unix: using %s as temp file\n", TempPath);
-@@ -278,7 +281,7 @@
-     RetVal = -1;
- 
-   /* can open out file? */
--  if ((!RetVal) && (InF) && ((TempF=OpenOutFile(TempPath)) == NULL))
-+  if ((!RetVal) && (InF) && ((TempF=OpenOutFile(fd)) == NULL))
-   {
-     fclose (InF);
-     RetVal = -1;
-@@ -295,6 +298,8 @@
-   /* can close out file? */
-   if ((TempF) && (fclose(TempF) == EOF))
-     RetVal = -1;
-+  if(fd>=0)
-+	  close(fd);
- 
-   if ((!RetVal) && (ipFlag->KeepDate))
-   {
-@@ -340,14 +345,17 @@
-   char TempPath[16];
-   struct stat StatBuf;
-   struct utimbuf UTimeBuf;
-+  int fd;
- 
-   /* retrieve ipInFN file date stamp */
-   if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
-     RetVal = -1;
- 
--  strcpy (TempPath, "./u2dtmp");
--  strcat (TempPath, "XXXXXX");
--  mkstemp (TempPath);
-+  strcpy (TempPath, "./u2dtmpXXXXXX");
-+  if((fd=mkstemp (TempPath))<0) {
-+	  perror("Failed to open output temp file");
-+	  RetVal = -1;
-+  }
- 
- #ifdef DEBUG
-   fprintf(stderr, "dos2unix: using %s as temp file\n", TempPath);
-@@ -358,7 +366,7 @@
-     RetVal = -1;
- 
-   /* can open out file? */
--  if ((!RetVal) && (InF) && ((TempF=OpenOutFile(TempPath)) == NULL))
-+  if ((!RetVal) && (InF) && ((TempF=OpenOutFile(fd)) == NULL))
-   {
-     fclose (InF);
-     RetVal = -1;
-@@ -376,6 +384,9 @@
-   if ((TempF) && (fclose(TempF) == EOF))
-     RetVal = -1;
- 
-+  if(fd>=0)
-+	  close(fd);
-+
-   if ((!RetVal) && (ipFlag->KeepDate))
-   {
-     UTimeBuf.actime = StatBuf.st_atime;
diff --git a/pkgs/tools/text/dos2unix/dos2unix-3.1-tmppath.patch b/pkgs/tools/text/dos2unix/dos2unix-3.1-tmppath.patch
deleted file mode 100644
index 6db6c84e04a74..0000000000000
--- a/pkgs/tools/text/dos2unix/dos2unix-3.1-tmppath.patch
+++ /dev/null
@@ -1,141 +0,0 @@
---- dos2unix-3.1/dos2unix.c.tmppath	2004-10-20 16:00:00.342561008 +0200
-+++ dos2unix-3.1/dos2unix.c	2004-10-20 16:01:42.210074792 +0200
-@@ -69,6 +69,7 @@
- #ifdef __MSDOS__
- #  include <dir.h>
- #endif __MSDOS__
-+#include <libgen.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -267,6 +268,39 @@
-     return RetVal;
- }
- 
-+static int MakeTempFileFrom(const char *OutFN, char **fname_ret)
-+{
-+  char *cpy = strdup(OutFN);
-+  char *dir = NULL;
-+  size_t fname_len = 0;
-+  char  *fname_str = NULL;
-+  int fd = -1;
-+  
-+  *fname_ret = NULL;
-+  
-+  if (!cpy)
-+    goto make_failed;
-+  
-+  dir = dirname(cpy);
-+  
-+  fname_len = strlen(dir) + strlen("/d2utmpXXXXXX") + sizeof (char);
-+  if (!(fname_str = malloc(fname_len)))
-+    goto make_failed;
-+  sprintf(fname_str, "%s%s", dir, "/d2utmpXXXXXX");
-+  *fname_ret = fname_str;
-+  
-+  free(cpy);
-+  
-+  if ((fd = mkstemp(fname_str)) == -1)
-+    goto make_failed;
-+  
-+  return (fd);
-+  
-+ make_failed:
-+  free(*fname_ret);
-+  *fname_ret = NULL;
-+  return (-1);
-+}
- 
- /* convert file ipInFN to UNIX format text and write to file ipOutFN
-  * RetVal: 0 if success
-@@ -277,7 +311,7 @@
-   int RetVal = 0;
-   FILE *InF = NULL;
-   FILE *TempF = NULL;
--  char TempPath[16];
-+  char *TempPath;
-   struct stat StatBuf;
-   struct utimbuf UTimeBuf;
-   int fd;
-@@ -286,8 +320,7 @@
-   if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
-     RetVal = -1;
- 
--  strcpy (TempPath, "./d2utmpXXXXXX");
--  if((fd=mkstemp (TempPath))<0) {
-+  if((fd = MakeTempFileFrom(ipOutFN, &TempPath))<0) {
- 	  perror("Failed to open output temp file");
- 	  RetVal = -1;
-   }
-@@ -304,6 +337,7 @@
-   if ((!RetVal) && (InF) && ((TempF=OpenOutFile(fd)) == NULL))
-   {
-     fclose (InF);
-+    InF = NULL;
-     RetVal = -1;
-   }
- 
-@@ -337,9 +371,6 @@
-   /* can rename temp file to out file? */
-   if (!RetVal)
-   {
--    if (stat(ipOutFN, &StatBuf) == 0)
--      unlink(ipOutFN);
--
-     if ((rename(TempPath, ipOutFN) == -1) && (!ipFlag->Quiet))
-     {
-       fprintf(stderr, "dos2unix: problems renaming '%s' to '%s'\n", TempPath, ipOutFN);
-@@ -347,6 +378,7 @@
-       RetVal = -1;
-     }
-   }
-+  free(TempPath);
-   return RetVal;
- }
- 
-@@ -362,7 +394,7 @@
-   int RetVal = 0;
-   FILE *InF = NULL;
-   FILE *TempF = NULL;
--  char TempPath[16];
-+  char *TempPath;
-   struct stat StatBuf;
-   struct utimbuf UTimeBuf;
-   mode_t mode = S_IRUSR | S_IWUSR;
-@@ -374,8 +406,7 @@
-   else
-     mode = StatBuf.st_mode;
- 
--  strcpy (TempPath, "./u2dtmpXXXXXX");
--  if((fd=mkstemp (TempPath))<0) {
-+  if((fd = MakeTempFileFrom(ipInFN, &TempPath))<0) {
- 	  perror("Failed to open output temp file");
- 	  RetVal = -1;
-   }
-@@ -395,6 +426,7 @@
-   if ((!RetVal) && (InF) && ((TempF=OpenOutFile(fd)) == NULL))
-   {
-     fclose (InF);
-+    InF = NULL;
-     RetVal = -1;
-   }
- 
-@@ -422,10 +454,6 @@
-       RetVal = -1;
-   }
- 
--  /* can delete in file? */
--  if ((!RetVal) && (unlink(ipInFN) == -1))
--    RetVal = -1;
--
-   /* any error? */
-   if ((RetVal) && (unlink(TempPath)))
-     RetVal = -1;
-@@ -440,6 +468,7 @@
-     }
-     RetVal = -1;
-   }
-+  free(TempPath);
-   return RetVal;
- }
- 
diff --git a/pkgs/tools/text/dos2unix/dos2unix-3.1.patch b/pkgs/tools/text/dos2unix/dos2unix-3.1.patch
deleted file mode 100644
index 5f823b2e7a9bc..0000000000000
--- a/pkgs/tools/text/dos2unix/dos2unix-3.1.patch
+++ /dev/null
@@ -1,49 +0,0 @@
---- dos2unix-3.1/Makefile.orig	Thu Nov 19 07:09:38 1998
-+++ dos2unix-3.1/Makefile	Fri Nov 17 13:25:35 2000
-@@ -1,10 +1,12 @@
-+CFLAGS=
-+
- default: dos2unix
- 
- all:	dos2unix link install
- 
- 
- dos2unix:
--	gcc -O dos2unix.c -o dos2unix
-+	gcc $(CFLAGS) dos2unix.c -o dos2unix
- 
- 
- link:	
-@@ -12,11 +14,10 @@
- 	ln -s dos2unix.1 mac2unix.1		
- 
- clean:
--	rm dos2unix
-+	rm -f dos2unix mac2unix mac2unix.1 *~ *.orig core
- 
- install:
- 	install -m 755 dos2unix /usr/local/bin
- 	install -m 644 dos2unix.1 /usr/local/man/man1
- 	install -m 755 mac2unix /usr/local/bin
- 	install -m 644 mac2unix.1 /usr/local/man/man1
--
---- dos2unix-3.1/dos2unix.c.orig	Thu Nov 19 07:19:25 1998
-+++ dos2unix-3.1/dos2unix.c	Fri Nov 17 13:25:25 2000
-@@ -267,7 +267,7 @@
- 
-   strcpy (TempPath, "./d2utmp");
-   strcat (TempPath, "XXXXXX");
--  mktemp (TempPath);
-+  mkstemp (TempPath);
- 
- #ifdef DEBUG
-   fprintf(stderr, "dos2unix: using %s as temp file\n", TempPath);
-@@ -347,7 +347,7 @@
- 
-   strcpy (TempPath, "./u2dtmp");
-   strcat (TempPath, "XXXXXX");
--  mktemp (TempPath);
-+  mkstemp (TempPath);
- 
- #ifdef DEBUG
-   fprintf(stderr, "dos2unix: using %s as temp file\n", TempPath);
diff --git a/pkgs/tools/text/dos2unix/dos2unix-c-missing-arg.patch b/pkgs/tools/text/dos2unix/dos2unix-c-missing-arg.patch
deleted file mode 100644
index ff63e67134f7e..0000000000000
--- a/pkgs/tools/text/dos2unix/dos2unix-c-missing-arg.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff -up dos2unix-3.1/dos2unix.c.c-missing-arg dos2unix-3.1/dos2unix.c
---- dos2unix-3.1/dos2unix.c.c-missing-arg	2008-01-18 09:24:21.000000000 +0000
-+++ dos2unix-3.1/dos2unix.c	2008-01-18 09:25:43.000000000 +0000
-@@ -533,19 +533,28 @@ int main (int argc, char *argv[])
-       
-       if ((strcmp(argv[ArgIdx],"-c") == 0) || (strcmp(argv[ArgIdx],"--convmode") == 0))
-       {
--        ArgIdx++;
--        if (strcmpi(argv[ArgIdx],"ASCII") == 0)
--          pFlag->ConvMode = 0;
--        else if (strcmpi(argv[ArgIdx], "7Bit") == 0)
--          pFlag->ConvMode = 1;
--        else if (strcmpi(argv[ArgIdx], "ISO") == 0)
--          pFlag->ConvMode = 2;
--        else if (strcmpi(argv[ArgIdx], "Mac") == 0)
--          pFlag->ConvMode = 3;
-+        if (++ArgIdx < argc)
-+        {
-+          if (strcmpi(argv[ArgIdx],"ASCII") == 0)
-+            pFlag->ConvMode = 0;
-+          else if (strcmpi(argv[ArgIdx], "7Bit") == 0)
-+            pFlag->ConvMode = 1;
-+          else if (strcmpi(argv[ArgIdx], "ISO") == 0)
-+            pFlag->ConvMode = 2;
-+          else if (strcmpi(argv[ArgIdx], "Mac") == 0)
-+            pFlag->ConvMode = 3;
-+          else
-+          {
-+            if (!pFlag->Quiet)
-+              fprintf(stderr, "dos2unix: invalid %s conversion mode specified\n",argv[ArgIdx]);
-+            ShouldExit = 1;
-+          }
-+        }
-         else
-         {
-+          ArgIdx--;
-           if (!pFlag->Quiet)
--            fprintf(stderr, "dos2unix: invalid %s conversion mode specified\n",argv[ArgIdx]);
-+            fprintf(stderr,"dos2unix: option `%s' requires an argument\n",argv[ArgIdx]);
-           ShouldExit = 1;
-         }
-       }
diff --git a/pkgs/tools/text/dos2unix/dos2unix-manpage.patch b/pkgs/tools/text/dos2unix/dos2unix-manpage.patch
deleted file mode 100644
index f9e1e6701bc79..0000000000000
--- a/pkgs/tools/text/dos2unix/dos2unix-manpage.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up dos2unix-3.1/dos2unix.1.manpage dos2unix-3.1/dos2unix.1
---- dos2unix-3.1/dos2unix.1.manpage	2008-09-08 09:58:46.000000000 +0100
-+++ dos2unix-3.1/dos2unix.1	2008-09-08 09:58:56.000000000 +0100
-@@ -52,7 +52,7 @@ default to run in this mode. Wildcard na
- .B \-n \-\-newfile infile outfile ...
- New file mode. Convert the infile and write output to outfile. File names
- must be given in pairs and wildcard names should NOT be used or you WILL 
--lost your files. 
-+lose your files. 
- 
- .SH "EXAMPLES"
- .LP 
diff --git a/pkgs/tools/text/dos2unix/dos2unix-missing-proto.patch b/pkgs/tools/text/dos2unix/dos2unix-missing-proto.patch
deleted file mode 100644
index 72cd2c0b6a452..0000000000000
--- a/pkgs/tools/text/dos2unix/dos2unix-missing-proto.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff -up dos2unix-3.1/dos2unix.c.missing-proto dos2unix-3.1/dos2unix.c
---- dos2unix-3.1/dos2unix.c.missing-proto	2008-04-14 17:11:58.000000000 +0100
-+++ dos2unix-3.1/dos2unix.c	2008-04-14 17:12:42.000000000 +0100
-@@ -75,6 +75,11 @@ static int macmode = 0;
- #include <string.h>
- #include <utime.h>
- #include <sys/stat.h>
-+#if defined(__MSDOS__) || defined(__WIN32__) || defined(_WIN32)
-+#  include <io.h>
-+#else
-+#  include <unistd.h>
-+#endif
- #include "dos2unix.h"
- 
- 
diff --git a/pkgs/tools/text/dos2unix/dos2unix-preserve-file-modes.patch b/pkgs/tools/text/dos2unix/dos2unix-preserve-file-modes.patch
deleted file mode 100644
index 1d4ab5d8e71ea..0000000000000
--- a/pkgs/tools/text/dos2unix/dos2unix-preserve-file-modes.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -up dos2unix-3.1/dos2unix.c.preserve-file-modes dos2unix-3.1/dos2unix.c
---- dos2unix-3.1/dos2unix.c.preserve-file-modes	2008-09-08 09:58:05.000000000 +0100
-+++ dos2unix-3.1/dos2unix.c	2008-09-08 10:16:04.000000000 +0100
-@@ -320,9 +320,10 @@ int ConvertDosToUnixNewFile(char *ipInFN
-   struct stat StatBuf;
-   struct utimbuf UTimeBuf;
-   int fd;
-+  mode_t mask;
- 
-   /* retrieve ipInFN file date stamp */
--  if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
-+  if (stat(ipInFN, &StatBuf))
-     RetVal = -1;
- 
-   if((fd = MakeTempFileFrom(ipOutFN, &TempPath))<0) {
-@@ -346,6 +347,12 @@ int ConvertDosToUnixNewFile(char *ipInFN
-     RetVal = -1;
-   }
- 
-+  /* preserve original mode as modified by umask */
-+  mask = umask(0);
-+  umask(mask);
-+  if (!RetVal && fchmod(fd, StatBuf.st_mode & ~mask))
-+    RetVal = -1;
-+
-   /* conversion sucessful? */
-   if ((!RetVal) && (ConvertDosToUnix(InF, TempF, ipFlag)))
-     RetVal = -1;