Deleted Added
full compact
vfontedpr.c (50477) vfontedpr.c (87693)
1/*
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
1/*
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35
36__FBSDID("$FreeBSD: head/usr.bin/vgrind/vfontedpr.c 87693 2001-12-11 23:10:26Z markm $");
37
34#ifndef lint
35static const char copyright[] =
36"@(#) Copyright (c) 1980, 1993\n\
37 The Regents of the University of California. All rights reserved.\n";
38#ifndef lint
39static const char copyright[] =
40"@(#) Copyright (c) 1980, 1993\n\
41 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
42#endif
39
40#ifndef lint
43
44#ifndef lint
41#if 0
42static char sccsid[] = "@(#)vfontedpr.c 8.1 (Berkeley) 6/6/93";
45static const char sccsid[] = "@(#)vfontedpr.c 8.1 (Berkeley) 6/6/93";
43#endif
46#endif
44static const char rcsid[] =
45 "$FreeBSD: head/usr.bin/vgrind/vfontedpr.c 50477 1999-08-28 01:08:13Z peter $";
46#endif /* not lint */
47
48#include <sys/types.h>
49#include <sys/stat.h>
50#include <ctype.h>
51#include <err.h>
52#include <stdio.h>
53#include <stdlib.h>
54#include <string.h>

--- 39 unchanged lines hidden (view full) ---

94static boolean pass = FALSE; /*
95 * when acting as a filter, pass indicates
96 * whether we are currently processing
97 * input.
98 */
99
100static int blklevel; /* current nesting level */
101static int comtype; /* type of comment */
47
48#include <sys/types.h>
49#include <sys/stat.h>
50#include <ctype.h>
51#include <err.h>
52#include <stdio.h>
53#include <stdlib.h>
54#include <string.h>

--- 39 unchanged lines hidden (view full) ---

94static boolean pass = FALSE; /*
95 * when acting as a filter, pass indicates
96 * whether we are currently processing
97 * input.
98 */
99
100static int blklevel; /* current nesting level */
101static int comtype; /* type of comment */
102static char *defsfile[2] = { _PATH_VGRINDEFS, 0 };
102static const char *defsfile[2] = { _PATH_VGRINDEFS, 0 };
103 /* name of language definitions file */
104static int margin;
105static int plstack[PSMAX]; /* the procedure nesting level stack */
106static char pname[BUFSIZ+1];
107static boolean prccont; /* continue last procedure */
108static int psptr; /* the stack index of the current procedure */
109static char pstack[PSMAX][PNAMELEN+1]; /* the procedure name stack */
110

--- 11 unchanged lines hidden (view full) ---

122char *l_comend; /* string ending a comment */
123char l_escape; /* character used to escape characters */
124char *l_keywds[BUFSIZ/2]; /* keyword table address */
125char *l_nocom; /* regexp for non-comments */
126char *l_prcbeg; /* regular expr for procedure begin */
127char *l_strbeg; /* delimiter for string constant */
128char *l_strend; /* delimiter for string constant */
129boolean l_toplex; /* procedures only defined at top lex level */
103 /* name of language definitions file */
104static int margin;
105static int plstack[PSMAX]; /* the procedure nesting level stack */
106static char pname[BUFSIZ+1];
107static boolean prccont; /* continue last procedure */
108static int psptr; /* the stack index of the current procedure */
109static char pstack[PSMAX][PNAMELEN+1]; /* the procedure name stack */
110

--- 11 unchanged lines hidden (view full) ---

122char *l_comend; /* string ending a comment */
123char l_escape; /* character used to escape characters */
124char *l_keywds[BUFSIZ/2]; /* keyword table address */
125char *l_nocom; /* regexp for non-comments */
126char *l_prcbeg; /* regular expr for procedure begin */
127char *l_strbeg; /* delimiter for string constant */
128char *l_strend; /* delimiter for string constant */
129boolean l_toplex; /* procedures only defined at top lex level */
130char *language = "c"; /* the language indicator */
130const char *language = "c"; /* the language indicator */
131
132#define ps(x) printf("%s", x)
133
134int
135main(argc, argv)
136 int argc;
137 char *argv[];
138{
131
132#define ps(x) printf("%s", x)
133
134int
135main(argc, argv)
136 int argc;
137 char *argv[];
138{
139 char *fname = "";
139 const char *fname = "";
140 struct stat stbuf;
141 char buf[BUFSIZ];
142 char *defs;
143 int needbp = 0;
144
145 argc--, argv++;
146 do {
147 char *cp;

--- 13 unchanged lines hidden (view full) ---

161 continue;
162 goto rest;
163 }
164
165 /* act as a filter like eqn */
166 if (!strcmp(argv[0], "-f")) {
167 filter++;
168 argv[0] = argv[argc-1];
140 struct stat stbuf;
141 char buf[BUFSIZ];
142 char *defs;
143 int needbp = 0;
144
145 argc--, argv++;
146 do {
147 char *cp;

--- 13 unchanged lines hidden (view full) ---

161 continue;
162 goto rest;
163 }
164
165 /* act as a filter like eqn */
166 if (!strcmp(argv[0], "-f")) {
167 filter++;
168 argv[0] = argv[argc-1];
169 argv[argc-1] = "-";
169 argv[argc-1] = strdup("-");
170 continue;
171 }
172
173 /* take input from the standard place */
174 if (!strcmp(argv[0], "-")) {
175 argc = 0;
176 goto rest;
177 }
178
179 /* build an index */
180 if (!strcmp(argv[0], "-x")) {
181 idx++;
170 continue;
171 }
172
173 /* take input from the standard place */
174 if (!strcmp(argv[0], "-")) {
175 argc = 0;
176 goto rest;
177 }
178
179 /* build an index */
180 if (!strcmp(argv[0], "-x")) {
181 idx++;
182 argv[0] = "-n";
182 argv[0] = strdup("-n");
183 }
184
185 /* indicate no keywords */
186 if (!strcmp(argv[0], "-n")) {
187 nokeyw++;
188 argc--, argv++;
189 continue;
190 }

--- 523 unchanged lines hidden (view full) ---

714 register char *s;
715{
716 register char **ss = l_keywds;
717 register int i = 1;
718 register char *cp = s;
719
720 while (++cp, isidchr(*cp))
721 i++;
183 }
184
185 /* indicate no keywords */
186 if (!strcmp(argv[0], "-n")) {
187 nokeyw++;
188 argc--, argv++;
189 continue;
190 }

--- 523 unchanged lines hidden (view full) ---

714 register char *s;
715{
716 register char **ss = l_keywds;
717 register int i = 1;
718 register char *cp = s;
719
720 while (++cp, isidchr(*cp))
721 i++;
722 while (cp = *ss++)
722 while ((cp = *ss++))
723 if (!STRNCMP(s,cp,i) && !isidchr(cp[i]))
724 return (i);
725 return (0);
726}
727
723 if (!STRNCMP(s,cp,i) && !isidchr(cp[i]))
724 return (i);
725 return (0);
726}
727