summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/Makefile4
-rw-r--r--bin/man1/mtags.114
-rw-r--r--bin/mtags.c9
3 files changed, 21 insertions, 6 deletions
diff --git a/bin/Makefile b/bin/Makefile
index 7e6b0b7d..7fc0ad0c 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -134,10 +134,10 @@ html: ${HTMLS}
 
 ${HTMLS}: html.sh scheme hilex htagml htmltags
 
-htmltags: *.[chly] mtags Makefile
+htmltags: *.[chly] mtags Makefile *.sh
 	rm -f $@
 	for f in *.[chly]; do ctags -aw -f $@ $$f; done
-	./mtags -a -f $@ Makefile
+	./mtags -a -f $@ Makefile *.sh
 
 .SUFFIXES: .html
 
diff --git a/bin/man1/mtags.1 b/bin/man1/mtags.1
index bb4b50b4..57856ba0 100644
--- a/bin/man1/mtags.1
+++ b/bin/man1/mtags.1
@@ -1,4 +1,4 @@
-.Dd January 19, 2021
+.Dd January 20, 2021
 .Dt MTAGS 1
 .Os
 .
@@ -21,9 +21,9 @@ makes a
 file for
 .Xr ex 1
 from the specified
-.Xr make 1
-and
+.Xr make 1 ,
 .Xr mdoc 7
+.Xr sh 1
 sources.
 .
 .Pp
@@ -55,6 +55,14 @@ Files whose names end in
 are assumed to be
 .Xr mdoc 7
 files.
+Files whose names are
+.Pa .profile ,
+.Pa .shrc
+or end in
+.Pa .sh
+are assumed to be
+.Xr sh 1
+files.
 .
 .Sh FILES
 .Bl -tag -width Ds
diff --git a/bin/mtags.c b/bin/mtags.c
index f055b443..282d9f03 100644
--- a/bin/mtags.c
+++ b/bin/mtags.c
@@ -49,6 +49,7 @@ int main(int argc, char *argv[]) {
 
 	regex_t makeFile, makeLine;
 	regex_t mdocFile, mdocLine;
+	regex_t shFile, shLine;
 	int error = 0
 		|| regcomp(&makeFile, "(^|/)Makefile|[.]mk$", REG_EXTENDED | REG_NOSUB)
 		|| regcomp(
@@ -57,7 +58,11 @@ int main(int argc, char *argv[]) {
 			REG_EXTENDED
 		)
 		|| regcomp(&mdocFile, "[.][1-9]$", REG_EXTENDED | REG_NOSUB)
-		|| regcomp(&mdocLine, "^[.]S[hs] ([^\t\n]+)", REG_EXTENDED);
+		|| regcomp(&mdocLine, "^[.]S[hs] ([^\t\n]+)", REG_EXTENDED)
+		|| regcomp(
+			&shFile, "(^|/)[.](profile|shrc)|[.]sh$", REG_EXTENDED | REG_NOSUB
+		)
+		|| regcomp(&shLine, "^([_[:alnum:]]+)[[:blank:]]*[(][)]", REG_EXTENDED);
 	assert(!error);
 
 	size_t cap = 0;
@@ -68,6 +73,8 @@ int main(int argc, char *argv[]) {
 			regex = &makeLine;
 		} else if (!regexec(&mdocFile, argv[i], 0, NULL, 0)) {
 			regex = &mdocLine;
+		} else if (!regexec(&shFile, argv[i], 0, NULL, 0)) {
+			regex = &shLine;
 		} else {
 			warnx("skipping unknown file type %s", argv[i]);
 			continue;