man pages screwed

Mark D. Roth roth+openssh at feep.net
Mon Apr 16 01:56:41 EST 2001


On Tue Feb 20 14:53 2001 -0600, mouring at etoh.eviladmin.org wrote:
> I'll make sure it stays on my list.  If you have a first run at
> configure.in patch feel free to post it.  

I've finally gotten a chance to work on this.  The attached patch
replaces the current --with-catman option with this new option:

  --with-mantype=man|cat|doc  Set man page type

Selecting "man" will automatically run the pages through mdoc2man.pl,
selecting "cat" will install the preformatted pages, and selecting
"doc" will install the BSD-style pages without modification.  fixpaths
still gets run no matter what you select.  The default is "doc" on
most BSD systems, and "man" everywhere else.

The patch is relative to openssh-2.5.2p2.  If there are problems
applying it to the current CVS snapshot, please let me know and I'll
take a look at it.

Please let me know what you think.

-- 
Mark D. Roth <roth at feep.net>
http://www.feep.net/~roth/
-------------- next part --------------
diff -urN openssh-2.5.2p2/Makefile.in openssh-2.5.2p2-work/Makefile.in
--- openssh-2.5.2p2/Makefile.in	Tue Mar 20 20:12:12 2001
+++ openssh-2.5.2p2-work/Makefile.in	Sun Apr 15 10:46:55 2001
@@ -6,7 +6,6 @@
 sbindir=@sbindir@
 libexecdir=@libexecdir@
 mandir=@mandir@
-mansubdir=@mansubdir@
 sysconfdir=@sysconfdir@
 piddir=@piddir@
 srcdir=@srcdir@
@@ -50,9 +49,8 @@
 
 SSHDOBJS= sshd.o auth.o auth1.o auth2.o auth-chall.o auth2-chall.o auth-rhosts.o auth-options.o auth-krb4.o auth-pam.o auth2-pam.o auth-passwd.o auth-rsa.o auth-rh-rsa.o auth-sia.o dh.o sshpty.o sshlogin.o loginrec.o servconf.o serverloop.o md5crypt.o session.o groupaccess.o
 
-TROFFMAN	= scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1
-CATMAN		= scp.0 ssh-add.0 ssh-agent.0 ssh-keygen.0 ssh-keyscan.0 ssh.0 sshd.0 sftp-server.0 sftp.0
-MANPAGES	= @MANTYPE@
+MANPAGES	= scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out
+MANTYPE		= @MANTYPE@
 
 CONFIGFILES=sshd_config ssh_config primes
 
@@ -73,9 +71,7 @@
 
 FIXPATHSCMD	= $(PERL) $(srcdir)/fixpaths $(PATHSUBS)
 
-all: $(CONFIGFILES) $(TARGETS) 
-
-manpages: $(MANPAGES)
+all: $(CONFIGFILES) $(TARGETS) $(MANPAGES)
 
 $(LIBSSH_OBJS): config.h
 $(SSHOBJS): config.h
@@ -123,8 +119,20 @@
 logintest: logintest.o $(LIBCOMPAT) libssh.a log.o loginrec.o
 	$(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh log.o $(LIBS)
 
-$(MANPAGES) $(CONFIGFILES)::
-	$(FIXPATHSCMD) $(srcdir)/$@
+$(MANPAGES): %.out: %
+	if test "$(MANTYPE)" = "cat"; then \
+		manpage=`echo $< | sed 's/\.[1-9]$$/\.0/'`; \
+	else \
+		manpage=$<; \
+	fi; \
+	if test "$(MANTYPE)" = "man"; then \
+		$(FIXPATHSCMD) $(srcdir)/$${manpage} | $(PERL) $(srcdir)/contrib/mdoc2man.pl > $@; \
+	else \
+		$(FIXPATHSCMD) $(srcdir)/$${manpage} > $@; \
+	fi
+
+$(CONFIGFILES)::
+	$(FIXPATHSCMD) $(srcdir)/$@ > $@.out
 
 clean:
 	(cd openbsd-compat; $(MAKE) clean)
@@ -151,14 +159,12 @@
 distprep: catman-do
 	autoreconf
 
-install: manpages $(TARGETS) install-files host-key
+install: $(TARGETS) install-files host-key
 
 install-files:
 	$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
 	$(srcdir)/mkinstalldirs $(DESTDIR)$(sbindir)
 	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
-	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)1
-	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8
 	$(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
 	$(INSTALL) -m $(SSH_MODE) -s ssh $(DESTDIR)$(bindir)/ssh
 	$(INSTALL) -m 0755 -s scp $(DESTDIR)$(bindir)/scp
@@ -169,15 +175,22 @@
 	$(INSTALL) -m 0755 -s sshd $(DESTDIR)$(sbindir)/sshd
 	@NO_SFTP@$(INSTALL) -m 0755 -s sftp $(DESTDIR)$(bindir)/sftp
 	@NO_SFTP@$(INSTALL) -m 0755 -s sftp-server $(DESTDIR)$(SFTP_SERVER)
-	$(INSTALL) -m 644 ssh.[01].out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
-	$(INSTALL) -m 644 scp.[01].out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
-	$(INSTALL) -m 644 ssh-add.[01].out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
-	$(INSTALL) -m 644 ssh-agent.[01].out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
-	$(INSTALL) -m 644 ssh-keygen.[01].out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
-	$(INSTALL) -m 644 ssh-keyscan.[01].out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
-	$(INSTALL) -m 644 sshd.[08].out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
-	@NO_SFTP@$(INSTALL) -m 644 sftp.[01].out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
-	@NO_SFTP@$(INSTALL) -m 644 sftp-server.[08].out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
+	if test "$(MANTYPE)" = "doc"; then \
+		mansubdir="man"; \
+	else \
+		mansubdir="$(MANTYPE)"; \
+	fi; \
+	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$${mansubdir}1; \
+	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$${mansubdir}8; \
+	$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$${mansubdir}1/ssh.1; \
+	$(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$${mansubdir}1/scp.1; \
+	$(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$${mansubdir}1/ssh-add.1; \
+	$(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/$${mansubdir}1/ssh-agent.1; \
+	$(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/$${mansubdir}1/ssh-keygen.1; \
+	$(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/$${mansubdir}1/ssh-keyscan.1; \
+	$(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$${mansubdir}8/sshd.8; \
+	@NO_SFTP@$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$${mansubdir}1/sftp.1; \
+	@NO_SFTP@$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$${mansubdir}8/sftp-server.8;
 	-rm -f $(DESTDIR)$(bindir)/slogin
 	ln -s ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
 	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
diff -urN openssh-2.5.2p2/configure.in openssh-2.5.2p2-work/configure.in
--- openssh-2.5.2p2/configure.in	Sun Mar 18 17:09:28 2001
+++ openssh-2.5.2p2-work/configure.in	Sun Apr 15 09:52:42 2001
@@ -58,12 +58,8 @@
 	fi
 	AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
 	AC_DEFINE(BROKEN_GETADDRINFO)
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	dnl AIX handles lastlog as part of its login message
 	AC_DEFINE(DISABLE_LASTLOG)
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	;;
 *-*-cygwin*)
 	LIBS="$LIBS -lregex /usr/lib/textmode.o"
@@ -75,9 +71,11 @@
 	AC_DEFINE(NO_X11_UNIX_SOCKETS)
 	no_libsocket=1
 	no_libnsl=1
+	MANTYPE=doc
 	;;
 *-*-dgux*)
 	AC_DEFINE(IP_TOS_IS_BROKEN)
+	MANTYPE=doc
 	;;
 *-*-hpux10*)
 	if test -z "$GCC"; then
@@ -90,8 +88,6 @@
 	AC_DEFINE(DISABLE_UTMP)
 	AC_DEFINE(SPT_TYPE,SPT_PSTAT)
 	LIBS="$LIBS -lsec"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	;;
 *-*-hpux11*)
 	CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
@@ -102,14 +98,11 @@
 	AC_DEFINE(DISABLE_UTMP)
 	AC_DEFINE(SPT_TYPE,SPT_PSTAT)
 	LIBS="$LIBS -lsec"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	;;
 *-*-irix5*)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS"
 	PATH="$PATH:/usr/etc"
-	MANTYPE='$(CATMAN)'
 	no_libsocket=1
 	no_libnsl=1
 	AC_DEFINE(BROKEN_INET_NTOA)
@@ -118,7 +111,6 @@
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS"
 	PATH="$PATH:/usr/etc"
-	MANTYPE='$(CATMAN)'
 	AC_DEFINE(WITH_IRIX_ARRAY)
 	AC_DEFINE(WITH_IRIX_PROJECT)
 	AC_DEFINE(WITH_IRIX_AUDIT)
@@ -126,7 +118,6 @@
 	no_libsocket=1
 	no_libnsl=1
 	AC_DEFINE(BROKEN_INET_NTOA)
-	mansubdir=man
 	;;
 *-*-linux*)
 	no_dev_ptmx=1
@@ -134,6 +125,7 @@
 	AC_DEFINE(DONT_TRY_OTHER_AF)
 	AC_DEFINE(PAM_TTY_KLUDGE)
 	inet6_default_4in6=yes
+	MANTYPE=doc
 	;;
 mips-sony-bsd|mips-sony-newsos4)
 	AC_DEFINE(HAVE_NEWS4)
@@ -141,12 +133,15 @@
 	AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
 		AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***])
         )
+	MANTYPE=doc
 	;;
 *-*-netbsd*)
 	need_dash_r=1
+	MANTYPE=doc
 	;;
 *-*-freebsd*)
 	check_for_libcrypt_later=1
+	MANTYPE=doc
 	;;
 *-next-*)
 	conf_lastlog_location="/usr/adm/lastlog"
@@ -159,6 +154,7 @@
 	AC_DEFINE(BROKEN_SAVED_UIDS)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	CFLAGS="$CFLAGS"
+	MANTYPE=doc
 	;;
 *-*-solaris*)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
@@ -186,56 +182,42 @@
 	conf_wtmp_location=/var/adm/wtmp
 	conf_lastlog_location=/var/adm/lastlog
 	AC_DEFINE(USE_PIPES)
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	;;
 *-ncr-sysv*)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	LIBS="$LIBS -lc89 -lnsl -lgen -lsocket"
 	;;
 *-sni-sysv*)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
-	MANTYPE='$(CATMAN)'
 	IPADDR_IN_DISPLAY=yes
 	AC_DEFINE(USE_PIPES)
 	AC_DEFINE(IP_TOS_IS_BROKEN)
 	AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H)
-	mansubdir=cat
 	LIBS="$LIBS -lgen -lnsl -lucb"
 	;;
 *-*-sysv4.2*)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	enable_suid_ssh=no
 	AC_DEFINE(USE_PIPES)
 	;;
 *-*-sysv5*)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	enable_suid_ssh=no
 	AC_DEFINE(USE_PIPES)
 	;;
 *-*-sysv*)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	LIBS="$LIBS -lgen -lsocket"
 	;;
 *-*-sco3.2v4*)
 	CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
-	MANTYPE='$(CATMAN)'
 	LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
-	mansubdir=cat
 	rsh_path="/usr/bin/rcmd"
 	RANLIB=true
 	no_dev_ptmx=1
@@ -251,8 +233,6 @@
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
 	LIBS="$LIBS -lprot -lx -ltinfo -lm"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	no_dev_ptmx=1
 	rsh_path="/usr/bin/rcmd"
 	AC_DEFINE(USE_PIPES)
@@ -1399,23 +1379,23 @@
 
 
 AC_ARG_WITH(catman,
-	[  --with-catman=man|cat   Install preformatted manpages[no]],
+	[  --with-mantype=man|cat|doc  Set man page type],
 	[
-		MANTYPE='$(CATMAN)'
-		if test x"$withval" != x"yes" ; then
-		   mansubdir=$withval
-		else
-		   mansubdir=cat
-		fi
+		case "$withval" in
+		man|cat|doc)
+			MANTYPE=$withval
+			;;
+		*)
+			AC_MSG_ERROR(invalid man type: $withval)
+			;;
+		esac
 	], [
 		if test -z "$MANTYPE" ; then
-			MANTYPE='$(TROFFMAN)'
-			mansubdir=man
+			MANTYPE=man
 		fi
 	]
 )
 AC_SUBST(MANTYPE)
-AC_SUBST(mansubdir)
 
 # Check whether to enable MD5 passwords
 MD5_MSG="no" 
@@ -1870,11 +1850,6 @@
 
 # Print summary of options
 
-if test x$MANTYPE = x'$(CATMAN)' ; then
-	MAN_MSG=cat
-else 
-	MAN_MSG=man
-fi
 if test ! -z "$RANDOM_POOL" ; then
 	RAND_MSG="Device ($RANDOM_POOL)"
 else
@@ -1894,7 +1869,7 @@
 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
-F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
+F=`eval echo ${mandir}` ; F=`eval echo ${F}`
 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
 H=`eval echo ${user_path}` ; H=`eval echo ${H}`
 
@@ -1908,7 +1883,7 @@
 echo "                      PID file: $G"
 echo "        sshd default user PATH: $H"
 echo "      Random number collection: $RAND_MSG"
-echo "                Manpage format: $MAN_MSG"
+echo "                Manpage format: $MANTYPE"
 echo "                   PAM support: ${PAM_MSG}"
 echo "            KerberosIV support: $KRB4_MSG"
 echo "                   AFS support: $AFS_MSG"
diff -urN openssh-2.5.2p2/contrib/mdoc2man.pl openssh-2.5.2p2-work/contrib/mdoc2man.pl
--- openssh-2.5.2p2/contrib/mdoc2man.pl	Thu Feb 22 00:20:10 2001
+++ openssh-2.5.2p2-work/contrib/mdoc2man.pl	Sun Apr 15 09:35:01 2001
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 ###
-### Quick usage:  mdoc2man.pl < mdoc_manpage.8 > doc_manpage.8
+### Quick usage:  mdoc2man.pl < mdoc_manpage.8 > man_manpage.8
 ###
 ###
 ###  Copyright (c) 2001 University of Illinois Board of Trustees
diff -urN openssh-2.5.2p2/fixpaths openssh-2.5.2p2-work/fixpaths
--- openssh-2.5.2p2/fixpaths	Tue Nov  7 19:07:51 2000
+++ openssh-2.5.2p2-work/fixpaths	Sun Apr 15 10:17:11 2001
@@ -3,21 +3,17 @@
 # fixpaths  - substitute makefile variables into text files
 
 
-$usage = "Usage: $0 [-x<file dot-suffix>] [-Dstring=replacement] [[infile] ...]\n";
-
-$ext="out";
+$usage = "Usage: $0 [-Dstring=replacement] [[infile] ...]\n";
 
 if (!defined(@ARGV)) { die ("$usage"); }
 
 # read in the command line and get some definitions
 while ($_=$ARGV[0], /^-/) {
-  if (/^-[Dx]/) {
+  if (/^-D/) {
     # definition
     shift(@ARGV);
     if ( /-D(.*)=(.*)/ ) {
       $def{"$1"}=$2;
-    } elsif ( /-x\s*(\w+)/ ) {
-	$ext=$1;
     } else {
       die ("$usage$0: error in command line arguments.\n");
     }
@@ -34,15 +30,13 @@
 for $f (@ARGV) {
 
   $f =~ /(.*\/)*(.*)$/;
-  $of = $2.".$ext"; 
 
   open(IN, "<$f")          || die ("$0: input file $f missing!\n");
-  open(OUT, ">$of")        || die ("$0: cannot create output file $of: $!\n");
   while (<IN>) {
     for $s (keys(%def)) {
       s#$s#$def{$s}#;
     } # for $s
-    print OUT;
+    print;
   } # while <IN>
 } # for $f
 


More information about the openssh-unix-dev mailing list