File: sanitize-manpage.pl

package info (click to toggle)
libmtp 1.1.16-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,056 kB
  • sloc: ansic: 29,517; sh: 4,362; makefile: 188; python: 26; perl: 13
file content (17 lines) | stat: -rw-r--r-- 326 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl -w

my $flag = 0;

while (<>) {
  s {"/.*/}{"} if /^\.TH/;
  if (/^\.SH NAME/) {
    $flag = 1;
  } elsif ($flag) {
    m {^(.*) \\-} if not m {^/.*/([^/\\]+) };
    $_ = "libmtp \\- $1\n";
    $flag = 0;
  }
  ## Escape minus signs before "-1" as return value
  s/-1 /\\-1 / if not /-1c/ and /-1/;
  print;
}