summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorUffe Jakobsen2022-07-20 23:17:31 +0200
committerUffe Jakobsen2022-07-20 23:17:31 +0200
commit9edd83ef61fb8c824997f8c8883e83c036e004d6 (patch)
tree0da6f188281daac5ed19187090a9774652687fed
parent81096f7599b5dee541126fb223f22f5f61f2220c (diff)
downloadaur-hexcurse.tar.gz
Add more patches to build hexcurse with modern compilers...
-rw-r--r--PKGBUILD30
-rw-r--r--boundry.patch45
-rw-r--r--file_ptr.patch29
-rw-r--r--ncurses.patch22
4 files changed, 113 insertions, 13 deletions
diff --git a/PKGBUILD b/PKGBUILD
index fea158be6725..3a2139efd450 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,4 +1,5 @@
-# Maintainer: SpepS <dreamspepser at yahoo dot it>
+# Maintainer: uffe < uffe at uffe dat org >
+# Contributor: SpepS <dreamspepser at yahoo dot it>
# Contributor: eric <eric@archlinux.org>
pkgname=hexcurse
@@ -6,37 +7,40 @@ pkgver=1.60.0
pkgrel=1
pkgdesc="Versatile ncurses-based hex editor."
arch=('i686' 'x86_64')
-#url="http://directory.fsf.org/project/HexCurse/"
url="https://github.com/LonnyGomes/hexcurse"
license=('GPL')
depends=('ncurses')
options=('!makeflags')
-source=("$pkgname-$pkgver.tgz::https://github.com/LonnyGomes/hexcurse/archive/v$pkgver.tar.gz")
-#source=("http://www.sourcefiles.org/Editors/Hex/$pkgname-$pkgver.tar.gz")
-#source=("http://gd.tuwien.ac.at/opsys/linux/gentoo/distfiles/$pkgname-$pkgver.tar.gz")
-#source=("https://github.com/LonnyGomes/hexcurse/archive/hexcurse-$pkgver.tar.gz")
+source=("${pkgname}-${pkgver}.tgz::https://github.com/LonnyGomes/hexcurse/archive/v${pkgver}.tar.gz")
md5sums=('cb24b564bea21a615a5c6a2ee30d6cad')
prepare() {
- cd "$srcdir/$pkgname-$pkgver"
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
# gcc does not like clever people
sed -i 's|buffer, 1,|NULL, 0,|' src/hexcurse.c
sed -i 's|char buffer\[1\];|//&|' src/hexcurse.c
sed -i 's|2*MAXY);|&\nbreak;|' src/acceptch.c
+
+ patch -p0 < ${startdir}/file_ptr.patch
+ patch -p0 < ${startdir}/ncurses.patch
+ patch -p0 < ${startdir}/boundry.patch
}
build() {
- cd "$srcdir/$pkgname-$pkgver"
+ cd "${srcdir}/${pkgname}-${pkgver}"
- ./configure \
- --prefix=/usr \
- --mandir=/usr/share/man
+ ./configure --prefix=/usr --mandir=/usr/share/man
make
}
package() {
- cd "$srcdir/$pkgname-$pkgver"
+ cd "${srcdir}/${pkgname}-${pkgver}"
- make DESTDIR="$pkgdir/" install
+ make DESTDIR="${pkgdir}/" install
}
+
+#
+# EOF
+#
diff --git a/boundry.patch b/boundry.patch
new file mode 100644
index 000000000000..9388f2e92f49
--- /dev/null
+++ b/boundry.patch
@@ -0,0 +1,45 @@
+diff --git src/acceptch.c src/acceptch.c
+index d57207b..6edf992 100644
+--- src/acceptch.c
++++ src/acceptch.c
+@@ -66,7 +66,8 @@ int wacceptch(WINS *win, off_t len)
+
+ /*createStack(stack);*/ /* init the stack */
+ stack = NULL;
+- temp = (char *)calloc(81, sizeof(char));
++ const int temp_size = 81;
++ temp = (char *)calloc(temp_size, sizeof(char));
+
+ if (fpIN) /* if file opened then*/
+ { /* highlight 0,0 loc */
+@@ -456,10 +457,10 @@ int wacceptch(WINS *win, off_t len)
+
+ if (temp != NULL)
+ {
+- bzero(SearchStr, 13);
++ bzero(SearchStr, sizeof(SearchStr));
+ strcat(SearchStr, "(");
+ if (strlen(temp) <= 10)
+- strncat(SearchStr, temp, strlen(temp));
++ strncat(SearchStr, temp, sizeof(SearchStr)-1);
+ else
+ {
+ strncat(SearchStr, temp, 7);
+@@ -497,14 +498,13 @@ int wacceptch(WINS *win, off_t len)
+
+ if (tmpstr[0] != '\0' ) /* enter was hit so */
+ { /* don't change temp */
+- bzero(temp, 81);
+- strncpy(temp, tmpstr, (strlen(tmpstr) > 80)
+- ? 80 : strlen(tmpstr));
++ bzero(temp, temp_size);
++ strncpy(temp, tmpstr, temp_size-1);
+ }
+
+ val = 0;
+ /* parse out input */
+- for (count = 0; temp[count] != 0 && count < 80; count++)
++ for (count = 0; temp[count] != 0 && count < temp_size-1; count++)
+ if (!editHex)
+ ch[count] = temp[count];
+ else
diff --git a/file_ptr.patch b/file_ptr.patch
new file mode 100644
index 000000000000..e89742342f2a
--- /dev/null
+++ b/file_ptr.patch
@@ -0,0 +1,29 @@
+diff --git include/hex.h include/hex.h
+index 57845c0..e1420a1 100644
+--- include/hex.h
++++ include/hex.h
+@@ -126,7 +126,7 @@ extern bool color_enabled;
+ #define max(a,b) ((a) >(b) ? (a) : (b))
+ #endif
+
+-FILE *fpIN; /* global file ptr */
++extern FILE *fpIN; /* global file ptr */
+
+ /* function prototypes */
+
+diff --git src/hexcurse.c src/hexcurse.c
+index e723ddc..5a60b1a 100644
+--- src/hexcurse.c
++++ src/hexcurse.c
+@@ -22,8 +22,11 @@
+ * *
+ \******************************************************************************/
+
++
+ #include "hex.h" /* custom header */
+
++FILE* fpIN;
++
+ /*#define DEBUG_LLIST*/
+ /*#define DEBUG_GOTO*/
+
diff --git a/ncurses.patch b/ncurses.patch
new file mode 100644
index 000000000000..eb7b09e13753
--- /dev/null
+++ b/ncurses.patch
@@ -0,0 +1,22 @@
+diff --git src/screen.c src/screen.c
+index 2cef657..f45fa8b 100644
+--- src/screen.c
++++ src/screen.c
+@@ -451,7 +451,7 @@ void popupWin(char *msg, int time)
+
+ keypad(tmpwin, TRUE);
+
+- mvwprintw(tmpwin,2,3, msg); /* output mesg */
++ mvwprintw(tmpwin, 2, 3, "%s", msg); /* output mesg */
+ wmove(tmpwin,2,len+4);
+ wrefresh(tmpwin);
+
+@@ -492,7 +492,7 @@ short int questionWin(char *msg)
+
+ tmpwin = drawbox(y, x, 5, len + 6); /* create window */
+
+- mvwprintw(tmpwin,2,3, msg);
++ mvwprintw(tmpwin, 2, 3, "%s", msg);
+ wmove(tmpwin,2,len+4);
+ wrefresh(tmpwin);
+