aboutsummaryrefslogtreecommitdiff
path: root/list/list
blob: d9dc558ddc16f571056f71507ffd2794f29b24fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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 $opt_E and s/^\\!// and next;
	if (/^\.\s*l\(\s*$/) {
		$_ = '';
		$_ = "$opt_p\n" if $opt_p;
	} elsif (/^\.\s*l\)\s*$/) {
		$_ = '';
		$_ = "$opt_s\n" if $opt_s;
	} else {
		s/\\/\\$&/g;
		s/^/\\&/g;
		s/'/\\(aq/g;
		s/\`/\\(ga/g;
	}
}