ctags bug corrected

utzoo!decvax!harpo!floyd!vax135!cornell!pavel utzoo!decvax!harpo!floyd!vax135!cornell!pavel
Wed Jun 2 22:02:43 AEST 1982


For any given function, ctags produces a line like

	func_name	filename.c	?^func_name(arg1, arg2)$?

where the first field is the function name, the second the file in which the
definition of that function appears and the third a search command to find
the definition.  If one has a function whose first line contains a '?', ctags
doesn't escape it.  For example:

	min	filename.c	?^#define min(a,b) ((a)>(b) ? (b) : (a))$?

This confuses vi which takes the imbedded '?' to be the end of the search
string.  The fix is easy:
-----------------------------------
*** ctags.c	Wed Apr 14 11:33:38 1982
--- new_ctags.c	Wed Jun  2 21:50:00 1982
***************
*** 494,499
  		for (sp = node->pat; *sp; sp++)
  			if (*sp == '\\')
  				fprintf(outf, "\\\\");
  			else
  				putc(*sp, outf);
  		fprintf(outf, "%c\n", searchar);

--- 494,501 -----
  		for (sp = node->pat; *sp; sp++)
  			if (*sp == '\\')
  				fprintf(outf, "\\\\");
+ 			else if (*sp == searchar)
+ 				fprintf(outf, "\\%c", searchar);
  			else
  				putc(*sp, outf);
  		fprintf(outf, "%c\n", searchar);
------------------------------------

	Pavel Curtis
	Cornell University



More information about the Comp.bugs.4bsd.ucb-fixes mailing list