From: Arkadiusz Miƛkiewicz Date: Fri, 30 May 2008 07:57:30 +0000 (+0000) Subject: - new X-Git-Tag: auto/th/dos2unix-3_1-20~1 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?p=packages%2Fdos2unix.git;a=commitdiff_plain;h=62371aa314d4906fe6eed074e7fd220bca274943 - new Changed files: dos2unix-includes.patch -> 1.1 dos2unix-manpage-update.patch -> 1.1 dos2unix-preserve-file-modes.patch -> 1.1 dos2unix-safeconv.patch -> 1.1 dos2unix-workaround-rename-EXDEV.patch -> 1.1 dos2unix.patch -> 1.2 --- diff --git a/dos2unix-includes.patch b/dos2unix-includes.patch new file mode 100644 index 0000000..a71c205 --- /dev/null +++ b/dos2unix-includes.patch @@ -0,0 +1,11 @@ +--- dos2unix-3.1/dos2unix.c ++++ dos2unix-3.1/dos2unix.c +@@ -71,6 +71,8 @@ + #endif __MSDOS__ + #include + #include ++#include ++#include + #include + #include + #include diff --git a/dos2unix-manpage-update.patch b/dos2unix-manpage-update.patch new file mode 100644 index 0000000..7e4b705 --- /dev/null +++ b/dos2unix-manpage-update.patch @@ -0,0 +1,180 @@ +Ripped from Fedora + +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. + +Patch by Bill Anderson +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=57507 + +--- dos2unix-3.1/dos2unix.1 ++++ dos2unix-3.1/dos2unix.1 +@@ -4,127 +4,104 @@ + .SH NAME + + dos2unix \- DOS/MAC to UNIX text file format converter ++.SH SYNOPSIS + +-.SH SYNOPSYS +- +-dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...] +-.PP +-Options: +-.PP +-[-hkqV] [--help] [--keepdate] [--quiet] [--version] ++\fBdos2unix\fR [options] [\-c convmode] [\-o file ...] [\-n infile outfile ...] + ++\fBdos2unix\fR [\-hkqV] [\-\-help] [\-\-keepdate] [\-\-quiet] [\-\-version] + .SH DESCRIPTION + + .PP +-This manual page documents dos2unix, the program that converts plain text ++This manual page documents \fBdos2unix\fR, the program that converts plain text + files in DOS/MAC format to UNIX format. +- + .SH OPTIONS + +-The following options are available: + .TP +-.B \-h --help ++.B \-h \-\-help + Print online help. +- + .TP +-.B \-k --keepdate ++.B \-k \-\-keepdate + Keep the date stamp of output file same as input file. +- + .TP +-.B \-q --quiet ++.B \-q \-\-quiet + Quiet mode. Suppress all warning and messages. +- + .TP +-.B \-V --version ++.B \-V \-\-version + Prints version information. +- + .TP +-.B \-c --convmode convmode +-Sets conversion mode. Simulates dos2unix under SunOS. +- ++.B \-c \-\-convmode convmode ++Sets conversion mode. convmode is one of: ++.B ASCII, 7bit, ISO, Mac ++with ASCII being the default. Simulates dos2unix under SunOS. + .TP +-.B \-o --oldfile file ... ++.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 ... ++.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 + Get input from stdin and write output to stdout. + .IP + .B dos2unix +- + .LP + Convert and replace a.txt. Convert and replace b.txt. + .IP + .B dos2unix a.txt b.txt + .IP +-.B dos2unix -o a.txt b.txt +- ++.B dos2unix \-o a.txt b.txt + .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 +- ++.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 ++.B dos2unix \-k a.txt + .IP +-.B dos2unix -k -o a.txt +- ++.B dos2unix \-k \-o a.txt + .LP + Convert a.txt and write to e.txt. + .IP +-.B dos2unix -n a.txt e.txt +- ++.B dos2unix \-n a.txt e.txt + .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 +- ++.B dos2unix \-k \-n a.txt e.txt + .LP + Convert and replace a.txt. Convert b.txt and write to e.txt. + .IP +-.B dos2unix a.txt -n b.txt e.txt ++.B dos2unix a.txt \-n b.txt e.txt + .IP +-.B dos2unix -o a.txt -n b.txt e.txt +- ++.B dos2unix \-o a.txt \-n b.txt e.txt + .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 +- +-.SH DIAGNOSTICS +- ++.B dos2unix \-n c.txt e.txt \-o a.txt b.txt \-n d.txt f.txt + .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 - ++Benjamin Lin + .B +- +- ++.br + Bernd Johannes Wuebben (mac2unix mode) + .B +- +- + .SH MISCELLANY + + Tested environment: +@@ -136,7 +114,6 @@ + MS-DOS 6.20 with Borland C++ 4.02 + .PP + Suggestions and bug reports are welcome. +- + .SH SEE ALSO +-unix2dos(1) mac2unix(1) +- ++.BR unix2dos (1), ++.BR mac2unix (1) diff --git a/dos2unix-preserve-file-modes.patch b/dos2unix-preserve-file-modes.patch new file mode 100644 index 0000000..a357b0b --- /dev/null +++ b/dos2unix-preserve-file-modes.patch @@ -0,0 +1,30 @@ +Ripped from Fedora + +--- dos2unix-3.1/dos2unix.c ++++ dos2unix-3.1/dos2unix.c +@@ -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/dos2unix-safeconv.patch b/dos2unix-safeconv.patch new file mode 100644 index 0000000..11998be --- /dev/null +++ b/dos2unix-safeconv.patch @@ -0,0 +1,88 @@ +* 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/dos2unix-workaround-rename-EXDEV.patch b/dos2unix-workaround-rename-EXDEV.patch new file mode 100644 index 0000000..71a3a69 --- /dev/null +++ b/dos2unix-workaround-rename-EXDEV.patch @@ -0,0 +1,56 @@ +--- ./dos2unix.c.orig 2007-04-17 11:16:32.000000000 +0400 ++++ ./dos2unix.c 2007-04-17 12:41:01.000000000 +0400 +@@ -279,7 +279,7 @@ + int RetVal = 0; + FILE *InF = NULL; + FILE *TempF = NULL; +- char TempPath[16]; ++ char *TempPath = (char *) malloc(sizeof(char) * strlen(ipInFN)+14); + struct stat StatBuf; + struct utimbuf UTimeBuf; + int fd; +@@ -288,7 +288,8 @@ + if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf)) + RetVal = -1; + +- strcpy (TempPath, "./d2utmpXXXXXX"); ++ strcpy (TempPath, ipInFN); ++ strcat (TempPath, "_u2dtmpXXXXXX"); + if((fd=mkstemp (TempPath))<0) { + perror("Failed to open output temp file"); + RetVal = -1; +@@ -349,6 +350,7 @@ + RetVal = -1; + } + } ++ free (TempPath); + return RetVal; + } + +@@ -364,7 +366,7 @@ + int RetVal = 0; + FILE *InF = NULL; + FILE *TempF = NULL; +- char TempPath[16]; ++ char *TempPath = (char *) malloc(sizeof(char) * strlen(ipInFN)+14); + struct stat StatBuf; + struct utimbuf UTimeBuf; + mode_t mode = S_IRUSR | S_IWUSR; +@@ -376,7 +378,8 @@ + else + mode = StatBuf.st_mode; + +- strcpy (TempPath, "./u2dtmpXXXXXX"); ++ strcpy (TempPath, ipInFN); ++ strcat (TempPath, "_u2dtmpXXXXXX"); + if((fd=mkstemp (TempPath))<0) { + perror("Failed to open output temp file"); + RetVal = -1; +@@ -442,6 +445,7 @@ + } + RetVal = -1; + } ++ free (TempPath); + return RetVal; + } + diff --git a/dos2unix.patch b/dos2unix.patch index 5f823b2..e7a9d86 100644 --- a/dos2unix.patch +++ b/dos2unix.patch @@ -27,23 +27,4 @@ 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); +