summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-10-01 23:07:29 +0000
committerJune McEnroe <june@causal.agency>2021-10-01 23:07:57 +0000
commitbc6432d1573c452fcad96ccd74cbe37b535ac31c (patch)
treef074e04a44e2d48d62f6e4513483661e167592c8
parentRemove igp (diff)
downloadsrc-bc6432d1573c452fcad96ccd74cbe37b535ac31c.tar.gz
src-bc6432d1573c452fcad96ccd74cbe37b535ac31c.zip
Add htagml -m to rename main tag
-rw-r--r--bin/htagml.c5
-rw-r--r--bin/man1/htagml.110
2 files changed, 12 insertions, 3 deletions
diff --git a/bin/htagml.c b/bin/htagml.c
index 04dd592..32ff163 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;
diff --git a/bin/man1/htagml.1 b/bin/man1/htagml.1
index 97e8f3f..d8cf644 100644
--- a/bin/man1/htagml.1
+++ b/bin/man1/htagml.1
@@ -1,4 +1,4 @@
-.Dd January 12, 2021
+.Dd October  1, 2021
 .Dt HTAGML 1
 .Os
 .
@@ -8,7 +8,7 @@
 .
 .Sh SYNOPSIS
 .Nm
-.Op Fl ip | x
+.Op Fl imp | x
 .Op Fl f Ar tagsfile
 .Ar file
 .
@@ -38,6 +38,12 @@ has been pre-formatted
 on standard input,
 such as by a syntax highlighter.
 Only tag hyperlinks are added.
+.It Fl m
+Rename the
+.Xr ctags 1
+.Sq M
+tag to
+.Sy main .
 .It Fl p
 Wrap the output in a
 .Sy pre