From bc6432d1573c452fcad96ccd74cbe37b535ac31c Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 1 Oct 2021 23:07:29 +0000 Subject: Add htagml -m to rename main tag --- bin/htagml.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bin/htagml.c') diff --git a/bin/htagml.c b/bin/htagml.c index 04dd5928..32ff1636 100644 --- a/bin/htagml.c +++ b/bin/htagml.c @@ -80,12 +80,14 @@ static char *hstrstr(const char *haystack, const char *needle) { int main(int argc, char *argv[]) { bool pre = false; bool pipe = false; + bool main = false; bool index = false; const char *tagsPath = "tags"; - for (int opt; 0 < (opt = getopt(argc, argv, "f:ipx"));) { + for (int opt; 0 < (opt = getopt(argc, argv, "f:impx"));) { switch (opt) { break; case 'f': tagsPath = optarg; break; case 'i': pipe = true; + break; case 'm': main = true; break; case 'p': pre = true; break; case 'x': index = true; break; default: return EX_USAGE; @@ -194,6 +196,7 @@ int main(int argc, char *argv[]) { if (!match && tag[0] == 'M') { mlen = 4; match = (pipe ? hstrstr : strstr)(buf, "main"); + if (main) tag = "main"; } if (!match) { mlen = strlen(buf) - 1; -- cgit 1.4.1