pcp
[Top] [All Lists]

Format .TS in manpages correctly on Solaris

To: PCP Mailing List <pcp@xxxxxxxxxxx>
Subject: Format .TS in manpages correctly on Solaris
From: Greg Banks <gnb@xxxxxxxxxxx>
Date: Sun, 11 Apr 2010 22:14:05 +1000
User-agent: Thunderbird 2.0.0.23 (X11/20090817)
G'day,

commit 326c5a61d378625310c1c72750df7e10e1a081cd
Author: Greg Banks <gnb@xxxxxxxxxxx>
Date:   Sun Apr 11 21:52:16 2010 +1000

   Format .TS in manpages correctly on Solaris
Solaris needs the right obscure magic in the first line of
   each manpage in order for the .TS/.TE table macros to work.
   The PCP manpages are formatted with a different piece of
   obscure magic designed to work on Irix.
This change automatically detects the old fashioned .\" t
   magic in a system manpage at configure time, and if present
   tweaks the PCP manpages at install time to contain it.

diff --git a/.gitignore b/.gitignore
index 1581608..1ac435c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,4 @@ libs_files
libs_files.rpm
gram*.tab.c
perl-pcp-*.list
+*.[1-9].tmp
diff --git a/configure.in b/configure.in
index 6b73ccc..1547bef 100644
--- a/configure.in
+++ b/configure.in
@@ -1419,6 +1419,8 @@ AC_SUBST(pcp_x11_appdefs_dir)
dnl man pages (source)
have_gzipped_manpages=false
have_bzip2ed_manpages=false
+need_old_tbl_header=false
+man_header=
pcp_man_dir=`eval echo $mandir`
pcp_man_dir=`eval echo $pcp_man_dir`
if test "`echo $pcp_man_dir | sed 's;/.*\$;;'`" = NONE
@@ -1443,29 +1445,35 @@ then
    then
        have_gzipped_manpages=true
        pcp_man_dir=$d
+        man_header=`$ZIP -d < $d/man1/man.1.gz | head -1`
        break
    elif test -f $d/man1/man.1.bz2
    then
        have_bzip2ed_manpages=true
        pcp_man_dir=$d
+        man_header=`$BZIP2 -d < $d/man1/man.1.bz2 | head -1`
        break
    elif test -f $d/man1/man.1
    then
        pcp_man_dir=$d
+        man_header=`head -1 $d/man1/man.1`
        break
    elif test -f $d/sman1/man.1.gz
    then
        have_gzipped_manpages=true
        pcp_man_dir=$d
+        man_header=`$ZIP -d < $d/sman1/man.1.gz | head -1`
        break
    elif test -f $d/sman1/man.1.bz2
    then
        have_bzip2ed_manpages=true
        pcp_man_dir=$d
+        man_header=`$BZIP2 -d < $d/sman1/man.1.bz2 | head -1`
        break
    elif test -f $d/sman1/man.1
    then
        pcp_man_dir=$d
+        man_header=`head -1 $d/sman1/man.1`
        break
    elif test -f $d/cat1/man.1
    then
@@ -1484,9 +1492,13 @@ then
    echo "FATAL ERROR: could not find pcp_man_dir directory."
    exit 1
fi
+if test x"$man_header" = "x'\\\" t" -o x"$man_header" = "x'\\\" te" ; then
+    need_old_tbl_header=true
+fi
AC_SUBST(pcp_man_dir)
AC_SUBST(have_gzipped_manpages)
AC_SUBST(have_bzip2ed_manpages)
+AC_SUBST(need_old_tbl_header)

dnl public binaries
pcp_bin_dir=`eval echo $bindir`
diff --git a/src/include/builddefs.in b/src/include/builddefs.in
index d2675e2..90faff4 100644
--- a/src/include/builddefs.in
+++ b/src/include/builddefs.in
@@ -172,6 +172,7 @@ MD5SUM    = @md5sum@

HAVE_GZIPPED_MANPAGES = @have_gzipped_manpages@
HAVE_BZIP2ED_MANPAGES = @have_bzip2ed_manpages@
+NEED_OLD_TBL_HEADER = @need_old_tbl_header@
CPP_SIMPLE = @cpp_simple@
CPP_SIMPLE_ARGS = @cpp_simple_args@
RDYNAMIC_FLAG = @rdynamic_flag@
@@ -241,15 +242,19 @@ INSTALL_MAN = \
        [ -z "$$m" -o "$$m" = "\\" ] && continue; \
        t=$(MAN_DEST)/$$m.$(MAN_SECTION); \
        if $$first; then \
+            _tfx= ;\
+        if $(NEED_OLD_TBL_HEADER) ; then \
+ $(SED) -e "1s/^'\\\\\"! tbl.*/'\\\\\" t/" $$d > $$d.tmp; _tfx=.tmp; \
+        fi; \
        if $(HAVE_GZIPPED_MANPAGES) ; then \
-            $(ZIP) -c $$d > $$d.gz; _sfx=.gz; \
+            $(ZIP) -c $$d$$_tfx > $$d.gz; _tfx=.gz; _sfx=.gz; \
        fi; \
        if $(HAVE_BZIP2ED_MANPAGES) ; then \
-            $(BZIP2) -c $$d > $$d.bz2; _sfx=.bz2; \
+            $(BZIP2) -c $$d$$_tfx > $$d.bz2; _tfx=.bz2; _sfx=.bz2; \
        fi; \
        u=$$m.$(MAN_SECTION)$$_sfx; \
-        echo $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
-        $(INSTALL) -m 644 $${d}$$_sfx $${t}$$_sfx; \
+        echo $(INSTALL) -m 644 $${d}$$_tfx $${t}$$_sfx; \
+        $(INSTALL) -m 644 $${d}$$_tfx $${t}$$_sfx; \
        else \
if test ! -z $(CASE_INSENSITIVE_FS) -a $(CASE_INSENSITIVE_FS); then \ if test "`echo $$u | tr 'a-z' 'A-Z'`" != "`basename $${t}$$_sfx | tr 'a-z' 'A-Z'`"; then \




--
Greg.

<Prev in Thread] Current Thread [Next in Thread>