1
0
Fork 0
mirror of https://github.com/vbatts/bvi.git synced 2025-07-01 16:18:34 +00:00

bvi-1.4.2.src.tar.gz

4bba16c2b496963a9b939336c0abcc8d488664492080ae43a86da18cf4ce94f2  bvi-1.4.2.src.tar.gz

https://bvi.sourceforge.net/download.html
This commit is contained in:
Gerhard Bürgmann 2023-03-07 00:00:00 +00:00 committed by Vincent Batts
parent 40e8e886bc
commit 75fc14b579
24 changed files with 2482 additions and 1761 deletions

19
CHANGES
View file

@ -1,3 +1,22 @@
New in release 1.4.2
====================
This release is dedicated to Sven Guckes (*1967-04-06 +2022-02-20).
Sven was an enthusiastic Linux explainer, his particular passion was the console tools.
I met Sven a couple of times. He always showed interest in the further development of
the bvi and liked to discuss new ideas.
R.I.P. Sven
* :wq bug fixed
* Error-message if input no terminal
* Mixed licenses (SF bug #10)
* Segmentation fault occurs on undo (SF bug #11)
* Segmentation fault occurs on substitution in 32-bit systems (SF bug #12)
* ncursesw support
* Handling inputs larger than 2^31 bytes (SF bug #13)
* Some incorrect function prototypes in ANSI mode fixed (SF bug #14)
* Minor fixes
New in release 1.4.1 New in release 1.4.1
==================== ====================

View file

@ -22,6 +22,10 @@ Josef Hinteregger <joehtg@joehtg.co.at> ZZ write bug, lfs
Richard Yao <ryao@gentoo.org> Buffer overflow at terminals > 255, ncurses with tinfo, configure fixed Richard Yao <ryao@gentoo.org> Buffer overflow at terminals > 255, ncurses with tinfo, configure fixed
<elo3456@sbcglobal.net> ~ operator dumps core <elo3456@sbcglobal.net> ~ operator dumps core
Dave Keaton <davek@gmail.com> ASCII_DEL patch Dave Keaton <davek@gmail.com> ASCII_DEL patch
Udo Hertrich-Jeromin <udo.hertrich-jeromin@tuwien.ac.at> ncursesw for tinycorelinux
Takashi Yano Segmentation fault occurs on undo, Segmentation fault occurs on substitution in 32-bit systems
Dominik Köppl <dkppl@dkppl.de> Handling inputs larger than 2^31 bytes
Christopher Head Some incorrect function prototypes in ANSI mode
Packages: Packages:

View file

@ -6,7 +6,7 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the # "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile. # actual Makefile.
# #
# Copyright (c) 1996-2019 by Gerhard Buergmann # Copyright (c) 1996-2022 by Gerhard Buergmann
# gerhard@puon.at # gerhard@puon.at
# #
# 1996-01-18 V 1.0.0 # 1996-01-18 V 1.0.0
@ -18,6 +18,7 @@
# 2003-07-03 V 1.3.2 # 2003-07-03 V 1.3.2
# 2014-10-01 V 1.4.0 # 2014-10-01 V 1.4.0
# 2019-01-30 V 1.4.1 # 2019-01-30 V 1.4.1
# 2022-02-08 V 1.4.2
# #
############################################### ###############################################
@ -55,7 +56,7 @@ all: bvi bmore
bvi: $(OBJS) $(HEADER) bvi: $(OBJS) $(HEADER)
$(CC) $(LDFLAGS) -o bvi $(OBJS) $(LIBS) $(CC) $(LDFLAGS) -o bvi $(OBJS) $(LIBS)
bmore: $(BMOBJ) bmore: $(BMOBJ) bmore.h
$(CC) $(LDFLAGS) -o bmore $(BMOBJ) $(LIBS) $(CC) $(LDFLAGS) -o bmore $(BMOBJ) $(LIBS)
%.o: %.c $(INCLUDES) %.o: %.c $(INCLUDES)

6
README
View file

@ -1,6 +1,6 @@
BVI - Binary visual editor BVI - Binary visual editor
========================== ==========================
http://bvi.sourceforge.net/ https/bvi.sourceforge.net/
This editor for binary files was written by Gerhard Buergmann This editor for binary files was written by Gerhard Buergmann
and is distributed under the GPL (GNU Public License). and is distributed under the GPL (GNU Public License).
@ -13,8 +13,8 @@ How to compile
https://www.cyberciti.biz/faq/linux-install-ncurses-library-headers-on-debian-ubuntu-centos-fedora/ https://www.cyberciti.biz/faq/linux-install-ncurses-library-headers-on-debian-ubuntu-centos-fedora/
gunzip -c bvi-1.4.1.src.tar.gz | tar xvf - gunzip -c bvi-1.4.2.src.tar.gz | tar xvf -
cd bvi-1.4.1 cd bvi-1.4.2
./configure ./configure
make make
make install make install

View file

@ -4,6 +4,8 @@
#undef HAVE_CURSES_H #undef HAVE_CURSES_H
#undef HAVE_NCURSESW_CURSES_H
#undef NO_SYSERRL #undef NO_SYSERRL
#undef NEED_PUTC_CHAR #undef NEED_PUTC_CHAR

View file

@ -1,4 +1,4 @@
.TH BMORE 1 "30 Jan 2019" .TH BMORE 1 "8 Feb 2022"
.SH NAME .SH NAME
bmore \- browse through a binary file bmore \- browse through a binary file
.SH SYNOPSIS .SH SYNOPSIS

View file

@ -8,8 +8,9 @@
* 2004-01-09 V 1.3.2 * 2004-01-09 V 1.3.2
* 2013-08-23 V 1.4.0 * 2013-08-23 V 1.4.0
* 2019-01-22 V 1.4.1 * 2019-01-22 V 1.4.1
* 2023-03-06 V 1.4.2
* *
* Copyright 1990-2019 by Gerhard Buergmann * Copyright 1990-2023 by Gerhard Buergmann
* gerhard@puon.at * gerhard@puon.at
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
@ -49,7 +50,7 @@
#include "bmore.h" #include "bmore.h"
char *copyright = "GPL (C) 1990-2019 by Gerhard Buergmann"; char *copyright = "GPL (C) 1990-2022 by Gerhard Buergmann";
int maxx, maxy; int maxx, maxy;
int mymaxx = 0, mymaxy = 0; int mymaxx = 0, mymaxy = 0;
@ -85,7 +86,7 @@ int prompt = 1;
char helppath[MAXCMD]; char helppath[MAXCMD];
static char progname[10]; static char progname[10];
static char cmdbuf[MAXCMD]; static char cmdbuf[2 * MAXCMD];
static int cnt = 0; static int cnt = 0;
static int icnt = 0; static int icnt = 0;
static int smode; static int smode;

44
bmore.h
View file

@ -11,10 +11,11 @@
* 2003-02-20 V 1.3.2 * 2003-02-20 V 1.3.2
* 2010-03-28 V 1.3.4 * 2010-03-28 V 1.3.4
* 2019-01-22 V 1.4.1 * 2019-01-22 V 1.4.1
* 2022-03-07 V 1.4.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2023 by Gerhard Buergmann
* gerhard@puon.at * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -49,20 +50,23 @@
# include "patchlevel.h" # include "patchlevel.h"
# include "config.h" # include "config.h"
# include <unistd.h> # include <unistd.h>
# if HAVE_NCURSES_H # if defined HAVE_NCURSESW_CURSES_H
# include <ncurses.h> # include <ncursesw/curses.h>
# else # include <ncursesw/term.h>
# include <curses.h> # elif defined HAVE_NCURSESW_H
# endif # include <ncursesw.h>
# if HAVE_TERM_H # elif defined HAVE_NCURSES_CURSES_H
# include <term.h> # include <ncurses/curses.h>
# else # elif defined HAVE_NCURSES_H
# if HAVE_NCURSES_TERM_H # include <ncurses.h>
# include <ncurses/term.h> # elif defined HAVE_CURSES_H
# else # include <curses.h>
# include <term.h> # else
# endif # error "SysV or X/Open-compatible Curses header file required"
# endif # endif
# if HAVE_TERM_H
# include <term.h>
# endif
#endif #endif
@ -135,17 +139,17 @@ extern int no_tty, no_intty;
#ifdef ANSI #ifdef ANSI
void initterm(void), set_tty(void), reset_tty(void); void initterm(void), set_tty(void), reset_tty(void);
void cleartoeol(void), clearscreen(void), highlight(void); void cleartoeol(void), clearscreen(void), highlight(void);
void normal(void), bmbeep(void), home(void), sig(void); void normal(void), bmbeep(void), home(void), sig(int);
void doshell(char *), emsg(char *); void doshell(char *), emsg(char *);
void do_next(int); void do_next(int);
void bmsearch(int); void bmsearch(int);
void pushback(int, char *); void pushback(int, char *);
int open_file(void); int open_file(char *);
int printout(int), rdline(int, char *); int printout(int), rdline(int, char *);
int nextchar(void), vgetc(void); int nextchar(void), vgetc(void);
int sbracket(int, char *, int); int sbracket(int, char *, int);
int bmregexec(char *); int bmregexec(char *);
int ascii_comp(char *, char *), hex_comp(char *, char *); int ascii_comp(char *, char *), hex_comp(char *, char *);
void putline(char *, int); void putline(char *, int);
#else #else
void initterm(), set_tty(), reset_tty(); void initterm(), set_tty(), reset_tty();

2
bvi.1
View file

@ -93,7 +93,7 @@
.nr % 0 .nr % 0
.rr F .rr F
.\} .\}
.TH BVI 1 "BVI Version 1.4.1" "30/Jan/2019" "User Commands" .TH BVI 1 "BVI Version 1.4.2" "8/Feb/2022" "User Commands"
.IX Title "BVI 1" .IX Title "BVI 1"
.UC .UC
.IX Name "bvi, bview - visual display editor for binary files" .IX Name "bvi, bview - visual display editor for binary files"

15
bvi.c
View file

@ -13,10 +13,11 @@
* 2013-08-23 V 1.4.0alpha * 2013-08-23 V 1.4.0alpha
* 2014-10-07 V 1.4.0 * 2014-10-07 V 1.4.0
* 2019-10-12 V 1.4.1 * 2019-10-12 V 1.4.1
* 2023-03-06 V 1.4.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2023 by Gerhard Buergmann
* gerhard@puon.at * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -33,6 +34,7 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h>
#include "bvi.h" #include "bvi.h"
#include "set.h" #include "set.h"
@ -42,7 +44,7 @@
#endif #endif
char *copyright = "(C) GPL 1996-2019 by Gerhard Buergmann"; char *copyright = "(C) GPL 1996-2023 by Gerhard Buergmann";
jmp_buf env; /* context for `longjmp' function */ jmp_buf env; /* context for `longjmp' function */
@ -145,6 +147,13 @@ main(argc, argv)
/* This should be the beginners version */ /* This should be the beginners version */
} }
if (isatty(fileno(stdin)) == 0) {
// Guckes
fprintf(stderr, "Input is not from a terminal\n");
exit(1);
}
while (n < argc) { while (n < argc) {
switch (argv[n][0]) { switch (argv[n][0]) {
case '-': case '-':
@ -918,7 +927,7 @@ do_put(loc, n, buf)
emsg(nobytes); emsg(nobytes);
return; return;
} }
if (loc > maxpos) { if (loc >= maxpos) {
beep(); beep();
return; return;
} }

23
bvi.h
View file

@ -12,10 +12,11 @@
* 2010-08-04 V 1.3.4 * 2010-08-04 V 1.3.4
* 2014-10-01 V 1.4.0 * 2014-10-01 V 1.4.0
* 2019-01-28 V 1.4.1 * 2019-01-28 V 1.4.1
* 2023-03-07 V 1.4.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2023 by Gerhard Buergmann
* gerhard@puon.at * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -50,11 +51,19 @@
#else #else
# include "patchlevel.h" # include "patchlevel.h"
# include "config.h" # include "config.h"
#if HAVE_NCURSES_H #if defined HAVE_NCURSESW_CURSES_H
# include <ncurses.h> # include <ncursesw/curses.h>
#else #elif defined HAVE_NCURSESW_H
# include <curses.h> # include <ncursesw.h>
#endif #elif defined HAVE_NCURSES_CURSES_H
# include <ncurses/curses.h>
#elif defined HAVE_NCURSES_H
# include <ncurses.h>
#elif defined HAVE_CURSES_H
# include <curses.h>
#else
# error "SysV or X/Open-compatible Curses header file required"
#endif
#endif #endif
/* defines for filemode */ /* defines for filemode */
@ -215,7 +224,7 @@ extern off_t block_begin, block_end, block_size;
void docmdline(char *), do_over(PTR, off_t, PTR), do_put(PTR, off_t, PTR); void docmdline(char *), do_over(PTR, off_t, PTR), do_put(PTR, off_t, PTR);
void jmpproc(int), printline(PTR, int); void jmpproc(int), printline(PTR, int);
int addfile(char *); int addfile(char *);
int bregexec(PTR, char *); PTR bregexec(PTR, char *);
int chk_comm(int); int chk_comm(int);
int doecmd(char *, int); int doecmd(char *, int);
int do_append(off_t, char *), do_logic(int, char *); int do_append(off_t, char *), do_logic(int, char *);

7
comm.c
View file

@ -14,10 +14,11 @@
* 2010-06-02 V 1.3.4 * 2010-06-02 V 1.3.4
* 2014-01-28 V 1.4.0 * 2014-01-28 V 1.4.0
* 2019-01-27 V 1.4.1 * 2019-01-27 V 1.4.1
* 2023-03-06 V 1.4.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2023 by Gerhard Buergmann
* gerhard@puon.at * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -87,7 +88,7 @@ extern char **files; /* used for "next" and "rewind" */
extern int numfiles, curfile; extern int numfiles, curfile;
extern int errno; extern int errno;
static char oldbuf[CMDSZ]; /** for :!! command **/ static char oldbuf[CMDSZ + 3]; /** for :!! command **/
/* /*
@ -308,7 +309,7 @@ docmdline(cmdline)
else ok = save(c_argv[0], start_addr, end_addr, saveflag); else ok = save(c_argv[0], start_addr, end_addr, saveflag);
} else { } else {
if (c_argc == 0) { if (c_argc == 0) {
save_chk(name, start_addr, end_addr, saveflag); ok = save_chk(name, start_addr, end_addr, saveflag);
} else { } else {
if (!stat(c_argv[0], &buf)) { if (!stat(c_argv[0], &buf)) {
if (saveflag == WRITE) { if (saveflag == WRITE) {

1213
config.guess vendored

File diff suppressed because it is too large Load diff

View file

@ -1,87 +1,144 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */ /* config.h.in. Generated from configure.ac by autoheader. */
/***** begin user configuration section *****/ /***** begin user configuration section *****/
#undef HAVE_NCURSES_H #undef HAVE_NCURSES_H
#undef HAVE_CURSES_H #undef HAVE_CURSES_H
#undef HAVE_NCURSESW_CURSES_H
#undef NO_SYSERRL #undef NO_SYSERRL
#undef NEED_PUTC_CHAR #undef NEED_PUTC_CHAR
#undef HAVE_NCURSES_TERM_H #undef HAVE_NCURSES_TERM_H
/* Define if you have the <fcntl.h> header file. */ /* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H #undef HAVE_FCNTL_H
/* Define if you have the <inttypes.h> header file. */ /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
/* Define if you have the `memmove' function. */ /* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE #undef HAVE_MEMMOVE
/* Define if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H
/* Define if you have the <ncurses/term.h> header file. */ /* Define to 1 if you have the <ncurses/term.h> header file. */
#undef HAVE_NCURSES_TERM_H #undef HAVE_NCURSES_TERM_H
/* Define if you have the <stdint.h> header file. */ /* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H #undef HAVE_STDINT_H
/* Define if you have the <stdlib.h> header file. */ /* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H #undef HAVE_STDLIB_H
/* Define if you have the `strdup' function. */ /* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP #undef HAVE_STRDUP
/* Define if you have the `strerror' function. */ /* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR #undef HAVE_STRERROR
/* Define if you have the <strings.h> header file. */ /* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H #undef HAVE_STRINGS_H
/* Define if you have the <string.h> header file. */ /* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H #undef HAVE_STRING_H
/* Define if you have the `strtol' function. */ /* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL #undef HAVE_STRTOL
/* Define if you have the <sys/stat.h> header file. */ /* Define to 1 if you have the `strtoll' function. */
#undef HAVE_STRTOLL
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H #undef HAVE_SYS_STAT_H
/* Define if you have the <sys/types.h> header file. */ /* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H #undef HAVE_SYS_TYPES_H
/* Define if you have the <termcap.h> header file. */ /* Define to 1 if you have the <termcap.h> header file. */
#undef HAVE_TERMCAP_H #undef HAVE_TERMCAP_H
/* Define if you have the <termios.h> header file. */ /* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H #undef HAVE_TERMIOS_H
/* Define if you have the <termio.h> header file. */ /* Define to 1 if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H #undef HAVE_TERMIO_H
/* Define if you have the <term.h> header file. */ /* Define to 1 if you have the <term.h> header file. */
#undef HAVE_TERM_H #undef HAVE_TERM_H
/* Define if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* The size of a `int', as computed by sizeof. */ /* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT #undef SIZEOF_INT
/* The size of a `long', as computed by sizeof. */ /* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG #undef SIZEOF_LONG
/* The size of a `void *', as computed by sizeof. */ /* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P #undef SIZEOF_VOID_P
/* Define if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#undef _LARGEFILE_SOURCE
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define to `int' if <sys/types.h> does not define. */ /* Define to `int' if <sys/types.h> does not define. */
#undef off_t #undef off_t
/* Define to rpl_realloc if the replacement function should be used. */
#undef realloc
/* Define to `unsigned int' if <sys/types.h> does not define. */ /* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t #undef size_t

676
config.sub vendored

File diff suppressed because it is too large Load diff

839
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -63,18 +63,23 @@ AC_ARG_WITH(ncurses,
]) ])
AC_CHECK_HEADER([ncurses.h],[ AC_CHECK_HEADER([ncurses.h],[
AC_SEARCH_LIBS([initscr], [ncurses],[ AC_SEARCH_LIBS([initscr], [ncurses], [
AC_DEFINE(HAVE_NCURSES_H) AC_DEFINE(HAVE_NCURSES_H)
AC_SEARCH_LIBS([tputs], [tinfo])], [ AC_SEARCH_LIBS([tputs], [tinfo])],[
AC_SEARCH_LIBS([initscr], [curses],[ AC_SEARCH_LIBS([initscr], [curses],[
AC_DEFINE(HAVE_CURSES_H) AC_DEFINE(HAVE_CURSES_H)
AC_SEARCH_LIBS([tputs], [tinfo])],[ AC_SEARCH_LIBS([tputs], [tinfo])],[
AC_MSG_ERROR([bvi requires the curses library])])])],[ AC_MSG_ERROR([bvi requires a curses library])])])
],[
AC_CHECK_HEADER([curses.h],[ AC_CHECK_HEADER([curses.h],[
AC_SEARCH_LIBS([initscr], [curses], [ AC_SEARCH_LIBS([initscr], [curses], [
AC_DEFINE(HAVE_CURSES_H)],[ AC_DEFINE(HAVE_CURSES_H)],[
AC_MSG_ERROR([bvi requires the curses library])])],[ AC_MSG_ERROR([bvi requires a curses library])])],[
AC_MSG_ERROR([bvi requires the curses library])])]) AC_CHECK_HEADER([ncursesw/curses.h], [
AC_SEARCH_LIBS([initscr], [ncursesw], [
AC_DEFINE(HAVE_NCURSESW_CURSES_H)],[
AC_MSG_ERROR([bvi requires a curses library])])],[
AC_MSG_ERROR([bvi requires a curses library])])])])
dnl Checks for typedefs, structures, and compiler characteristics. dnl Checks for typedefs, structures, and compiler characteristics.
dnl AC_TYPE_SIZE_T dnl AC_TYPE_SIZE_T

24
io.c
View file

@ -11,10 +11,11 @@
* 2010-06-02 V 1.3.4 * 2010-06-02 V 1.3.4
* 2014-05-03 V 1.4.0 * 2014-05-03 V 1.4.0
* 2019-01-27 V 1.4.1 * 2019-01-27 V 1.4.1
* 2022-03-09 V 1.4.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2022 by Gerhard Buergmann
* gerhard@puon.at * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -55,6 +56,20 @@
# include <fcntl.h> # include <fcntl.h>
#endif #endif
//@ read on linux has a limit of 0x7ffff000 bytes (see `man read`)
//@ this function calls recursively read until all `count` characters are read.
static ssize_t
read_to_end(int fd, void *buf, size_t count) {
size_t read_bytes = 0;
while(read_bytes < count) {
const ssize_t ret = read(fd, ((char*)buf)+read_bytes, count-read_bytes);
if(ret <= 0) return ret;
read_bytes += ret;
}
return read_bytes;
}
int filemode; int filemode;
static struct stat buf; static struct stat buf;
static off_t block_read; static off_t block_read;
@ -261,7 +276,7 @@ load(fname)
sysemsg(fname); sysemsg(fname);
filemode = ERROR; filemode = ERROR;
} else { } else {
if ((filesize = read(fd, mem, block_size)) == 0) { if ((filesize = read_to_end(fd, mem, block_size)) == 0) {
sprintf(fname_buf, "\"%s\" Empty file", fname); sprintf(fname_buf, "\"%s\" Empty file", fname);
filemode = ERROR; filemode = ERROR;
} else { } else {
@ -278,7 +293,7 @@ load(fname)
} }
} else if ((filemode == REGULAR) || (filemode == DIRECTORY)) { } else if ((filemode == REGULAR) || (filemode == DIRECTORY)) {
filesize = buf.st_size; filesize = buf.st_size;
if (read(fd, mem, filesize) != filesize) { if (read_to_end(fd, mem, filesize) != filesize) {
sysemsg(fname); sysemsg(fname);
filemode = ERROR; filemode = ERROR;
} }
@ -478,7 +493,7 @@ addfile(fname)
} }
oldsize = filesize; oldsize = filesize;
if (enlarge(buf.st_size)) return 1; if (enlarge(buf.st_size)) return 1;
if (read(fd, mem + filesize, buf.st_size) == -1) { if (read_to_end(fd, mem + filesize, buf.st_size) == -1) {
sysemsg(fname); sysemsg(fname);
return 1; return 1;
} }
@ -488,3 +503,4 @@ addfile(fname)
setpage(mem + oldsize); setpage(mem + oldsize);
return 0; return 0;
} }

59
macro.m4 Normal file
View file

@ -0,0 +1,59 @@
AC_CHECK_HEADER
(
[ncurses.h],
[
AC_SEARCH_LIBS
([initscr], [ncurses],
[
AC_DEFINE(HAVE_NCURSES_H)
AC_SEARCH_LIBS([tputs], [tinfo])
],[
AC_SEARCH_LIBS
(
[initscr], [curses],
[
AC_DEFINE(HAVE_CURSES_H)
AC_SEARCH_LIBS([tputs], [tinfo])
],[
AC_MSG_ERROR([bvi requires a curses library])
]
)
]
)
],[
AC_CHECK_HEADER
(
[curses.h],
[
AC_SEARCH_LIBS
(
[initscr], [curses],
[
AC_DEFINE(HAVE_CURSES_H)
],[
AC_MSG_ERROR([bvi requires a curses library])
]
)
],[
# statt: AC_MSG_ERROR([bvi requires a curses library])
AC_CHECK_HEADER
(
[ncursesw/curses.h],
[
AC_SEARCH_LIBS
(
[initscr], [curses],
[
AC_DEFINE(HAVE_NCURSESW_CURSES_H)
],[
AC_MSG_ERROR([bvi requires a curses library])
]
)
],[
AC_MSG_ERROR([bvi requires a curses library])
]
)
]
)
]
)

View file

@ -1 +1 @@
#define VERSION "1.4.1" #define VERSION "1.4.2"

7
re.c
View file

@ -11,8 +11,9 @@
* 2010-06-02 V 1.3.4 * 2010-06-02 V 1.3.4
* 2013-08-24 V 1.4.0 * 2013-08-24 V 1.4.0
* 2019-01-28 V 1.4.1 * 2019-01-28 V 1.4.1
* 2023-03-07 V 1.4.2
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2023 by Gerhard Buergmann
* gerhard@puon.at * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -312,7 +313,7 @@ do_substitution(delim, line, startpos, endpos)
refresh(); refresh();
if (global) { if (global) {
if ((undo_count = alloc_buf(endpos - startpos, &undo_buf))) { if ((undo_count = alloc_buf((off_t)(endpos - startpos), &undo_buf))) {
memcpy(undo_buf, startpos + 1, undo_count); memcpy(undo_buf, startpos + 1, undo_count);
} }
undo_start = startpos + 1; undo_start = startpos + 1;
@ -350,7 +351,7 @@ AGAIN:
repl_count++; repl_count++;
current_start = pagepos + y * Anzahl + xpos(); current_start = pagepos + y * Anzahl + xpos();
if (!global) { if (!global) {
if ((undo_count = alloc_buf(pat_len, &undo_buf))) { if ((undo_count = alloc_buf((off_t)pat_len, &undo_buf))) {
memcpy(undo_buf, current_start, undo_count); memcpy(undo_buf, current_start, undo_count);
} }
undo_start = current_start; undo_start = current_start;

939
tags

File diff suppressed because it is too large Load diff

209
test.txt Normal file
View file

@ -0,0 +1,209 @@
AAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDDDDD
EEEEEEEEEEEEEEEEEEEEEEE
FFFFFFFFFFFFFFFFFFFFFFF
GGGGGGGGGGGGGGGGGGGGGGG
HHHHHHHHHHHHHHHHHHHHHHH
IIIIIIIIIIIIIIIIIIIIIII
JJJJJJJJJJJJJJJJJJJJJJJ
KKKKKKKKKKKKKKKKKKKKKKK
LLLLLLLLLLLLLLLLLLLLLLL
MMMMMMMMMMMMMMMMMMMMMMM
NNNNNNNNNNNNNNNNNNNNNNN
OOOOOOOOOOOOOOOOOOOOOOO
PPPPPPPPPPPPPPPPPPPPPPP
QQQQQQQQQQQQQQQQQQQQQQQ
RRRRRRRRRRRRRRRRRRRRRRR
SSSSSSSSSSSSSSSSSSSSSSS
TTTTTTTTTTTTTTTTT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x
yyyyyyyyyyyyyyyyyyyyyyy
zzzzzzzzzzzzzzzzzzzzzzz

15
tmp
View file

@ -1,15 +0,0 @@
if ((ch > 31) && (ch < 127)) {
PRINTF("%c", ch);
} else {
if (r_flag) {
if ((ch & 128) && ((ch > 159) && (ch < 255))) {
if (!no_tty) highlight();
PRINTF("%c", ch & 127);
if (!no_tty) normal();
} else {
PRINTF(".");
}
} else {
PRINTF(".");
}
}