3 diff -NrU2 ../build/Makefile.in ../../nvi-1.79/build/Makefile.in
4 --- ../build/Makefile.in Mon May 8 16:05:17 2000
5 +++ ../../nvi-1.79/build/Makefile.in Mon May 8 16:06:15 2000
9 -CFLAGS= -c $(OPTFLAG) @CFLAGS@ -I. -I$(srcdir)/include @CPPFLAGS@
10 +CFLAGS= -c $(OPTFLAG) @CFLAGS@ -I. -I$(srcdir)/include @CPPFLAGS@ -DGTAGS
12 PERL= @vi_cv_path_perl@
13 diff -NrU2 ../common/main.c ../../nvi-1.79/common/main.c
14 --- ../common/main.c Sat Oct 12 07:28:28 1996
15 +++ ../../nvi-1.79/common/main.c Mon May 8 16:06:15 2000
18 int ch, flagchk, lflag, secure, startup, readonly, rval, silent;
22 char *tag_f, *wsizearg, path[256];
25 F_SET(gp, G_SNAPSHOT);
29 + while ((ch = getopt(argc, argv, "c:D:eFGlRrSsT:t:vw:")) != EOF)
31 + while ((ch = getopt(argc, argv, "c:eFGlRrSst:vw:")) != EOF)
35 while ((ch = getopt(argc, argv, "c:D:eFlRrSsT:t:vw:")) != EOF)
37 while ((ch = getopt(argc, argv, "c:eFlRrSst:vw:")) != EOF)
41 case 'c': /* Run the command. */
43 F_CLR(gp, G_SNAPSHOT);
46 + case 'G': /* gtags mode. */
50 case 'l': /* Set lisp, showmatch options. */
54 *oargp++ = O_READONLY;
57 + *oargp++ = O_GTAGSMODE;
61 diff -NrU2 ../common/options.c ../../nvi-1.79/common/options.c
62 --- ../common/options.c Mon May 8 16:05:18 2000
63 +++ ../../nvi-1.79/common/options.c Mon May 8 16:20:26 2000
66 {"flash", NULL, OPT_1BOOL, 0},
68 +/* O_GTAGSMODE FreeBSD2.2 */
69 + {"gtagsmode", NULL, OPT_0BOOL, 0},
72 {"hardtabs", NULL, OPT_NUM, 0},
75 {"fe", O_FILEENCODING}, /* MULTIBYTE */
78 + {"gt", O_GTAGSMODE}, /* GTAGS */
80 {"ht", O_HARDTABS}, /* 4BSD */
81 diff -NrU2 ../docs/USD.doc/vi.man/vi.1 ../../nvi-1.79/docs/USD.doc/vi.man/vi.1
82 --- ../docs/USD.doc/vi.man/vi.1 Fri Oct 11 10:34:05 1996
83 +++ ../../nvi-1.79/docs/USD.doc/vi.man/vi.1 Mon May 8 16:06:15 2000
106 Start editing with the lisp and showmatch options set.
109 +Start editing in gtags mode, as if the gtagsmode option was set.
112 Start editing in read-only mode, as if the command name was
115 Push a tag reference onto the tag stack.
116 +In gtagsmode, if at the first column of line,
117 +locate function references otherwise function definitions.
121 Rewind the argument list.
123 +.B "rta[g][!] tagstring"
124 +Edit the file refering the specified tag. (Only in gtagsmode)
126 .B "se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]"
127 Display or set editor options.
128 @@ -1110,4 +1118,7 @@
130 Flash the screen instead of beeping the keyboard on error.
132 +.B "gtagsmode, gt [off]"
133 +Use GTAGS and GRTAGS instead of tags.
135 .B "hardtabs, ht [8]"
136 diff -NrU2 ../ex/ex.h ../../nvi-1.79/ex/ex.h
137 --- ../ex/ex.h Mon May 8 16:05:18 2000
138 +++ ../../nvi-1.79/ex/ex.h Mon May 8 16:06:15 2000
140 #define E_USELASTCMD 0x02000000 /* Use the last command. */
141 #define E_VISEARCH 0x04000000 /* It's really a vi search command. */
143 +#define E_REFERENCE 0x08000000 /* locate function references */
145 u_int32_t flags; /* Current flags. */
147 diff -NrU2 ../ex/ex_cmd.c ../../nvi-1.79/ex/ex_cmd.c
148 --- ../ex/ex_cmd.c Wed Oct 23 22:31:01 1996
149 +++ ../../nvi-1.79/ex/ex_cmd.c Mon May 8 16:06:15 2000
152 "re-edit all the files in the file argument list"},
155 + {"rtag", ex_rtag_push, E_NEWSCREEN,
157 + "rta[g][!] [string]",
158 + "edit the file containing the tag"},
162 diff -NrU2 ../ex/ex_tag.c ../../nvi-1.79/ex/ex_tag.c
163 --- ../ex/ex_tag.c Mon Sep 16 05:02:43 1996
164 +++ ../../nvi-1.79/ex/ex_tag.c Mon May 8 16:06:15 2000
166 static void ctag_file __P((SCR *, TAGF *, char *, char **, size_t *));
167 static int ctag_search __P((SCR *, char *, size_t, char *));
169 +static int getentry __P((char *, char **, char **, char **));
170 +static TAGQ *gtag_slist __P((SCR *, char *, int));
172 static int ctag_sfile __P((SCR *, TAGF *, TAGQ *, char *));
173 static TAGQ *ctag_slist __P((SCR *, char *));
179 + * ex_rtag_push -- ^]
180 + * :rtag[!] [string]
182 + * Enter a new TAGQ context based on a ctag string.
184 + * PUBLIC: int ex_rtag_push __P((SCR *, EXCMD *));
187 +ex_rtag_push(sp, cmdp)
191 + F_SET(cmdp, E_REFERENCE);
192 + return ex_tag_push(sp, cmdp);
200 /* Get the tag information. */
202 + if (O_ISSET(sp, O_GTAGSMODE)) {
203 + if ((tqp = gtag_slist(sp, exp->tag_last, F_ISSET(cmdp, E_REFERENCE))) == NULL)
207 if ((tqp = ctag_slist(sp, exp->tag_last)) == NULL)
209 @@ -970,4 +999,127 @@
215 + * get tag information from current line.
217 + * gtags temporary file format.
218 + * <tag> <lineno> <file> <image>
221 + * +------------------------------------------------
222 + * |main 30 main.c main(argc, argv)
223 + * |func 21 subr.c func(arg)
226 +getentry(buf, tag, file, line)
227 + char *buf, **tag, **file, **line;
231 + for (*tag = p; *p && !isspace(*p); p++) /* tag name */
236 + for (; *p && isspace(*p); p++) /* (skip blanks) */
240 + *line = p; /* line no */
241 + for (*line = p; *p && !isspace(*p); p++)
246 + for (; *p && isspace(*p); p++) /* (skip blanks) */
250 + *file = p; /* file name */
251 + for (*file = p; *p && !isspace(*p); p++)
258 + if (strlen(*tag) && strlen(*line) && strlen(*file) && atoi(*line) > 0)
261 + return 0; /* ERROR */
266 + * Search the list of tags files for a tag, and return tag queue.
269 +gtag_slist(sp, tag, ref)
280 + char *name, *file, *line;
281 + char command[BUFSIZ];
285 + /* Allocate and initialize the tag queue structure. */
287 + CALLOC_GOTO(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + len + 1);
288 + CIRCLEQ_INIT(&tqp->tagq);
289 + tqp->tag = tqp->buf;
290 + memcpy(tqp->tag, tag, (tqp->tlen = len) + 1);
293 + * Find the tag, only display missing file messages once, and
294 + * then only if we didn't find the tag.
296 + snprintf(command, sizeof(command), "global -%s '%s' 2>/dev/null", ref ? "rx" : "x", tag);
297 + if (fp = popen(command, "r")) {
298 + while (fgets(buf, sizeof(buf), fp)) {
299 + if (buf[strlen(buf)-1] == '\n') /* chop(buf) */
300 + buf[strlen(buf)-1] = 0;
302 + while (fgetc(fp) != '\n')
304 + if (getentry(buf, &name, &file, &line) == 0) {
306 + F_SET(tfp, TAGF_ERR);
309 + CALLOC_GOTO(sp, tp,
310 + TAG *, 1, sizeof(TAG) + strlen(file) + 1 + strlen(line) + 1);
311 + tp->fname = tp->buf;
312 + strcpy(tp->fname, file);
313 + tp->fnlen = strlen(file);
314 + tp->search = tp->fname + tp->fnlen + 1;
315 + strcpy(tp->search, line);
316 + CIRCLEQ_INSERT_TAIL(&tqp->tagq, tp, q);
321 + /* Check to see if we found anything. */
322 + if (tqp->tagq.cqh_first == (void *)&tqp->tagq) {
323 + msgq_str(sp, M_ERR, tag, "162|%s: tag not found");
328 + tqp->current = tqp->tagq.cqh_first;
337 diff -NrU2 ../include/ex_def.h ../../nvi-1.79/include/ex_def.h
338 --- ../include/ex_def.h Wed Oct 23 22:53:09 1996
339 +++ ../../nvi-1.79/include/ex_def.h Mon May 8 16:06:15 2000
343 -#define C_SUBSTITUTE 49
349 -#define C_SUSPEND 55
352 -#define C_TAGNEXT 58
354 -#define C_TAGPREV 60
358 -#define C_UNABBREVIATE 64
361 -#define C_VERSION 67
362 -#define C_VISUAL_EX 68
363 -#define C_VISUAL_VI 69
364 -#define C_VIUSAGE 70
371 -#define C_SUBTILDE 77
373 +#define C_SUBSTITUTE 50
379 +#define C_SUSPEND 56
382 +#define C_TAGNEXT 59
384 +#define C_TAGPREV 61
388 +#define C_UNABBREVIATE 65
391 +#define C_VERSION 68
392 +#define C_VISUAL_EX 69
393 +#define C_VISUAL_VI 70
394 +#define C_VIUSAGE 71
401 +#define C_SUBTILDE 78
402 diff -NrU2 ../include/ex_extern.h ../../nvi-1.79/include/ex_extern.h
403 --- ../include/ex_extern.h Wed Oct 23 22:53:10 1996
404 +++ ../../nvi-1.79/include/ex_extern.h Mon May 8 16:06:15 2000
406 void re_error __P((SCR *, int, regex_t *));
407 int ex_tag_first __P((SCR *, char *));
408 +int ex_rtag_push __P((SCR *, EXCMD *));
409 int ex_tag_push __P((SCR *, EXCMD *));
410 int ex_tag_next __P((SCR *, EXCMD *));
411 diff -NrU2 ../include/options_def.h ../../nvi-1.79/include/options_def.h
412 --- ../include/options_def.h Mon May 8 16:05:18 2000
413 +++ ../../nvi-1.79/include/options_def.h Mon May 8 16:24:38 2000
415 #define O_FILEENCODING 24
417 -#define O_HARDTABS 26
418 -#define O_ICLOWER 27
419 -#define O_IGNORECASE 28
420 -#define O_INPUTENCODING 29
421 -#define O_KEYTIME 30
422 -#define O_LEFTRIGHT 31
426 -#define O_LOCKFILES 35
428 -#define O_MATCHTIME 37
430 -#define O_MODELINE 39
432 -#define O_NOPRINT 41
436 -#define O_OPTIMIZE 45
437 -#define O_PARAGRAPHS 46
441 -#define O_READONLY 50
448 -#define O_SEARCHINCR 57
449 -#define O_SECTIONS 58
452 -#define O_SHELLMETA 61
453 -#define O_SHIFTWIDTH 62
454 -#define O_SHOWMATCH 63
455 -#define O_SHOWMODE 64
456 -#define O_SIDESCROLL 65
457 -#define O_SKIPDISPLAY 66
458 -#define O_SLOWOPEN 67
459 -#define O_SOURCEANY 68
460 -#define O_TABSTOP 69
461 -#define O_TAGLENGTH 70
465 -#define O_TILDEOP 74
466 -#define O_TIMEOUT 75
467 -#define O_TTYWERASE 76
468 -#define O_VERBOSE 77
474 -#define O_WINDOWNAME 83
475 -#define O_WRAPLEN 84
476 -#define O_WRAPMARGIN 85
477 -#define O_WRAPSCAN 86
478 -#define O_WRITEANY 87
479 -#define O_OPTIONCOUNT 88
480 +#define O_GTAGSMODE 26
481 +#define O_HARDTABS 27
482 +#define O_ICLOWER 28
483 +#define O_IGNORECASE 29
484 +#define O_INPUTENCODING 30
485 +#define O_KEYTIME 31
486 +#define O_LEFTRIGHT 32
490 +#define O_LOCKFILES 36
492 +#define O_MATCHTIME 38
494 +#define O_MODELINE 40
496 +#define O_NOPRINT 42
500 +#define O_OPTIMIZE 46
501 +#define O_PARAGRAPHS 47
505 +#define O_READONLY 51
512 +#define O_SEARCHINCR 58
513 +#define O_SECTIONS 59
516 +#define O_SHELLMETA 62
517 +#define O_SHIFTWIDTH 63
518 +#define O_SHOWMATCH 64
519 +#define O_SHOWMODE 65
520 +#define O_SIDESCROLL 66
521 +#define O_SKIPDISPLAY 67
522 +#define O_SLOWOPEN 68
523 +#define O_SOURCEANY 69
524 +#define O_TABSTOP 70
525 +#define O_TAGLENGTH 71
529 +#define O_TILDEOP 75
530 +#define O_TIMEOUT 76
531 +#define O_TTYWERASE 77
532 +#define O_VERBOSE 78
538 +#define O_WINDOWNAME 84
539 +#define O_WRAPLEN 85
540 +#define O_WRAPMARGIN 86
541 +#define O_WRAPSCAN 87
542 +#define O_WRITEANY 88
543 +#define O_OPTIONCOUNT 89
544 diff -NrU2 ../vi/v_ex.c ../../nvi-1.79/vi/v_ex.c
545 --- ../vi/v_ex.c Mon May 8 16:05:18 2000
546 +++ ../../nvi-1.79/vi/v_ex.c Mon May 8 16:06:15 2000
551 + if (O_ISSET(sp, O_GTAGSMODE) && vp->m_start.cno == 0)
552 + ex_cinit(&cmd, C_RTAG, 0, OOBLNO, 0, 0, ap);
555 ex_cinit(&cmd, C_TAG, 0, OOBLNO, 0, 0, ap);
556 ex_cadd(&cmd, &a, VIP(sp)->keyw, strlen(VIP(sp)->keyw));