aboutsummaryrefslogtreecommitdiff
path: root/list
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-06-27 18:37:36 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-06-27 18:37:36 +0200
commitb23a1093b73e16f1b69e5d8d05c9e3dcf8ee5d65 (patch)
tree7561a64156f244bda61c14a1b673c028e3f27d74 /list
parente8086631ecabb0018062c1b8a519a2fa265c92f9 (diff)
downloadmk-b23a1093b73e16f1b69e5d8d05c9e3dcf8ee5d65.tar.gz
Add 'list' utility
Diffstat (limited to 'list')
-rwxr-xr-xlist/list17
-rw-r--r--list/list.143
2 files changed, 60 insertions, 0 deletions
diff --git a/list/list b/list/list
new file mode 100755
index 0000000..64ec8ac
--- /dev/null
+++ b/list/list
@@ -0,0 +1,17 @@
+#!/usr/bin/perl -ps
+
+# list -- escape code listing for troff
+
+if (/^\.\s*l\(\s*$/ .. /^\.\s*l\)\s*$/) {
+ not $E and s/^\\!// and next;
+ if (/^\.\s*l\(\s*$/) {
+ print "$p\n" if $p;
+ } elsif (/^\.\s*l\)\s*$/) {
+ print "$s\n" if $s;
+ } else {
+ s/\\/\\$&/g;
+ s/^/\\&/g;
+ s/'/\\(aq/g;
+ s/\`/\\(ga/g;
+ }
+}
diff --git a/list/list.1 b/list/list.1
new file mode 100644
index 0000000..085bb20
--- /dev/null
+++ b/list/list.1
@@ -0,0 +1,43 @@
+.Dd $Mdocdate$
+.Dt list 1
+.Os
+.Sh NAME
+.Nm list
+.Nd escape code listings for troff
+.
+.Sh SYNOPSIS
+.Nm
+.Op Fl p=prefix
+.Op Fl s=suffix
+.Op Fl E
+.Op Ar file
+.Sh DESCRIPTION
+.Pp
+.Nm
+escapes text between
+.Ql .l(
+and
+.Ql .l)
+lines for
+.Xr troff 1 .
+.Pp
+Lines beginning with
+.Ql \\\\!
+are copied verbatim, unless the
+.Fl E
+flag is given.
+.Pp
+Text given to
+.Fl p
+and
+.Fl s
+is inserted on a new line before and after each code block.
+This text is not escaped and can contain arbitrary
+.Xr troff 1
+requests.
+.
+.Sh AUTHORS
+.Pp
+.Nm
+is written by John Ankarström
+.Aq Mt "john (at) ankarstrom.se" .