]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Import version 1.012.
authorJim Meyering <jim@meyering.net>
Sat, 10 Jul 1999 08:44:49 +0000 (08:44 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 10 Jul 1999 08:44:49 +0000 (08:44 +0000)
man/help2man

index fde8e53fdc63e690ad494392e52936a1ec3c9664..08695dad1e2d2c9832c5d3cafa20696378b223a1 100755 (executable)
@@ -26,7 +26,7 @@ use Text::Tabs qw(expand);
 use POSIX qw(strftime setlocale LC_TIME);
 
 my $this_program = 'help2man';
-my $this_version = '1.011';
+my $this_version = '1.012';
 my $version_info = <<EOT;
 $this_program $this_version
 
@@ -42,28 +42,32 @@ my $help_info = <<EOT;
 
 Usage: $this_program [OPTION]... EXECUTABLE
 
-  --name=STRING       use `STRING' as the description for the NAME paragraph
-  --include=FILE      include material from `FILE'
-  --opt-include=FILE  include material from `FILE' if it exists
-  --output=FILE       send output to `FILE'
-  --no-info           suppress pointer to Texinfo manual
-  --help              print this help, then exit
-  --version           print $this_program program version number, then exit
+ -n, --name=STRING       use `STRING' as the description for the NAME paragraph
+ -s, --section=SECTION   use `SECTION' as the section for the man page
+ -i, --include=FILE      include material from `FILE'
+ -I, --opt-include=FILE  include material from `FILE' if it exists
+ -o, --output=FILE       send output to `FILE'
+ -N, --no-info           suppress pointer to Texinfo manual
+     --help              print this help, then exit
+     --version           print $this_program program version number, then exit
 
 EXECUTABLE should accept `--help' and `version' options.
 EOT
 
+my $section = 1;
 my ($include, $opt_name, $opt_include, $opt_output, $opt_no_info);
 
 # Parse options.
+Getopt::Long::config('bundling');
 GetOptions (
-    'name=s'       => \$opt_name,
-    'include=s'            => \$include,
-    'opt-include=s' => \$opt_include,
-    'output=s'     => \$opt_output,
-    'no-info'      => \$opt_no_info,
-    help           => sub { print $help_info; exit },
-    version        => sub { print $version_info; exit },
+    'n|name=s'         => \$opt_name,
+    's|section=s'      => \$section,
+    'i|include=s'      => \$include,
+    'I|opt-include=s'  => \$opt_include,
+    'o|output=s'       => \$opt_output,
+    'N|no-info'                => \$opt_no_info,
+    help               => sub { print $help_info; exit },
+    version            => sub { print $version_info; exit },
 ) or die $help_info;
 
 die $help_info unless @ARGV == 1;
@@ -198,11 +202,12 @@ my $PROGRAM = uc $program;
 # Header.
 print <<EOT;
 .\\" DO NOT MODIFY THIS FILE!  It was generated by $this_program $this_version.
-.TH $PROGRAM 1 "$date" "$package $version" "FSF"
+.TH $PROGRAM "$section" "$date" "$package $version" FSF
 .SH NAME
 $include{NAME}
 EOT
 
+my $break;
 my $accumulate = 1;
 my @description = ();
 
@@ -245,6 +250,7 @@ for (@help)
            print $include{DESCRIPTION};
        }
 
+       $break = 1;
        next unless $_;
     }
 
@@ -260,6 +266,7 @@ for (@help)
     if (s/^(Options|Examples): *\n//)
     {
        print qq(.SH \U$1\n);
+       $break = '';
        next unless length;
     }
 
@@ -267,11 +274,16 @@ for (@help)
     if (/^Report bugs |^Email bug reports to /)
     {
        print qq(.SH "REPORTING BUGS"\n$_\n);
+       $break = '';
        next;
     }
 
     # Option subsections have second line indented.
-    print qq(.SS "$1"\n) if s/^(\S.*)\n / /;
+    if (s/^(\S.*)\n / /)
+    {
+       print qq(.SS "$1"\n);
+       $break = '';
+    }
 
     my $output = '';
     while (length)
@@ -283,6 +295,7 @@ for (@help)
        {
            $indent = length $1;
            $output .= ".TP\n$2\n$3\n";
+           $break = 1;
        }
 
        # Indented paragraph
@@ -290,14 +303,16 @@ for (@help)
        {
            $indent = length $1;
            $output .= ".IP\n$2\n";
+           $break = 1;
        }
 
        # Left justified paragraph
        else
        {
            s/(.*)\n?//;
-           $output .= ".PP\n" if $output;
+           $output .= ".PP\n" if $break;
            $output .= "$1\n";
+           $break = 1;
        }
 
        # Continuations