File: Mkdoc

package info (click to toggle)
plan 1.8.4-9
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,964 kB
  • ctags: 1,986
  • sloc: ansic: 24,493; perl: 1,361; makefile: 531; sh: 516; yacc: 119; sed: 17
file content (21 lines) | stat: -rwxr-xr-x 560 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/perl
#
# convert plan.help to nroff -ms format.
# by gregg hanna <gregor@kafka.saic.com>
#
$nofill = 0;
$s = "";
while (<>) {
  if ( /^#/ ) { next; }
  elsif ( /^%/ ) { $s = ".SH\n"; }
  elsif ( /^\t(.*)\s*--\s*(.*)$/ ) { $s = ".IP \"\\fI$1\\fR\"\n$2\n"; }
  elsif ( /^\t(\s\s\s\s\s\s.*)$/ ) {
    if ( $nofill ) { print "$1\n"; next; }
    else { $nofill = 1; print ".nf\n$1\n"; next; }
  }
  elsif ( /^\t\s*(.*)$/ ) { $s = "$1\n"; }
  elsif ( /^$/ ) { $s = ".LP\n"; }
  else { $s = $*; }
  if ( $nofill ) { $nofill = 0; print ".fi\n"; }
  print $s;
}