CVS commit: othersrc/external/bsd/agcre/dist

2023-06-21 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Jun 21 23:48:08 UTC 2023

Modified Files:
othersrc/external/bsd/agcre/dist: agcre.c agcre.h
othersrc/external/bsd/agcre/dist/tests: 62.expected

Log Message:
agcre version 20230621
==

+ agcre - added internal magic numbers to agcre to attempt to catch
  if misbehaving programs overwrite sections of memory
+ agcre - check internal magic numbers before attempting to execute
  regex programs
+ agcre - bump agcre magic number in the external structure
+ agcre - bump version number in header file. Fix up tests to ensure
  correct operation


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/agcre/dist/agcre.c
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/agcre/dist/agcre.h
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/agcre/dist/tests/62.expected

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/agcre/dist/agcre.c
diff -u othersrc/external/bsd/agcre/dist/agcre.c:1.3 othersrc/external/bsd/agcre/dist/agcre.c:1.4
--- othersrc/external/bsd/agcre/dist/agcre.c:1.3	Fri Feb 24 19:01:10 2023
+++ othersrc/external/bsd/agcre/dist/agcre.c	Wed Jun 21 23:48:08 2023
@@ -159,17 +159,26 @@ typedef struct threadlist_t {
 	re_thread_t	t[1];			/* the threads */
 } threadlist_t;
 
+#define MAGIC1		0xac1deaf0
+#define MAGIC2		0x41525345
+#define MAGIC3		0xd0d0d00d
+#define MAGIC4		0x666f7572
+
 /* regular expression internals */
 typedef struct re_t {
+	uint32_t	 magic1;	/* magic number #1 */
 	instr_t		*prog;		/* start of instructions */
 	uint32_t	 instrc;	/* # of instructions */
 	uint32_t	 gen;		/* generation number */
 	uint32_t	 setc;		/* # of sets */
 	uint32_t	 maxset;	/* allocated # of sets */
+	uint32_t	 magic2;	/* magic number #2 */
 	set_t		*sets;		/* sets */
 	uint32_t	 flags;		/* comp/exec flags */
 	context_t	*ctxlist;	/* list of contexts */
+	uint32_t	 magic3;	/* magic number #3 */
 	instr_t		*pc;		/* prog counter */
+	uint32_t	 magic4;	/* magic number #4 */
 	int		 msgc;		/* # of chars in msg buffer */
 	char		 msg[256];	/* message buffer */
 } re_t;
@@ -2669,6 +2678,22 @@ growspace(char **buf, size_t *size, size
 	return 1;
 }
 
+/* check it was compiled properly */
+static inline int
+good_struct(const agcre_regex_t *agcre)
+{
+	re_t	*re;
+
+	if (agcre == NULL || agcre->re_magic != AGCRE_MAGIC2) {
+		return 0;
+	}
+	if ((re = agcre->re_g) == NULL) {
+		return 0;
+	}
+	return re->magic1 = MAGIC1 && re->magic2 == MAGIC2 &&
+		re->magic3 == MAGIC3 && re->magic4 == MAGIC4;
+}
+
 /***/
 
 /* allocate a new structure and return it */
@@ -2697,7 +2722,13 @@ agcre_regcomp(agcre_regex_t *agcre, cons
 		(agcre_regoff_t)(agcre->re_endp - in.s) :
 		(agcre_regoff_t)strlen(in.s);
 	memset(agcre, 0x0, sizeof(*agcre));
-	agcre->re_g = re = in.re = calloc(1, sizeof(*re));
+	if ((agcre->re_g = re = in.re = calloc(1, sizeof(*re))) == NULL) {
+		return AGCRE_REG_FAILURE;
+	}
+	re->magic1 = MAGIC1;
+	re->magic2 = MAGIC2;
+	re->magic3 = MAGIC3;
+	re->magic4 = MAGIC4;
 	if (in.eo - in.so > AGCRE_MAX_EXPR_LENGTH) {
 		re->msgc = snprintf(re->msg, sizeof(re->msg),
 			"expression length %llu larger than %u",
@@ -2739,7 +2770,7 @@ agcre_regcomp(agcre_regex_t *agcre, cons
 	re->pc->op = OP_MATCH;
 	re->pc += 1;
 	re->instrc = re->pc - re->prog;
-	agcre->re_magic = AGCRE_MAGIC;
+	agcre->re_magic = AGCRE_MAGIC2;
 	if (flags & AGCRE_REG_DUMP) {
 		printprog(re);
 	}
@@ -2757,7 +2788,7 @@ agcre_regerror(int errcode, const agcre_
 	re_t	*re;
 
 	USE_ARG(errcode);
-	if (agcre == NULL || size == 0 || errbuf == NULL) {
+	if (!good_struct(agcre) || size == 0 || errbuf == NULL) {
 		return 0;
 	}
 	re = agcre->re_g;
@@ -2782,15 +2813,15 @@ agcre_regexec(agcre_regex_t *agcre, cons
 	re_t		*re;
 	int		 ret;
 	
-	if (agcre == NULL || vs == NULL || (matchc > 0 && m == NULL)) {
+	if (!good_struct(agcre) || vs == NULL || (matchc > 0 && m == NULL)) {
 		return AGCRE_REG_FAILURE;
 	}
 	if ((re = agcre->re_g) == NULL) {
 		return AGCRE_REG_FAILURE;
 	}
-	if (agcre->re_magic != AGCRE_MAGIC) {
+	if (agcre->re_magic != AGCRE_MAGIC2) {
 		re->msgc = snprintf(re->msg, sizeof(re->msg),
-			"bad magic number 0x%x, not 0x%x", agcre->re_magic, AGCRE_MAGIC);
+			"bad magic number 0x%x, not 0x%x", agcre->re_magic, AGCRE_MAGIC2);
 		return AGCRE_REG_FAILURE;
 	}
 	if (matchc > AGCRE_MAX_SUBEXPR) {
@@ -2942,6 +2973,9 @@ agcre_rev_regexec(agcre_regex_t *agcre, 
 	int		found;
 	int		lastmatch;
 
+	if (!good_struct(agcre) || vs == NULL || (matchc > 0 && m == NULL)) {
+		return AGCRE_REG_FAILURE;
+	}
 	if (flags & AGCRE_REG_STARTEND) {
 		from = m[0].rm_so;
 		to = m[0].rm_eo;
@@ -2984,7 +3018,7 @@ agcre_regfree(agcre_regex_t *agcre)
 	uint32_t	 i;
 	re_t		*re;
 
-	if (agcre) {
+	if (agcre && good_struct(agcre)) {
 		if ((re = agcre->re_g) != NULL) {
 			free(re->prog);
 			for 

CVS commit: othersrc/external/bsd/agcre/dist

2023-06-21 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Jun 21 23:48:08 UTC 2023

Modified Files:
othersrc/external/bsd/agcre/dist: agcre.c agcre.h
othersrc/external/bsd/agcre/dist/tests: 62.expected

Log Message:
agcre version 20230621
==

+ agcre - added internal magic numbers to agcre to attempt to catch
  if misbehaving programs overwrite sections of memory
+ agcre - check internal magic numbers before attempting to execute
  regex programs
+ agcre - bump agcre magic number in the external structure
+ agcre - bump version number in header file. Fix up tests to ensure
  correct operation


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/agcre/dist/agcre.c
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/agcre/dist/agcre.h
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/agcre/dist/tests/62.expected

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: othersrc/external/bsd/agcre/dist

2021-12-03 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sat Dec  4 03:40:29 UTC 2021

Modified Files:
othersrc/external/bsd/agcre/dist: agcre.h

Log Message:
Change HIDE_AGCRE to be a 0/1 value, rather than defined/undef

By default, don't hide (i.e. export all symbols)

NFC


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/agcre/dist/agcre.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: othersrc/external/bsd/agcre/dist

2021-12-03 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sat Dec  4 01:54:51 UTC 2021

Modified Files:
othersrc/external/bsd/agcre/dist: agcre.c agcre.h

Log Message:
Add visibility definitions for agcre.

For any sources embedding these routines, simply define HIDE_AGCRE,
before including the agcre.h header file, and the routines will have
the hidden visibility attribute set on them.  For more information on
that, see

https://gcc.gnu.org/wiki/Visibility

To stop agcre routines being exported in a .so, simply define
HIDE_AGCRE - I've been doing this successfully in library Makefiles,
for example, this is from elex/lib/Makefile (elex is a library that
calls the agcre functions):

# set symbol visibility for .so
CPPFLAGS+=  -DHIDE_AGCRE

and the agcre symbols will be found just fine when linking and
running, but will not be exported by the linker.  This can save
headaches, and weird crashes, especially when combined with ASLR (when
two libraries define the same symbol, but with different structs or
arguments).

BEFORE:
[2021/12/03 Fri 17:47:19] agc@netbsd-002 ~/local/elex-2025 [13781] 
> nm -D lib/libelex.so
 w _Jv_RegisterClasses
 w __cxa_finalize
 w __deregister_frame_info
 U __fstat50
 w __register_frame_info
 U __sF
0020f198 D _end
c240 T _fini
0ea0 T _init
aa13 T agcre_new
bc48 T agcre_regasub
aa28 T agcre_regcomp
adde T agcre_regerror
ae48 T agcre_regexec
b8fd T agcre_regfree
b9a2 T agcre_regnsub
b7e8 T agcre_rev_regexec
 U asprintf
 U calloc
27f6 T elex_dispose
2b6a T elex_exec
2f5b T elex_exec_str
2982 T elex_make_new_rule
27bb T elex_new
 U fclose
 U fopen
 U fprintf
 U free
 U fwrite
 U memchr
 U memcmp
 U memcpy
 U memmove
 U memset
 U mmap
 U munmap
 U printf
 U putchar
 U realloc
 U snprintf
 U strchr
 U strcmp
 U strdup
c10c T striter_dispose
c165 T striter_exec
c1da T striter_exec_mem
c0f7 T striter_new
 U strlen
 U strtol
 U strtoul
 U vsnprintf
 U warn
 U warnx
[2021/12/03 Fri 17:47:22] agc@netbsd-002 ~/local/elex-2025 [13782] >

AFTER adding HIDE_AGCRE (and HIDE_STRITER) to elex/lib/Makefile:
[2021/12/03 Fri 17:47:45] agc@netbsd-002 ~/local/elex-2025 [13774] 
> nm -D lib/libelex.so
 w _Jv_RegisterClasses
 w __cxa_finalize
 w __deregister_frame_info
 U __fstat50
 w __register_frame_info
 U __sF
0020e160 D _end
bf30 T _fini
0c00 T _init
 U asprintf
 U calloc
24e6 T elex_dispose
285a T elex_exec
2c4b T elex_exec_str
2672 T elex_make_new_rule
24ab T elex_new
 U fclose
 U fopen
 U fprintf
 U free
 U fwrite
 U memchr
 U memcmp
 U memcpy
 U memmove
 U memset
 U mmap
 U munmap
 U printf
 U putchar
 U realloc
 U snprintf
 U strchr
 U strcmp
 U strdup
 U strlen
 U strtol
 U strtoul
 U vsnprintf
 U warn
 U warnx


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/agcre/dist/agcre.c
cvs rdiff -u 

CVS commit: othersrc/external/bsd/agcre/dist

2021-10-05 Thread Valeriy E. Ushakov
Module Name:othersrc
Committed By:   uwe
Date:   Tue Oct  5 23:35:39 UTC 2021

Modified Files:
othersrc/external/bsd/agcre/dist: libagcre.3

Log Message:
Sprinkle more markup in previous.  Sync argument names.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/agcre/dist/libagcre.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/agcre/dist/libagcre.3
diff -u othersrc/external/bsd/agcre/dist/libagcre.3:1.5 othersrc/external/bsd/agcre/dist/libagcre.3:1.6
--- othersrc/external/bsd/agcre/dist/libagcre.3:1.5	Tue Oct  5 22:17:15 2021
+++ othersrc/external/bsd/agcre/dist/libagcre.3	Tue Oct  5 23:35:38 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: libagcre.3,v 1.5 2021/10/05 22:17:15 agc Exp $
+.\" $NetBSD: libagcre.3,v 1.6 2021/10/05 23:35:38 uwe Exp $
 .\"
 .\" Copyright (c) 2017,2020,2021 Alistair Crooks 
 .\" All rights reserved.
@@ -165,7 +165,7 @@ Traces execution of the regular expressi
 .It Dv AGCRE_REG_CTAGS
 This is used where a regular expression pattern was generated by the
 .Xr ctags 1
-program, since the syntax generated does not conform to a standard 
+program, since the syntax generated does not conform to a standard
 basic regular expression.
 In particular,
 .Xr ctags 1
@@ -353,29 +353,43 @@ functions perform substitutions using
 .Xr sed 1
 like syntax.
 They return the length of
-the string that would have been created if there was enough space or -1 on error, setting errno.
+the string that would have been created if there was enough space
+or \-1 on error, setting
+.Va errno .
 The result is
-placed in buf which is user-supplied in
+placed in
+.Fa buf
+which is user-supplied in
 .Fn agcre_regnsub
 and dynamically allocated in
 .Fn agcre_regasub .
-The sub argument
-contains a substitution string which might refer to the first 9 regular expression strings using
-.Ql \e
+The
+.Fa repl
+argument contains a substitution string which might
+refer to the first 9 regular expression strings using
+.Sq Li \e Ns Ar 
 to refer
-to the nth matched item, or
-.Ql &
+to the
+.Ar n\^ Ns th
+matched item,
+or
+.Ql \&&
 (which is equivalent to
 .Ql \e0 )
 to refer to the full match.
-The match array must be
-at least 10 elements long,
+The
+.Fa matches
+array must be at least 10 elements long,
 and should contain the result of the matches from a previous
 .Fn agcre_regexec
 call.
 Only 10
-elements of the rm array can be used.
-The str argument contains the source string in which transformations will be substituted.
+elements of the
+.Fa matches
+array can be used.
+The
+.Fa str
+argument contains the source string in which transformations will be substituted.
 .Pp
 To show the value of constant-time execution, especially
 for regular expressions which may be subject to abuse,



CVS commit: othersrc/external/bsd/agcre/dist

2021-10-05 Thread Valeriy E. Ushakov
Module Name:othersrc
Committed By:   uwe
Date:   Tue Oct  5 23:35:39 UTC 2021

Modified Files:
othersrc/external/bsd/agcre/dist: libagcre.3

Log Message:
Sprinkle more markup in previous.  Sync argument names.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/agcre/dist/libagcre.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: othersrc/external/bsd/agcre/dist

2021-10-05 Thread Valeriy E. Ushakov
Module Name:othersrc
Committed By:   uwe
Date:   Tue Oct  5 19:25:28 UTC 2021

Modified Files:
othersrc/external/bsd/agcre/dist: agcre.1

Log Message:
Tweak markup.  Sync argument names between text and synopsis.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/agcre/dist/agcre.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/agcre/dist/agcre.1
diff -u othersrc/external/bsd/agcre/dist/agcre.1:1.2 othersrc/external/bsd/agcre/dist/agcre.1:1.3
--- othersrc/external/bsd/agcre/dist/agcre.1:1.2	Thu Aug 17 11:02:04 2017
+++ othersrc/external/bsd/agcre/dist/agcre.1	Tue Oct  5 19:25:28 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: agcre.1,v 1.2 2017/08/17 11:02:04 wiz Exp $
+.\" $NetBSD: agcre.1,v 1.3 2021/10/05 19:25:28 uwe Exp $
 .\"
 .\" Copyright (c) 2017 Alistair Crooks 
 .\" All rights reserved.
@@ -35,30 +35,36 @@
 .Op Fl e Ar expression
 .Op Fl f Ar filename
 .Op Fl m Ar maxmatch
-.Op Fl P Ar reg_pend
-.Op Fl S Ar subexpression
-.Op Fl T Ar regexp_type
+.Op Fl P Ar end
+.Op Fl S Ar n
+.Op Fl T Ar type
+.Op Ar expression
 .Ar file ...
 .Sh DESCRIPTION
 The
 .Nm
-utility uses
+utility uses the
 .Xr libagcre 3
-as a regular expression library.
+library to perform textual matches on files and standard input
+in the same way as
+.Xr grep 1 .
+.Pp
 The library is built on Rob Pike's Virtual Machine implementation,
-but also recognises back references, Unicode characters and PERL
+but also recognises back references, Unicode characters and Perl
 patterns, and performs greedy and non-greedy matching.
-.Bl -tag -width subexpressionX
+.Bl -tag -width Fl
 .It Fl D
 Dump the generated virtual machine program to
-.Dv stdout
+.Va stdout
 if the
 regular expression compilation was successful.
 .It Fl e Ar expression
-Use the expression provided in the argument as the expression
+Use the
+.Ar expression
+provided in the argument as the expression
 to be compiled.
 This is useful if the expression begins with a
-.Dq -
+.Ql \&-
 character, for example.
 .It Fl f Ar filename
 Take the regular expression from the filename provided
@@ -68,55 +74,52 @@ Perform matching in a case-insensitive m
 .It Fl l
 Suppress output, and merely print the filename for
 any expression match.
-.It Fl m Ar N
-Perform matching until N matches are found.
+.It Fl m Ar maxmatch
+Perform matching until
+.Ar maxmatch
+matches are found.
 The default is to show all matches.
 .It Fl n
 Show line numbers in files of any matches found
 .It Fl O
 Do not print matching text.
 Instead, print the offsets of any matching text.
-.It Fl P Ar offset
+.It Fl P Ar end
 Use
 .Dv AGCRE_REG_PEND
 to denote the end offset of the regular expression to be compiled.
 .It Fl r
 If an argument is found to be a directory, recurse into that directory
 and perform matching against all files in that directory.
-.It Fl S Ar N
-Print the subscript matching subexpression number N.
+.It Fl S Ar n
+Print the substring matching subexpression number
+.Ar n .
 The default is to print the whole match, subexpression 0.
-.It Fl T Ar nospec|basic|extended
+.It Fl T Ar type
 Explicitly specify the type of matching to be performed.
 Possible values for this are
-.Dq nospec ,
-.Dq basic ,
+.Ql nospec ,
+.Ql basic ,
 and
-.Dq extended .
+.Ql extended .
 The default in
 .Nm
-is to use extended regular expressions by default.
+is to use extended regular expressions.
 There is no default regular expression type in
 .Xr libagcre 3 .
 .It Fl t
 Trace the execution of
 .Fn agcre_regexec
 by producing tracing information on
-.Dv stderr .
+.Va stderr .
 .It Fl V
 Print version number and then exit.
 .It Fl v
-Perform an inverse match, showing all lines which do not match the
+Perform an inverse match, showing all lines which do
+.Em not
+match the
 regular expression.
 .El
-.Pp
-The
-.Nm
-utility uses the
-.Xr libagcre 3
-library to perform textual matches on files and standard input
-in the same way as
-.Xr grep 1 .
 .Sh SEE ALSO
 .Xr grep 1 ,
 .Xr libagcre 3 ,



CVS commit: othersrc/external/bsd/agcre/dist

2021-10-05 Thread Valeriy E. Ushakov
Module Name:othersrc
Committed By:   uwe
Date:   Tue Oct  5 19:25:28 UTC 2021

Modified Files:
othersrc/external/bsd/agcre/dist: agcre.1

Log Message:
Tweak markup.  Sync argument names between text and synopsis.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/agcre/dist/agcre.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: othersrc/external/bsd/agcre/dist

2021-10-05 Thread Valeriy E. Ushakov
Module Name:othersrc
Committed By:   uwe
Date:   Tue Oct  5 18:56:24 UTC 2021

Modified Files:
othersrc/external/bsd/agcre/dist: libagcre.3

Log Message:
Tweak markup.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/agcre/dist/libagcre.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/agcre/dist/libagcre.3
diff -u othersrc/external/bsd/agcre/dist/libagcre.3:1.3 othersrc/external/bsd/agcre/dist/libagcre.3:1.4
--- othersrc/external/bsd/agcre/dist/libagcre.3:1.3	Tue Oct  5 01:23:39 2021
+++ othersrc/external/bsd/agcre/dist/libagcre.3	Tue Oct  5 18:56:24 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: libagcre.3,v 1.3 2021/10/05 01:23:39 agc Exp $
+.\" $NetBSD: libagcre.3,v 1.4 2021/10/05 18:56:24 uwe Exp $
 .\"
 .\" Copyright (c) 2017,2020,2021 Alistair Crooks 
 .\" All rights reserved.
@@ -24,46 +24,75 @@
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .Dd October 1, 2021
-.Dt AGCRE-EMBED 3
+.Dt LIBAGCRE 3
 .Os
 .Sh NAME
 .Nm agcre
 .Nd regular expression library
 .Sh LIBRARY
-.Lb agcre
+.\"Lb agcre
+agcre Regular Expression Library (libagcre, \-lagcre)
 .Sh SYNOPSIS
 .In agcre.h
+.\"
 .Ft "agcre_regex_t *"
 .Fo agcre_new
 .Fa "void"
 .Fc
-.Ft "int"
+.\"
+.Ft int
 .Fo agcre_regcomp
-.Fa "agcre_regex_t *expression" "const void *pat" "uint32_t flags"
+.Fa "agcre_regex_t *expression"
+.Fa "const void *pat"
+.Fa "uint32_t flags"
 .Fc
+.\"
 .Ft int
 .Fo agcre_regexec
-.Fa "agcre_regex_t *expression" "const void *input" "size_t nmatch" "agcre_regmatch_t *matches" "uint32_t flags"
+.Fa "agcre_regex_t *expression"
+.Fa "const void *input"
+.Fa "size_t nmatch"
+.Fa "agcre_regmatch_t *matches"
+.Fa "uint32_t flags"
 .Fc
+.\"
 .Ft int
 .Fo agcre_rev_regexec
-.Fa "agcre_regex_t *expression" "const void *input" "size_t nmatch" "agcre_regmatch_t *matches" "uint32_t flags"
+.Fa "agcre_regex_t *expression"
+.Fa "const void *input"
+.Fa "size_t nmatch"
+.Fa "agcre_regmatch_t *matches"
+.Fa "uint32_t flags"
 .Fc
+.\"
 .Ft void
 .Fo agcre_regfree
 .Fa "agcre_regex_t *expression"
 .Fc
+.\"
 .Ft size_t
 .Fo agcre_regerror
-.Fa "int errnum" "const agcre_regex_t *expression" "char *buf" "size_t size"
+.Fa "int errnum"
+.Fa "const agcre_regex_t *expression"
+.Fa "char *buf"
+.Fa "size_t size"
 .Fc
+.\"
 .Ft ssize_t
 .Fo agcre_regnsub
-.Fa "char *buf" "size_t size" "const char *repl" "const agcre_regmatch_t *matches" "const char *str"
+.Fa "char *buf"
+.Fa "size_t size"
+.Fa "const char *repl"
+.Fa "const agcre_regmatch_t *matches"
+.Fa "const char *str"
 .Fc
+.\"
 .Ft ssize_t
 .Fo agcre_regasub
-.Fa "char **buf" "const char *repl" "const agcre_regmatch_t *matches" "const char *str"
+.Fa "char **buf"
+.Fa "const char *repl"
+.Fa "const agcre_regmatch_t *matches"
+.Fa "const char *str"
 .Fc
 .Sh DESCRIPTION
 The
@@ -74,7 +103,7 @@ It will compile expressions described in
 .Xr agcre_format 7 ,
 as well as some extensions.
 .Pp
-A
+An
 .Vt agcre_regex_t
 structure can either be allocated on the stack, or
 it can be allocated dynamically using
@@ -89,10 +118,10 @@ A regular expression is compiled using
 Various flags can be specified during compilation, which will
 alter the regular expression which is produced.
 These flags are:
-.Bl -tag -width AGCRE_REG_EXTENDEDXXX
+.Bl -tag -width Dv
 .It Dv AGCRE_REG_BASIC
 Use basic regular expressions.
-These are prserved for legacy reasons; no new code should use basic
+These are preserved for legacy reasons; no new code should use basic
 regular expressions.
 For more information on regular expression formats, please refer to
 .Xr agcre_format 7 .
@@ -100,25 +129,27 @@ For more information on regular expressi
 Extended regular expressions are the standard form of searching,
 and should be used.
 .It Dv AGCRE_REG_NOSUB
-When searching through text, the standard searches are perfomed,
+When searching through text, the standard searches are performed,
 but no subexpression information will be returned.
 .It Dv AGCRE_REG_NEWLINE
 Normally newline characters are treated as a standard character.
 With this flag, the zero width match for
-.Dq ^
+.Ql \&^
 before the newline character will match, as will the zero width string
 after the
-.Dq $ .
+.Ql \&$ .
 .It Dv AGCRE_REG_NOSPEC
 A standard search text will be performed, and no special characters
 will be recognised.
 In the current implementation, this will be performed using
-a Horspool-modified Boyer-Moore search.
+a Horspool-modified Boyer\(enMoore search.
 .It Dv AGCRE_REG_PEND
 Normally, the end of the string to be compiled will be the
-first ASCII NUL character encountered.
+first
+.Tn ASCII NUL
+character encountered.
 With this flag, the
-.Dv re_endp
+.Va re_endp
 field in the
 .Vt agcre_regex_t
 structure will be used to point to the last position in
@@ -156,8 +187,8 @@ Traces execution of the regular expressi
 A regular expression, once compiled,
 can be 

CVS commit: othersrc/external/bsd/agcre/dist

2021-10-05 Thread Valeriy E. Ushakov
Module Name:othersrc
Committed By:   uwe
Date:   Tue Oct  5 18:56:24 UTC 2021

Modified Files:
othersrc/external/bsd/agcre/dist: libagcre.3

Log Message:
Tweak markup.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/agcre/dist/libagcre.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.