[gpm]At last! Awk independence.

Mark Hymers markh@linuxfromscratch.org
Fri, 4 Jan 2002 00:11:39 +0000


Hi,

Sorry for the repeated posts but we've got there this time.

Jason Gurtz and myself, having thrown ideas back and forward have made a
tiny adaption to Alessandro Rubini's new manpager and put in a little
sed hack which means that the man pages now build cleanly on gawk, mawk
and the original awk.

Hope this is acceptable.

The patch is against gpm-1.19.6 and includes Alessandro's alterations to
manpager.

Mark

-- 
Mark Hymers					 BLFS Editor
markh@linuxfromscratch.org

diff -Naur gpm-1.19.6/doc/Makefile.in gpm-1.19.6-new/doc/Makefile.in
--- gpm-1.19.6/doc/Makefile.in	Wed Oct  3 21:51:46 2001
+++ gpm-1.19.6-new/doc/Makefile.in	Thu Jan  3 23:49:03 2002
@@ -71,7 +71,11 @@
 all: $(srcdir)/gpmdoc.ps $(srcdir)/gpm.info $(srcdir)/gpmdoc.txt $(MANPAGES)
 
 $(MANPAGES): doc.gpm manpager
-	gawk -f ./manpager doc.gpm
+	awk -f ./manpager doc.gpm
+	for i in gpm-root.1 gpm-types.7 gpm.8 mev.1 mouse-test.1; do \
+		expand $$i | sed s/^'[ ]*'//g > $$i.new; \
+		mv $$i.new $$i; \
+	done;
 
 # why gpmdoc.ps and gpm.ps
 gpmdoc.ps:	gpm.ps
diff -Naur gpm-1.19.6/doc/manpager gpm-1.19.6-new/doc/manpager
--- gpm-1.19.6/doc/manpager	Sun Sep 23 20:00:03 2001
+++ gpm-1.19.6-new/doc/manpager	Thu Jan  3 23:37:35 2002
@@ -1,6 +1,5 @@
-#! /usr/bin/gawk -f
-
-# Warning: this uses gnu-awk features
+#! /usr/bin/awk -f
+# Copyright (c) 1998-2001 Alessandro Rubini
 
 BEGIN {IN=0}
 
@@ -23,18 +22,32 @@
 
 	        { gsub("^%M ?",""); }
 
-# itz Wed Sep 30 10:28:58 PDT 1998
+# Use gensub for converting tags: itz Sep 30 1998
+#
+# However, the gensub function is gawk-specific, and we want things
+# to work with original-awk too (for portability).
+# Therefore, use a normal gsub, even though it's a subobptimal solution
+# as it may step in extra braces. The good solution will be piping to sed,
+# or match, extract subesxpression, replace, reinsert -- bleah...
+# (ARub, Oct 10 2000)
 /@b\{/ {
-  $0 = gensub(/@b\{([^}]+)\}/, "\\\\fB\\1\\\\fP","g");
+  #$0 = gensub(/@b\{([^}]+)\}/, "\\\\fB\\1\\\\fP","g");
+  gsub("@b\{","\\fB");
+  gsub("\}","\\fP");
+} 
+
+/@var\{/ {
+  #$0 = gensub(/@var\{([^}]+)\}/, "\\\\fI\\1\\\\fP","g");
+  gsub("@var\{","\\fB");
+  gsub("\}","\\fP");
 } 
 
 /@(samp|code|file)\{/ {
-  $0 = gensub(/@(samp|code|file)\{([^}]+)\}/, "`\\2'","g");
+  #$0 = gensub(/@(samp|code|file)\{([^}]+)\}/, "`\\2'","g");
+  gsub("@(samp|code|file)\{","");
+  gsub("\}","");
 }
 
-/@var\{/ {
-  $0 = gensub(/@var\{([^}]+)\}/, "\\\\fI\\1\\\\fP","g");
-} 
 
 /@xref\{.*\}\./ {
   gsub(/@xref\{.*\}\./,"");
@@ -55,6 +68,7 @@
 		}
 
 /^@table/       { TABLE=1; }
+/^@itemize/     { TABLE=1; next}
 
 /^@item/        {
 	        gsub("^@item *","");
@@ -63,6 +77,7 @@
 		}
 
 /^@end table/   {TABLE=0}
+/^@end itemize/ {TABLE=0}
 
 # discard other texinfo commands
 
@@ -78,9 +93,10 @@
 		gsub("\\%","%");
 		}
 
+
 # remove leading blanks
 
-/^[ \t]/	{gsub("^[ \t]*","");}
+/^[ \t]/        {gsub("^[ \t]","");}
 
 # put a .LP at blank lines
 
diff -Naur gpm-1.19.6/doc/mktxt gpm-1.19.6-new/doc/mktxt
--- gpm-1.19.6/doc/mktxt	Sun Sep 23 20:00:03 2001
+++ gpm-1.19.6-new/doc/mktxt	Thu Jan  3 20:08:31 2002
@@ -1,6 +1,6 @@
-#! /usr/bin/gawk -f
+#! /usr/bin/awk -f
 
-# Warning: this may use gnu-awk features
+# This shouldn't contain any gawk specific features anymore 
 
 # Program to create ascii from info;
 # Missing: table of contents
@@ -29,7 +29,7 @@
 NODELINE==5  { printf "\t\t\t\t"; NODELINE=0}
 
 
-/^* Menu:$/  { KEEP=0 }
+/^\*\ Menu:$/  { KEEP=0 }