File: postprocess-help

package info (click to toggle)
grib-api 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,008 kB
  • ctags: 10,015
  • sloc: ansic: 63,157; sh: 9,355; f90: 2,545; makefile: 2,496; yacc: 519; perl: 240; lex: 217
file content (41 lines) | stat: -rwxr-xr-x 704 bytes parent folder | download | duplicates (5)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl -w

# Postprocess grib_api's help messages, which are almost man pages

my $name = shift @ARGV;

sub escapeslashes($)
{
	my $str = shift;
	$str =~ s/-/\\-/g;
	return $str;
}

print ".TH ".uc($name)." \"1\" \"April 2009\" \"".lc($name)."\" \"User Commands\"\n";

while (<>)
{
	if (/^[A-Z]/)
       	{
		# Sections
		s/\s+(.+)$/\n$1/;
		s/^/.SH /;
		print;
	} elsif (/^\t-/) {
		# Options
		print ".TP\n";
		s/^\s*//;
		s/(\S+)/"\\fB".escapeslashes($1)."\\fR"/e ;
		print;
	} elsif (/^\t/) {
		s/^\s*//;
		print;
	} else {
		print;
	}
}

print ".SH AUTHOR\n";
print "This manpage has been autogenerated by Enrico Zini <enrico\@debian.org>";
print "from the command line help of $name.\n";