mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-18 22:06:04 +01:00
development/hexcurse: Added (ncurses-based hex editor).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
This commit is contained in:
parent
8a89006a6e
commit
dc346489b4
5 changed files with 193 additions and 0 deletions
7
development/hexcurse/README
Normal file
7
development/hexcurse/README
Normal file
|
@ -0,0 +1,7 @@
|
|||
hexcurse (ncurses-based hex editor)
|
||||
|
||||
Hexcurse is a curses-based hex editing utility that can open, edit,
|
||||
and save files, editing both the hexadecimal and decimal values. It
|
||||
currently supports searching, hex and decimal address output, jumping
|
||||
to specified locations in the file, "undo" capabilities, "bolded"
|
||||
modifications, EBCDIC mode, and quick keyboard shortcuts to commands.
|
88
development/hexcurse/hexcurse.SlackBuild
Normal file
88
development/hexcurse/hexcurse.SlackBuild
Normal file
|
@ -0,0 +1,88 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Slackware build script for hexcurse
|
||||
|
||||
# Written by B. Watson (yalhcru@gmail.com)
|
||||
|
||||
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
||||
|
||||
PRGNAM=hexcurse
|
||||
VERSION=${VERSION:-1.60.0}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
case "$( uname -m )" in
|
||||
i?86) ARCH=i586 ;;
|
||||
arm*) ARCH=arm ;;
|
||||
*) ARCH=$( uname -m ) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
CWD=$(pwd)
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
if [ "$ARCH" = "i586" ]; then
|
||||
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "i686" ]; then
|
||||
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
SLKCFLAGS="-O2 -fPIC"
|
||||
LIBDIRSUFFIX="64"
|
||||
else
|
||||
SLKCFLAGS="-O2"
|
||||
LIBDIRSUFFIX=""
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
rm -rf $PRGNAM-$VERSION
|
||||
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
||||
cd $PRGNAM-$VERSION
|
||||
chown -R root:root .
|
||||
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
|
||||
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
|
||||
|
||||
# Include some fixes from upstream git. The main one is to have hexcurse
|
||||
# exit with a usage message if called with no filename. Without this,
|
||||
# it will show its UI, but it's useless with no data to edit, and the
|
||||
# 'quit' keystrokes don't work (very annoying, have to kill from another
|
||||
# terminal).
|
||||
GITREV="${GITREV:-a7d60e8b}"
|
||||
PATCH=v$VERSION-$GITREV.diff
|
||||
[ -e $CWD/$PATCH ] && patch -p1 < $CWD/$PATCH
|
||||
|
||||
CFLAGS="$SLKCFLAGS" \
|
||||
CXXFLAGS="$SLKCFLAGS" \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var \
|
||||
--mandir=/usr/man \
|
||||
--docdir=/usr/doc/$PRGNAM-$VERSION \
|
||||
--build=$ARCH-slackware-linux
|
||||
|
||||
make
|
||||
make install-strip DESTDIR=$PKG
|
||||
gzip -9 $PKG/usr/man/man1/$PRGNAM.1
|
||||
|
||||
# Will the real license please stand up? COPYING is the GPLv2, LICENSE.txt
|
||||
# is the LGPLv2. The READMEs don't say, so I include both in the tarball.
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a AUTHORS COPYING ChangeLog LICENSE.txt NEWS README README.md \
|
||||
$PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|
10
development/hexcurse/hexcurse.info
Normal file
10
development/hexcurse/hexcurse.info
Normal file
|
@ -0,0 +1,10 @@
|
|||
PRGNAM="hexcurse"
|
||||
VERSION="1.60.0"
|
||||
HOMEPAGE="https://github.com/LonnyGomes/hexcurse"
|
||||
DOWNLOAD="https://github.com/LonnyGomes/hexcurse/archive/v1.60.0/hexcurse-1.60.0.tar.gz"
|
||||
MD5SUM="cb24b564bea21a615a5c6a2ee30d6cad"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES=""
|
||||
MAINTAINER="B. Watson"
|
||||
EMAIL="yalhcru@gmail.com"
|
19
development/hexcurse/slack-desc
Normal file
19
development/hexcurse/slack-desc
Normal file
|
@ -0,0 +1,19 @@
|
|||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description.
|
||||
# Line up the first '|' above the ':' following the base package name, and
|
||||
# the '|' on the right side marks the last column you can put a character in.
|
||||
# You must make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
hexcurse: hexcurse (ncurses-based hex editor)
|
||||
hexcurse:
|
||||
hexcurse: Hexcurse is a curses-based hex editing utility that can open, edit,
|
||||
hexcurse: and save files, editing both the hexadecimal and decimal values. It
|
||||
hexcurse: currently supports searching, hex and decimal address output, jumping
|
||||
hexcurse: to specified locations in the file, "undo" capabilities, "bolded"
|
||||
hexcurse: modifications, EBCDIC mode, and quick keyboard shortcuts to commands.
|
||||
hexcurse:
|
||||
hexcurse:
|
||||
hexcurse:
|
||||
hexcurse:
|
69
development/hexcurse/v1.60.0-a7d60e8b.diff
Normal file
69
development/hexcurse/v1.60.0-a7d60e8b.diff
Normal file
|
@ -0,0 +1,69 @@
|
|||
diff --git a/README.md b/README.md
|
||||
index 3ead7a7..bba4f89 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -9,7 +9,7 @@ Bug reports: https://github.com/LonnyGomes/hexcurse/issues
|
||||
|
||||
Description
|
||||
-----------
|
||||
-Hexcurse is a curses-base hex editing utility that can open, edit, and save files, editing both the hexadecimal and decimal values.
|
||||
+Hexcurse is a curses-based hex editing utility that can open, edit, and save files, editing both the hexadecimal and decimal values.
|
||||
|
||||
It was written by [Lonny Gomes](https://twitter.com/lonnygomes) and [James Stephenson](https://plus.google.com/u/0/103174459258175070784/about) but we haven't maintained it for some time. We recently saw an old tarball of the code floating around the net and thought it would be good to start maintaining the codebase again.
|
||||
|
||||
@@ -33,9 +33,9 @@ Usage
|
||||
|
||||
usage: hexcurse [-?|help] [-a] [-r rnum] [-o outputfile] [[-i] infile]
|
||||
|
||||
- -a Output addresses in decimal format initially
|
||||
- -e Output characters in EBCDIC format rather than ASCII
|
||||
- -r rnum Resize the display to "rnum" bytes wide
|
||||
+ -a Output addresses in decimal format initially
|
||||
+ -e Output characters in EBCDIC format rather than ASCII
|
||||
+ -r rnum Resize the display to "rnum" bytes wide
|
||||
-o outfile Write output to outfile by default
|
||||
-? | -help Display usage and version of hexcurse program
|
||||
[-i] infile Read from data from infile (-i required if not last argument)
|
||||
diff --git a/src/acceptch.c b/src/acceptch.c
|
||||
index 1580645..d57207b 100644
|
||||
--- a/src/acceptch.c
|
||||
+++ b/src/acceptch.c
|
||||
@@ -297,6 +297,7 @@ int wacceptch(WINS *win, off_t len)
|
||||
}
|
||||
else
|
||||
currentLine -= (2*MAXY);
|
||||
+ /* fall through */
|
||||
|
||||
case CTRL_AND('d'):
|
||||
case KEY_PGDN: /* if KEY_PGDN... */
|
||||
diff --git a/src/hexcurse.c b/src/hexcurse.c
|
||||
index 9a275ee..e723ddc 100644
|
||||
--- a/src/hexcurse.c
|
||||
+++ b/src/hexcurse.c
|
||||
@@ -217,9 +217,13 @@ off_t parseArgs(int argc, char *argv[])
|
||||
fpINfilename = strdup(argv[0]);
|
||||
}
|
||||
|
||||
- if (fpINfilename && strcmp(fpINfilename, ""))
|
||||
+ if (fpINfilename == NULL) {
|
||||
+ print_usage();
|
||||
+ exit(-1);
|
||||
+ } else if (fpINfilename && strcmp(fpINfilename, "")) {
|
||||
if ((fpIN = fopen(fpINfilename, "r")) == NULL)
|
||||
exit_err("Could not open file");
|
||||
+ }
|
||||
|
||||
return ((fpIN != NULL) ? maxLoc(fpIN):0); /* return file length */
|
||||
}
|
||||
@@ -231,10 +235,9 @@ off_t parseArgs(int argc, char *argv[])
|
||||
\********************************************************/
|
||||
int getMinimumAddressLength(off_t len)
|
||||
{
|
||||
- char buffer[1];
|
||||
int min_address_length;
|
||||
|
||||
- min_address_length = snprintf(buffer, 1, "%jd", (intmax_t)len);
|
||||
+ min_address_length = snprintf(NULL, 0, "%jd", (intmax_t)len);
|
||||
|
||||
/* At least 8 characters wide */
|
||||
return min_address_length > 8 ? min_address_length : 8;
|
Loading…
Reference in a new issue