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:
parent
75fc14b579
commit
50898d8d59
28 changed files with 1936 additions and 1473 deletions
74
re.c
74
re.c
|
@ -12,8 +12,9 @@
|
|||
* 2013-08-24 V 1.4.0
|
||||
* 2019-01-28 V 1.4.1
|
||||
* 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
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
|
@ -32,11 +33,15 @@
|
|||
/* You cannot use a common regexp subroutine, because \0 is a regular
|
||||
* character in a binary string !
|
||||
*/
|
||||
|
||||
|
||||
#include "bvi.h"
|
||||
#include "set.h"
|
||||
|
||||
#ifdef __STDC__
|
||||
static int sbracket(int, char *, int);
|
||||
#else
|
||||
static int sbracket();
|
||||
#endif
|
||||
|
||||
char act_pat[MAXCMD]; /* found pattern */
|
||||
char pattern[MAXCMD + 1];
|
||||
|
@ -48,9 +53,7 @@ char *emptyclass = "Bad character class|Empty byte class '[]' or '[^]' cannot ma
|
|||
|
||||
|
||||
PTR
|
||||
bregexec(start, scan)
|
||||
PTR start;
|
||||
char *scan;
|
||||
bregexec(PTR start, char *scan)
|
||||
{
|
||||
char *act;
|
||||
int count, test;
|
||||
|
@ -125,10 +128,7 @@ bregexec(start, scan)
|
|||
|
||||
|
||||
static 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;
|
||||
|
@ -140,8 +140,7 @@ sbracket(start, scan, count)
|
|||
|
||||
|
||||
PTR
|
||||
end_word(start)
|
||||
PTR start;
|
||||
end_word(PTR start)
|
||||
{
|
||||
PTR pos;
|
||||
|
||||
|
@ -155,9 +154,7 @@ end_word(start)
|
|||
/* wordsearch serves the 'W' and 'w' - command
|
||||
*/
|
||||
PTR
|
||||
wordsearch(start, mode)
|
||||
PTR start;
|
||||
char mode;
|
||||
wordsearch(PTR start, char mode)
|
||||
{
|
||||
PTR found;
|
||||
PTR pos;
|
||||
|
@ -187,9 +184,7 @@ wordsearch(start, mode)
|
|||
/* backsearch serves the 'b' and 'B' command
|
||||
*/
|
||||
PTR
|
||||
backsearch(start, mode)
|
||||
PTR start;
|
||||
char mode;
|
||||
backsearch(PTR start, char mode)
|
||||
{
|
||||
PTR pos;
|
||||
int ccount;
|
||||
|
@ -216,11 +211,7 @@ backsearch(start, mode)
|
|||
/* used by :s
|
||||
*/
|
||||
int
|
||||
do_substitution(delim, line, startpos, endpos)
|
||||
int delim;
|
||||
char *line;
|
||||
PTR startpos;
|
||||
PTR endpos;
|
||||
do_substitution(int delim, char *line, PTR startpos, PTR endpos)
|
||||
{
|
||||
int n;
|
||||
char *found;
|
||||
|
@ -332,9 +323,9 @@ AGAIN:
|
|||
emsg(notfound);
|
||||
} else {
|
||||
if (P(P_TE))
|
||||
sprintf(string, "No match to %s", direct == FORWARD ? "BOTTOM" : "TOP");
|
||||
sprintf(string, "No match to %s", direct == FORWARD ? "BOTTOM" : "TOP");
|
||||
else
|
||||
sprintf(string, "Address search hit %s without matching pattern",
|
||||
sprintf(string, "Address search hit %s without matching pattern",
|
||||
direct == FORWARD ? "BOTTOM" : "TOP");
|
||||
emsg(string);
|
||||
}
|
||||
|
@ -376,12 +367,7 @@ SKIP:
|
|||
* return address found
|
||||
*/
|
||||
PTR
|
||||
searching(ch, line, startpos, endpos, flag)
|
||||
int ch;
|
||||
char *line;
|
||||
PTR startpos;
|
||||
PTR endpos;
|
||||
int flag;
|
||||
searching(int ch, char *line, PTR startpos, PTR endpos, int flag)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
PTR found;
|
||||
|
@ -455,9 +441,9 @@ searching(ch, line, startpos, endpos, flag)
|
|||
emsg(notfound);
|
||||
} else {
|
||||
if (P(P_TE)) {
|
||||
sprintf(string, "No match to %s", sdir == FORWARD ? "BOTTOM" : "TOP");
|
||||
sprintf(string, "No match to %s", sdir == FORWARD ? "BOTTOM" : "TOP");
|
||||
} else {
|
||||
sprintf(string, "Address search hit %s without matching pattern",
|
||||
sprintf(string, "Address search hit %s without matching pattern",
|
||||
sdir == FORWARD ? "BOTTOM" : "TOP");
|
||||
}
|
||||
emsg(string);
|
||||
|
@ -485,9 +471,7 @@ searching(ch, line, startpos, endpos, flag)
|
|||
* returns pointer to next character
|
||||
*/
|
||||
char *
|
||||
patcpy(s1, s2, delim)
|
||||
char *s1, *s2;
|
||||
char delim;
|
||||
patcpy(char *s1, char *s2, char delim)
|
||||
{
|
||||
while (*s2 != '\0' && *s2 != delim) {
|
||||
if (*s2 == '\\' && *(s2 + 1) == delim) s2++;
|
||||
|
@ -500,14 +484,10 @@ patcpy(s1, s2, delim)
|
|||
|
||||
|
||||
PTR
|
||||
fsearch_end(start, end, smem, s_end)
|
||||
fsearch_end(PTR start, PTR end, char *smem, PTR *s_end)
|
||||
/*
|
||||
fsearch(start, end, smem)
|
||||
*/
|
||||
PTR start;
|
||||
PTR end;
|
||||
char *smem;
|
||||
PTR *s_end;
|
||||
{
|
||||
PTR spos;
|
||||
|
||||
|
@ -526,10 +506,7 @@ fsearch(start, end, smem)
|
|||
|
||||
|
||||
PTR
|
||||
fsearch(start, end, smem)
|
||||
PTR start;
|
||||
PTR end;
|
||||
char *smem;
|
||||
fsearch(PTR start, PTR end, char *smem)
|
||||
{
|
||||
PTR s_end;
|
||||
return fsearch_end(start, end, smem, &s_end);
|
||||
|
@ -537,10 +514,7 @@ fsearch(start, end, smem)
|
|||
|
||||
|
||||
PTR
|
||||
rsearch(start, end, smem)
|
||||
PTR start;
|
||||
PTR end;
|
||||
char *smem;
|
||||
rsearch(PTR start, PTR end, char *smem)
|
||||
{
|
||||
PTR spos;
|
||||
|
||||
|
@ -560,9 +534,7 @@ rsearch(start, end, smem)
|
|||
* returns NULL on error or default_address, if nothing found
|
||||
*/
|
||||
PTR
|
||||
calc_addr(pointer, def_addr)
|
||||
char **pointer;
|
||||
PTR def_addr;
|
||||
calc_addr(char **pointer, PTR def_addr)
|
||||
{
|
||||
PTR addr;
|
||||
int ch, mark;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue