Accepting request 26841 from Base:System

Copy from Base:System/dos2unix based on submit request 26841 from user psmt

OBS-URL: https://build.opensuse.org/request/show/26841
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dos2unix?expand=0&rev=6
This commit is contained in:
OBS User autobuild 2009-12-18 11:50:51 +00:00 committed by Git OBS Bridge
parent 90463fbe49
commit 6e25f30dd4
10 changed files with 350 additions and 356 deletions

195
de.po Normal file
View File

@ -0,0 +1,195 @@
# German messages for dos2unix
# Copyright (C) 2009
# This file is distributed under the same license as the dos2unix package.
#
# Philipp Thomas <pth@suse.de>, 2009.
# Philipp Thomas <psmt@opensuse.org>, 2009.
msgid ""
msgstr ""
"Project-Id-Version: dos2unix 4.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-12-15 11:26+0100\n"
"PO-Revision-Date: 2009-12-16 19:41+0100\n"
"Last-Translator: Philipp Thomas <psmt@opensuse.org>\n"
"Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 1.0\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
#: dos2unix.c:114
#, c-format
msgid ""
"dos2unix %s (%s)\n"
"Usage: dos2unix [-hkqLV] [-c convmode] [-o file ...] [-n infile "
"outfile ...]\n"
" -h --help give this help\n"
" -k --keepdate keep output file date\n"
" -q --quiet quiet mode, suppress all warnings\n"
" always on in stdin->stdout mode\n"
" -L --license print software license\n"
" -V --version display version number\n"
" -c --convmode conversion mode\n"
" convmode ASCII, 7bit, ISO, Mac, default to ASCII\n"
" -l --newline add additional newline in all but Mac convmode\n"
" -o --oldfile write to old file\n"
" file ... files to convert in old file mode\n"
" -n --newfile write to new file\n"
" infile original file in new file mode\n"
" outfile output file in new file mode\n"
msgstr ""
"dos2unix %s (%s)\n"
"Aufruf: dos2unix [-hkqLV] [-c Konvertierungsmodus] [-o Datei ...] [-n "
"Eingabedatei"
"Ausgabedatei ...]\n"
" -h --help Diese Hilfe ausgeben\n"
" -k --keepdate Datum der Ausgabedatei beibehalten\n"
" -q --quiet Lautlosmodus, alle Warnungen werden unterdrückt\n"
" im stdin->stdout Modus immer aktiv\n"
" -L --license Die Software-Lizenz ausgeben\n"
" -V --version Die Versionsnummer ausgeben\n"
" -c --convmode Umwandlungsmodus \n"
" convmode ASCII, 7bit, ISO, Mac, Standard ist ASCII\n"
" -l --newline Zusätzlichen Zeilenvorschub bei allen ausser dem "
"Mac/Modus hinzufügen\n"
" -o --oldfile Ausgabe in die alte Datei schreiben\n"
"Datei ... Umzuwandelnde Dateien\n"
" -n --newfile Neue Dateien erzeugen\n"
" Eingabedatei Originaldatei bei Neudatei-Modus\n"
" Ausgabedatei Ausdgabedatei bei Neudatei-Modus\n"
#: dos2unix.c:135
#, c-format
msgid ""
"Copyright (c) 1994-1995 Benjamin Lin\n"
"Copyright (c) 1998 Bernd Johannes Wuebben (Version 3.0)\n"
"Copyright (c) 1998 Christian Wurll (Version 3.1)\n"
"Copyright (c) 2009 Erwin Waterlander\n"
"All rights reserved.\n"
"\n"
"Redistribution and use in source and binary forms, with or without\n"
"modification, are permitted provided that the following conditions\n"
"are met:\n"
"1. Redistributions of source code must retain the above copyright\n"
" notice, this list of conditions and the following disclaimer.\n"
"2. Redistributions in binary form must reproduce the above copyright\n"
" notice in the documentation and/or other materials provided with\n"
" the distribution.\n"
"\n"
"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY\n"
"EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n"
"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n"
"PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE\n"
"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n"
"CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n"
"OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n"
"BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n"
"WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n"
"OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n"
"IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
msgstr ""
"Copyright © 1994,1995 Benjamin Lin\n"
"Copyright © 1998 Bernd Johannes Wuebben (Version 3.0)\n"
"Copyright © 1998 Christian Wurll (Version 3.1)\n"
"Copyright © 2009 Erwin Waterlander\n"
"Alle Rechte vorbehalten.\n"
"\n"
"Verbreitung und Verwendung als Quelltext oder Binärdatei, in geänderter\n"
"oder ungeänderter Form sind gestattet, soweit die folgenden Bedingungen\n"
"eingehalten werden:\n"
"1. Weiterverbreitung des Quellcodes muss den obigen Copyrightshinweis,\n"
" Diese Liste von Bedingungen sowie den folgenden Haftungsausschlus\n"
" beibehalten.\n"
"2. Weiterverbreitung in binärer Form muss den obigen Copyright-Hinweis\n"
" in der Dokumentation oder anderem der Distribution beiliegenden\n"
" Material wiedergeben.\n"
"\n"
"DIESE SOFTWARE WIRD VOM AUTHOR WIE VORLIEGT ZUR VERFÜGUNG GESTELLT\n"
"UND JEGLICHE AUSDRÜCKLICH GENANNTEN ODER IMPLIZITEN GARANTIEN,\N"
"EINSCHLIESLICH, ABER NICHT DARAUF BESCHRÄNKT, DER GARANTIE DER\n"
"HANDELBARKEIT UND DER EIGNUNG FÜR EINEN BESTIMMTEN ZWECK WERDEN\n"
"HIERMIT AUSGESCHLOSSEN. IN KEINEM WIE AUCH IMMER GELAGERTEN FALL KANN\n"
"DER AUTHOR FÜR IRGENDWELCHE DIREKTEN ODER INDIREKTEN, ZUFÄLLIGEN,\n"
"BESONDEREN ODER BEISPIELHAFTEN SCHÄDEN (EINSCHLIESSLICH ABER NICHT\n"
"AUSSCHLIESSLICH DER LIEFERUNG VON ERSATZGÜTERN ODER DIENSTEN;VERLUST\n"
"DER NUTZBARKEIT, DER DATEN ODER DER GEWINNE ODER ETWAIGEN VERDIENST-\n"
"AUSFALL-ENTSCHÄDIGUNGEN) HAFTBAR GEMACHT WERDEN, WIE AUCH IMMER SIE\n"
"VERURSACHT WURDEN UND WELCHE HAFTUNGSMÖGLICHKEIT ZUGRUNDE GELEGT WIRD,\n"
"SEI ES DURCH VERTRAG, VERBINDLICHKEIT ODER SCHADEN (EINSCHLIESSLICH\n"
"FAHRLÄSSIGKEIT), DIE AUS DER VERWENDUNG DIESER SOFTWARE ERWÄCHST,\n"
"SELBST WENN AUF DIE MÖGLICHKIET SOLCHER SCHÄDEN HINGEWIESEN WURDE.\n"
#: dos2unix.c:169
#, c-format
msgid "With native language support.\n"
msgstr "Mit Unterstützung von Landessprachen.\n"
#: dos2unix.c:247 dos2unix.c:261 dos2unix.c:275 dos2unix.c:290 dos2unix.c:306
#, c-format
msgid "dos2unix: can not write to out file\n"
msgstr "dos2unix: In die Ausgabedatei kann nicht geschrieben werden\n"
#: dos2unix.c:314
#, c-format
msgid "dos2unix: program error, invalid conversion mode %d\n"
msgstr ""
"dos2unix: Programmfehler, der Konvertierungsmodus %d ist unzulässig\n"
#: dos2unix.c:408 dos2unix.c:519
#, c-format
msgid "dos2unix: using %s as temp file\n"
msgstr "dos2unix: %s wird als temporäre Datei verwendet\n"
#: dos2unix.c:467 dos2unix.c:580
#, c-format
msgid "dos2unix: problems renaming '%s' to '%s'\n"
msgstr ""
"dos2unix: Beim Umbenennen von »%s« zu »%s« sind Probleme aufgetreten\n"
#: dos2unix.c:468 dos2unix.c:581
#, c-format
msgid " output file remains in '%s'\n"
msgstr " Die Ausgabedatei verbleibt in »%s«\n"
#: dos2unix.c:692
#, c-format
msgid "dos2unix: invalid %s conversion mode specified\n"
msgstr "dos2unix: Der angegebene Konvertierungsmodus %s ist unzulässig\n"
#: dos2unix.c:700
#, c-format
msgid "dos2unix: option `%s' requires an argument\n"
msgstr "dos2unix: Die Option »%s« benötigt ein Argument\n"
#: dos2unix.c:711 dos2unix.c:723 dos2unix.c:765
#, c-format
msgid "dos2unix: target of file %s not specified in new file mode\n"
msgstr ""
"dos2unix: Das Yiel der Datei %s wurde für den Neudatei-Modus nicht "
"angegeben\n"
#: dos2unix.c:739
#, c-format
msgid "dos2unix: converting file %s to file %s in UNIX format ...\n"
msgstr ""
"dos2unix: Datei %s wird yu Datei %s im UNIX-Format umgewandelt ...\n"
#: dos2unix.c:743
#, c-format
msgid "dos2unix: problems converting file %s to file %s\n"
msgstr ""
"dos2unix: Beim Konvertieren von Datei %s yu Dtei %s sind Probleme "
"aufgetreten\n"
#: dos2unix.c:752
#, c-format
msgid "dos2unix: converting file %s to UNIX format ...\n"
msgstr "dos2unix: Datei %s wird ins UNIX-Format umgewandelt ...\n"
#: dos2unix.c:756
#, c-format
msgid "dos2unix: problems converting file %s\n"
msgstr "dos2unix: Beim Umwandeln von Datei %s sind Probleme aufgetreten\n"

View File

@ -1,28 +0,0 @@
--- dos2unix.c. 2003-05-21 08:09:08.000000000 -0700
+++ 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

View File

@ -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;

View File

@ -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);

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e571d6f334809cecf064da32e8be95132e69a30020e7f3009bb80455f093a94
size 13400

3
dos2unix-4.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6279191fd085ebcbbb19a074c7cfbb455ae043a2e2d5dbfe1e3a9ed0e4b70b50
size 26856

108
dos2unix-Makefile.patch Normal file
View File

@ -0,0 +1,108 @@
Index: Makefile
===================================================================
--- Makefile.orig 2009-12-15 21:48:07.000000000 +0100
+++ Makefile 2009-12-16 18:21:36.504153125 +0100
@@ -25,12 +25,12 @@ exec_prefix = $(prefix)
man_prefix = $(prefix)/share
mandir = $(man_prefix)/man
bindir = $(exec_prefix)/bin
-sharedir = $(prefix)/share
+datadir = $(prefix)/share
-BINDIR = $(DESTDIR)$(bindir)
-DOCDIR = $(DESTDIR)$(sharedir)/doc/$(PACKAGE)-$(DOS2UNIX_VERSION)
-LOCALEDIR = $(DESTDIR)$(sharedir)/locale
-MANDIR = $(DESTDIR)$(mandir)
+BINDIR = $(bindir)
+DOCDIR = $(datadir)/doc/packages/$(PACKAGE)
+LOCALEDIR = $(datadir)/locale
+MANDIR = $(mandir)
MANDIR1 = $(MANDIR)/man1
ifdef ENABLE_NLS
@@ -47,7 +47,7 @@ INSTALL = install
MKDIR = mkdir
ifdef ENABLE_NLS
- NLSDEFS = -DENABLE_NLS -DLOCALEDIR=\"$(sharedir)/locale\" -DPACKAGE=\"$(PACKAGE)\"
+ NLSDEFS = -DENABLE_NLS -DLOCALEDIR=\"$(datadir)/locale\" -DPACKAGE=\"$(PACKAGE)\"
endif
# ......................................................... OS flags ...
@@ -116,7 +116,7 @@ endif
# ............................................................ flags ...
-GCCFLAGS = -O2 -Wall -D_LARGEFILE_SOURCE
+GCCFLAGS = -O2 -Wall -D_LARGEFILE_SOURCE $(RPM_OPT_FLAGS)
ifdef STATIC
GCCFLAGS += -static
@@ -177,31 +177,31 @@ $(PACKAGE).ps : dos2unix.1
ps2pdf $< $@
install: all
- $(MKDIR) -p -m 755 $(BINDIR)
- $(INSTALL) -m 755 $(BIN) $(BINDIR)
- $(INSTALL) -m 755 $(MAC2UNIX_BIN) $(BINDIR)
- $(MKDIR) -p -m 755 $(MANDIR1)
- $(INSTALL) -m 644 $(PACKAGE).1 $(MANDIR1)
- $(INSTALL) -m 644 $(MAC2UNIX).1 $(MANDIR1)
+ $(MKDIR) -p -m 755 $(DESTDIR)$(BINDIR)
+ $(INSTALL) -m 755 $(BIN) $(DESTDIR)$(BINDIR)
+ $(INSTALL) -m 755 $(MAC2UNIX_BIN) $(DESTDIR)$(BINDIR)
+ $(MKDIR) -p -m 755 $(DESTDIR)$(MANDIR1)
+ $(INSTALL) -m 644 $(PACKAGE).1 $(DESTDIR)$(MANDIR1)
+ $(INSTALL) -m 644 $(MAC2UNIX).1 $(DESTDIR)$(MANDIR1)
ifdef ENABLE_NLS
@echo "-- install-mo"
- $(foreach mofile, $(MOFILES), $(MKDIR) -p -m 755 $(LOCALEDIR)/$(basename $(notdir $(mofile)))/LC_MESSAGES ;)
- $(foreach mofile, $(MOFILES), $(INSTALL) -m 644 $(mofile) $(LOCALEDIR)/$(basename $(notdir $(mofile)))/LC_MESSAGES/$(PACKAGE).mo ;)
+ $(foreach mofile, $(MOFILES), $(MKDIR) -p -m 755 $(DESTDIR)$(LOCALEDIR)/$(basename $(notdir $(mofile)))/LC_MESSAGES ;)
+ $(foreach mofile, $(MOFILES), $(INSTALL) -m 644 $(mofile) $(DESTDIR)$(LOCALEDIR)/$(basename $(notdir $(mofile)))/LC_MESSAGES/$(PACKAGE).mo ;)
endif
@echo "-- install-doc"
- $(MKDIR) -p -m 755 $(DOCDIR)
- $(INSTALL) -m 644 $(INSTALL_OBJS_DOC) $(DOCDIR)
+ $(MKDIR) -p -m 755 $(DESTDIR)$(DOCDIR)
+ $(INSTALL) -m 644 $(INSTALL_OBJS_DOC) $(DESTDIR)$(DOCDIR)
uninstall:
@echo "-- target: uninstall"
- -rm -f $(BINDIR)/$(BIN)
- -rm -f $(BINDIR)/$(MAC2UNIX_BIN)
+ -rm -f $(DESTDIR)$(BINDIR)/$(BIN)
+ -rm -f $(DESTDIR)$(BINDIR)/$(MAC2UNIX_BIN)
ifdef ENABLE_NLS
- $(foreach mofile, $(MOFILES), rm -f $(LOCALEDIR)/$(basename $(notdir $(mofile)))/LC_MESSAGES/$(PACKAGE).mo ;)
+ $(foreach mofile, $(MOFILES), rm -f $(DESTDIR)$(LOCALEDIR)/$(basename $(notdir $(mofile)))/LC_MESSAGES/$(PACKAGE).mo ;)
endif
- -rm -f $(MANDIR)/man1/$(PACKAGE).1
- -rm -f $(MANDIR)/man1/$(MAC2UNIX).1
- -rm -rf $(DOCDIR)
+ -rm -f $(DESTDIR)$(MANDIR)/man1/$(PACKAGE).1
+ -rm -f $(DESTDIR)$(MANDIR)/man1/$(MAC2UNIX).1
+ -rm -rf $(DESTDIR)$(DOCDIR)
clean:
rm -f *.o
@@ -230,6 +230,7 @@ endif
VERSIONSUFFIX = -bin
ZIPFILE = $(PACKAGE)-$(DOS2UNIX_VERSION)$(VERSIONSUFFIX).zip
TGZFILE = $(PACKAGE)-$(DOS2UNIX_VERSION)$(VERSIONSUFFIX).tar.gz
+TBZFILE = $(PACKAGE)-$(DOS2UNIX_VERSION)$(VERSIONSUFFIX).tar.bz2
dist-zip:
rm -f $(ZIPFILE)
@@ -242,5 +243,10 @@ dist-tgz:
cd $(prefix) ; tar cvzf $(TGZFILE) $(ZIPOBJ)
mv $(prefix)/$(TGZFILE) ..
-dist: dist-tgz
+dist-tbz:
+ cd $(prefix) ; dos2unix share/doc/$(PACKAGE)-$(DOS2UNIX_VERSION)/*.txt share/man/man1/$(PACKAGE).1 share/man/man1/$(MAC2UNIX).1
+ cd $(prefix) ; tar cvjf $(TBZFILE) $(ZIPOBJ)
+ mv $(prefix)/$(TBZFILE) ..
+
+dist: dist-tbz

View File

@ -1,143 +0,0 @@
Index: dos2unix.c
===================================================================
--- dos2unix.c.orig
+++ dos2unix.c
@@ -69,6 +69,7 @@ static int macmode = 0;
#ifdef __MSDOS__
# include <dir.h>
#endif __MSDOS__
+#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -247,6 +248,39 @@ int ConvertDosToUnix(FILE* ipInF, FILE*
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
@@ -257,7 +291,7 @@ int ConvertDosToUnixNewFile(char *ipInFN
int RetVal = 0;
FILE *InF = NULL;
FILE *TempF = NULL;
- char TempPath[16];
+ char *TempPath;
struct stat StatBuf;
struct utimbuf UTimeBuf;
int fd;
@@ -266,8 +300,7 @@ int ConvertDosToUnixNewFile(char *ipInFN
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;
}
@@ -284,6 +317,7 @@ int ConvertDosToUnixNewFile(char *ipInFN
if ((!RetVal) && (InF) && ((TempF=OpenOutFile(fd)) == NULL))
{
fclose (InF);
+ InF = NULL;
RetVal = -1;
}
@@ -317,9 +351,6 @@ int ConvertDosToUnixNewFile(char *ipInFN
/* 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);
@@ -327,6 +358,7 @@ int ConvertDosToUnixNewFile(char *ipInFN
RetVal = -1;
}
}
+ free(TempPath);
return RetVal;
}
@@ -342,7 +374,7 @@ int ConvertDosToUnixOldFile(char* ipInFN
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;
@@ -354,8 +386,7 @@ int ConvertDosToUnixOldFile(char* ipInFN
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;
}
@@ -375,6 +406,7 @@ int ConvertDosToUnixOldFile(char* ipInFN
if ((!RetVal) && (InF) && ((TempF=OpenOutFile(fd)) == NULL))
{
fclose (InF);
+ InF = NULL;
RetVal = -1;
}
@@ -402,10 +434,6 @@ int ConvertDosToUnixOldFile(char* ipInFN
RetVal = -1;
}
- /* can delete in file? */
- if ((!RetVal) && (unlink(ipInFN) == -1))
- RetVal = -1;
-
/* any error? */
if ((RetVal) && (unlink(TempPath)))
RetVal = -1;
@@ -420,6 +448,7 @@ int ConvertDosToUnixOldFile(char* ipInFN
}
RetVal = -1;
}
+ free(TempPath);
return RetVal;
}

View File

@ -1,3 +1,30 @@
-------------------------------------------------------------------
Wed Dec 16 14:23:06 CET 2009 - pth@suse.de
- Update to 4.0:
* version 4.0
* Added internationalisation using gettext.
* Added Dutch translation.
* New option -L/--license that prints software license.
* Code cleanup
* Update manual
* version 3.2
* version.mk: New file.
* README: New file.
* INSTALL: Updated.
* Makefile: Makefile according GNU standards.
* ChangeLog : New file.
* Applied all patches from RedHat:
- Use DESTDIR only in install makefile targets.
- Add a German translation.
-------------------------------------------------------------------
Tue Dec 15 22:27:07 CET 2009 - jengelh@medozas.de
- enable parallel building
-------------------------------------------------------------------
Mon Apr 20 15:03:31 CEST 2009 - pth@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package dos2unix (Version 3.1)
# spec file for package dos2unix (Version 4.0)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -19,15 +19,14 @@
Name: dos2unix
Summary: A DOS to UNIX Text Converter
Version: 3.1
Release: 439
Version: 4.0
Release: 1
Group: Productivity/Text/Convertors
License: BSD 3-Clause
License: BSD3c
Url: http://www.xs4all.nl/~waterlan/#DOS2UNIX
Source: %{name}-%{version}.tar.bz2
Patch0: %{name}-%{version}.patch
Patch1: dos2unix-3.1-segfault.patch
Patch2: dos2unix-3.1-preserve-file-modes.patch
Patch3: dos2unix-bnc#488261-dont_destroy_original.patch
Source1: de.po
Patch0: dos2unix-Makefile.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -39,30 +38,25 @@ format (LF).
Authors:
--------
Benjamin Lin blin @ socs.uts.edu.au
Erwin Waterlander <waterlan @ xs4all.nl>
%prep
%setup -q
%patch0 -p1 -b .orig
%patch1 -p1 -b .segf
%patch2 -b .fmode
%patch3
perl -pi -e 's,(#endif|#else)[^ ]*(.*),$1 /* $2 */,g' *.[ch]
%patch0
cp %{S:1} po/
find . -type f -exec chmod -x {} \;
%build
make clean
make CFLAGS="$RPM_OPT_FLAGS"
make link
export RPM_OPT_FLAGS
make %{?jobs:-j%jobs}
%install
mkdir -p $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
install -m755 dos2unix $RPM_BUILD_ROOT%{_bindir}
ln -s dos2unix $RPM_BUILD_ROOT%{_bindir}/mac2unix
install -m444 dos2unix.1 $RPM_BUILD_ROOT%{_mandir}/man1
ln -s dos2unix.1 $RPM_BUILD_ROOT%{_mandir}/man1/mac2unix.1
%makeinstall
%{find_lang} %{name}
%files
%files -f %{name}.lang
%defattr(-,root,root,0755)
%doc COPYRIGHT
%doc %{_defaultdocdir}/%{name}
%{_bindir}/dos2unix
%{_bindir}/mac2unix
%{_mandir}/*/*
@ -71,20 +65,3 @@ ln -s dos2unix.1 $RPM_BUILD_ROOT%{_mandir}/man1/mac2unix.1
rm -rf $RPM_BUILD_ROOT
%changelog
* Mon Apr 20 2009 pth@suse.de
- Don't destroy original file if the output is on a different file
system (bnc#488261).
* Tue Dec 09 2008 schwab@suse.de
- Fix last change.
* Mon Sep 15 2008 ro@suse.de
- let mac2unix be a hardlink (instead of duplicate binary)
* Tue Apr 11 2006 pth@suse.de
- Make dos2unix preserve file modes (bugzilla #119350).
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Oct 05 2005 dmueller@suse.de
- add norootforbuild
* Mon Aug 12 2002 bk@suse.de
- update to dos2unix-3.1(no longer uses hd2u, but real dos2unix)
* Wed Jun 19 2002 postadal@suse.cz
- new package dos2unix verison 0.8.0