Patch for unformatted manpages

Mark D. Roth roth+openssh at feep.net
Wed Feb 7 17:00:40 EST 2001


The attached patch (relative to the current CVS snapshot) uses a perl
script to convert the OpenSSH manpages from the BSD -mdoc format to
the -man format used by other systems.  This allows the unformatted
manpages to be installed normally, rather than defaulting to
preformatted pages.

I'd like to see this patch integrated into the portable version of
OpenSSH.  Please let me know what you think about this.  Thanks!

-- 
Mark D. Roth <roth at feep.net>
http://www.feep.net/~roth/
-------------- next part --------------
diff -urN openssh_cvs/Makefile.in openssh_work/Makefile.in
--- openssh_cvs/Makefile.in	Sun Feb  4 07:54:23 2001
+++ openssh_work/Makefile.in	Tue Feb  6 23:42:49 2001
@@ -6,7 +6,6 @@
 sbindir=@sbindir@
 libexecdir=@libexecdir@
 mandir=@mandir@
-mansubdir=@mansubdir@
 sysconfdir=@sysconfdir@
 piddir=@piddir@
 srcdir=@srcdir@
@@ -45,9 +44,7 @@
 
 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 dh.o pty.o log-server.o login.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 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1
 
 CONFIGFILES=sshd_config ssh_config primes
 
@@ -67,6 +64,8 @@
 
 FIXPATHSCMD	= $(PERL) $(srcdir)/fixpaths $(PATHSUBS)
 
+MDOC2MANCMD	= $(PERL) $(srcdir)/mdoc2man.pl
+
 all: $(TARGETS) $(CONFIGFILES)
 
 manpages: $(MANPAGES)
@@ -118,8 +117,12 @@
 logintest: logintest.o $(LIBCOMPAT) libssh.a log-client.o loginrec.o
 	$(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh log-client.o $(LIBS)
 
-$(MANPAGES) $(CONFIGFILES)::
+$(CONFIGFILES)::
+	$(FIXPATHSCMD) $(srcdir)/$@
+
+$(MANPAGES)::
 	$(FIXPATHSCMD) $(srcdir)/$@
+	$(MDOC2MANCMD) < $@.out > $@.out2 && mv $@.out2 $@.out
 
 clean:
 	(cd openbsd-compat; $(MAKE) clean)
@@ -152,8 +155,8 @@
 	$(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)$(mandir)/man1
+	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man8
 	$(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
 	$(INSTALL) -m $(SSH_MODE) -s ssh $(DESTDIR)$(bindir)/ssh
 	$(INSTALL) -m 0755 -s scp $(DESTDIR)$(bindir)/scp
@@ -164,19 +167,19 @@
 	$(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)$(libexecdir)/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
+	$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/man1/ssh.1
+	$(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/man1/scp.1
+	$(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/man1/ssh-add.1
+	$(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/man1/ssh-agent.1
+	$(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/man1/ssh-keygen.1
+	$(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/man1/ssh-keyscan.1
+	$(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/man8/sshd.8
+	@NO_SFTP@$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/man1/sftp.1
+	@NO_SFTP@$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/man8/sftp-server.8
 	-rm -f $(DESTDIR)$(bindir)/slogin
 	ln -s ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
-	ln -s ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
+	-rm -f $(DESTDIR)$(mandir)/man1/slogin.1
+	ln -s ssh.1 $(DESTDIR)$(mandir)/man1/slogin.1
 	@FILEPRIV@ -f dev,filesys,driver $(DESTDIR)$(bindir)/ssh $(DESTDIR)$(bindir)/slogin
 	if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
 		$(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir); \
@@ -236,8 +239,8 @@
 	-rmdir $(DESTDIR)$(sysconfdir)
 	-rmdir $(DESTDIR)$(bindir)
 	-rmdir $(DESTDIR)$(sbindir)
-	-rmdir $(DESTDIR)$(mandir)/$(mansubdir)1
-	-rmdir $(DESTDIR)$(mandir)/$(mansubdir)8
+	-rmdir $(DESTDIR)$(mandir)/man1
+	-rmdir $(DESTDIR)$(mandir)/man8
 	-rmdir $(DESTDIR)$(mandir)
 	-rmdir $(DESTDIR)$(libexecdir)
 
@@ -252,14 +255,14 @@
 	-rm -f $(DESTDIR)$(bindir)/sftp$(EXEEXT)
 	-rm -f $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
 	-rm -r $(DESTDIR)$(libexecdir)/sftp-server$(EXEEXT)
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
-	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
+	-rm -f $(DESTDIR)$(mandir)/man1/ssh.1
+	-rm -f $(DESTDIR)$(mandir)/man1/scp.1
+	-rm -f $(DESTDIR)$(mandir)/man1/ssh-add.1
+	-rm -f $(DESTDIR)$(mandir)/man1/ssh-agent.1
+	-rm -f $(DESTDIR)$(mandir)/man1/ssh-keygen.1
+	-rm -f $(DESTDIR)$(mandir)/man1/sftp.1
+	-rm -f $(DESTDIR)$(mandir)/man1/ssh-keyscan.1
+	-rm -f $(DESTDIR)$(mandir)/man8/sshd.8
+	-rm -f $(DESTDIR)$(mandir)/man8/sftp-server.8
+	-rm -f $(DESTDIR)$(mandir)/man1/slogin.1
 	-rm -f $(DESTDIR)${ASKPASS_PROGRAM}
diff -urN openssh_cvs/configure.in openssh_work/configure.in
--- openssh_cvs/configure.in	Tue Feb  6 16:54:31 2001
+++ openssh_work/configure.in	Tue Feb  6 23:22:02 2001
@@ -52,12 +52,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"
@@ -80,8 +76,6 @@
 	AC_DEFINE(DISABLE_UTMP)
 	AC_DEFINE(SPT_TYPE,SPT_PSTAT)
 	LIBS="$LIBS -lsec"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	;;
 *-*-hpux11*)
 	CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
@@ -92,14 +86,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)
@@ -108,7 +99,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)
@@ -116,7 +106,6 @@
 	no_libsocket=1
 	no_libnsl=1
 	AC_DEFINE(BROKEN_INET_NTOA)
-	mansubdir=man
 	;;
 *-*-linux*)
 	no_dev_ptmx=1
@@ -171,46 +160,34 @@
 	conf_wtmp_location=/var/adm/wtmp
 	conf_lastlog_location=/var/adm/lastlog
 	AC_DEFINE(USE_PIPES)
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	;;
 *-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)
-	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
 	;;
 *-*-sysv5*)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	enable_suid_ssh=no
 	;;
 *-*-sysv*)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	LIBS="$LIBS -lgen -lsocket"
 	;;
 *-*-sco3.2v4*)
 	AC_DEFINE(USE_PIPES)
 	CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
 	no_dev_ptmx=1
 	RANLIB=true
@@ -224,8 +201,6 @@
 	AC_DEFINE(USE_PIPES)
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
-	MANTYPE='$(CATMAN)'
-	mansubdir=cat
 	LIBS="$LIBS -lprot -lx -ltinfo -lm"
 	no_dev_ptmx=1
 	rsh_path="/usr/bin/rcmd"
@@ -1117,25 +1092,6 @@
 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
 
 
-AC_ARG_WITH(catman,
-	[  --with-catman=man|cat   Install preformatted manpages[no]],
-	[
-		MANTYPE='$(CATMAN)'
-		if test x"$withval" != x"yes" ; then
-		   mansubdir=$withval
-		else
-		   mansubdir=cat
-		fi
-	], [
-		if test -z "$MANTYPE" ; then
-			MANTYPE='$(TROFFMAN)'
-			mansubdir=man
-		fi
-	]
-)
-AC_SUBST(MANTYPE)
-AC_SUBST(mansubdir)
-
 # Check whether user wants Kerberos support
 KRB4_MSG="no" 
 AC_ARG_WITH(kerberos4,
@@ -1645,11 +1601,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
@@ -1667,7 +1618,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}/manX` ; F=`eval echo ${F}`
 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
 
 echo ""
@@ -1680,7 +1631,6 @@
 echo "                  Manual pages: $F"
 echo "                      PID file: $G"
 echo "      Random number collection: $RAND_MSG"
-echo "                Manpage format: $MAN_MSG"
 echo "                   PAM support: ${PAM_MSG}"
 echo "            KerberosIV support: $KRB4_MSG"
 echo "                   AFS support: $AFS_MSG"
diff -urN openssh_cvs/mdoc2man.pl openssh_work/mdoc2man.pl
--- openssh_cvs/mdoc2man.pl	Wed Dec 31 18:00:00 1969
+++ openssh_work/mdoc2man.pl	Tue Feb  6 23:17:10 2001
@@ -0,0 +1,329 @@
+#!/usr/local/bin/perl
+
+use strict;
+
+my ($name, $date, $id);
+my ($line);
+my ($optlist, $nospace, $enum, $synopsis);
+
+
+$optlist = 0;		### 1 = bullet, 2 = enum, 3 = tag
+$nospace = 0;
+$synopsis = 0;
+
+while ($line = <STDIN>)
+{
+	if ($line !~ /^\./)
+	{
+		print $line;
+		next;
+	}
+
+	$line =~ s/^\.//;
+
+	next
+		if ($line =~ m/\\"/);
+
+	$line = ParseMacro($line);
+	print($line)
+		if (defined $line);
+}
+
+
+
+sub ParseMacro # ($line)
+{
+	my ($line) = @_;
+	my (@words, $retval, $option, $parens, $arg);
+
+	@words = split(/\s+/, $line);
+	$retval = '';
+	$option = 0;
+	$parens = 0;
+	$arg = 0;
+
+#	print('@words = ', scalar(@words), ': ', join(' ', @words), "\n");
+
+	while ($_ = shift @words)
+	{
+#		print "WORD: $_\n";
+
+		next
+			if (/^(Li|Pf|X[oc])$/);
+
+		if (/^Ns/)
+		{
+			$nospace = 1
+				if (! $nospace);
+			$retval =~ s/ $//;
+			next;
+		}
+
+		if (/^No/)
+		{
+			$retval =~ s/ $//;
+			$retval .= shift @words;
+			next;
+		}
+
+		if (/^Dq$/) {
+			$retval .= '``' . (shift @words) . '\'\'';
+			$nospace = 1
+				if (! $nospace && $words[0] =~ m/^[\.,]/);
+			next;
+		}
+
+		if (/^(Sq|Ql)$/) {
+			$retval .= '`' . (shift @words) . '\'';
+			$nospace = 1
+				if (! $nospace && $words[0] =~ m/^[\.,]/);
+			next;
+		}
+
+		$retval .= ' '
+			if (! $nospace && $retval ne '' && $retval !~ m/[\n ]$/);
+		$nospace = 0
+			if ($nospace == 1);
+
+		if (/^Dd$/) {
+			$date = join(' ', @words);
+			return undef;
+		}
+
+		if (/^Dt$/) {
+			$id = join(' ', @words);
+			return undef;
+		}
+
+		if (/^Os$/) {
+			$retval .= '.TH '
+				. $id
+				. " \"$date\" \""
+				. join(' ', @words)
+				. "\"";
+			last;
+		}
+
+		if (/^Sh$/) {
+			$retval .= '.SH';
+			if ($words[0] eq 'SYNOPSIS')
+			{
+				$synopsis = 1;
+			}
+			else
+			{
+				$synopsis = 0;
+			}
+			next;
+		}
+
+		if (/^Xr$/) {
+			$retval .= '\\fB' . (shift @words) .
+				'\\fR(' . (shift @words) . ')'
+				. (shift @words);
+			last;
+		}
+
+		if (/^Nm$/) {
+			$name = shift @words
+				if (@words > 0);
+			$retval .= ".br\n"
+				if ($synopsis);
+			$retval .= "\\fB$name\\fR";
+			$nospace = 1
+				if (! $nospace && $words[0] =~ m/^[\.,]/);
+			next;
+		}
+
+		if (/^Nd$/) {
+			$retval .= '\\-';
+			next;
+		}
+
+		if (/^Fl$/) {
+			$retval .= '\\fB\\-' . (shift @words) . '\\fR';
+			$nospace = 1
+				if (! $nospace && $words[0] =~ m/^[\.,]/);
+			next;
+		}
+
+		if (/^Ar$/) {
+			$retval .= '\\fI';
+			if (! defined $words[0])
+			{
+				$retval .= 'file ...\\fR';
+			}
+			$arg = 1;
+			$nospace = 1
+				if (! $nospace);
+			next;
+		}
+
+		if (/^Cm$/) {
+			$retval .= '\\fB' . (shift @words) . '\\fR';
+			next;
+		}
+
+		if (/^Op$/) {
+			$option = 1;
+			$nospace = 1
+				if (! $nospace);
+			$retval .= '[';
+			next;
+		}
+
+		if (/^Oo$/) {
+			$retval .= "[\\c\n";
+			next;
+		}
+
+		if (/^Oc$/) {
+			$retval .= ']';
+			next;
+		}
+
+		if (/^Pp$/) {
+			if ($optlist) {
+				$retval .= "\n";
+			} else {
+				$retval .= '.LP';
+			}
+			next;
+		}
+
+		if (/^Ss$/) {
+			$retval .= '.SS';
+			next;
+		}
+
+		if (/^Pa$/ && ! $option) {
+			$retval .= '\\fI';
+			$retval .= '\\&'
+				if ($words[0] =~ m/^\./);
+			$retval .= (shift @words) . '\\fR';
+			$nospace = 1
+				if (! $nospace && $words[0] =~ m/^[\.,]/);
+			next;
+		}
+
+		if (/^Dv$/) {
+			$retval .= '.BR';
+			next;
+		}
+
+		if (/^(Em|Ev)$/) {
+			$retval .= '.IR';
+			next;
+		}
+
+		if (/^Pq$/) {
+			$retval .= '(';
+			$nospace = 1;
+			$parens = 1;
+			next;
+		}
+
+		if (/^(S[xy])$/) {
+			$retval .= '.B ' . join(' ', @words);
+			last;
+		}
+
+		if (/^Ic$/)
+		{
+			$retval .= '\\fB';
+			while (defined $words[0]
+				&& $words[0] !~ m/^[\.,]/)
+			{
+				$retval .= shift @words;
+				$retval .= ' '
+					if (! $nospace);
+			}
+			$retval =~ s/ $//;
+			$retval .= '\\fR';
+			$retval .= shift @words
+				if (defined $words[0]);
+			last;
+		}
+
+		if (/^Bl$/) {
+			if ($words[0] eq '-bullet') {
+				$optlist = 1;
+			} elsif ($words[0] eq '-enum') {
+				$optlist = 2;
+				$enum = 0;
+			} elsif ($words[0] eq '-tag') {
+				$optlist = 3;
+			}
+			last;
+		}
+
+		if (/^El$/) {
+			$optlist = 0;
+			next;
+		}
+
+		if ($optlist && /^It$/) {
+			if ($optlist == 1) {
+				# bullets
+				$retval .= '.IP \\(bu';
+				next;
+			}
+
+			if ($optlist == 2) {
+				# enum
+				$retval .= '.IP ' . (++$enum) . '.';
+				next;
+			}
+
+			if ($optlist == 3) {
+				# tags
+				$retval .= ".TP\n";
+				if ($words[0] =~ m/^(Pa|Ev)$/)
+				{
+					shift @words;
+					$retval .= '.B';
+				}
+				next;
+			}
+
+			next;
+		}
+
+		if (/^Sm$/) {
+			if ($words[0] eq 'off') {
+				$nospace = 2;
+			} elsif ($words[0] eq 'on') {
+				$retval .= "\n";
+				$nospace = 0;
+			}
+			shift @words;
+			next;
+		}
+
+		$retval .= "$_";
+	}
+
+	return undef
+		if ($retval eq '.');
+
+	$retval =~ s/^\.([^a-zA-Z])/$1/;
+	$retval =~ s/ $//;
+
+	$retval .= ')'
+		if ($parens == 1);
+
+	$retval .= ']'
+		if ($option == 1);
+
+	$retval .= '\\fR'
+		if ($arg);
+
+	$retval .= '\\c'
+		if ($nospace && $retval ne '' && $retval !~ m/\n$/);
+
+	$retval .= "\n"
+		if ($retval ne '' && $retval !~ m/\n$/);
+
+	return $retval;
+}
+


More information about the openssh-unix-dev mailing list