Commit 7313dd61822c94c428007c8729ec89e5bfce22ac

Thomas de Grivel 2023-01-21T15:08:36

help2man-1.23

diff --git a/ChangeLog b/ChangeLog
index 6290456..d9b3411 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Oct 31 17:07:30 2000  Brendan O'Dea  <bod@compusol.com.au>
+
+	* help2man.PL: Add protection for leading apostrophes (reported by
+	  Matt Kraai). Don't zero-pad version.
+
 Fri Jul  7 16:16:18 2000  Brendan O'Dea  <bod@compusol.com.au>
 
 	* README.sh: Add GNU prefix
diff --git a/NEWS b/NEWS
index 4a150d7..96ad3e6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Version 1.23		October 31, 2000
+
+ * Escape leading apostrophes.
+
 Version 1.022		July 7, 2000
 
  * help2man is now officially a GNU program.  Add bug reporting
diff --git a/README b/README
index 89c597f..53ee070 100644
--- a/README
+++ b/README
@@ -1,12 +1,12 @@
                         README for GNU help2man
-                             version 1.022
-                             July  7, 2000
+                              version 1.23
+                            October 31, 2000
 
 help2man is a script to create simple man pages from the --help and
 --version output of programs.
 
   http://www.gnu.org/software/help2man/
-  ftp://ftp.gnu.org/gnu/help2man/help2man-1.022.tar.gz
+  ftp://ftp.gnu.org/gnu/help2man/help2man-1.23.tar.gz
 
 Since most GNU documentation is now in info format, this provides a
 way to generate a placeholder man page pointing to that resource while
diff --git a/THANKS b/THANKS
index 7389c3a..1f964df 100644
--- a/THANKS
+++ b/THANKS
@@ -6,6 +6,7 @@ Karl Berry			<karl@cs.umb.edu>
 Mo DeJong			<mdejong@cygnus.com>
 Akim Demaille			<demaille@inf.enst.fr>
 Roland Huebner			<rh@pelikan.cologne.de>
+Matt Kraai			<kraai@alumni.carnegiemellon.edu>
 Jim Meyering			<meyering@ascend.com>
 Dave Morrison			<dave@bnl.gov>
 Peter Moulder			<reiter@netspace.net.au>
diff --git a/help2man.PL b/help2man.PL
index 37238ef..34c4fd3 100755
--- a/help2man.PL
+++ b/help2man.PL
@@ -16,12 +16,9 @@ use Config;
 use Getopt::Long;
 
 my ($program, $version)
-    = (qw$Id: help2man.PL,v 1.22 2000/07/07 06:16:18 bod Exp $)[1..2];
+    = (qw$Id: help2man.PL,v 1.23 2000/10/31 06:07:30 bod Exp $)[1..2];
 
 $program =~ s/\.PL(,v)?$//;
-$version =~ s/\.(\d+)/sprintf "-%03d", $1/e;
-$version =~ s/\.(\d+)\.(\d+).*/sprintf "_%02d", ($1-1) * 50 + $2/e;
-$version =~ s/-/./;
 
 my %opts;
 die "Usage: $0 [--quiet] [--stdout] [--name] [--version]\n"
@@ -338,9 +335,11 @@ s/^\n+//;
 s/\n*$/\n/;
 s/\n\n+/\n\n/g;
 
-# Temporarily exchange leading dots and backslashes for tokens.
+# Temporarily exchange leading dots, apostrophes and backslashes for
+# tokens.
 s/^\./\x80/mg;
-s/\\/\x81/g;
+s/^'/\x81/mg;
+s/\\/\x82/g;
 
 # Start a new paragraph (if required) for these.
 s/([^\n])\n(Report +bugs|Email +bug +reports +to|Written +by)/$1\n\n$2/g;
@@ -435,7 +434,7 @@ while (length)
     {
 	$matched .= $& if %append;
 	$indent = length ($4 || "$1$3");
-	$content = ".TP\n\x82$2\n\x82$5\n";
+	$content = ".TP\n\x83$2\n\x83$5\n";
 	unless ($4)
 	{
 	    # Indent may be different on second line.
@@ -447,7 +446,7 @@ while (length)
     elsif (s/^ {1,10}([+-]\S.*)\n//)
     {
 	$matched .= $& if %append;
-	$content = ".HP\n\x82$1\n";
+	$content = ".HP\n\x83$1\n";
 	$indent = 80; # not continued
     }
 
@@ -456,7 +455,7 @@ while (length)
     {
 	$matched .= $& if %append;
 	$indent = length $1;
-	$content = ".TP\n\x82$2\n\x82$3\n";
+	$content = ".TP\n\x83$2\n\x83$3\n";
     }
 
     # Indented paragraph.
@@ -464,7 +463,7 @@ while (length)
     {
 	$matched .= $& if %append;
 	$indent = length $1;
-	$content = ".IP\n\x82$2\n";
+	$content = ".IP\n\x83$2\n";
     }
 
     # Left justified paragraph.
@@ -480,7 +479,7 @@ while (length)
     while (s/^ {$indent}(\S.*)\n//)
     {
 	$matched .= $& if %append;
-	$content .= "\x82$1\n"
+	$content .= "\x83$1\n"
     }
 
     # Move to next paragraph.
@@ -488,9 +487,10 @@ while (length)
 
     for ($content)
     {
-	# Leading dot protection.
-	s/\x82\./\x80/g;
-	s/\x82//g;
+	# Leading dot and apostrophe protection.
+	s/\x83\./\x80/g;
+	s/\x83'/\x81/g;
+	s/\x83//g;
 
 	# Convert options.
 	s/(^| )(-[][\w=-]+)/$1 . convert_option $2/mge;
@@ -554,9 +554,10 @@ for (@pre, (grep ! /^($filter)$/o, @include), @post)
 	
 	for ($include{$_})
 	{
-	    # Replace leading dot an backslash tokens.
+	    # Replace leading dot, apostrophe and backslash tokens.
 	    s/\x80/\\&./g;
-	    s/\x81/\\e/g;
+	    s/\x81/\\&'/g;
+	    s/\x82/\\e/g;
 	    print;
 	}
     }