The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=198637a6869c703c2d01cd87e222c1dc3761c853
commit 198637a6869c703c2d01cd87e222c1dc3761c853 Author: Warner Losh <[email protected]> AuthorDate: 2026-06-22 22:16:55 +0000 Commit: Warner Losh <[email protected]> CommitDate: 2026-06-22 23:06:14 +0000 vgrind: Tear down vgrind support vgrind has been disconnected from the build for a while. Remove from the build, and gc vgrid support in the few remaining places. Reviewed by: jhb Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D57648 --- share/mk/bsd.doc.mk | 1 - targets/pseudo/userland/Makefile.depend | 1 - usr.bin/ctags/ctags.1 | 15 - usr.bin/ctags/ctags.c | 5 +- usr.bin/ctags/ctags.h | 1 - usr.bin/ctags/print.c | 5 +- usr.bin/man/man.1 | 2 - usr.bin/man/man.conf.5 | 1 - usr.bin/man/man.sh | 6 +- usr.bin/vgrind/Makefile | 24 -- usr.bin/vgrind/Makefile.depend | 15 - usr.bin/vgrind/extern.h | 59 --- usr.bin/vgrind/pathnames.h | 32 -- usr.bin/vgrind/regexp.c | 584 ------------------------- usr.bin/vgrind/tmac.vgrind | 71 ---- usr.bin/vgrind/vfontedpr.c | 704 ------------------------------- usr.bin/vgrind/vgrind.1 | 239 ----------- usr.bin/vgrind/vgrind.sh | 128 ------ usr.bin/vgrind/vgrindefs.5 | 167 -------- usr.bin/vgrind/vgrindefs.src | 153 ------- usr.sbin/crunch/examples/really-big.conf | 2 +- 21 files changed, 5 insertions(+), 2210 deletions(-) diff --git a/share/mk/bsd.doc.mk b/share/mk/bsd.doc.mk index 675639db7611..fcade5064b7c 100644 --- a/share/mk/bsd.doc.mk +++ b/share/mk/bsd.doc.mk @@ -46,7 +46,6 @@ PRINTERDEVICE?= ascii BIB?= bib GREMLIN?= grn -GRIND?= vgrind -f INDXBIB?= indxbib PIC?= pic REFER?= refer diff --git a/targets/pseudo/userland/Makefile.depend b/targets/pseudo/userland/Makefile.depend index e159fdf39822..b23b307cce82 100644 --- a/targets/pseudo/userland/Makefile.depend +++ b/targets/pseudo/userland/Makefile.depend @@ -362,7 +362,6 @@ DIRDEPS+= \ usr.bin/usbhidctl \ usr.bin/users \ usr.bin/vacation \ - usr.bin/vgrind \ usr.bin/vi \ usr.bin/vi/catalog \ usr.bin/vis \ diff --git a/usr.bin/ctags/ctags.1 b/usr.bin/ctags/ctags.1 index c9745f407575..0f4662d3be86 100644 --- a/usr.bin/ctags/ctags.1 +++ b/usr.bin/ctags/ctags.1 @@ -110,21 +110,6 @@ Beware: this option is implemented in a way which is rather slow; it is usually faster to simply rebuild the .Pa tags file. -.It Fl v -An index of the form expected by -.Xr vgrind 1 -is produced on the standard output. -This listing -contains the object name, file name, and page number (assuming 64 -line pages). -Since the output will be sorted into lexicographic order, -it may be desired to run the output through -.Xr sort 1 . -Sample use: -.Bd -literal -offset indent -ctags -v files | sort -f > index -vgrind -x index -.Ed .It Fl w Suppress warning diagnostics. .It Fl x diff --git a/usr.bin/ctags/ctags.c b/usr.bin/ctags/ctags.c index b8d642520466..5fdc269c7159 100644 --- a/usr.bin/ctags/ctags.c +++ b/usr.bin/ctags/ctags.c @@ -62,7 +62,6 @@ long lineftell; /* ftell after getc( inf ) == '\n' */ int lineno; /* line number of current line */ int dflag; /* -d: non-macro defines */ int tflag; /* -t: create tags for typedefs */ -int vflag; /* -v: vgrind style index output */ int wflag; /* -w: suppress warnings */ int xflag; /* -x: cxref style output */ @@ -88,7 +87,7 @@ main(int argc, char **argv) aflag = uflag = false; tflag = true; - while ((ch = getopt(argc, argv, "BFTadf:tuwvx")) != -1) + while ((ch = getopt(argc, argv, "BFTadf:tuwx")) != -1) switch(ch) { case 'B': searchar = '?'; @@ -117,8 +116,6 @@ main(int argc, char **argv) case 'w': wflag++; break; - case 'v': - vflag++; case 'x': xflag++; break; diff --git a/usr.bin/ctags/ctags.h b/usr.bin/ctags/ctags.h index b74bf7ea7602..903704b4d53e 100644 --- a/usr.bin/ctags/ctags.h +++ b/usr.bin/ctags/ctags.h @@ -72,7 +72,6 @@ extern long lineftell; /* ftell after getc( inf ) == '\n' */ extern int lineno; /* line number of current line */ extern int dflag; /* -d: non-macro defines */ extern int tflag; /* -t: create tags for typedefs */ -extern int vflag; /* -v: vgrind style index output */ extern int wflag; /* -w: suppress warnings */ extern int xflag; /* -x: cxref style output */ extern bool _wht[], _etk[], _itk[], _btk[], _gd[]; diff --git a/usr.bin/ctags/print.c b/usr.bin/ctags/print.c index e1b0957104c0..42c7ad056a3c 100644 --- a/usr.bin/ctags/print.c +++ b/usr.bin/ctags/print.c @@ -93,10 +93,7 @@ put_entries(NODE *node) if (node->left) put_entries(node->left); - if (vflag) - printf("%s %s %d\n", - node->entry, node->file, (node->lno + 63) / 64); - else if (xflag) + if (xflag) printf("%-16s %4d %-16s %s\n", node->entry, node->lno, node->file, node->pat); else diff --git a/usr.bin/man/man.1 b/usr.bin/man/man.1 index 707677ccce06..18b58f3c03b3 100644 --- a/usr.bin/man/man.1 +++ b/usr.bin/man/man.1 @@ -190,8 +190,6 @@ Valid preprocessors arguments: .Xr refer 1 Pq Pa ports/textproc/groff .It Cm t .Xr tbl 1 Pq Pa ports/textproc/groff -.It Cm v -.Xr vgrind 1 .El .Pp Overrides the diff --git a/usr.bin/man/man.conf.5 b/usr.bin/man/man.conf.5 index 90595bb6d498..6dcb3156c331 100644 --- a/usr.bin/man/man.conf.5 +++ b/usr.bin/man/man.conf.5 @@ -76,7 +76,6 @@ display is supported via the following definitions: .It TBL Ns _ Ns Va LANG .It TROFF Ns _ Ns Va LANG .It REFER Ns _ Ns Va LANG -.It VGRIND Ns _ Ns Va LANG .El .Pp See the diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh index 920223ce3c27..d6429901c598 100755 --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -418,7 +418,7 @@ man_display_page() { # Usage: man_display_page_groff # Display the manpage using groff man_display_page_groff() { - local EQN NROFF PIC TBL TROFF REFER VGRIND + local EQN NROFF PIC TBL TROFF REFER local IFS l nroff_dev pipeline preproc_arg tool # So, we really do need to parse the manpage. First, figure out the @@ -456,7 +456,7 @@ man_display_page_groff() { # Allow language specific calls to override the default # set of utilities. l=$(echo $man_lang | tr [:lower:] [:upper:]) - for tool in EQN NROFF PIC TBL TROFF REFER VGRIND; do + for tool in EQN NROFF PIC TBL TROFF REFER; do eval "$tool=\${${tool}_$l:-\$$tool}" done ;; @@ -483,7 +483,6 @@ man_display_page_groff() { p) pipeline="$pipeline | $PIC" ;; r) pipeline="$pipeline | $REFER" ;; t) pipeline="$pipeline | $TBL" ;; - v) pipeline="$pipeline | $VGRIND" ;; *) usage ;; esac done @@ -1129,7 +1128,6 @@ PIC=pic REFER=refer TBL=tbl TROFF='groff -S -mandoc' -VGRIND=vgrind LOCALE=/usr/bin/locale STTY=/bin/stty diff --git a/usr.bin/vgrind/Makefile b/usr.bin/vgrind/Makefile deleted file mode 100644 index 6ab148768aa6..000000000000 --- a/usr.bin/vgrind/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -PROG= vfontedpr -SRCS= regexp.c vfontedpr.c -SCRIPTS=vgrind.sh -FILES= vgrindefs.src vgrindefs.src.db tmac.vgrind -FILESNAME_vgrindefs.src= vgrindefs -FILESNAME_vgrindefs.src.db= vgrindefs.db -FILESDIR= ${SHAREDIR}/misc -FILESDIR_tmac.vgrind= ${SHAREDIR}/tmac -MAN= vgrind.1 vgrindefs.5 - -WARNS?= 3 - -BINDIR= ${LIBEXECDIR} -SCRIPTSDIR=/usr/bin - -CLEANFILES= vgrindefs.src.db - -.include <bsd.endian.mk> -.include <src.tools.mk> - -vgrindefs.src.db: vgrindefs.src - ${CAP_MKDB_CMD} ${CAP_MKDB_ENDIAN} -f vgrindefs.src ${.ALLSRC} - -.include <bsd.prog.mk> diff --git a/usr.bin/vgrind/Makefile.depend b/usr.bin/vgrind/Makefile.depend deleted file mode 100644 index 6ef78fac5cbf..000000000000 --- a/usr.bin/vgrind/Makefile.depend +++ /dev/null @@ -1,15 +0,0 @@ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - - -.include <dirdeps.mk> - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.bin/vgrind/extern.h b/usr.bin/vgrind/extern.h deleted file mode 100644 index a6d4331ef7f2..000000000000 --- a/usr.bin/vgrind/extern.h +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -extern bool _escaped; /* if last character was an escape */ -extern char *s_start; /* start of the current string */ -extern char *l_acmbeg; /* string introducing a comment */ -extern char *l_acmend; /* string ending a comment */ -extern char *l_blkbeg; /* string beginning of a block */ -extern char *l_blkend; /* string ending a block */ -extern char *l_chrbeg; /* delimiter for character constant */ -extern char *l_chrend; /* delimiter for character constant */ -extern char *l_combeg; /* string introducing a comment */ -extern char *l_comend; /* string ending a comment */ -extern char l_escape; /* character used to escape characters */ -extern char *l_keywds[]; /* keyword table address */ -extern bool l_onecase; /* upper and lower case are equivalent */ -extern char *l_prcbeg; /* regular expr for procedure begin */ -extern char *l_strbeg; /* delimiter for string constant */ -extern char *l_strend; /* delimiter for string constant */ -extern bool l_toplex; /* procedures only defined at top lex level */ -extern const char *language; /* the language indicator */ - -#include <sys/cdefs.h> - -__BEGIN_DECLS -extern int STRNCMP(char *, char *, int); -extern char *convexp(char *); -extern char *expmatch(char *, char *, char *); -__END_DECLS - diff --git a/usr.bin/vgrind/pathnames.h b/usr.bin/vgrind/pathnames.h deleted file mode 100644 index 597abd21eeb6..000000000000 --- a/usr.bin/vgrind/pathnames.h +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#define _PATH_VGRINDEFS "/usr/share/misc/vgrindefs" diff --git a/usr.bin/vgrind/regexp.c b/usr.bin/vgrind/regexp.c deleted file mode 100644 index 0cd616569ae2..000000000000 --- a/usr.bin/vgrind/regexp.c +++ /dev/null @@ -1,584 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <ctype.h> -#include <stdlib.h> -#include <stdbool.h> -#include <string.h> - -#include "extern.h" - -static void expconv(void); - -bool _escaped; /* true if we are currently x_escaped */ -char *s_start; /* start of string */ -bool l_onecase; /* true if upper and lower equivalent */ - -#define makelower(c) (isupper((c)) ? tolower((c)) : (c)) - -/* STRNCMP - like strncmp except that we convert the - * first string to lower case before comparing - * if l_onecase is set. - */ - -int -STRNCMP(register char *s1, register char *s2, register int len) -{ - if (l_onecase) { - do - if (*s2 - makelower(*s1)) - return (*s2 - makelower(*s1)); - else { - s2++; - s1++; - } - while (--len); - } else { - do - if (*s2 - *s1) - return (*s2 - *s1); - else { - s2++; - s1++; - } - while (--len); - } - return(0); -} - -/* The following routine converts an irregular expression to - * internal format. - * - * Either meta symbols (\a \d or \p) or character strings or - * operations ( alternation or parenthesizing ) can be - * specified. Each starts with a descriptor byte. The descriptor - * byte has STR set for strings, META set for meta symbols - * and OPER set for operations. - * The descriptor byte can also have the OPT bit set if the object - * defined is optional. Also ALT can be set to indicate an alternation. - * - * For metasymbols the byte following the descriptor byte identities - * the meta symbol (containing an ascii 'a', 'd', 'p', '|', or '('). For - * strings the byte after the descriptor is a character count for - * the string: - * - * meta symbols := descriptor - * symbol - * - * strings := descriptor - * character count - * the string - * - * operations := descriptor - * symbol - * character count - */ - -/* - * handy macros for accessing parts of match blocks - */ -#define MSYM(A) (*(A+1)) /* symbol in a meta symbol block */ -#define MNEXT(A) (A+2) /* character following a metasymbol block */ - -#define OSYM(A) (*(A+1)) /* symbol in an operation block */ -#define OCNT(A) (*(A+2)) /* character count */ -#define ONEXT(A) (A+3) /* next character after the operation */ -#define OPTR(A) (A+*(A+2)) /* place pointed to by the operator */ - -#define SCNT(A) (*(A+1)) /* byte count of a string */ -#define SSTR(A) (A+2) /* address of the string */ -#define SNEXT(A) (A+2+*(A+1)) /* character following the string */ - -/* - * bit flags in the descriptor - */ -#define OPT 1 -#define STR 2 -#define META 4 -#define ALT 8 -#define OPER 16 - -static char *ccre; /* pointer to current position in converted exp*/ -static char *ure; /* pointer current position in unconverted exp */ - -/* re: unconverted irregular expression */ -char * -convexp(char *re) -{ - register char *cre; /* pointer to converted regular expression */ - - /* allocate room for the converted expression */ - if (re == NULL) - return (NULL); - if (*re == '\0') - return (NULL); - cre = malloc(4 * strlen(re) + 3); - ccre = cre; - ure = re; - - /* start the conversion with a \a */ - *cre = META | OPT; - MSYM(cre) = 'a'; - ccre = MNEXT(cre); - - /* start the conversion (its recursive) */ - expconv (); - *ccre = 0; - return (cre); -} - -static void -expconv() -{ - register char *cs; /* pointer to current symbol in converted exp */ - register char c; /* character being processed */ - register char *acs; /* pinter to last alternate */ - register int temp; - - /* let the conversion begin */ - acs = NULL; - cs = NULL; - while (*ure) { - switch (c = *ure++) { - - case '\\': - switch (c = *ure++) { - - /* escaped characters are just characters */ - default: - if (cs == NULL || (*cs & STR) == 0) { - cs = ccre; - *cs = STR; - SCNT(cs) = 1; - ccre += 2; - } else - SCNT(cs)++; - *ccre++ = c; - break; - - /* normal(?) metacharacters */ - case 'a': - case 'd': - case 'e': - case 'p': - if (acs != NULL && acs != cs) { - do { - temp = OCNT(acs); - OCNT(acs) = ccre - acs; - acs -= temp; - } while (temp != 0); - acs = NULL; - } - cs = ccre; - *cs = META; - MSYM(cs) = c; - ccre = MNEXT(cs); - break; - } - break; - - /* just put the symbol in */ - case '^': - case '$': - if (acs != NULL && acs != cs) { - do { - temp = OCNT(acs); - OCNT(acs) = ccre - acs; - acs -= temp; - } while (temp != 0); - acs = NULL; - } - cs = ccre; - *cs = META; - MSYM(cs) = c; - ccre = MNEXT(cs); - break; - - /* mark the last match sequence as optional */ - case '?': - if (cs) - *cs = *cs | OPT; - break; - - /* recurse and define a subexpression */ - case '(': - if (acs != NULL && acs != cs) { - do { - temp = OCNT(acs); - OCNT(acs) = ccre - acs; - acs -= temp; - } while (temp != 0); - acs = NULL; - } - cs = ccre; - *cs = OPER; - OSYM(cs) = '('; - ccre = ONEXT(cs); - expconv(); - OCNT(cs) = ccre - cs; /* offset to next symbol */ - break; - - /* return from a recursion */ - case ')': - if (acs != NULL) { - do { - temp = OCNT(acs); - OCNT(acs) = ccre - acs; - acs -= temp; - } while (temp != 0); - acs = NULL; - } - cs = ccre; - *cs = META; - MSYM(cs) = c; - ccre = MNEXT(cs); - return; - - /* mark the last match sequence as having an alternate */ - /* the third byte will contain an offset to jump over the */ - /* alternate match in case the first did not fail */ - case '|': - if (acs != NULL && acs != cs) - OCNT(ccre) = ccre - acs; /* make a back pointer */ - else - OCNT(ccre) = 0; - *cs |= ALT; - cs = ccre; - *cs = OPER; - OSYM(cs) = '|'; - ccre = ONEXT(cs); - acs = cs; /* remember that the pointer is to be filles */ - break; - - /* if its not a metasymbol just build a scharacter string */ - default: - if (cs == NULL || (*cs & STR) == 0) { - cs = ccre; - *cs = STR; - SCNT(cs) = 1; - ccre = SSTR(cs); - } else - SCNT(cs)++; - *ccre++ = c; - break; - } - } - if (acs != NULL) { - do { - temp = OCNT(acs); - OCNT(acs) = ccre - acs; - acs -= temp; - } while (temp != 0); - acs = NULL; - } - return; -} -/* end of convertre */ - - -/* - * The following routine recognises an irregular expression - * with the following special characters: - * - * \? - means last match was optional - * \a - matches any number of characters - * \d - matches any number of spaces and tabs - * \p - matches any number of alphanumeric - * characters. The - * characters matched will be copied into - * the area pointed to by 'name'. - * \| - alternation - * \( \) - grouping used mostly for alternation and - * optionality - * - * The irregular expression must be translated to internal form - * prior to calling this routine - * - * The value returned is the pointer to the first non \a - * character matched. - */ - -/* - * s: string to check for a match in - * re: a converted irregular expression - * mstring: where to put whatever matches a \p - */ -char * -expmatch (register char *s, register char *re, register char *mstring) -{ - register char *cs; /* the current symbol */ - register char *ptr,*s1; /* temporary pointer */ - bool matched; /* a temporary bool */ - - /* initial conditions */ - if (re == NULL) - return (NULL); - cs = re; - matched = false; - - /* loop till expression string is exhausted (or at least pretty tired) */ - while (*cs) { - switch (*cs & (OPER | STR | META)) { - - /* try to match a string */ - case STR: - matched = !STRNCMP (s, SSTR(cs), SCNT(cs)); - if (matched) { - - /* hoorah it matches */ - s += SCNT(cs); - cs = SNEXT(cs); - } else if (*cs & ALT) { - - /* alternation, skip to next expression */ - cs = SNEXT(cs); - } else if (*cs & OPT) { - - /* the match is optional */ - cs = SNEXT(cs); - matched = 1; /* indicate a successful match */ - } else { - - /* no match, error return */ - return (NULL); - } - break; - - /* an operator, do something fancy */ - case OPER: - switch (OSYM(cs)) { - - /* this is an alternation */ - case '|': - if (matched) - - /* last thing in the alternation was a match, skip ahead */ - cs = OPTR(cs); - else - - /* no match, keep trying */ - cs = ONEXT(cs); - break; - - /* this is a grouping, recurse */ - case '(': - ptr = expmatch(s, ONEXT(cs), mstring); - if (ptr != NULL) { - - /* the subexpression matched */ - matched = 1; - s = ptr; - } else if (*cs & ALT) { - - /* alternation, skip to next expression */ - matched = 0; - } else if (*cs & OPT) { - - /* the match is optional */ - matched = 1; /* indicate a successful match */ - } else { - - /* no match, error return */ - return (NULL); - } - cs = OPTR(cs); - break; - } - break; - - /* try to match a metasymbol */ - case META: - switch (MSYM(cs)) { - - /* try to match anything and remember what was matched */ - case 'p': - /* - * This is really the same as trying the match the - * remaining parts of the expression to any subset - * of the string. - */ - s1 = s; - do { - ptr = expmatch(s1, MNEXT(cs), mstring); - if (ptr != NULL && s1 != s) { - - /* we have a match, remember the match */ - strncpy (mstring, s, s1 - s); - mstring[s1 - s] = '\0'; - return (ptr); - } else if (ptr != NULL && (*cs & OPT)) { - - /* it was aoptional so no match is ok */ - return (ptr); - } else if (ptr != NULL) { - - /* not optional and we still matched */ - return (NULL); - } - if (!(isalnum(*s1) || *s1 == '_' || - /* C++ destructor */ - *s1 == '~' || - /* C++ scope operator */ - (strlen(s1) > 1 && *s1 == ':' && s1[1] == ':' && - (s1++, true)))) - return (NULL); - if (*s1 == '\\') - _escaped = _escaped ? false : true; - else - _escaped = false; - } while (*s1++); - return (NULL); - - /* try to match anything */ - case 'a': - /* - * This is really the same as trying the match the - * remaining parts of the expression to any subset - * of the string. - */ - s1 = s; - do { - ptr = expmatch(s1, MNEXT(cs), mstring); - if (ptr != NULL && s1 != s) { - - /* we have a match */ - return (ptr); - } else if (ptr != NULL && (*cs & OPT)) { - - /* it was aoptional so no match is ok */ - return (ptr); - } else if (ptr != NULL) { - - /* not optional and we still matched */ - return (NULL); - } - if (*s1 == '\\') - _escaped = _escaped ? false : true; - else - _escaped = false; - } while (*s1++); - return (NULL); - - /* fail if we are currently _escaped */ - case 'e': - if (_escaped) - return(NULL); - cs = MNEXT(cs); - break; - - /* match any number of tabs and spaces */ - case 'd': - ptr = s; - while (*s == ' ' || *s == '\t') - s++; - if (s != ptr || s == s_start) { - - /* match, be happy */ - matched = 1; - cs = MNEXT(cs); - } else if (*s == '\n' || *s == '\0') { - - /* match, be happy */ - matched = 1; - cs = MNEXT(cs); - } else if (*cs & ALT) { - - /* try the next part */ - matched = 0; - cs = MNEXT(cs); - } else if (*cs & OPT) { - - /* doesn't matter */ - matched = 1; - cs = MNEXT(cs); - } else - - /* no match, error return */ - return (NULL); - break; - - /* check for end of line */ - case '$': - if (*s == '\0' || *s == '\n') { - - /* match, be happy */ - s++; - matched = 1; - cs = MNEXT(cs); - } else if (*cs & ALT) { - - /* try the next part */ - matched = 0; - cs = MNEXT(cs); - } else if (*cs & OPT) { - - /* doesn't matter */ - matched = 1; - cs = MNEXT(cs); - } else - - /* no match, error return */ - return (NULL); - break; - - /* check for start of line */ - case '^': - if (s == s_start) { - - /* match, be happy */ - matched = 1; - cs = MNEXT(cs); - } else if (*cs & ALT) { - - /* try the next part */ - matched = 0; - cs = MNEXT(cs); - } else if (*cs & OPT) { - - /* doesn't matter */ - matched = 1; - cs = MNEXT(cs); - } else - - /* no match, error return */ - return (NULL); - break; - - /* end of a subexpression, return success */ - case ')': - return (s); - } - break; - } - } - return (s); -} diff --git a/usr.bin/vgrind/tmac.vgrind b/usr.bin/vgrind/tmac.vgrind deleted file mode 100644 index 57ad70efa61f..000000000000 --- a/usr.bin/vgrind/tmac.vgrind +++ /dev/null @@ -1,71 +0,0 @@ -.am vS -.. -.am vE -.. -'ss 23 -'ds _ \d\(mi\u -'ps 9z -'vs 10p -'ds - \(mi -'ds / \\h'\\w' 'u-\\w'/'u'/ -'ds /* \\h'\\w' 'u-\\w'/'u'/* -'bd B 3 -'bd S B 3 -'nr cm 0 -'nf -'de vH -'ev 2 -'ft 1 -'sp .35i -'tl '\s14\f3\\*(=F\fP\s0'\\*(=H'\f3\s14\\*(=F\fP\s0' -'sp .25i -'ft 1 -\f2\s12\h'\\n(.lu-\w'\\*(=f'u'\\*(=f\fP\s0\h'|0u' -.sp .05i *** 1481 LINES SKIPPED ***
