aboutsummaryrefslogtreecommitdiff
path: root/list/list
blob: 11ec7c11f97f38ebfb816c270dda4f1d25846c52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl -p

# list -- escape code listing for troff

# Permission to use, copy, modify and/or
# distribute this software for any purpose
# with or without fee is hereby granted.

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;
	}
}