Merged with 4.4lite.

Changed to conform to NetBSD's new RCS Id conventions.
This commit is contained in:
jtc 1994-11-17 08:27:58 +00:00
parent 31ce5c89d3
commit b2fe91d9f0
12 changed files with 179 additions and 134 deletions

View File

@ -1,17 +1,21 @@
# from: @(#)Makefile 5.8 (Berkeley) 6/5/90
# $Id: Makefile,v 1.2 1993/07/30 22:30:17 mycroft Exp $
# $NetBSD: Makefile,v 1.3 1994/11/17 08:27:58 jtc Exp $
# @(#)Makefile 8.1 (Berkeley) 6/9/93
PROG= vfontedpr
SRCS= regexp.c vfontedpr.c vgrindefs.c
SRCS= regexp.c vfontedpr.c
MAN1= vgrind.0
MAN5= vgrindefs.0
BINDIR= /usr/libexec
CLEANFILES+=vgrindefs.src.db
beforeinstall:
cap_mkdb -f vgrindefs.src ${.CURDIR}/vgrindefs.src
install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
${.CURDIR}/vgrind.sh ${DESTDIR}/usr/bin/vgrind
install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/vgrindefs.src \
${DESTDIR}/usr/share/misc/vgrindefs
install -c -o ${BINOWN} -g ${BINGRP} -m 444 \
vgrindefs.src.db ${DESTDIR}/usr/share/misc/vgrindefs.db
install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/tmac.vgrind \
${DESTDIR}/usr/share/tmac

View File

@ -1,3 +1,4 @@
# $NetBSD: Makefile,v 1.2 1994/11/17 08:28:17 jtc Exp $
# @(#)Makefile 8.1 (Berkeley) 6/6/93
PROG= retest

View File

@ -1,3 +1,5 @@
/* $NetBSD: retest.c,v 1.2 1994/11/17 08:28:18 jtc Exp $ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@ -38,7 +40,10 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)retest.c 8.1 (Berkeley) 6/6/93";
#endif
static char rcsid[] = "$NetBSD: retest.c,v 1.2 1994/11/17 08:28:18 jtc Exp $":
#endif /* not lint */
#include <ctype.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: extern.h,v 1.2 1994/11/17 08:27:59 jtc Exp $ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.

View File

@ -1,6 +1,8 @@
/* $NetBSD: pathnames.h,v 1.3 1994/11/17 08:28:01 jtc Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
* 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
@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)pathnames.h 5.2 (Berkeley) 6/1/90
* $Id: pathnames.h,v 1.2 1993/08/01 18:03:26 mycroft Exp $
* @(#)pathnames.h 8.1 (Berkeley) 6/6/93
*/
#define _PATH_VGRINDEFS "/usr/share/misc/vgrindefs"

View File

@ -1,6 +1,9 @@
/* $NetBSD: regexp.c,v 1.3 1994/11/17 08:28:02 jtc Exp $ */
/*
* Copyright (c) 1980 The Regents of the University of California.
* All rights reserved.
* 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
@ -32,18 +35,32 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)regexp.c 5.3 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: regexp.c,v 1.2 1993/08/01 18:03:29 mycroft Exp $";
static char copyright[] =
"@(#) Copyright (c) 1980, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)regexp.c 8.1 (Berkeley) 6/6/93";
#endif
static char rcsid[] = "$NetBSD: regexp.c,v 1.3 1994/11/17 08:28:02 jtc Exp $";
#endif /* not lint */
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "extern.h"
typedef int boolean;
#define TRUE 1
#define FALSE 0
#define TRUE !(FALSE)
#define NIL 0
boolean l_onecase; /* true if upper and lower equivalent */
static void expconv __P((void));
boolean _escaped; /* true if we are currently _escaped */
char *_start; /* start of string */
boolean l_onecase; /* true if upper and lower equivalent */
#define makelower(c) (isupper((c)) ? tolower((c)) : (c))
@ -52,6 +69,7 @@ boolean l_onecase; /* true if upper and lower equivalent */
* if l_onecase is set.
*/
int
STRNCMP(s1, s2, len)
register char *s1,*s2;
register int len;
@ -130,9 +148,8 @@ STRNCMP(s1, s2, len)
#define ALT 8
#define OPER 16
char *ure; /* pointer current position in unconverted exp */
char *ccre; /* pointer to current position in converted exp*/
char *malloc();
static char *ccre; /* pointer to current position in converted exp*/
static char *ure; /* pointer current position in unconverted exp */
char *
convexp(re)
@ -160,6 +177,7 @@ convexp(re)
return (cre);
}
static void
expconv()
{
register char *cs; /* pointer to current symbol in converted exp */
@ -250,7 +268,7 @@ expconv()
OCNT(cs) = ccre - cs; /* offset to next symbol */
break;
/* return from a recursion */
/* reurn from a recursion */
case ')':
if (acs != NIL) {
do {
@ -330,9 +348,6 @@ expconv()
* character matched.
*/
boolean _escaped; /* true if we are currently _escaped */
char *_start; /* start of string */
char *
expmatch (s, re, mstring)
register char *s; /* string to check for a match in */

View File

@ -1,6 +1,8 @@
/* $NetBSD: vfontedpr.c,v 1.3 1994/11/17 08:28:03 jtc Exp $ */
/*
* Copyright (c) 1980 The Regents of the University of California.
* All rights reserved.
* 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
@ -32,25 +34,30 @@
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 The Regents of the University of California.\n\
All rights reserved.\n";
static char copyright[] =
"@(#) Copyright (c) 1980, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)vfontedpr.c 5.5 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: vfontedpr.c,v 1.2 1993/08/01 18:03:28 mycroft Exp $";
#if 0
static char sccsid[] = "@(#)vfontedpr.c 8.1 (Berkeley) 6/6/93";
#endif
static char rcsid[] = "$NetBSD: vfontedpr.c,v 1.3 1994/11/17 08:28:03 jtc Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "pathnames.h"
#include "extern.h"
#define boolean int
#define TRUE 1
#define FALSE 0
#define TRUE !(FALSE)
#define NIL 0
#define STANDARD 0
#define ALTERNATE 1
@ -66,82 +73,72 @@ static char rcsid[] = "$Id: vfontedpr.c,v 1.2 1993/08/01 18:03:28 mycroft Exp $"
#define PNAMELEN 40 /* length of a function/procedure name */
#define PSMAX 20 /* size of procedure name stacking */
/* regular expression routines */
char *expmatch(); /* match a string to an expression */
char *STRNCMP(); /* a different kindof strncmp */
char *convexp(); /* convert expression to internal form */
char *tgetstr();
boolean isproc();
char *ctime();
static int iskw __P((char *));
static boolean isproc __P((char *));
static void putKcp __P((char *, char *, boolean));
static void putScp __P((char *));
static void putcp __P((int));
static int tabs __P((char *, char *));
static int width __P((char *, char *));
/*
* The state variables
*/
boolean incomm; /* in a comment of the primary type */
boolean instr; /* in a string constant */
boolean inchr; /* in a string constant */
boolean nokeyw = FALSE; /* no keywords being flagged */
boolean index = FALSE; /* form an index */
boolean filter = FALSE; /* act as a filter (like eqn) */
boolean pass = FALSE; /* when acting as a filter, pass indicates
static boolean filter = FALSE; /* act as a filter (like eqn) */
static boolean inchr; /* in a string constant */
static boolean incomm; /* in a comment of the primary type */
static boolean idx = FALSE; /* form an index */
static boolean instr; /* in a string constant */
static boolean nokeyw = FALSE; /* no keywords being flagged */
static boolean pass = FALSE; /*
* when acting as a filter, pass indicates
* whether we are currently processing
* input.
*/
boolean prccont; /* continue last procedure */
int comtype; /* type of comment */
int margin;
int psptr; /* the stack index of the current procedure */
char pstack[PSMAX][PNAMELEN+1]; /* the procedure name stack */
int plstack[PSMAX]; /* the procedure nesting level stack */
int blklevel; /* current nesting level */
char *defsfile = _PATH_VGRINDEFS; /* name of language definitions file */
char pname[BUFSIZ+1];
static int blklevel; /* current nesting level */
static int comtype; /* type of comment */
static char *defsfile[2] = { _PATH_VGRINDEFS, 0 };
/* name of language definitions file */
static int margin;
static int plstack[PSMAX]; /* the procedure nesting level stack */
static char pname[BUFSIZ+1];
static boolean prccont; /* continue last procedure */
static int psptr; /* the stack index of the current procedure */
static char pstack[PSMAX][PNAMELEN+1]; /* the procedure name stack */
/*
* The language specific globals
*/
char *language = "c"; /* the language indicator */
char *l_keywds[BUFSIZ/2]; /* keyword table address */
char *l_prcbeg; /* regular expr for procedure begin */
char *l_combeg; /* string introducing a comment */
char *l_comend; /* string ending a comment */
char *l_acmbeg; /* string introducing a comment */
char *l_acmend; /* string ending a comment */
char *l_blkbeg; /* string begining of a block */
char *l_blkend; /* string ending a block */
char *l_strbeg; /* delimiter for string constant */
char *l_strend; /* delimiter for string constant */
char *l_chrbeg; /* delimiter for character constant */
char *l_chrend; /* delimiter for character constant */
char l_escape; /* character used to escape characters */
boolean l_toplex; /* procedures only defined at top lex level */
/*
* global variables also used by expmatch
*/
boolean _escaped; /* if last character was an escape */
char *_start; /* start of the current string */
boolean l_onecase; /* upper and lower case are equivalent */
char *l_combeg; /* string introducing a comment */
char *l_comend; /* string ending a comment */
char l_escape; /* character used to escape characters */
char *l_keywds[BUFSIZ/2]; /* keyword table address */
char *l_prcbeg; /* regular expr for procedure begin */
char *l_strbeg; /* delimiter for string constant */
char *l_strend; /* delimiter for string constant */
boolean l_toplex; /* procedures only defined at top lex level */
char *language = "c"; /* the language indicator */
#define ps(x) printf("%s", x)
void
main(argc, argv)
int argc;
char *argv[];
{
int lineno;
char *fname = "";
char *ptr;
struct stat stbuf;
char buf[BUFSIZ];
char strings[2 * BUFSIZ];
char defs[2 * BUFSIZ];
char *defs;
int needbp = 0;
argc--, argv++;
@ -180,7 +177,7 @@ main(argc, argv)
/* build an index */
if (!strcmp(argv[0], "-x")) {
index++;
idx++;
argv[0] = "-n";
}
@ -211,7 +208,7 @@ main(argc, argv)
/* specify the language description file */
if (!strncmp(argv[0], "-d", 2)) {
defsfile = argv[1];
defsfile[0] = argv[1];
argc--, argv++;
argc--, argv++;
continue;
@ -222,7 +219,7 @@ main(argc, argv)
perror(argv[0]);
exit(1);
}
if (index)
if (idx)
printf("'ta 4i 4.25i 5.5iR\n'in .5i\n");
fname = argv[0];
argc--, argv++;
@ -232,22 +229,24 @@ main(argc, argv)
/*
* get the language definition from the defs file
*/
i = tgetent (defs, language, defsfile);
if (i == 0) {
i = cgetent(&defs, defsfile, language);
if (i == -1) {
fprintf (stderr, "no entry for language %s\n", language);
exit (0);
} else if (i < 0) {
fprintf (stderr, "cannot find vgrindefs file %s\n", defsfile);
} else if (i == -2) { fprintf(stderr,
"cannot find vgrindefs file %s\n", defsfile[0]);
exit (0);
} else if (i == -3) { fprintf(stderr,
"potential reference loop detected in vgrindefs file %s\n",
defsfile[0]);
exit(0);
}
cp = strings;
if (tgetstr ("kw", &cp) == NIL)
if (cgetustr(defs, "kw", &cp) == -1)
nokeyw = TRUE;
else {
char **cpp;
cpp = l_keywds;
cp = strings;
while (*cp) {
while (*cp == ' ' || *cp =='\t')
*cp++ = NULL;
@ -258,31 +257,31 @@ main(argc, argv)
}
*cpp = NIL;
}
cp = buf;
l_prcbeg = convexp (tgetstr ("pb", &cp));
cp = buf;
l_combeg = convexp (tgetstr ("cb", &cp));
cp = buf;
l_comend = convexp (tgetstr ("ce", &cp));
cp = buf;
l_acmbeg = convexp (tgetstr ("ab", &cp));
cp = buf;
l_acmend = convexp (tgetstr ("ae", &cp));
cp = buf;
l_strbeg = convexp (tgetstr ("sb", &cp));
cp = buf;
l_strend = convexp (tgetstr ("se", &cp));
cp = buf;
l_blkbeg = convexp (tgetstr ("bb", &cp));
cp = buf;
l_blkend = convexp (tgetstr ("be", &cp));
cp = buf;
l_chrbeg = convexp (tgetstr ("lb", &cp));
cp = buf;
l_chrend = convexp (tgetstr ("le", &cp));
cgetustr(defs, "pb", &cp);
l_prcbeg = convexp(cp);
cgetustr(defs, "cb", &cp);
l_combeg = convexp(cp);
cgetustr(defs, "ce", &cp);
l_comend = convexp(cp);
cgetustr(defs, "ab", &cp);
l_acmbeg = convexp(cp);
cgetustr(defs, "ae", &cp);
l_acmend = convexp(cp);
cgetustr(defs, "sb", &cp);
l_strbeg = convexp(cp);
cgetustr(defs, "se", &cp);
l_strend = convexp(cp);
cgetustr(defs, "bb", &cp);
l_blkbeg = convexp(cp);
cgetustr(defs, "be", &cp);
l_blkend = convexp(cp);
cgetustr(defs, "lb", &cp);
l_chrbeg = convexp(cp);
cgetustr(defs, "le", &cp);
l_chrend = convexp(cp);
l_escape = '\\';
l_onecase = tgetflag ("oc");
l_toplex = tgetflag ("tl");
l_onecase = (cgetcap(defs, "oc", ':') != NULL);
l_toplex = (cgetcap(defs, "tl", ':') != NULL);
/* initialize the program */
@ -352,6 +351,7 @@ main(argc, argv)
#define isidchr(c) (isalnum(c) || (c) == '_')
static void
putScp(os)
char *os;
{
@ -532,6 +532,7 @@ skip:
} while (*s);
}
static void
putKcp (start, end, force)
char *start; /* start of string to write */
char *end; /* end of string to write */
@ -541,7 +542,7 @@ putKcp (start, end, force)
int xfld = 0;
while (start <= end) {
if (index) {
if (idx) {
if (*start == ' ' || *start == '\t') {
if (xfld == 0)
printf("");
@ -581,6 +582,7 @@ putKcp (start, end, force)
}
static int
tabs(s, os)
char *s, *os;
{
@ -588,6 +590,7 @@ tabs(s, os)
return (width(s, os) / 8);
}
static int
width(s, os)
register char *s, *os;
{
@ -608,6 +611,7 @@ width(s, os)
return (i);
}
static void
putcp(c)
register int c;
{
@ -672,7 +676,7 @@ putcp(c)
/*
* look for a process beginning on this line
*/
boolean
static boolean
isproc(s)
char *s;
{
@ -688,6 +692,7 @@ isproc(s)
/* iskw - check to see if the next word is a keyword
*/
static int
iskw(s)
register char *s;
{
@ -702,3 +707,4 @@ iskw(s)
return (i);
return (0);
}

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1980 ,1990 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: vgrind.1,v 1.4 1994/11/17 08:28:04 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 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
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)vgrind.1 6.4 (Berkeley) 4/23/91
.\" $Id: vgrind.1,v 1.3 1993/09/05 22:48:37 mycroft Exp $
.\" @(#)vgrind.1 8.1 (Berkeley) 6/6/93
.\"
.Dd April 23, 1991
.Dd June 6, 1993
.Dt VGRIND 1
.Os BSD 4
.Sh NAME
@ -177,6 +178,7 @@ language descriptions
.Sh SEE ALSO
.Xr lpr 1 ,
.Xr troff 1 ,
.Xr getcap 3 ,
.Xr vgrindefs 5
.Sh BUGS
Vfontedpr assumes that a certain programming style is followed:

View File

@ -1,7 +1,9 @@
#!/bin/csh -f
#
# Copyright (c) 1980 The Regents of the University of California.
# All rights reserved.
# $NetBSD: vgrind.sh,v 1.3 1994/11/17 08:28:06 jtc Exp $
#
# 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
@ -31,7 +33,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# @(#)vgrind.sh 5.7 (Berkeley) 4/16/91
# @(#)vgrind.sh 8.1 (Berkeley) 6/6/93
#
set voptions=
@ -116,10 +118,10 @@ if (-r index) then
else
if ("$head" != "") then
$vf $options -h "$head" $files | \
sh -c "troff -rx1 $voptions -i -mvgrind 2>> xindex"
sh -c "psroff -rx1 $voptions -i -mvgrind 2>> xindex"
else
$vf $options $files | \
sh -c "troff -rx1 $voptions -i -mvgrind 2>> xindex"
sh -c "psroff -rx1 $voptions -i -mvgrind 2>> xindex"
endif
endif
sort -df +0 -2 xindex >index
@ -133,9 +135,9 @@ else
endif
else
if ("$head" != "") then
$vf $options -h "$head" $files | troff -i $voptions -mvgrind
$vf $options -h "$head" $files | psroff -i $voptions -mvgrind
else
$vf $options $files | troff -i $voptions -mvgrind
$vf $options $files | psroff -i $voptions -mvgrind
endif
endif
endif

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1989, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: vgrindefs.5,v 1.3 1994/11/17 08:28:07 jtc Exp $
.\"
.\" Copyright (c) 1989, 1991, 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
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)vgrindefs.5 6.7 (Berkeley) 7/31/91
.\" $Id: vgrindefs.5,v 1.2 1993/08/01 07:26:39 mycroft Exp $
.\" @(#)vgrindefs.5 8.1 (Berkeley) 6/6/93
.\"
.Dd July 31, 1991
.Dd June 6, 1993
.Dt VGRINDEFS 5
.Os BSD 4.2
.Sh NAME

View File

@ -1,6 +1,8 @@
/* $NetBSD: vgrindefs.c,v 1.4 1994/11/17 08:28:08 jtc Exp $ */
/*
* Copyright (c) 1980 The Regents of the University of California.
* All rights reserved.
* 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
@ -32,8 +34,10 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)vgrindefs.c 5.3 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: vgrindefs.c,v 1.3 1993/08/01 18:03:27 mycroft Exp $";
#if 0
static char sccsid[] = "@(#)vgrindefs.c 8.1 (Berkeley) 6/6/93";
#endif
static char rcsid[] = "$NetBSD: vgrindefs.c,v 1.4 1994/11/17 08:28:08 jtc Exp $";
#endif /* not lint */
#define BUFSIZ 1024

View File

@ -1,3 +1,5 @@
# $NetBSD: vgrindefs.src,v 1.2 1994/11/17 08:28:09 jtc Exp $
#
# Copyright (c) 1987, 1993
# The Regents of the University of California. All rights reserved.
#