summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Wolf2020-02-14 15:42:25 +0100
committerErik Wolf2020-02-14 15:45:41 +0100
commit0a9350514c2257eff9a44c8ebdd31dd5f99098b7 (patch)
treeb82c350784e8144d20f59a7a468da51d5adcd799
downloadaur-0a9350514c2257eff9a44c8ebdd31dd5f99098b7.tar.gz
Initial version based on https://github.com/LonnyGomes/hexcurse/commit/a7d60e8b65d5756a2aaf0d2223c929b67220f7a6
-rw-r--r--.SRCINFO17
-rw-r--r--PKGBUILD43
-rw-r--r--hexcurse_gccerrors.patch535
3 files changed, 595 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..c1c715f4412d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,17 @@
+pkgbase = hexcurse-git
+ pkgdesc = Versatile ncurses-based hex editor.
+ pkgver = v1.60.0.r6.ga7d60e8
+ pkgrel = 1
+ url = https://github.com/LonnyGomes/hexcurse
+ arch = i686
+ arch = x86_64
+ license = GPL
+ depends = ncurses
+ options = !makeflags
+ source = git+https://github.com/LonnyGomes/hexcurse
+ source = hexcurse_gccerrors.patch
+ md5sums = SKIP
+ md5sums = 0d1229aa298581c16493a26f25ff40f2
+
+pkgname = hexcurse-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..ac38098b79d2
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,43 @@
+# Maintainer: 3mb3dw0rk5 <3mb3dw0rk5 at gmail dot com>
+
+pkgname=hexcurse-git
+pkgver=v1.60.0.r6.ga7d60e8
+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=("git+https://github.com/LonnyGomes/hexcurse"
+ "hexcurse_gccerrors.patch")
+md5sums=('SKIP'
+ '0d1229aa298581c16493a26f25ff40f2')
+
+function pkgver() {
+ cd "$srcdir/${pkgname%-git}"
+ git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
+prepare() {
+ cd "$srcdir/${pkgname%-git}"
+ patch --forward --strip=1 --input="${srcdir}/hexcurse_gccerrors.patch"
+}
+
+build() {
+ cd "$srcdir/${pkgname%-git}"
+
+ autoreconf -f -i
+ ./configure \
+ --prefix=/usr \
+ --mandir=/usr/share/man
+
+ make
+}
+
+package() {
+ cd "$srcdir/${pkgname%-git}"
+
+ make DESTDIR="$pkgdir/" install
+}
diff --git a/hexcurse_gccerrors.patch b/hexcurse_gccerrors.patch
new file mode 100644
index 000000000000..7e76ee71453a
--- /dev/null
+++ b/hexcurse_gccerrors.patch
@@ -0,0 +1,535 @@
+diff --git a/src/acceptch.c b/src/acceptch.c
+index d57207b..2e61dc3 100644
+--- a/src/acceptch.c
++++ b/src/acceptch.c
+@@ -32,9 +32,9 @@ int SIZE_CH; /* global winch flag */
+ int wacceptch(WINS *win, off_t len)
+ {
+ intmax_t tmp_max;
+-
++
+ off_t count;
+- int col = 0, val, tmpval, /* counters, etc. */
++ int col = 0, val, tmpval, /* counters, etc. */
+ ch[17], /* holds search string*/
+ eol = (BASE * 3) - 1, /* end of line pos */
+ lastRow = 0, lastCol = 0, /* last row/col coords*/
+@@ -61,7 +61,7 @@ int wacceptch(WINS *win, off_t len)
+ SIZE_CH = FALSE; /* set winch to false */
+ Winds = win->hex; /* curr edit window */
+ maxlines = maxLines(len); /* lines in file */
+-
++
+ bool shouldExit = false;
+
+ /*createStack(stack);*/ /* init the stack */
+@@ -81,7 +81,7 @@ int wacceptch(WINS *win, off_t len)
+ wnoutrefresh(win->ascii);
+ doupdate();
+ }
+-
++
+ /* get keys til exit */
+ while(!shouldExit)
+ //while (!(save=quitProgram(isEmptyStack(stack),(key = wgetch(Winds)))))
+@@ -110,10 +110,10 @@ int wacceptch(WINS *win, off_t len)
+ if (!fpIN && (key != CTRL_AND('o')) && (key != KEY_F(3)) &&
+ (key != CTRL_AND('h')) && (key != KEY_F(1)))
+ continue;
+-
++
+
+ switch (key) { /* check keypress */
+-
++
+ /* if exit key... */
+ case CTRL_AND('q'):
+ case CTRL_AND('x'):
+@@ -144,7 +144,7 @@ int wacceptch(WINS *win, off_t len)
+
+ case KEY_UP: /* if UP... */
+ if (currentLine > 0) /* move up... */
+- {
++ {
+ currentLine--;
+ wmove(Winds, --row, col);
+ }
+@@ -154,8 +154,8 @@ int wacceptch(WINS *win, off_t len)
+ break;
+
+ case KEY_DOWN: /* if DOWN... */
+- if (cursorLoc(currentLine + 1, col, editHex,BASE) < len)
+- {
++ if (cursorLoc(currentLine + 1, col, editHex,BASE) < len)
++ {
+ if (currentLine < maxlines) /* move down... */
+ {
+ wmove(Winds, ++row, col);
+@@ -170,7 +170,7 @@ int wacceptch(WINS *win, off_t len)
+ case KEY_BACKSPACE:
+ case KEY_LEFT: /* if LEFT or BACK... */
+ if ((col == 0) && (currentLine != 0)) /* move up... */
+- {
++ {
+ currentLine--;
+ if (row == 0) /* scroll up... */
+ {
+@@ -192,9 +192,9 @@ int wacceptch(WINS *win, off_t len)
+ /* if key we want... */
+ if (isprint(key) && ((editHex && isxdigit(key)) || !editHex))
+ {
+- if ((cl=cursorLoc(currentLine, col, editHex,BASE))< len)
+- {
+-
++ if ((cl=cursorLoc(currentLine, col, editHex,BASE))< len)
++ {
++
+ /* if not in ll... */
+ if ((val = searchList(head, cl)) == -1)
+ {
+@@ -216,7 +216,7 @@ int wacceptch(WINS *win, off_t len)
+ else if (key >= 97 && key <= 102)
+ key -= 39;
+ key -= 48;
+-
++
+ if ((col % 3) == 0) /* compute byte val */
+ val = (key * 16) + (val % 16);
+ else if ((col % 3) == 1)
+@@ -227,7 +227,7 @@ int wacceptch(WINS *win, off_t len)
+
+ if (editHex) /* update ascii win */
+ {
+- wmove(win->ascii, row, (col/3));
++ wmove(win->ascii, row, (col/3));
+ wprintw(win->ascii, "%c", (USE_EBCDIC) ?EBCDIC[val]:
+ (isprint(val) ? val : 46));
+ wmove(win->hex, row, col);
+@@ -235,7 +235,7 @@ int wacceptch(WINS *win, off_t len)
+ }
+ else /* update hex win */
+ {
+- wmove(win->hex, row, (col*3));
++ wmove(win->hex, row, (col*3));
+ wprintw(win->hex, "%02X", val);
+ wmove(win->ascii, row, col);
+ wrefresh(win->hex);
+@@ -243,7 +243,7 @@ int wacceptch(WINS *win, off_t len)
+
+ wattrset(win->hex, A_NORMAL);
+ wattrset(win->ascii, A_NORMAL);
+-
++
+ /* edit list */
+ head = insertItem(head, cl, val);
+ /* calloc() is used because it NULLS out all returned memory */
+@@ -257,8 +257,8 @@ int wacceptch(WINS *win, off_t len)
+ case */
+
+ case KEY_RIGHT: /* if RIGHT... */
+- if (cursorLoc(currentLine, col, editHex, BASE) < len)
+- {
++ if (cursorLoc(currentLine, col, editHex, BASE) < len)
++ {
+ wmove(Winds, row, ++col); /* move right */
+ if (cursorLoc(currentLine, col, editHex,BASE) == len)
+ wmove(Winds, row, --col);
+@@ -338,7 +338,7 @@ int wacceptch(WINS *win, off_t len)
+
+ break;
+ }
+-
++
+ currentLine += MAXY;
+
+ if (currentLine > maxlines) /* adjust currentLine */
+@@ -347,10 +347,10 @@ int wacceptch(WINS *win, off_t len)
+ currentLine = 0;
+
+ val = currentLine - row; /* get val */
+- if (val < 0)
++ if (val < 0)
+ {
+ row = val = 0;
+- if (cursorLoc(currentLine, col, editHex,BASE) !=
++ if (cursorLoc(currentLine, col, editHex,BASE) !=
+ cursorLoc(row, col, editHex,BASE))
+ row = currentLine;
+ }
+@@ -372,7 +372,7 @@ int wacceptch(WINS *win, off_t len)
+ wmove(win->ascii, count, 0);
+ wclrtoeol(win->ascii);
+ }
+-
++
+ wmove(Winds, row, col); /* restore cursor */
+ wnoutrefresh(win->ascii);
+ wnoutrefresh(win->address);
+@@ -386,31 +386,31 @@ int wacceptch(WINS *win, off_t len)
+ wmove(win->ascii, 0, 0);
+ wmove(win->address, 0, 0);
+
+- for (count = 0; count <= MAXY && count <=
++ for (count = 0; count <= MAXY && count <=
+ maxLines(maxLoc(fpIN)); count++)
+ outline(fpIN, count);
+
+- mvwprintw(windows->cur_address, 0, 0, "%0*d", MIN_ADDR_LENGTH, 0);
++ mvwprintw(windows->cur_address, 0, 0, "%0*d", MIN_ADDR_LENGTH, 0);
+ wmove((editHex) ? win->hex : win->ascii, 0, 0);
+ wnoutrefresh(win->ascii);
+ wnoutrefresh(win->address);
+ wnoutrefresh(win->hex);
+ break;
+-
++
+ case CTRL_AND('b'):
+ case KEY_END: /* goto end of file */
+ if (cursorLoc(currentLine, col, editHex, BASE)==maxLoc(fpIN)-1)
+ break; /* alread at oef */
+-
++
+ /* if there's more than 1 screen, move to the last screenfull */
+ if ((maxlines - currentLine) >= MAXY) /*if more than 1 scrn */
+- currentLine = gotoLine(fpIN,
++ currentLine = gotoLine(fpIN,
+ cursorLoc(currentLine, col, editHex, BASE),
+ maxLoc(fpIN)-(BASE*((len%BASE)?MAXY:MAXY+1)),
+ maxlines, Winds);
+
+ getyx(Winds, row, col); /* move to EOF */
+- currentLine = gotoLine(fpIN,
++ currentLine = gotoLine(fpIN,
+ cursorLoc(currentLine, col, editHex, BASE),
+ maxLoc(fpIN)-1, maxlines, Winds);
+
+@@ -429,7 +429,7 @@ int wacceptch(WINS *win, off_t len)
+ {
+ MIN_ADDR_LENGTH = getMinimumAddressLength(maxLoc(fpIN));
+ curVal = getLocVal(0);
+- }
++ }
+ return TRUE; /* TRUE if worked */
+ }
+ break;
+@@ -443,7 +443,7 @@ int wacceptch(WINS *win, off_t len)
+ case KEY_F(5):
+ /* SeachStr stores the last searched string into the format *\
+ \* "(XXXXXXX...)" with 10 being the max chars shown */
+- if (!fpINfilename || !strcmp(fpINfilename, ""))
++ if (!fpINfilename || !strcmp(fpINfilename, ""))
+ { /* output prompt */
+ wmove(win->hex_outline, LINES-1, 1);
+ wclrtoeol(win->hex_outline);
+@@ -452,14 +452,14 @@ int wacceptch(WINS *win, off_t len)
+ wrefresh(win->hex_outline);
+ break;
+ }
+-
++
+
+ if (temp != NULL)
+ {
+ bzero(SearchStr, 13);
+ strcat(SearchStr, "(");
+ if (strlen(temp) <= 10)
+- strncat(SearchStr, temp, strlen(temp));
++ strncat(SearchStr, temp, 13 - 2);
+ else
+ {
+ strncat(SearchStr, temp, 7);
+@@ -470,15 +470,15 @@ int wacceptch(WINS *win, off_t len)
+
+ wmove(win->hex_outline, LINES - 1, 19); /* output prompt */
+ wclrtoeol(win->hex_outline);
+- mvwprintw(win->hex_outline, LINES - 1, 1,
+- "Enter %s value %s: ",
++ mvwprintw(win->hex_outline, LINES - 1, 1,
++ "Enter %s value %s: ",
+ (editHex) ? "hex" : "ascii", SearchStr);
+
+ echo(); /* echo chars */
+ /*wscanw(win->hex_outline, "%s", temp);*/
+ /* the third parameter positions the cursor in the correct loc*/
+- tmpstr = inputLine(win->hex_outline, LINES - 1,
+- ((editHex) ? 21 : 23) +
++ tmpstr = inputLine(win->hex_outline, LINES - 1,
++ ((editHex) ? 21 : 23) +
+ ((strlen(temp) > 10) ? 10 : strlen(temp)));
+ noecho();
+
+@@ -498,8 +498,7 @@ 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));
++ strncpy(temp, tmpstr, 80);
+ }
+
+ val = 0;
+@@ -509,17 +508,17 @@ int wacceptch(WINS *win, off_t len)
+ ch[count] = temp[count];
+ else
+ /* if hex digit */
+- if (isxdigit(key = temp[count]))
++ if (isxdigit(key = temp[count]))
+ {
+ if (key >= 65 && key <= 70) /* get correct val */
+ key -= 7;
+ else if (key >= 97 && key <= 102)
+ key -= 39;
+ key -= 48;
+-
++
+ if ((count % 2) == 0) /* compute byte val */
+ tmp = (key * 16);
+- else
++ else
+ ch[(count - 1) / 2] = tmp + key;
+ }
+ else /* if not hex, bad! */
+@@ -539,7 +538,7 @@ int wacceptch(WINS *win, off_t len)
+ restoreBorder(win); /* restore border */
+ wrefresh(win->hex_outline);
+ }
+- else
++ else
+ {
+ getyx(Winds, row, col);
+ /* goto found loc */
+@@ -580,11 +579,11 @@ int wacceptch(WINS *win, off_t len)
+ case KEY_F(4): /* if F4 or ^g... */
+ wmove(win->hex_outline, LINES-1, 21); /* output prompt */
+ wclrtoeol(win->hex_outline);
+- mvwprintw(win->hex_outline, LINES - 1, 1,
++ mvwprintw(win->hex_outline, LINES - 1, 1,
+ "Enter %s location: ", (printHex) ? "HEX":"decimal");
+
+ echo(); /* echo chars */
+- gotoLocStr = inputLine(win->hex_outline, LINES - 1,
++ gotoLocStr = inputLine(win->hex_outline, LINES - 1,
+ (printHex) ? 21 : 25);
+ if (gotoLocStr[0] == 27) /* escape was hit */
+ { /* restore & return */
+@@ -592,22 +591,22 @@ int wacceptch(WINS *win, off_t len)
+ wrefresh(win->hex_outline);
+ break;
+ }
+-
++
+ /* convert str to number */
+ if (sscanf(gotoLocStr, printHex ? "%jX" : "%jd", &tmp_max) != 1)
+ tmp_max = 0;
+-
++
+ gotoLoc = (off_t)tmp_max;
+ /*wscanw(win->hex_outline, (printHex) ? "%X":"%d",&gotoLoc); */
+ noecho(); /* disable echoing */
+
+ if ((gotoLoc < 0) || (gotoLoc > len-1))
+- {
++ {
+ popupWin("Invalid location!", -1);
+ restoreBorder(win); /* restore border */
+ wrefresh(win->hex_outline);
+ }
+- else
++ else
+ {
+ getyx(Winds, row, col);
+ /* goto found loc */
+@@ -623,8 +622,8 @@ int wacceptch(WINS *win, off_t len)
+ getyx(Winds, row, col); /* current location */
+ wattrset((editHex) ? win->ascii : win->hex, A_NORMAL);
+ mvwprintw((editHex) ? win->ascii : win->hex, row,
+- (editHex) ? col/3 : col*3,
+- (editHex) ? "%c": "%02X",
++ (editHex) ? col/3 : col*3,
++ (editHex) ? "%c": "%02X",
+ (editHex) ? ((isprint(curVal))?curVal : '.'):curVal);
+ wnoutrefresh((editHex) ? win->ascii : win->hex);
+ if (editHex) /* already in hex win */
+@@ -638,7 +637,7 @@ int wacceptch(WINS *win, off_t len)
+ {
+ Winds = win->hex; /* change to hex win */
+ eol = (BASE * 3) - 1;
+- wmove(Winds, row, (col*3));
++ wmove(Winds, row, (col*3));
+ slk_set(7, "Hex Edit", 1);
+ }
+
+@@ -647,14 +646,14 @@ int wacceptch(WINS *win, off_t len)
+
+ getyx(Winds, row, col); /* current location */
+ /* re-bold char if the value over the cursor is modified */
+- if (inHexList(cursorLoc(currentLine, col, editHex, BASE)))
++ if (inHexList(cursorLoc(currentLine, col, editHex, BASE)))
+ {
+ wattron((editHex) ? win->hex : win->ascii, A_BOLD);
+- mvwprintw((editHex) ? win->hex : win->ascii , row, col,
+- (editHex) ? "%02X" : "%c",
++ mvwprintw((editHex) ? win->hex : win->ascii , row, col,
++ (editHex) ? "%02X" : "%c",
+ (editHex) ?curVal:((isprint(curVal))?curVal:'.'));
+ wattrset((editHex) ? win->hex : win->ascii, A_NORMAL);
+- wmove(Winds, row, col);
++ wmove(Winds, row, col);
+ wnoutrefresh((editHex) ? win->ascii : win->hex);
+ }
+ break;
+@@ -684,49 +683,49 @@ int wacceptch(WINS *win, off_t len)
+ head = deleteNode(head,cl);
+
+
+- currentLine = gotoLine(fpIN,
++ currentLine = gotoLine(fpIN,
+ cursorLoc(currentLine, col, editHex,BASE),
+ cl, maxlines, Winds);
+ /*
+ if (stack != NULL)
+- {
++ {
+ mvwprintw(win->hex_outline,0,20," ");
+ mvwprintw(win->hex_outline,0,10,
+ "value:%02X location:%d ",
+- stack->currentLoc,
++ stack->currentLoc,
+ currentLine);
+ }
+ */
+-
++
+ getyx(Winds, row, col);
+
+ if ((searchList(head, cl)) != -1)
+- {
++ {
+ wattron(win->hex, A_BOLD);
+ wattron(win->ascii, A_BOLD);
+ }
+ if (editHex)
+ {
+- wmove(win->ascii, row, (col/3));
++ wmove(win->ascii, row, (col/3));
+ wprintw(win->ascii, "%c", (USE_EBCDIC) ? EBCDIC[val] :
+ (isprint(val) ? val : 46));
+ wmove(win->hex, row, col);
+ wrefresh(win->ascii);
+
+ wprintw(win->hex, "%02X", val);
+- wmove(win->hex, row, col);
++ wmove(win->hex, row, col);
+ wrefresh(win->hex);
+ }
+ else
+ {
+- wmove(win->hex, row, (col*3));
++ wmove(win->hex, row, (col*3));
+ wprintw(win->hex, "%02X", val);
+ wmove(win->ascii, row, col);
+ wrefresh(win->hex);
+
+ wprintw(win->ascii, "%c", (USE_EBCDIC) ? EBCDIC[val] :
+ (isprint(val) ? val : 46));
+- wmove(win->ascii, row, col);
++ wmove(win->ascii, row, col);
+ wrefresh(win->ascii);
+ }
+ wattrset(win->hex, A_NORMAL);
+@@ -758,7 +757,7 @@ int wacceptch(WINS *win, off_t len)
+ else if ((lastRow == 0) && (lastCol == 0) && (key == KEY_LEFT) &&
+ (currentLine != 0))
+ lastRow++;
+-
++
+
+ if (key != KEY_TAB) /* if tab, don't do it*/
+ { /* unhighlight the previous character if tab was not pressed */
+@@ -767,9 +766,9 @@ int wacceptch(WINS *win, off_t len)
+ wattron((editHex) ? win->ascii : win->hex,
+ (inHexList(cursorLoc(lastLine, lastCol, editHex, BASE))) ?
+ A_BOLD : A_NORMAL);
+- mvwprintw((editHex) ? win->ascii : win->hex, lastRow,
+- (editHex) ? lastCol/3 : lastCol*3,
+- (editHex) ? "%c" : "%02X",
++ mvwprintw((editHex) ? win->ascii : win->hex, lastRow,
++ (editHex) ? lastCol/3 : lastCol*3,
++ (editHex) ? "%c" : "%02X",
+ (editHex) ? (isprint(curVal)) ? curVal : '.': curVal);
+ wmove(Winds, row, col);
+ wattrset((editHex) ? win->ascii : win->hex, A_NORMAL);
+@@ -782,10 +781,10 @@ int wacceptch(WINS *win, off_t len)
+
+ curVal = getLocVal(cursorLoc(currentLine, col, editHex, BASE));
+
+- mvwprintw((editHex) ? win->ascii : win->hex, row,
+- (editHex) ? col/3 : col*3,
+- (editHex) ? "%c" : "%02X",
+- (editHex) ? (isprint(curVal)) ? curVal : '.' : curVal);
++ mvwprintw((editHex) ? win->ascii : win->hex, row,
++ (editHex) ? col/3 : col*3,
++ (editHex) ? "%c" : "%02X",
++ (editHex) ? (isprint(curVal)) ? curVal : '.' : curVal);
+ wattrset((editHex) ? win->ascii : win->hex, A_NORMAL);
+ wnoutrefresh((editHex) ? win->ascii : win->hex);
+ }
+@@ -795,11 +794,11 @@ int wacceptch(WINS *win, off_t len)
+ /* print cur location */
+ mvwprintw(win->cur_address, 0, 0, (printHex) ? "%0*jX":"%0*jd",
+ MIN_ADDR_LENGTH, (intmax_t)cursorLoc(currentLine, col, editHex,BASE));
+-
++
+ wnoutrefresh(win->cur_address); /* refresh outline */
+-
++
+ scrollbar(win, cursorLoc(currentLine, col, editHex,BASE), maxlines);
+-
++
+ wmove(Winds, row, col); /* restore cursor */
+ doupdate(); /* update visual */
+ }
+@@ -807,7 +806,7 @@ int wacceptch(WINS *win, off_t len)
+ free(temp);
+ while (stack != NULL)
+ popStack(&stack);
+-
++
+ return 0; /* return */
+ }
+
+@@ -842,14 +841,14 @@ char *inputLine(WINDOW *win, int line, int col)
+
+ wmove(win, line, col);
+
+- for (x = 0; (c = wgetch(win)) != 10; x++)
++ for (x = 0; (c = wgetch(win)) != 10; x++)
+ {
+ if (x > 0 && x >= allocated)
+ {
+ ch = (char*)realloc(ch, x + 1);
+ allocated = x + 1;
+ }
+-
++
+ wclrtoeol(win); /* clear line */
+ if (c == '\b' || c == 127) /* get backspace */
+ {
+@@ -866,7 +865,7 @@ char *inputLine(WINDOW *win, int line, int col)
+ else if (c == 27) /* if the escape key */
+ { /* is pressed, return */
+ ch[0] = 27; /* setting ch to 0xff */
+- return ch;
++ return ch;
+ }
+ else /* if anything else */
+ {
+@@ -874,7 +873,7 @@ char *inputLine(WINDOW *win, int line, int col)
+ x--;
+ }
+
+- if (x < 0)
++ if (x < 0)
+ {
+ wmove(win, line, col); /* move cursor */
+ x = -1;