dos2unix stable port information

Package: dos2unix
Version: 3.1
Revision: 3
Description: Convert DOS or Mac text files to Unix format
License: Public Domain
Homepage: http://fresh.t-systems-sfr.com/linux/src/
Maintainer: Blair Zajac
NoSetMAKEFLAGS: true
SetMAKEFLAGS: -j1

# Unpack Phase.
Source: http://fresh.t-systems-sfr.com/linux/src/%n-%v.tar.gz
Source-MD5: 25ff56bab202de63ea6f6c211c416e96

# Patch Phase.
Patch: %n.patch

# Compile Phase.
CompileScript: make CFLAGS=-Os clean dos2unix link

# Install Phase.
InstallScript: <<
mkdir -p %i/bin
mkdir -p %i/share/man/man1
install -m 755 dos2unix %i/bin
ln -s dos2unix %i/bin/mac2unix
install -m 644 dos2unix.1 %i/share/man/man1
ln -s dos2unix.1 %i/share/man/man1/mac2unix.1
<<
DocFiles: COPYRIGHT

# Documentation.
DescDetail: <<
Two utilities to convert DOS end-of-line (CRLF) and Macintosh classic
end-of-line (CR) formated text files into Unix (LF) format.
<<

dos2unix stable port .patch

diff -ruN dos2unix-3.1.orig/Makefile dos2unix-3.1/Makefile
--- dos2unix-3.1.orig/Makefile Thu Nov 19 04:09:38 1998
+++ dos2unix-3.1/Makefile Fri Jul 30 08:55:52 2004
@@ -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,7 +14,7 @@
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
@@ -20,3 +22,4 @@
install -m 755 mac2unix /usr/local/bin
install -m 644 mac2unix.1 /usr/local/man/man1

+.PHONY: all clean install link
--- 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);
--- 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;

dos2unix _unstable_ port information

Package: dos2unix
Version: 3.1
Revision: 3
Description: Convert DOS or Mac text files to Unix format
License: Public Domain
Homepage: http://fresh.t-systems-sfr.com/linux/src/
Maintainer: Blair Zajac
NoSetMAKEFLAGS: true
SetMAKEFLAGS: -j1

# Unpack Phase.
Source: http://fresh.t-systems-sfr.com/linux/src/%n-%v.tar.gz
Source-MD5: 25ff56bab202de63ea6f6c211c416e96

# Patch Phase.
Patch: %n.patch

# Compile Phase.
CompileScript: make CFLAGS=-Os clean dos2unix link

# Install Phase.
InstallScript: <<
mkdir -p %i/bin
mkdir -p %i/share/man/man1
install -m 755 dos2unix %i/bin
ln -s dos2unix %i/bin/mac2unix
install -m 644 dos2unix.1 %i/share/man/man1
ln -s dos2unix.1 %i/share/man/man1/mac2unix.1
<<
DocFiles: COPYRIGHT

# Documentation.
DescDetail: <<
Two utilities to convert DOS end-of-line (CRLF) and Macintosh classic
end-of-line (CR) formated text files into Unix (LF) format.
<<

dos2unix _unstable_ port .patch

diff -ruN dos2unix-3.1.orig/Makefile dos2unix-3.1/Makefile
--- dos2unix-3.1.orig/Makefile Thu Nov 19 04:09:38 1998
+++ dos2unix-3.1/Makefile Fri Jul 30 08:55:52 2004
@@ -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,7 +14,7 @@
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
@@ -20,3 +22,4 @@
install -m 755 mac2unix /usr/local/bin
install -m 644 mac2unix.1 /usr/local/man/man1

+.PHONY: all clean install link
--- 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);
--- 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;