summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bin/htagml.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bin/htagml.c b/bin/htagml.c
index 3d555dc8..a3a4101d 100644
--- a/bin/htagml.c
+++ b/bin/htagml.c
@@ -182,6 +182,9 @@ int main(int argc, char *argv[]) {
 
 		size_t mlen = strlen(tag->tag);
 		char *match = (pipe ? hstrstr : strstr)(buf, tag->tag);
+		while (match > buf && isalnum(match[-1])) {
+			match = (pipe ? hstrstr : strstr)(&match[mlen], tag->tag);
+		}
 		if (!match && tag->tag[0] == 'M') {
 			mlen = 4;
 			match = (pipe ? hstrstr : strstr)(buf, "main");