aboutsummaryrefslogtreecommitdiff
path: root/list/list
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-06-28 16:48:04 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-06-28 16:52:00 +0200
commit6e603db0d71a49b499313eca7bb7d8e7ef9c492e (patch)
treeb6b5fbc5541188cbf6fd4d4c8a303eb4554211c6 /list/list
parentb23a1093b73e16f1b69e5d8d05c9e3dcf8ee5d65 (diff)
downloadmk-6e603db0d71a49b499313eca7bb7d8e7ef9c492e.tar.gz
list: Use getopt
Diffstat (limited to 'list/list')
-rwxr-xr-xlist/list13
1 files changed, 9 insertions, 4 deletions
diff --git a/list/list b/list/list
index 64ec8ac..d9dc558 100755
--- a/list/list
+++ b/list/list
@@ -1,13 +1,18 @@
-#!/usr/bin/perl -ps
+#!/usr/bin/perl -p
# list -- escape code listing for troff
+use Getopt::Std;
+BEGIN { getopt('Ep:s:'); }
+
if (/^\.\s*l\(\s*$/ .. /^\.\s*l\)\s*$/) {
- not $E and s/^\\!// and next;
+ not $opt_E and s/^\\!// and next;
if (/^\.\s*l\(\s*$/) {
- print "$p\n" if $p;
+ $_ = '';
+ $_ = "$opt_p\n" if $opt_p;
} elsif (/^\.\s*l\)\s*$/) {
- print "$s\n" if $s;
+ $_ = '';
+ $_ = "$opt_s\n" if $opt_s;
} else {
s/\\/\\$&/g;
s/^/\\&/g;