1
0
Fork 0
mirror of https://github.com/vbatts/bvi.git synced 2025-08-03 08:00:27 +00:00

bvi-1.5.0.src.tar.gz

6540716a1a3b2b9711635108da14b26baea488881d4a682121c0bddbba6b74cb  bvi-1.5.0.src.tar.gz

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Gerhard Bürgmann 2025-07-27 10:02:07 -04:00 committed by Vincent Batts
parent 75fc14b579
commit 50898d8d59
Signed by: vbatts
GPG key ID: E30EFAA812C6E5ED
28 changed files with 1936 additions and 1473 deletions

80
bmore.c
View file

@ -9,8 +9,9 @@
* 2013-08-23 V 1.4.0
* 2019-01-22 V 1.4.1
* 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
*
* NOTE: Edit this file with tabstop=4 !
@ -113,9 +114,7 @@ usage()
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
int ch, ch1;
int colon = 0, last_ch = 0;
@ -141,7 +140,7 @@ main(argc, argv)
#endif
poi = strrchr(argv[0], DELIM);
if (poi) strncpy(progname, ++poi, 9);
else strncpy(progname, argv[0], 9);
strtok(progname, ".");
@ -177,7 +176,7 @@ main(argc, argv)
break;
case 'r': r_flag++;
break;
default:
default:
usage();
}
i++;
@ -340,7 +339,7 @@ main(argc, argv)
fclose(curr_file);
reset_tty();
exit(exval);
case ':' :
case ':' :
switch (colon) {
case 'f':
prompt = 0;
@ -449,7 +448,7 @@ main(argc, argv)
bytepos = screen_home;
to_print = maxy;
break;
case '\\':
case '\\':
if (ascii_flag) {
bmbeep();
break;
@ -460,13 +459,13 @@ main(argc, argv)
if (rdline(ch, sstring)) break;
}
case 'n': /**** Search Next ****/
case 'N':
case 'N':
bmsearch(ch);
/*
to_print--;
*/
break;
case '\'':
case '\'':
if (no_intty) {
bmbeep();
} else {
@ -493,7 +492,7 @@ main(argc, argv)
break;
}
while ((ch1 = getc(help_file)) != EOF)
putchar(ch1);
putchar(ch1);
fclose(help_file);
to_print = 0;
break;
@ -502,13 +501,13 @@ main(argc, argv)
if (!no_intty) {
cleartoeol();
if (ch == 'v') {
sprintf(string, "bvi +%lu %s",
(unsigned long)(screen_home +
sprintf(string, "bvi +%lu %s",
(unsigned long)(screen_home +
(maxy + 1) / 2 * out_len), name);
} else {
if (precount < 1) precount = bytepos - screen_home;
sprintf(string, "bvi -b %lu -s %lu %s",
(unsigned long)screen_home,
(unsigned long)screen_home,
(unsigned long)precount, name);
}
doshell(string);
@ -533,9 +532,7 @@ main(argc, argv)
int
rdline(ch, sstring)
int ch;
char *sstring;
rdline(int ch, char *sstring)
{
int i = 0;
int ch1 = 0;
@ -587,8 +584,7 @@ rdline(ch, sstring)
void
do_next(n)
int n;
do_next(int n)
{
if (numfiles) {
if (n == 1 && file_nr == numfiles) {
@ -614,8 +610,7 @@ do_next(n)
int
open_file(name)
char *name;
open_file(char *name)
{
struct stat buf;
@ -636,9 +631,7 @@ open_file(name)
void
putline(buf, num)
char *buf;
int num;
putline(char *buf, int num)
{
int print_pos;
unsigned char ch;
@ -649,31 +642,31 @@ putline(buf, num)
if (!ascii_flag) {
for (print_pos = 0; print_pos < num; print_pos++) {
ch = buf[print_pos];
PRINTF("%02X ", ch);
PRINTF("%02X ", ch);
}
for (; print_pos < out_len; print_pos++) {
PRINTF(" ");
PRINTF(" ");
}
PRINTF(" ");
}
// ASCII section
for (print_pos = 0; print_pos < num; print_pos++) {
++bytepos;
ch = buf[print_pos];
if ((ch > 31) && (ch < 127)) {
PRINTF("%c", ch);
PRINTF("%c", ch);
} else {
if (r_flag) {
if ((ch & 128) && ((ch > 159) && (ch < 255))) {
if (!no_tty) highlight();
PRINTF("%c", ch & 127);
PRINTF("%c", ch & 127);
if (!no_tty) normal();
} else {
PRINTF(".");
PRINTF(".");
}
} else {
PRINTF(".");
PRINTF(".");
}
}
}
@ -689,13 +682,12 @@ putline(buf, num)
int
printout(lns)
int lns;
printout(int lns)
{
int c, num;
int doub = 0;
static int flag;
if (c_flag) {
clearscreen();
}
@ -755,9 +747,7 @@ nextchar()
void
pushback(n, where)
int n;
char *where;
pushback(int n, char *where)
{
if (cnt) memmove(cmdbuf + n, cmdbuf, n);
memcpy(cmdbuf, where, n);
@ -774,8 +764,7 @@ pushback(n, where)
* 1 found
*/
int
bmregexec(scan)
char *scan;
bmregexec(char *scan)
{
char *act;
int count, test;
@ -869,7 +858,7 @@ bmregexec(scan)
pushback(1, --act);
l--;
}
} else { /* ".*" */
} else { /* ".*" */
do {
if ((test = nextchar()) == -1) return -5;
*act++ = test;
@ -893,10 +882,7 @@ bmregexec(scan)
int
sbracket(start, scan, count)
int start;
char *scan;
int count;
sbracket(int start, char *scan, int count)
{
if (*scan++ == '^') {
if (!memchr(scan, start, --count)) return 0;
@ -908,8 +894,7 @@ sbracket(start, scan, count)
void
bmsearch(ch)
int ch;
bmsearch(int ch)
{
int i;
@ -961,8 +946,7 @@ emsg(string);
void
emsg(s)
char *s;
emsg(char *s)
{
putchar('\r');
cleartoeol();