1
0
Fork 0
mirror of https://github.com/vbatts/bvi.git synced 2025-08-02 15:40:28 +00:00

Compare commits

...

1 commit

Author SHA1 Message Date
Gerhard Bürgmann
50898d8d59
bvi-1.5.0.src.tar.gz
6540716a1a3b2b9711635108da14b26baea488881d4a682121c0bddbba6b74cb  bvi-1.5.0.src.tar.gz

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2025-07-30 10:02:07 -04:00
28 changed files with 1936 additions and 1473 deletions

11
CHANGES
View file

@ -1,3 +1,14 @@
New in release 1.5.0
====================
* Terminal window resizeable
* fix build fails with gcc-15/C23
* fix statusline for small windows
* various issues caught by lintian solved
* fix old-style-definition warnings
* Minor fixes
New in release 1.4.2 New in release 1.4.2
==================== ====================
This release is dedicated to Sven Guckes (*1967-04-06 +2022-02-20). This release is dedicated to Sven Guckes (*1967-04-06 +2022-02-20).

View file

@ -1,7 +1,7 @@
Patches: Patches:
Guido <guido@bearix.oche.de> sys_errlist Etienne Mollier <emollier@debian.org> gcc-15/C23 issues
Christian "naddy" Weisgerber <naddy@mips.rhein-neckar.de> {Free,Open}BSD Matthias Klose <doko@debian.org> GCC-15 issues
Gunnar Larisch <la@softing.com> ^ZZ bug Vincent Batts <vbatts@hashbangbash.com> nit cleanup
Peter J. Holzer <hjp@wsr.ac.at> setlocale Peter J. Holzer <hjp@wsr.ac.at> setlocale
Albert Chin-A-Young <china@thewrittenword.com> Makefile.in Albert Chin-A-Young <china@thewrittenword.com> Makefile.in
Ralf <rks@ffm.tc.iot.dtag.de> AIX fixes Ralf <rks@ffm.tc.iot.dtag.de> AIX fixes

12
README
View file

@ -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.2.src.tar.gz | tar xvf - gunzip -c bvi-1.5.0.src.tar.gz | tar xvf -
cd bvi-1.4.2 cd bvi-1.5.0
./configure ./configure
make make
make install make install
@ -32,14 +32,6 @@ To avoid this behaviour use:
stty dsusp undef stty dsusp undef
---------------------------------------------------------------------------
Subscribe to the bvi mailing for support, updates and other news:
Send a blank email to bvi-subscribe@yahoogroups.com. You will receive a
subscription confirmation message. Simply reply this message and your
subscription will be complete.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
PLEASE send any bug reports (and fixes), code for new features, PLEASE send any bug reports (and fixes), code for new features,
comments, questions, etc. (even flames) to: comments, questions, etc. (even flames) to:

View file

@ -7,10 +7,11 @@
* 2010-06-02 V 1.3.4 * 2010-06-02 V 1.3.4
* 2013-08-22 V 1.4.0 * 2013-08-22 V 1.4.0
* 2019-10-09 V 1.4.1 * 2019-10-09 V 1.4.1
* 2025-07-19 V 1.5.0
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2025 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
@ -64,8 +65,7 @@ putchr(char ch)
#else #else
int int
putchr(ch) putchr(int ch)
int ch;
{return putchar(ch);} {return putchar(ch);}
#endif #endif
@ -143,8 +143,7 @@ reset_tty()
void void
sig(sig) sig(int sig)
int sig;
{ {
reset_tty(); reset_tty();
printf("\r\n"); printf("\r\n");
@ -156,12 +155,15 @@ sig(sig)
* doshell() - run a command or an interactive shell * doshell() - run a command or an interactive shell
*/ */
void void
doshell(cmd) doshell(char *cmd)
char *cmd;
{ {
int ret; int ret;
#ifndef DJGPP #ifndef DJGPP
#ifdef __STDC__
char *getenv(const char *);
#else
char *getenv(); char *getenv();
#endif
char *shell; char *shell;
char cline[128]; char cline[128];
#endif #endif
@ -277,10 +279,7 @@ vgetc()
* Copy contents of memory (with possible overlapping). * Copy contents of memory (with possible overlapping).
*/ */
char * char *
memmove(s1, s2, n) memmove(char *s1, char *s2, size_t n)
char *s1;
char *s2;
size_t n;
{ {
bcopy(s2, s1, n); bcopy(s2, s1, n);
return(s1); return(s1);

View file

@ -1,4 +1,4 @@
.TH BMORE 1 "8 Feb 2022" .TH BMORE 1 "24 May 2025"
.SH NAME .SH NAME
bmore \- browse through a binary file bmore \- browse through a binary file
.SH SYNOPSIS .SH SYNOPSIS
@ -232,7 +232,7 @@ in the file remains unchanged. Regular expressions can be
edited using erase and kill characters. edited using erase and kill characters.
Erasing back past the first column cancels the search command. Erasing back past the first column cancels the search command.
.TP .TP
.B \' .B '
Single quote. Go to the point from which the last search started. Single quote. Go to the point from which the last search started.
If no search has been performed in the current file, If no search has been performed in the current file,
go to the beginning of the file. go to the beginning of the file.

42
bmore.c
View file

@ -9,8 +9,9 @@
* 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 * 2023-03-06 V 1.4.2
* 2025-07-19 V 1.5.0
* *
* Copyright 1990-2023 by Gerhard Buergmann * Copyright 1990-2025 by Gerhard Buergmann
* gerhard@puon.at * gerhard@puon.at
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
@ -113,9 +114,7 @@ usage()
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
int ch, ch1; int ch, ch1;
int colon = 0, last_ch = 0; int colon = 0, last_ch = 0;
@ -533,9 +532,7 @@ main(argc, argv)
int int
rdline(ch, sstring) rdline(int ch, char *sstring)
int ch;
char *sstring;
{ {
int i = 0; int i = 0;
int ch1 = 0; int ch1 = 0;
@ -587,8 +584,7 @@ rdline(ch, sstring)
void void
do_next(n) do_next(int n)
int n;
{ {
if (numfiles) { if (numfiles) {
if (n == 1 && file_nr == numfiles) { if (n == 1 && file_nr == numfiles) {
@ -614,8 +610,7 @@ do_next(n)
int int
open_file(name) open_file(char *name)
char *name;
{ {
struct stat buf; struct stat buf;
@ -636,9 +631,7 @@ open_file(name)
void void
putline(buf, num) putline(char *buf, int num)
char *buf;
int num;
{ {
int print_pos; int print_pos;
unsigned char ch; unsigned char ch;
@ -689,8 +682,7 @@ putline(buf, num)
int int
printout(lns) printout(int lns)
int lns;
{ {
int c, num; int c, num;
int doub = 0; int doub = 0;
@ -755,9 +747,7 @@ nextchar()
void void
pushback(n, where) pushback(int n, char *where)
int n;
char *where;
{ {
if (cnt) memmove(cmdbuf + n, cmdbuf, n); if (cnt) memmove(cmdbuf + n, cmdbuf, n);
memcpy(cmdbuf, where, n); memcpy(cmdbuf, where, n);
@ -774,8 +764,7 @@ pushback(n, where)
* 1 found * 1 found
*/ */
int int
bmregexec(scan) bmregexec(char *scan)
char *scan;
{ {
char *act; char *act;
int count, test; int count, test;
@ -893,10 +882,7 @@ bmregexec(scan)
int int
sbracket(start, scan, count) sbracket(int start, char *scan, int count)
int start;
char *scan;
int count;
{ {
if (*scan++ == '^') { if (*scan++ == '^') {
if (!memchr(scan, start, --count)) return 0; if (!memchr(scan, start, --count)) return 0;
@ -908,8 +894,7 @@ sbracket(start, scan, count)
void void
bmsearch(ch) bmsearch(int ch)
int ch;
{ {
int i; int i;
@ -961,8 +946,7 @@ emsg(string);
void void
emsg(s) emsg(char *s)
char *s;
{ {
putchar('\r'); putchar('\r');
cleartoeol(); cleartoeol();

View file

@ -136,7 +136,7 @@ extern int no_tty, no_intty;
#ifdef ANSI #if defined(ANSI) || defined(__STDC__)
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(int); void normal(void), bmbeep(void), home(void), sig(int);

43
bvi.1
View file

@ -1,8 +1,8 @@
.rn '' }` .rn '' }`
''' $RCSfile$$Revision$$Date$ .\" $RCSfile$$Revision$$Date$
''' .\"
''' $Log$ .\" $Log$
''' .\"
.de Sh .de Sh
.br .br
.if t .Sp .if t .Sp
@ -31,12 +31,12 @@
.fi .fi
.. ..
''' .\"
''' .\"
''' Set up \*(-- to give an unbreakable dash; .\" Set up \*(-- to give an unbreakable dash;
''' string Tr holds user defined translation string. .\" string Tr holds user defined translation string.
''' Bell System Logo is used as a dummy character. .\" Bell System Logo is used as a dummy character.
''' .\"
.tr \(*W-|\(bv\*(Tr .tr \(*W-|\(bv\*(Tr
.ie n \{\ .ie n \{\
.ds -- \(*W- .ds -- \(*W-
@ -45,10 +45,10 @@
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.ds L" "" .ds L" ""
.ds R" "" .ds R" ""
''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of .\" \*(M", \*(S", \*(N" and \*(T" are the equivalent of
''' \*(L" and \*(R", except that they are used on ".xx" lines, .\" \*(L" and \*(R", except that they are used on ".xx" lines,
''' such as .IP and .SH, which do another additional levels of .\" such as .IP and .SH, which do another additional levels of
''' double-quote interpretation .\" double-quote interpretation
.ds M" """ .ds M" """
.ds S" """ .ds S" """
.ds N" """"" .ds N" """""
@ -93,7 +93,7 @@
.nr % 0 .nr % 0
.rr F .rr F
.\} .\}
.TH BVI 1 "BVI Version 1.4.2" "8/Feb/2022" "User Commands" .TH BVI 1 "BVI Version 1.5.0" "31/May/2025" "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"
@ -194,7 +194,7 @@
bvi, bview \- visual editor for binary files bvi, bview \- visual editor for binary files
.SH "VERSION" .SH "VERSION"
.IX Header "VERSION" .IX Header "VERSION"
bvi-1.4.1 bvi-1.5.0
.SH "SYNOPSIS" .SH "SYNOPSIS"
.IX Header "SYNOPSIS" .IX Header "SYNOPSIS"
\fBbvi\fR\ \ \ [\fB\-R\fR]\ [\fB\-c\fR\ \fIcmd\fR]\ [\fB\-f\fR\ \fIscript\fR]\ [\fB\-s\fR\ \fIskip\fR]\ [\fB\-e\fR\ \fIend\fR]\ [\fB\-n\fR\ \fIlength\fR]\ \fIfile\fR... \fBbvi\fR\ \ \ [\fB\-R\fR]\ [\fB\-c\fR\ \fIcmd\fR]\ [\fB\-f\fR\ \fIscript\fR]\ [\fB\-s\fR\ \fIskip\fR]\ [\fB\-e\fR\ \fIend\fR]\ [\fB\-n\fR\ \fIlength\fR]\ \fIfile\fR...
@ -273,7 +273,7 @@ Files are treated as one long stream of bytes. The characters
\*(L"newline\*(R" and \*(L"carriage return\*(R" are not special, id est they \*(L"newline\*(R" and \*(L"carriage return\*(R" are not special, id est they
never mark the end of lines. Therefore the lines on the screen do not never mark the end of lines. Therefore the lines on the screen do not
represent lines in the usual way. Data is broken across screen lines represent lines in the usual way. Data is broken across screen lines
arbitarily. arbitrarily.
As a consequence there are no commands in bvi from ex or vi As a consequence there are no commands in bvi from ex or vi
that are based on line numbers, eg \*(L"dd\*(R", \*(L"yy\*(R", \*(L'C\*(R', \*(L'S\*(R', \*(L'o\*(R', \*(L'O\*(R'. that are based on line numbers, eg \*(L"dd\*(R", \*(L"yy\*(R", \*(L'C\*(R', \*(L'S\*(R', \*(L'o\*(R', \*(L'O\*(R'.
This also changes the meaning of \*(L"range\*(R" before the \*(L":write\*(R" command This also changes the meaning of \*(L"range\*(R" before the \*(L":write\*(R" command
@ -313,7 +313,7 @@ using these meta sequences:
.Ve .Ve
Additional search commands: Additional search commands:
Similar to the text search commands there are additional hex-search Similar to the text search commands there are additional hex-search
functions \*(L'\e\*(R' and \*(L'#\*(R' which allow to search for any byte value. functions \*(L'\e\*(R' and \*(L'#\*(R' which allow one to search for any byte value.
Example: \*(L"\e62 76 69\*(R" will search for the string \*(L"bvi\*(R". Example: \*(L"\e62 76 69\*(R" will search for the string \*(L"bvi\*(R".
Spaces between hex value are optional, so searching Spaces between hex value are optional, so searching
for \*(L"6775636B6573\*(R" will find \*(L"guckes\*(R". for \*(L"6775636B6573\*(R" will find \*(L"guckes\*(R".
@ -584,7 +584,7 @@ the file. If you use ASCII mode you can use the special characters
\& ignorecase noic Ignores letter case in searching \& ignorecase noic Ignores letter case in searching
\& magic nomagic Makes . [ * special in patterns \& magic nomagic Makes . [ * special in patterns
\& memmove nomm enables insert and delete commands \& memmove nomm enables insert and delete commands
\& offset of=0 adds an offset to the diplayed addresses \& offset of=0 adds an offset to the displayed addresses
\& readonly noro If set, write fails unless you use ! after command \& readonly noro If set, write fails unless you use ! after command
\& reverse nore display otherwise-printable characters with their \& reverse nore display otherwise-printable characters with their
\& high bit set as reverse video \& high bit set as reverse video
@ -606,7 +606,7 @@ bvi was developed by Gerhard Buergmann, Vienna, Austria
\fIgerhard@puon.at\fR \fIgerhard@puon.at\fR
.SH "WWW" .SH "WWW"
.IX Header "WWW" .IX Header "WWW"
Bvi\ Homepage:\ \ http://bvi.sourceforge.net/ Bvi\ Homepage:\ \ https://bvi.sourceforge.net/
Vi\ Pages:\ \ \ \ \ \ http://www.guckes.net/vi/clones.php3 Vi\ Pages:\ \ \ \ \ \ http://www.guckes.net/vi/clones.php3
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (all\ about\ Vi\ and\ its\ clones) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (all\ about\ Vi\ and\ its\ clones)
.SH "FILES" .SH "FILES"
@ -614,9 +614,6 @@ Vi\ Pages:\ \ \ \ \ \ http://www.guckes.net/vi/clones.php3
\fI\ $HOME/.bvirc\fR\ \ \ \ \ \ \ \ \ \ editor\ startup\ file \fI\ $HOME/.bvirc\fR\ \ \ \ \ \ \ \ \ \ editor\ startup\ file
.BR .BR
\fI\ ./.bvirc\fR\ \ \ \ \ \ \ \ \ \ \ \ \ \ editor\ startup\ file \fI\ ./.bvirc\fR\ \ \ \ \ \ \ \ \ \ \ \ \ \ editor\ startup\ file
.SH "BUGS"
.IX Header "BUGS"
Bvi does not update the screen when the terminal changes its size.
.SH "SEE ALSO" .SH "SEE ALSO"
.IX Header "SEE ALSO" .IX Header "SEE ALSO"
\fIbmore\fR\|(1), \fIvi\fR\|(1), \fIstrings\fR\|(1), \fIascii\fR\|(5) \fIbmore\fR\|(1), \fIvi\fR\|(1), \fIstrings\fR\|(1), \fIascii\fR\|(5)

68
bvi.c
View file

@ -14,10 +14,11 @@
* 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 * 2023-03-06 V 1.4.2
* 2025-07-19 V 1.5.0
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2023 by Gerhard Buergmann * Copyright 1996-2025 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
@ -44,7 +45,7 @@
#endif #endif
char *copyright = "(C) GPL 1996-2023 by Gerhard Buergmann"; char *copyright = "(C) GPL 1996-2025 by Gerhard Buergmann";
jmp_buf env; /* context for `longjmp' function */ jmp_buf env; /* context for `longjmp' function */
@ -65,7 +66,8 @@ FILE *Ausgabe_Datei;
int edits = 0; int edits = 0;
int AnzAdd, Anzahl, Anzahl3; int AnzAdd, Anzahl, Anzahl3;
off_t filesize, memsize, undosize; off_t filesize, memsize, undosize;
int statusflag = 1;
int space = 2;
long precount = -1; long precount = -1;
@ -117,9 +119,7 @@ usage()
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
int ch; int ch;
int lflag; int lflag;
@ -248,7 +248,7 @@ main(argc, argv)
break; break;
case BLOCK_BEGIN|BLOCK_END|BLOCK_LEN: case BLOCK_BEGIN|BLOCK_END|BLOCK_LEN:
if (block_end - block_begin != block_size + 1) { if (block_end - block_begin != block_size + 1) {
fprintf(stderr, "Ambigous block data\n"); fprintf(stderr, "Ambiguous block data\n");
exit(1); exit(1);
} }
break; break;
@ -267,7 +267,9 @@ main(argc, argv)
maxy = LINES; maxy = LINES;
if (params[P_LI].flags & P_CHANGED) maxy = P(P_LI); if (params[P_LI].flags & P_CHANGED) maxy = P(P_LI);
P(P_SS) = maxy / 2; P(P_SS) = maxy / 2;
/* We do not set P(P_LI) and P(P_CM) anymore, because 0 means "auto"
P(P_LI) = maxy; P(P_LI) = maxy;
*/
maxy--; maxy--;
keypad(stdscr, TRUE); keypad(stdscr, TRUE);
scrollok(stdscr, TRUE); scrollok(stdscr, TRUE);
@ -281,15 +283,15 @@ main(argc, argv)
/* reserve 1 hex digit more than required */ /* reserve 1 hex digit more than required */
char tmp[sizeof(block_begin) * 2 + 3]; char tmp[sizeof(block_begin) * 2 + 3];
AnzAdd = sprintf(tmp, "%llX", (long long unsigned)block_begin) + 1; AnzAdd = sprintf(tmp, "%llX", (long long unsigned)block_begin) + 1;
if (AnzAdd < 8) if (AnzAdd < 8) AnzAdd = 8;
AnzAdd = 8; if (AnzAdd > sizeof(block_begin) * 2) AnzAdd = sizeof(block_begin) * 2;
if (AnzAdd > sizeof(block_begin) * 2)
AnzAdd = sizeof(block_begin) * 2;
sprintf(addr_form, "%%0%dllX ", AnzAdd); sprintf(addr_form, "%%0%dllX ", AnzAdd);
AnzAdd = sprintf(tmp, addr_form, block_begin); AnzAdd = sprintf(tmp, addr_form, block_begin);
Anzahl = ((COLS - AnzAdd - 1) / 16) * 4; Anzahl = ((COLS - AnzAdd - space) / 16) * 4;
/*
P(P_CM) = Anzahl; P(P_CM) = Anzahl;
*/
maxx = Anzahl * 4 + AnzAdd + 1; maxx = Anzahl * 4 + AnzAdd + 1;
Anzahl3 = Anzahl * 3; Anzahl3 = Anzahl * 3;
statsize = 35; statsize = 35;
@ -328,6 +330,10 @@ main(argc, argv)
else precount = -1; else precount = -1;
lflag = arrnum = 0; lflag = arrnum = 0;
if (statusflag == 0) {
statusflag = 1;
clearstr();
}
switch (ch) { switch (ch) {
case '^': x = AnzAdd; case '^': x = AnzAdd;
loc = HEX; loc = HEX;
@ -467,6 +473,18 @@ main(argc, argv)
fileinfo(name); fileinfo(name);
wrstat = 0; wrstat = 0;
break; break;
case KEY_RESIZE:
if (P(P_CM) == 0) {
Anzahl = ((COLS - AnzAdd - space) / 4);
maxx = Anzahl * 4 + AnzAdd + 1;
Anzahl3 = Anzahl * 3;
status = Anzahl3 + Anzahl - statsize;
}
if (P(P_LI) == 0) {
screen = Anzahl * (maxy - 1);
maxy = LINES - 1;
P(P_SS) = maxy / 2;
}
case BVICTRL('L'): /*** REDRAW SCREEN ***/ case BVICTRL('L'): /*** REDRAW SCREEN ***/
new_screen(); new_screen();
break; break;
@ -735,8 +753,7 @@ main(argc, argv)
off_t off_t
calc_size(arg) calc_size(char *arg)
char *arg;
{ {
off_t val; off_t val;
extern int errno; extern int errno;
@ -787,9 +804,7 @@ trunc_cur()
int int
do_append(count, buf) do_append(off_t count, char *buf)
off_t count;
char *buf;
{ {
if (filesize + count > memsize) { if (filesize + count > memsize) {
if (enlarge(count + 100L)) return 1; if (enlarge(count + 100L)) return 1;
@ -806,8 +821,7 @@ do_append(count, buf)
void void
do_tilde(count) do_tilde(off_t count)
off_t count;
{ {
if (filesize == 0L) return; if (filesize == 0L) return;
undo_start = current; undo_start = current;
@ -893,10 +907,7 @@ do_undo()
void void
do_over(loc, n, buf) do_over(PTR loc, off_t n, PTR buf)
PTR loc;
off_t n;
PTR buf;
{ {
if (n < 1L) { if (n < 1L) {
emsg(nobytes); emsg(nobytes);
@ -918,10 +929,7 @@ do_over(loc, n, buf)
void void
do_put(loc, n, buf) do_put(PTR loc, off_t n, PTR buf)
PTR loc;
off_t n;
PTR buf;
{ {
if (n < 1L) { if (n < 1L) {
emsg(nobytes); emsg(nobytes);
@ -949,8 +957,7 @@ do_put(loc, n, buf)
/* argument sig not used, because only SIGINT will be catched */ /* argument sig not used, because only SIGINT will be catched */
void void
jmpproc(sig) jmpproc(int sig)
int sig;
{ {
if (P(P_EB)) beep(); if (P(P_EB)) beep();
repaint(); repaint();
@ -961,8 +968,7 @@ jmpproc(sig)
off_t off_t
range(ch) range(int ch)
int ch;
{ {
int ch1; int ch1;
long count; long count;

7
bvi.h
View file

@ -13,10 +13,11 @@
* 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 * 2023-03-07 V 1.4.2
* 2025-05-24 V 1.5.0
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2023 by Gerhard Buergmann * Copyright 1996-2025 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
@ -200,6 +201,8 @@ extern int smode;
extern int again; extern int again;
extern int block_flag; extern int block_flag;
extern off_t block_begin, block_end, block_size; extern off_t block_begin, block_end, block_size;
extern int statusflag;
extern int space;
#ifndef S_ISDIR /* POSIX 1003.1 file type tests. */ #ifndef S_ISDIR /* POSIX 1003.1 file type tests. */
#define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */ #define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */
@ -214,7 +217,7 @@ extern off_t block_begin, block_end, block_size;
void d_memmove(PTR, PTR, off_t); void d_memmove(PTR, PTR, off_t);
#endif #endif
#ifdef ANSI #if defined(ANSI) || defined(__STDC__)
off_t alloc_buf(off_t, char **), yd_addr(void); off_t alloc_buf(off_t, char **), yd_addr(void);
off_t range(int); off_t range(int);
void do_dot(void), do_exit(void), do_shell(void), do_undo(void); void do_dot(void), do_exit(void), do_shell(void), do_undo(void);

62
comm.c
View file

@ -15,10 +15,11 @@
* 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 * 2023-03-06 V 1.4.2
* 2025-07-19 V 1.5.0
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2023 by Gerhard Buergmann * Copyright 1996-2025 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
@ -72,8 +73,8 @@ static char *c_argv[9];
char *nowrtmsg = "No write@since last change (:%s! overrides)"; char *nowrtmsg = "No write@since last change (:%s! overrides)";
char *morefiles = "more files@to edit"; char *morefiles = "more files@to edit";
char *ambigous = "Ambigous|Too many file names"; char *ambigous = "Ambiguous|Too many file names";
char *ambvalue = "Ambigous|Too many values"; char *ambvalue = "Ambiguous|Too many values";
char *extra = "Extra chars|Extra characters at end of command"; char *extra = "Extra chars|Extra characters at end of command";
char *noaddr = "No address allowed@on this command"; char *noaddr = "No address allowed@on this command";
char *noval = "No value@for binary operation"; char *noval = "No value@for binary operation";
@ -98,8 +99,7 @@ static char oldbuf[CMDSZ + 3]; /** for :!! command **/
* the environment variable "BVIINIT" (or eventually .bvirc). * the environment variable "BVIINIT" (or eventually .bvirc).
*/ */
void void
docmdline(cmdline) docmdline(char *cmdline)
char *cmdline;
{ {
char buff[CMDSZ]; char buff[CMDSZ];
char cmdbuf[CMDSZ]; char cmdbuf[CMDSZ];
@ -629,11 +629,7 @@ yd_addr()
/*********** Save file if not read only ********************/ /*********** Save file if not read only ********************/
int int
save_chk(fname, start, end, flags) save_chk(char *fname, char *start, char *end, int flags)
char *fname;
char *start;
char *end;
int flags;
{ {
if (P(P_RO)) { if (P(P_RO)) {
sprintf(string, "\"%s\" File is read only", name); sprintf(string, "\"%s\" File is read only", name);
@ -657,9 +653,7 @@ do_exit()
int int
doecmd(arg, force) doecmd(char *arg, int force)
char *arg;
int force;
{ {
char *tmp; char *tmp;
@ -722,33 +716,34 @@ clearstr()
/**** displays an error message *****/ /**** displays an error message *****/
void void
emsg(s) emsg(char *s)
char *s;
{ {
int cnt; int cnt;
/*
int stchar; int stchar;
if (P(P_EB)) beep();
if (P(P_MO)) { if (P(P_MO)) {
stchar = statsize; stchar = statsize;
} else { } else {
stchar = 0; stchar = 0;
} }
*/
if (P(P_EB)) beep();
statusflag = 0;
clearstr(); clearstr();
attrset(A_REVERSE); attrset(A_REVERSE);
cnt = outmsg(s); cnt = outmsg(s);
attrset(A_NORMAL); attrset(A_NORMAL);
if (cnt >= (maxx - stchar)) { if (cnt >= (maxx)) {
addch('\n'); // addch('\n');
wait_return(TRUE); } wait_return(TRUE);
}
} }
/*** System error message *****/ /*** System error message *****/
void void
sysemsg(s) sysemsg(char *s)
char *s;
{ {
char string[256]; char string[256];
@ -764,8 +759,7 @@ sysemsg(s)
/*** displays mode if showmode set *****/ /*** displays mode if showmode set *****/
void void
smsg(s) smsg(char *s)
char *s;
{ {
if (P(P_MO)) { if (P(P_MO)) {
msg(s); msg(s);
@ -776,27 +770,27 @@ smsg(s)
/************* displays s on status line *****************/ /************* displays s on status line *****************/
void void
msg(s) msg(char *s)
char *s;
{ {
/*
int stchar; int stchar;
if (P(P_MO)) { if (P(P_MO)) {
stchar = statsize; stchar = statsize;
} else { } else {
stchar = 0; stchar = 0;
} }o*/
statusflag = 0;
clearstr(); clearstr();
if (outmsg(s) >= (maxx - stchar)) { if (outmsg(s) >= maxx) {
addch('\n'); // addch('\n');
wait_return(TRUE); wait_return(TRUE);
} }
} }
int int
outmsg(s) outmsg(char *s)
char *s;
{ {
char *poi; char *poi;
int cnt = 0; int cnt = 0;
@ -828,8 +822,7 @@ outmsg(s)
* *
*/ */
int int
wait_return(flag) wait_return(int flag)
int flag;
{ {
int c; int c;
@ -852,8 +845,7 @@ wait_return(flag)
int int
chk_comm(flag) chk_comm(int flag)
int flag;
{ {
if ((flag & NO_ADDR) && (addr_flag > 0)) { if ((flag & NO_ADDR) && (addr_flag > 0)) {
emsg(noaddr); return 1; } emsg(noaddr); return 1; }

71
config.guess vendored
View file

@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright 1992-2023 Free Software Foundation, Inc. # Copyright 1992-2024 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale # shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2023-01-01' timestamp='2024-07-27'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -47,7 +47,7 @@ me=`echo "$0" | sed -e 's,.*/,,'`
usage="\ usage="\
Usage: $0 [OPTION] Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on. Output the configuration name of the system '$me' is run on.
Options: Options:
-h, --help print this help, then exit -h, --help print this help, then exit
@ -60,13 +60,13 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright 1992-2023 Free Software Foundation, Inc. Copyright 1992-2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help=" help="
Try \`$me --help' for more information." Try '$me --help' for more information."
# Parse command line # Parse command line
while test $# -gt 0 ; do while test $# -gt 0 ; do
@ -102,8 +102,8 @@ GUESS=
# temporary files to be created and, as you can see below, it is a # temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion. # headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated. # use 'HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team. # Portable tmp directory creation inspired by the Autoconf team.
@ -123,7 +123,7 @@ set_cc_for_build() {
dummy=$tmp/dummy dummy=$tmp/dummy
case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
,,) echo "int x;" > "$dummy.c" ,,) echo "int x;" > "$dummy.c"
for driver in cc gcc c89 c99 ; do for driver in cc gcc c17 c99 c89 ; do
if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
CC_FOR_BUILD=$driver CC_FOR_BUILD=$driver
break break
@ -155,6 +155,9 @@ Linux|GNU|GNU/*)
set_cc_for_build set_cc_for_build
cat <<-EOF > "$dummy.c" cat <<-EOF > "$dummy.c"
#if defined(__ANDROID__)
LIBC=android
#else
#include <features.h> #include <features.h>
#if defined(__UCLIBC__) #if defined(__UCLIBC__)
LIBC=uclibc LIBC=uclibc
@ -162,6 +165,8 @@ Linux|GNU|GNU/*)
LIBC=dietlibc LIBC=dietlibc
#elif defined(__GLIBC__) #elif defined(__GLIBC__)
LIBC=gnu LIBC=gnu
#elif defined(__LLVM_LIBC__)
LIBC=llvm
#else #else
#include <stdarg.h> #include <stdarg.h>
/* First heuristic to detect musl libc. */ /* First heuristic to detect musl libc. */
@ -169,6 +174,7 @@ Linux|GNU|GNU/*)
LIBC=musl LIBC=musl
#endif #endif
#endif #endif
#endif
EOF EOF
cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
eval "$cc_set_libc" eval "$cc_set_libc"
@ -459,7 +465,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
UNAME_RELEASE=`uname -v` UNAME_RELEASE=`uname -v`
;; ;;
esac esac
# Japanese Language versions have a version number like `4.1.3-JL'. # Japanese Language versions have a version number like '4.1.3-JL'.
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
GUESS=sparc-sun-sunos$SUN_REL GUESS=sparc-sun-sunos$SUN_REL
;; ;;
@ -628,7 +634,8 @@ EOF
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h> #include <sys/systemcfg.h>
main() int
main ()
{ {
if (!__power_pc()) if (!__power_pc())
exit(1); exit(1);
@ -712,7 +719,8 @@ EOF
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
int main () int
main ()
{ {
#if defined(_SC_KERNEL_BITS) #if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS); long bits = sysconf(_SC_KERNEL_BITS);
@ -904,7 +912,7 @@ EOF
fi fi
;; ;;
*:FreeBSD:*:*) *:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p` UNAME_PROCESSOR=`uname -p`
case $UNAME_PROCESSOR in case $UNAME_PROCESSOR in
amd64) amd64)
UNAME_PROCESSOR=x86_64 ;; UNAME_PROCESSOR=x86_64 ;;
@ -976,7 +984,27 @@ EOF
GUESS=$UNAME_MACHINE-unknown-minix GUESS=$UNAME_MACHINE-unknown-minix
;; ;;
aarch64:Linux:*:*) aarch64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC set_cc_for_build
CPU=$UNAME_MACHINE
LIBCABI=$LIBC
if test "$CC_FOR_BUILD" != no_compiler_found; then
ABI=64
sed 's/^ //' << EOF > "$dummy.c"
#ifdef __ARM_EABI__
#ifdef __ARM_PCS_VFP
ABI=eabihf
#else
ABI=eabi
#endif
#endif
EOF
cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
eval "$cc_set_abi"
case $ABI in
eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
esac
fi
GUESS=$CPU-unknown-linux-$LIBCABI
;; ;;
aarch64_be:Linux:*:*) aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be UNAME_MACHINE=aarch64_be
@ -1042,6 +1070,15 @@ EOF
k1om:Linux:*:*) k1om:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;; ;;
kvx:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
kvx:cos:*:*)
GUESS=$UNAME_MACHINE-unknown-cos
;;
kvx:mbr:*:*)
GUESS=$UNAME_MACHINE-unknown-mbr
;;
loongarch32:Linux:*:* | loongarch64:Linux:*:*) loongarch32:Linux:*:* | loongarch64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;; ;;
@ -1197,7 +1234,7 @@ EOF
GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
;; ;;
i*86:OS/2:*:*) i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility # If we were able to find 'uname', then EMX Unix compatibility
# is probably installed. # is probably installed.
GUESS=$UNAME_MACHINE-pc-os2-emx GUESS=$UNAME_MACHINE-pc-os2-emx
;; ;;
@ -1338,7 +1375,7 @@ EOF
GUESS=ns32k-sni-sysv GUESS=ns32k-sni-sysv
fi fi
;; ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV> # says <Richard.M.Bartel@ccMail.Census.GOV>
GUESS=i586-unisys-sysv4 GUESS=i586-unisys-sysv4
;; ;;
@ -1560,6 +1597,9 @@ EOF
*:Unleashed:*:*) *:Unleashed:*:*)
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
;; ;;
*:Ironclad:*:*)
GUESS=$UNAME_MACHINE-unknown-ironclad
;;
esac esac
# Do we have a guess based on uname results? # Do we have a guess based on uname results?
@ -1583,6 +1623,7 @@ cat > "$dummy.c" <<EOF
#endif #endif
#endif #endif
#endif #endif
int
main () main ()
{ {
#if defined (sony) #if defined (sony)

935
config.sub vendored

File diff suppressed because it is too large Load diff

67
edit.c
View file

@ -12,8 +12,9 @@
* 2006-04-05 V 1.3.3 alpha - binary representation * 2006-04-05 V 1.3.3 alpha - binary representation
* 2014-09-30 V 1.4.0 * 2014-09-30 V 1.4.0
* 2019-10-12 V 1.4.1 * 2019-10-12 V 1.4.1
* 2025-07-19 V 1.5.0
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2025 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
@ -63,8 +64,7 @@ static char *getcnext = NULL;
* characters (for "." command) * characters (for "." command)
*/ */
off_t off_t
edit(mode) edit(int mode)
int mode;
{ {
int ch, ch1; int ch, ch1;
size_t len; size_t len;
@ -286,8 +286,7 @@ escape:
* else setpage() * else setpage()
*/ */
PTR PTR
do_ft(ch, flag) do_ft(int ch, int flag)
int ch, flag;
{ {
static int chi; static int chi;
static int chp = 1; static int chp = 1;
@ -364,8 +363,7 @@ do_ft(ch, flag)
void void
do_z(mode) do_z(int mode)
int mode;
{ {
switch (mode) { switch (mode) {
case '.': while (y != maxy / 2) { case '.': while (y != maxy / 2) {
@ -401,8 +399,7 @@ do_z(mode)
void void
scrolldown(lns) scrolldown(int lns)
int lns;
{ {
while (lns--) { while (lns--) {
if (maxpos >= (pagepos + Anzahl)) pagepos += Anzahl; if (maxpos >= (pagepos + Anzahl)) pagepos += Anzahl;
@ -414,8 +411,7 @@ scrolldown(lns)
void void
scrollup(lns) scrollup(int lns)
int lns;
{ {
while (lns--) { while (lns--) {
if (mem <= (PTR)(pagepos - Anzahl)) pagepos -= Anzahl; if (mem <= (PTR)(pagepos - Anzahl)) pagepos -= Anzahl;
@ -465,7 +461,8 @@ statpos()
off_t bytepos; off_t bytepos;
char string[MAXCMD+1], str[6]; char string[MAXCMD+1], str[6];
if (!P(P_MO)) return; // if (!P(P_MO)) return;
if (!statusflag) return;
bytepos = current - mem; bytepos = current - mem;
if (bytepos >= filesize) { if (bytepos >= filesize) {
// mvaddstr(maxy, status, " "); // mvaddstr(maxy, status, " ");
@ -484,10 +481,18 @@ statpos()
} }
bin_val[8] = '\0'; bin_val[8] = '\0';
sprintf(string, "%08llX %s \\%03o 0x%02X %3d ",
(long long)(bytepos + P(P_OF)), bin_val, Char1, Char1, Char1);
attrset(A_BOLD); attrset(A_BOLD);
status = maxx - 1 - statsize; status = maxx - 1 - statsize;
if (status > 0) {
sprintf(string, "%08llX %s \\%03o 0x%02X %3d ",
(long long)(bytepos + P(P_OF)), bin_val, Char1, Char1, Char1);
} else {
sprintf(string, "%08llX %3d ",
(long long)(bytepos + P(P_OF)), Char1);
mvaddstr(maxy, 0, string);
attrset(A_NORMAL);
return;
}
mvaddstr(maxy, status, string); mvaddstr(maxy, status, string);
if (isprint(Char1)) { if (isprint(Char1)) {
@ -521,10 +526,9 @@ statpos()
} }
void void
printline(mempos, scpos) printline(PTR mempos, int scpos)
PTR mempos;
int scpos;
{ {
PTR hl_start = 0; PTR hl_start = 0;
PTR hl_end = 0; PTR hl_end = 0;
@ -660,8 +664,7 @@ repaint() /***** redraw screen *********************/
/******* display an arbitrary address on screen *******/ /******* display an arbitrary address on screen *******/
void void
setpage(addr) setpage(PTR addr)
PTR addr;
{ {
if ((addr >= pagepos) && ((addr - pagepos) < screen)) { if ((addr >= pagepos) && ((addr - pagepos) < screen)) {
y = (addr - pagepos) / Anzahl; y = (addr - pagepos) / Anzahl;
@ -684,8 +687,7 @@ setpage(addr)
int int
cur_forw(check) cur_forw(int check)
int check;
{ {
if (check) { if (check) {
if (current - mem >= filesize) { if (current - mem >= filesize) {
@ -760,8 +762,7 @@ cur_back()
void void
fileinfo(fname) fileinfo(char *fname)
char *fname;
{ {
off_t bytepos; off_t bytepos;
char fstatus[MAXCMD]; char fstatus[MAXCMD];
@ -830,8 +831,7 @@ vgetc()
void void
stuffin(s) stuffin(char *s)
char *s;
{ {
if (s == NULL) { /* clear the stuff buffer */ if (s == NULL) { /* clear the stuff buffer */
getcnext = NULL; getcnext = NULL;
@ -846,9 +846,7 @@ char *s;
void void
do_back(n, start) do_back(off_t n, PTR start)
off_t n;
PTR start;
{ {
if (start - n < mem) { if (start - n < mem) {
beep(); beep();
@ -870,9 +868,7 @@ do_back(n, start)
int int
do_delete(n, start) do_delete(off_t n, PTR start)
off_t n;
PTR start;
{ {
if (n + start > maxpos) { if (n + start > maxpos) {
beep(); beep();
@ -902,10 +898,7 @@ do_delete(n, start)
* The :insert, :append and :change command * The :insert, :append and :change command
*/ */
void void
do_ins_chg(start, arg, mode) do_ins_chg(PTR start, char *arg, int mode)
PTR start;
char *arg;
int mode;
{ {
int base; int base;
off_t buffer = BUFFER; off_t buffer = BUFFER;
@ -1021,9 +1014,7 @@ clear_marks()
void void
do_mark(mark, addr) do_mark(int mark, PTR addr)
int mark;
PTR addr;
{ {
if (mark < 'a' || mark > 'z' || current >= maxpos) if (mark < 'a' || mark > 'z' || current >= maxpos)
return; return;

33
io.c
View file

@ -12,10 +12,11 @@
* 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 * 2022-03-09 V 1.4.2
* 2025-07-19 V 1.5.0
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2022 by Gerhard Buergmann * Copyright 1996-2025 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
@ -79,11 +80,7 @@ extern char *fname_buf;
/*********** Save the patched file ********************/ /*********** Save the patched file ********************/
int int
save(fname, start, end, flags) save(char *fname, char *start, char *end, int flags)
char *fname;
char *start;
char *end;
int flags;
{ {
int fd; int fd;
char *string; char *string;
@ -167,8 +164,7 @@ save(fname, start, end, flags)
/* loads a file, returns the filesize */ /* loads a file, returns the filesize */
off_t off_t
load(fname) load(char *fname)
char *fname;
{ {
int fd = -1; int fd = -1;
//char *string; //char *string;
@ -337,8 +333,7 @@ load(fname)
* Needed for DOS version only * Needed for DOS version only
*/ */
void void
bvi_init(dir) bvi_init(char *dir)
char *dir;
{ {
char *initstr; char *initstr;
char rcpath[MAXCMD]; char rcpath[MAXCMD];
@ -378,8 +373,7 @@ bvi_init(dir)
int int
enlarge(add) enlarge(off_t add)
off_t add;
{ {
char *newmem; char *newmem;
off_t savecur, savepag, savemax, saveundo; off_t savecur, savepag, savemax, saveundo;
@ -428,8 +422,7 @@ do_shell()
#ifndef HAVE_STRDUP #ifndef HAVE_STRDUP
char * char *
strdup(s) strdup(char *s)
char *s;
{ {
char *p; char *p;
size_t n; size_t n;
@ -447,10 +440,7 @@ strdup(s)
* Copy contents of memory (with possible overlapping). * Copy contents of memory (with possible overlapping).
*/ */
char * char *
memmove(s1, s2, n) memmove(char *s1, char *s2, size_t n)
char *s1;
char *s2;
size_t n;
{ {
bcopy(s2, s1, n); bcopy(s2, s1, n);
return(s1); return(s1);
@ -459,9 +449,7 @@ memmove(s1, s2, n)
off_t off_t
alloc_buf(n, buffer) alloc_buf(off_t n, char **buffer)
off_t n;
char **buffer;
{ {
if (*buffer == NULL) { if (*buffer == NULL) {
*buffer = (char *)malloc(n); *buffer = (char *)malloc(n);
@ -477,8 +465,7 @@ alloc_buf(n, buffer)
int int
addfile(fname) addfile(char *fname)
char *fname;
{ {
int fd; int fd;
off_t oldsize; off_t oldsize;

View file

@ -35,7 +35,7 @@ AC_CHECK_HEADER
] ]
) )
],[ ],[
# statt: AC_MSG_ERROR([bvi requires a curses library]) # statt: AC_MSG_ERROR([bvi requires a curses library])
AC_CHECK_HEADER AC_CHECK_HEADER
( (
[ncursesw/curses.h], [ncursesw/curses.h],

View file

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

64
re.c
View file

@ -12,8 +12,9 @@
* 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 * 2023-03-07 V 1.4.2
* 2025-07-19 V 1.5.0
* *
* Copyright 1996-2023 by Gerhard Buergmann * Copyright 1996-2025 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
@ -36,7 +37,11 @@
#include "bvi.h" #include "bvi.h"
#include "set.h" #include "set.h"
#ifdef __STDC__
static int sbracket(int, char *, int);
#else
static int sbracket(); static int sbracket();
#endif
char act_pat[MAXCMD]; /* found pattern */ char act_pat[MAXCMD]; /* found pattern */
char pattern[MAXCMD + 1]; char pattern[MAXCMD + 1];
@ -48,9 +53,7 @@ char *emptyclass = "Bad character class|Empty byte class '[]' or '[^]' cannot ma
PTR PTR
bregexec(start, scan) bregexec(PTR start, char *scan)
PTR start;
char *scan;
{ {
char *act; char *act;
int count, test; int count, test;
@ -125,10 +128,7 @@ bregexec(start, scan)
static int static int
sbracket(start, scan, count) sbracket(int start, char *scan, int count)
int start;
char *scan;
int count;
{ {
if (*scan++ == '^') { if (*scan++ == '^') {
if (!memchr(scan, start, --count)) return 0; if (!memchr(scan, start, --count)) return 0;
@ -140,8 +140,7 @@ sbracket(start, scan, count)
PTR PTR
end_word(start) end_word(PTR start)
PTR start;
{ {
PTR pos; PTR pos;
@ -155,9 +154,7 @@ end_word(start)
/* wordsearch serves the 'W' and 'w' - command /* wordsearch serves the 'W' and 'w' - command
*/ */
PTR PTR
wordsearch(start, mode) wordsearch(PTR start, char mode)
PTR start;
char mode;
{ {
PTR found; PTR found;
PTR pos; PTR pos;
@ -187,9 +184,7 @@ wordsearch(start, mode)
/* backsearch serves the 'b' and 'B' command /* backsearch serves the 'b' and 'B' command
*/ */
PTR PTR
backsearch(start, mode) backsearch(PTR start, char mode)
PTR start;
char mode;
{ {
PTR pos; PTR pos;
int ccount; int ccount;
@ -216,11 +211,7 @@ backsearch(start, mode)
/* used by :s /* used by :s
*/ */
int int
do_substitution(delim, line, startpos, endpos) do_substitution(int delim, char *line, PTR startpos, PTR endpos)
int delim;
char *line;
PTR startpos;
PTR endpos;
{ {
int n; int n;
char *found; char *found;
@ -376,12 +367,7 @@ SKIP:
* return address found * return address found
*/ */
PTR PTR
searching(ch, line, startpos, endpos, flag) searching(int ch, char *line, PTR startpos, PTR endpos, int flag)
int ch;
char *line;
PTR startpos;
PTR endpos;
int flag;
{ {
char *cmd = NULL; char *cmd = NULL;
PTR found; PTR found;
@ -485,9 +471,7 @@ searching(ch, line, startpos, endpos, flag)
* returns pointer to next character * returns pointer to next character
*/ */
char * char *
patcpy(s1, s2, delim) patcpy(char *s1, char *s2, char delim)
char *s1, *s2;
char delim;
{ {
while (*s2 != '\0' && *s2 != delim) { while (*s2 != '\0' && *s2 != delim) {
if (*s2 == '\\' && *(s2 + 1) == delim) s2++; if (*s2 == '\\' && *(s2 + 1) == delim) s2++;
@ -500,14 +484,10 @@ patcpy(s1, s2, delim)
PTR PTR
fsearch_end(start, end, smem, s_end) fsearch_end(PTR start, PTR end, char *smem, PTR *s_end)
/* /*
fsearch(start, end, smem) fsearch(start, end, smem)
*/ */
PTR start;
PTR end;
char *smem;
PTR *s_end;
{ {
PTR spos; PTR spos;
@ -526,10 +506,7 @@ fsearch(start, end, smem)
PTR PTR
fsearch(start, end, smem) fsearch(PTR start, PTR end, char *smem)
PTR start;
PTR end;
char *smem;
{ {
PTR s_end; PTR s_end;
return fsearch_end(start, end, smem, &s_end); return fsearch_end(start, end, smem, &s_end);
@ -537,10 +514,7 @@ fsearch(start, end, smem)
PTR PTR
rsearch(start, end, smem) rsearch(PTR start, PTR end, char *smem)
PTR start;
PTR end;
char *smem;
{ {
PTR spos; PTR spos;
@ -560,9 +534,7 @@ rsearch(start, end, smem)
* returns NULL on error or default_address, if nothing found * returns NULL on error or default_address, if nothing found
*/ */
PTR PTR
calc_addr(pointer, def_addr) calc_addr(char **pointer, PTR def_addr)
char **pointer;
PTR def_addr;
{ {
PTR addr; PTR addr;
int ch, mark; int ch, mark;

View file

@ -6,8 +6,9 @@
* 2000-04-25 V 1.3.0 beta * 2000-04-25 V 1.3.0 beta
* 2000-07-12 V 1.3.0 final * 2000-07-12 V 1.3.0 final
* 2019-01-28 V 1.4.1 * 2019-01-28 V 1.4.1
* 2025-07-19 V 1.5.0
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2025 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
@ -46,9 +47,7 @@ extern char *emptyclass;
* Compiling an ASCII sequence to a regex string * Compiling an ASCII sequence to a regex string
*/ */
int int
ascii_comp(smem, pattern) ascii_comp(char *smem, char *pattern)
char *smem;
char *pattern;
{ {
char *end; char *end;
char *comp; char *comp;
@ -167,9 +166,7 @@ ascii_comp(smem, pattern)
* Compiling a hex expression to a regex string * Compiling a hex expression to a regex string
*/ */
int int
hex_comp(smem, pattern) hex_comp(char *smem, char *pattern)
char *smem;
char *pattern;
{ {
char *end; char *end;
char *comp; char *comp;

88
set.c
View file

@ -14,8 +14,9 @@
* 2010-06-02 V 1.2.4 * 2010-06-02 V 1.2.4
* 2014-09-30 V 1.4.0 * 2014-09-30 V 1.4.0
* 2019-01-22 V 1.4.1 * 2019-01-22 V 1.4.1
* 2025-07-19 V 1.5.0
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2025 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
@ -41,7 +42,7 @@ static char buf[MAXCMD+1];
struct param params[] = { struct param params[] = {
{ "autowrite", "aw", FALSE, "", P_BOOL }, { "autowrite", "aw", FALSE, "", P_BOOL },
{ "columns", "cm", 16, "", P_NUM }, { "columns", "cm", 0, "", P_NUM },
{ "errorbells", "eb", FALSE, "", P_BOOL }, { "errorbells", "eb", FALSE, "", P_BOOL },
{ "ignorecase", "ic", FALSE, "", P_BOOL }, { "ignorecase", "ic", FALSE, "", P_BOOL },
{ "magic", "ma", TRUE, "", P_BOOL }, { "magic", "ma", TRUE, "", P_BOOL },
@ -53,7 +54,7 @@ struct param params[] = {
{ "term", "term", 0, "", P_TEXT }, { "term", "term", 0, "", P_TEXT },
{ "terse", "terse", FALSE, "", P_BOOL }, { "terse", "terse", FALSE, "", P_BOOL },
{ "unixstyle", "us", FALSE, "", P_BOOL }, { "unixstyle", "us", FALSE, "", P_BOOL },
{ "window", "window", 25, "", P_NUM }, { "window", "window", 0, "", P_NUM },
{ "wordlength", "wl", 4, "", P_NUM }, { "wordlength", "wl", 4, "", P_NUM },
{ "wrapscan", "ws", TRUE, "", P_BOOL }, { "wrapscan", "ws", TRUE, "", P_BOOL },
{ "highlight", "hl", TRUE, "", P_BOOL }, { "highlight", "hl", TRUE, "", P_BOOL },
@ -65,15 +66,16 @@ struct param params[] = {
}; };
int int
doset(arg) doset(char *arg)
char *arg; /* parameter string */
{ {
int i; int i;
char *s; char *s;
int did_window = FALSE; int did_window = FALSE;
int state = TRUE; /* new state of boolean parms. */ int state = TRUE; /* new state of boolean parms. */
char string[80]; char string[80];
off_t val;
if (arg == NULL) { if (arg == NULL) {
showparms(FALSE); showparms(FALSE);
@ -111,20 +113,38 @@ doset(arg)
return 0; return 0;
} }
if (!strcmp(params[i].fullname, "term")) { if (!strcmp(params[i].fullname, "term")) {
emsg("Can't change type of terminal from within bvi"); emsg("Can't change@type of terminal from within bvi");
return 1; return 1;
} }
if (params[i].flags & P_NUM) { if (params[i].flags & P_NUM) {
if ((i == P_LI) || (i == P_OF)) did_window++; if ((i == P_LI) || (i == P_OF) || (i == P_CM)) did_window++;
if (arg[strlen(s)] != '=' || state == FALSE) { if (arg[strlen(s)] != '=' || state == FALSE) {
sprintf(string, "Option %s is not a toggle", sprintf(string, "Option %s is not a toggle", params[i].fullname);
params[i].fullname);
emsg(string); emsg(string);
return 1; return 1;
} else { } else {
s = arg + strlen(s) + 1; s = arg + strlen(s) + 1;
params[i].nvalue = strtoll(s, &s, 0); val = strtoll(s, &s, 0);
if ((i == P_CM || i == P_LI) && (!strcmp("auto", s) || (val == 0))) {
if (i == P_CM) {
params[i].nvalue = 0;
Anzahl = ((COLS - AnzAdd - space) / 4);
} else {
params[i].nvalue = 0;
maxy = LINES - 1;
}
} else {
params[i].nvalue = val;
if (i == P_CM) {
Anzahl = val;
} else {
maxy = val;
}
}
params[i].flags |= P_CHANGED; params[i].flags |= P_CHANGED;
if (i == P_LI) params[P_SS].nvalue = val / 2;
#if defined(__MSDOS__) && !defined(DJGPP) #if defined(__MSDOS__) && !defined(DJGPP)
if (i == P_CO) { if (i == P_CO) {
textcolor(P(P_CO) & 0x07); textcolor(P(P_CO) & 0x07);
@ -134,22 +154,23 @@ doset(arg)
} }
#endif #endif
if (i == P_CM) { if (i == P_CM) {
/*
if (((COLS - AnzAdd - 1) / 4) >= P(P_CM)) { if (((COLS - AnzAdd - 1) / 4) >= P(P_CM)) {
Anzahl = P(P_CM); Anzahl = P(P_CM);
} else { } else {
Anzahl = P(P_CM) = ((COLS - AnzAdd - 1) / 4); Anzahl = ((COLS - AnzAdd - 1) / 4);
} }
*/
maxx = Anzahl * 4 + AnzAdd + 1; maxx = Anzahl * 4 + AnzAdd + 1;
Anzahl3 = Anzahl * 3; Anzahl3 = Anzahl * 3;
status = Anzahl3 + Anzahl - 17; status = Anzahl3 + Anzahl - statsize;
screen = Anzahl * (maxy - 1); screen = Anzahl * (maxy - 1);
did_window++;
stuffin("H"); /* set cursor at HOME */ stuffin("H"); /* set cursor at HOME */
} }
} }
} else { /* boolean */ } else { /* boolean */
if (arg[strlen(s)] == '=') { if (arg[strlen(s)] == '=') {
emsg("Invalid set of boolean parameter"); emsg("Invalid set@of boolean parameter");
return 1; return 1;
} else { } else {
params[i].nvalue = state; params[i].nvalue = state;
@ -169,7 +190,10 @@ doset(arg)
} }
if (did_window) { if (did_window) {
/*
maxy = P(P_LI) - 1; maxy = P(P_LI) - 1;
maxy = LINES - 1;
*/
new_screen(); new_screen();
} }
@ -179,28 +203,33 @@ doset(arg)
/* show ALL parameters */ /* show ALL parameters */
void void
showparms(all) showparms(int all)
int all;
{ {
struct param *p; struct param *p;
int n; int n, i;
statusflag = 0;
n = 2; n = 2;
i = -1;
msg("Parameters:\n"); msg("Parameters:\n");
for (p = &params[0]; p->fullname[0] != '\0' ;p++) { for (p = &params[0]; p->fullname[0] != '\0' ;p++) {
i++;
if (!all && ((p->flags & P_CHANGED) == 0)) if (!all && ((p->flags & P_CHANGED) == 0))
continue; continue;
if (p->flags & P_BOOL) if (p->flags & P_BOOL) {
sprintf(buf, " %s%s\n", sprintf(buf, " %s%s\n", (p->nvalue ? " " : "no"), p->fullname);
(p->nvalue ? " " : "no"), p->fullname); } else if (p->flags & P_TEXT) {
else if (p->flags & P_TEXT)
sprintf(buf, " %s=%s\n", p->fullname, p->svalue); sprintf(buf, " %s=%s\n", p->fullname, p->svalue);
else } else {
if ((p->nvalue == 0) && (i == P_CM || i == P_LI)) {
sprintf(buf, " %s=auto\n", p->fullname);
} else {
sprintf(buf, " %s=%lld\n", p->fullname, (long long)p->nvalue); sprintf(buf, " %s=%lld\n", p->fullname, (long long)p->nvalue);
}
}
msg(buf); msg(buf);
n++; n++;
if (n == params[P_LI].nvalue) { if (n == maxy) {
if (wait_return(FALSE)) return; if (wait_return(FALSE)) return;
n = 1; n = 1;
} }
@ -211,8 +240,7 @@ showparms(all)
/* reads the init file (.bvirc) */ /* reads the init file (.bvirc) */
int int
read_rc(fn) read_rc(char *fn)
char *fn;
{ {
int i; int i;
@ -230,9 +258,7 @@ read_rc(fn)
int int
do_logic(mode, str) do_logic(int mode, char *str)
int mode;
char *str;
{ {
int a, b; int a, b;
int value; int value;
@ -318,9 +344,7 @@ do_logic(mode, str)
int int
getcmdstr(p, x) getcmdstr(char *p, int x)
char *p;
int x;
{ {
int c; int c;
int i, n; int i, n;

5
set.h
View file

@ -2,8 +2,8 @@
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2019 by Gerhard Buergmann * Copyright 1996-2025 by Gerhard Buergmann
* Gerhard.Buergmann@puon.at * gerhard@puon.at
* *
* 1998-03-14 V 1.0.0 * 1998-03-14 V 1.0.0
* 1999-01-14 V 1.1.0 * 1999-01-14 V 1.1.0
@ -14,6 +14,7 @@
* 2010-06-02 V 1.3.4 * 2010-06-02 V 1.3.4
* 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
* 2025-05-24 V 1.5.0
* *
* 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
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the

1091
tags

File diff suppressed because it is too large Load diff