mirror of
https://github.com/yann64/haikuports.git
synced 2026-03-19 01:46:00 +01:00
dos2unix, bump version, cleanup (#9346)
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
SUMMARY="Converter between DOS and Unix end-of-line delimiters"
|
||||
DESCRIPTION="DOS/Windows like to put CR/LF at the end of lines whereas UNIX like \
|
||||
to have just LF. Dos2unix and unix2dos are simple parser/converter command line \
|
||||
programs to convert between the two formats."
|
||||
HOMEPAGE="https://github.com/puckipedia/dos2unix"
|
||||
COPYRIGHT="Public Domain"
|
||||
LICENSE="Public Domain"
|
||||
REVISION="2"
|
||||
SOURCE_URI="git://github.com/puckipedia/dos2unix.git#553720356be18ca60cae3d970a575520aef5a4f4"
|
||||
|
||||
ARCHITECTURES="all"
|
||||
|
||||
PROVIDES="
|
||||
dos2unix = 1.0.1 compat >= 1
|
||||
cmd:dos2unix
|
||||
cmd:unix2dos
|
||||
"
|
||||
REQUIRES="
|
||||
haiku
|
||||
"
|
||||
|
||||
BUILD_PREREQUIRES="
|
||||
haiku_devel
|
||||
cmd:g++
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
cd src
|
||||
g++ -O -o ../dos2unix dos2unix.c
|
||||
g++ -O -o ../unix2dos unix2dos.c
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
mkdir -p $binDir
|
||||
cp dos2unix $binDir/dos2unix
|
||||
cp unix2dos $binDir/unix2dos
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
SUMMARY="Converter between DOS and Unix end-of-line"
|
||||
DESCRIPTION="DOS/Windows like to put CR/LF at the end of lines whereas UNIX like \
|
||||
to have just LF. Dos2unix and unix2dos are simple parser/converter command line \
|
||||
programs to convert between the two formats."
|
||||
HOMEPAGE="http://www.programmersheaven.com/download/3118/download.aspx"
|
||||
COPYRIGHT="Public Domain"
|
||||
LICENSE="Public Domain"
|
||||
REVISION="1"
|
||||
SOURCE_URI="http://ports-space.haiku-files.org/source/dos2unix-1.0.zip"
|
||||
CHECKSUM_SHA256="a88941a2ab824deb79e7d012b0df72b5c84d1157af0b2d59b46184fb35b5519d"
|
||||
|
||||
ARCHITECTURES="all"
|
||||
|
||||
PROVIDES="
|
||||
dos2unix = 1.0 compat >= 1
|
||||
cmd:dos2unix
|
||||
cmd:unix2dos
|
||||
"
|
||||
REQUIRES="
|
||||
haiku
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku_devel
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:gcc
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
gcc -O -o dos2unix DOS2UNIX.C
|
||||
gcc -O -o unix2dos UNIX2DOS.C
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
mkdir -p $binDir
|
||||
cp dos2unix $binDir/dos2unix
|
||||
cp unix2dos $binDir/unix2dos
|
||||
}
|
||||
@@ -3,38 +3,35 @@ DESCRIPTION="DOS/Windows uses CR/LF at the end of lines whereas UNIX has \
|
||||
just LF. Dos2unix and unix2dos are simple command line tools to convert \
|
||||
between the two formats."
|
||||
HOMEPAGE="https://sourceforge.net/projects/dos2unix"
|
||||
COPYRIGHT="2009-2015 Erwin Waterlander
|
||||
COPYRIGHT="2009-2023 Erwin Waterlander
|
||||
1998 Christian Wurll
|
||||
1998 Bernd Johannes Wuebben
|
||||
1994-1995 Benjamin Lin"
|
||||
LICENSE="BSD (2-clause)"
|
||||
REVISION="1"
|
||||
SOURCE_URI="http://downloads.sourceforge.net/project/dos2unix/dos2unix/$portVersion/dos2unix-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="b68db41956daf933828423aa30510e00c12d29ef5916e715e8d4e694fe66ca72"
|
||||
CHECKSUM_SHA256="da07788bb2e029b0d63f6471d166f68528acd8da2cf14823a188e8a9d5c1fc15"
|
||||
|
||||
if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then
|
||||
PATCHES="dos2unix-$portVersion.patchset"
|
||||
fi
|
||||
|
||||
ARCHITECTURES="all"
|
||||
ARCHITECTURES="all !x86_gcc2"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
PROVIDES="
|
||||
dos2unix = $portVersion compat >= 7
|
||||
dos2unix$secondaryArchSuffix = $portVersion compat >= 7
|
||||
cmd:dos2unix
|
||||
cmd:unix2dos
|
||||
cmd:mac2unix
|
||||
cmd:unix2mac
|
||||
"
|
||||
REQUIRES="
|
||||
haiku
|
||||
haiku$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku_devel
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:make
|
||||
cmd:gcc
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:find
|
||||
cmd:xargs
|
||||
"
|
||||
@@ -1,22 +0,0 @@
|
||||
From c8521cb9fc56b963d7d1d7b8121c9f05f21f619f Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Wed, 10 Jun 2015 12:00:08 +0000
|
||||
Subject: gcc2 patch
|
||||
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 68dfd14..1cf5b78 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -322,7 +322,7 @@ CFLAGS ?= -O0
|
||||
else
|
||||
CFLAGS ?= -O2
|
||||
endif
|
||||
-CFLAGS += -Wall -Wextra -Wconversion $(RPM_OPT_FLAGS) $(CPPFLAGS) $(CFLAGS_USER)
|
||||
+CFLAGS += -Wall -Wconversion $(RPM_OPT_FLAGS) $(CPPFLAGS) $(CFLAGS_USER)
|
||||
|
||||
EXTRA_CFLAGS = -DVER_REVISION=\"$(DOS2UNIX_VERSION)\" \
|
||||
-DVER_DATE=\"$(DOS2UNIX_DATE)\" \
|
||||
--
|
||||
2.12.2
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* DOS2UNIX.C
|
||||
*
|
||||
* Clean out cr/lf combinations in a file but keep it's original
|
||||
* date/time stamp.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef TRUE
|
||||
# define TRUE (1)
|
||||
# define FALSE (0)
|
||||
#endif
|
||||
|
||||
#define R_CNTRL "r"
|
||||
#define W_CNTRL "w"
|
||||
|
||||
struct stat s_buf;
|
||||
|
||||
|
||||
int dos2u (char *path);
|
||||
|
||||
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *path;
|
||||
while (--argc>0)
|
||||
{
|
||||
if (stat (path=*++argv, &s_buf) != -1)
|
||||
{
|
||||
printf ("Dos2Unix: Cleaning file %s ...\n", path);
|
||||
if (dos2u (path))
|
||||
{
|
||||
fprintf (stderr, "Dos2Unix: Problems cleaning file %s\n", path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Dos2Unix: Can't stat '%s'\n", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int dos2u (char *path)
|
||||
{
|
||||
FILE *in, *out;
|
||||
int ch,
|
||||
rval = FALSE;
|
||||
char temppath [16];
|
||||
/* struct utimbuf { time_t actime, modtime; } ut_buf; */
|
||||
struct utimbuf ut_buf;
|
||||
|
||||
strcpy (temppath, "./clntmp");
|
||||
if ((in=fopen (path, R_CNTRL)) == (FILE *) 0)
|
||||
return TRUE;
|
||||
if ((out=fopen (temppath, W_CNTRL)) == (FILE *) 0)
|
||||
{
|
||||
fclose (in);
|
||||
return TRUE;
|
||||
}
|
||||
while ((ch = getc (in)) != EOF)
|
||||
if ((ch != '\015' && ch != '\032') &&
|
||||
(putc (ch, out) == EOF) )
|
||||
{
|
||||
rval = TRUE;
|
||||
break;
|
||||
}
|
||||
if (fclose (in) == EOF)
|
||||
{
|
||||
rval = TRUE;
|
||||
}
|
||||
if (fclose (out) == EOF)
|
||||
{
|
||||
rval = TRUE;
|
||||
}
|
||||
ut_buf.actime = s_buf.st_atime;
|
||||
ut_buf.modtime = s_buf.st_mtime;
|
||||
if (utime (temppath, &ut_buf) == -1)
|
||||
rval = TRUE;
|
||||
if (unlink (path) == -1)
|
||||
rval = TRUE;
|
||||
if (rval)
|
||||
{
|
||||
unlink (temppath);
|
||||
return TRUE;
|
||||
}
|
||||
if (rename (temppath,path) == -1)
|
||||
{
|
||||
fprintf (stderr, "Dos2Unix: Problems renaming '%s' to '%s'\n", temppath, path);
|
||||
fprintf (stderr, " However, file '%s' remains\n", temppath);
|
||||
exit (1);
|
||||
}
|
||||
unlink (temppath);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* UNIX2DOS.C
|
||||
*
|
||||
* Convert lf's to crlf combinations in a file but keep it's original
|
||||
* date/time stamp.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef TRUE
|
||||
# define TRUE (1)
|
||||
# define FALSE (0)
|
||||
#endif
|
||||
|
||||
#define R_CNTRL "r"
|
||||
#define W_CNTRL "w"
|
||||
|
||||
|
||||
|
||||
struct stat s_buf;
|
||||
|
||||
int u2dos (char *path);
|
||||
|
||||
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *path;
|
||||
while (--argc>0)
|
||||
{
|
||||
if (stat (path=*++argv, &s_buf) != -1)
|
||||
{
|
||||
printf ("Unix2Dos: Cleaning file %s ...\n", path);
|
||||
if (u2dos (path))
|
||||
{
|
||||
fprintf (stderr, "Unix2Dos: Problems cleaning file %s\n", path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Unix2Dos: Can't stat '%s'\n", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int u2dos (char *path)
|
||||
{
|
||||
FILE *in, *out;
|
||||
int ch,
|
||||
rval = FALSE;
|
||||
char temppath [16];
|
||||
/* struct utimbuf { time_t actime, modtime; } ut_buf; */
|
||||
struct utimbuf ut_buf;
|
||||
|
||||
strcpy (temppath, "./clntmp");
|
||||
if ((in=fopen (path, R_CNTRL)) == (FILE *) 0)
|
||||
return TRUE;
|
||||
if ((out=fopen (temppath, W_CNTRL)) == (FILE *) 0)
|
||||
{
|
||||
fclose (in);
|
||||
return TRUE;
|
||||
}
|
||||
while ((ch = getc (in)) != EOF)
|
||||
if (((ch == '\012') && (putc ('\015', out) == EOF)) ||
|
||||
(putc (ch, out) == EOF) )
|
||||
{
|
||||
rval = TRUE;
|
||||
break;
|
||||
}
|
||||
if (fclose (in) == EOF)
|
||||
{
|
||||
rval = TRUE;
|
||||
}
|
||||
if (fclose (out) == EOF)
|
||||
{
|
||||
rval = TRUE;
|
||||
}
|
||||
ut_buf.actime = s_buf.st_atime;
|
||||
ut_buf.modtime = s_buf.st_mtime;
|
||||
if (utime (temppath, &ut_buf) == -1)
|
||||
rval = TRUE;
|
||||
if (unlink (path) == -1)
|
||||
rval = TRUE;
|
||||
if (rval)
|
||||
{
|
||||
unlink (temppath);
|
||||
return TRUE;
|
||||
}
|
||||
if (rename (temppath,path) == -1)
|
||||
{
|
||||
fprintf (stderr, "Unix2Dos: Problems renaming '%s' to '%s'\n", temppath, path);
|
||||
fprintf (stderr, " However, file '%s' remains\n", temppath);
|
||||
exit (1);
|
||||
}
|
||||
unlink (temppath);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user