tags.c.diff   [plain text]


--- tags.c.orig	2005-01-06 17:32:19.000000000 -0800
+++ tags.c	2005-02-21 10:43:18.000000000 -0800
@@ -22,6 +22,7 @@
 
 extern int linenums;
 extern int sigs;
+extern int unix2003_compat;
 
 enum tag_result {
 	TAG_FOUND,
@@ -400,6 +401,7 @@
 	LINENUM linenum;
 	int len;
 	char *line;
+	int found_string_match;
 
 	pos = ch_zero();
 	linenum = find_linenum(pos);
@@ -447,7 +449,13 @@
 		 * the way to end of line (no extra chars after the match).
 		 */
 		len = strlen(curtag->tag_pattern);
-		if (strncmp(curtag->tag_pattern, line, len) == 0 &&
+		if (unix2003_compat) {
+			/* this should probably be the else case too */
+			found_string_match = strstr(line, curtag->tag_pattern) != NULL;
+		} else {
+			found_string_match = strncmp(curtag->tag_pattern, line, len) == 0;
+		}
+		if (found_string_match  &&
 		    (!curtag->tag_endline || line[len] == '\0' || line[len] == '\r'))
 		{
 			curtag->tag_linenum = find_linenum(linepos);