--- old/usr/src/cmd/man/Makefile	Tue Jul 15 19:41:37 2014
+++ new/usr/src/cmd/man/Makefile	Tue Jul 15 19:41:37 2014
@@ -14,7 +14,8 @@
 #
 
 PROG=		man
-LINKS=		apropos whatis
+LINKS=		apropos whatis catman
+LIBLINKS =	makewhatis
 OBJS=		makewhatis.o man.o stringlist.o
 SRCS=		$(OBJS:%.o=%.c)
 
@@ -22,7 +23,7 @@
 
 CFLAGS +=	$(CCVERBOSE)
 
-ROOTLINKS=	$(LINKS:%=$(ROOTBIN)/%)
+ROOTLINKS=	$(LINKS:%=$(ROOTBIN)/%) $(LIBLINKS:%=$(ROOTLIB)/%)
 
 .KEEP_STATE :
 
--- old/usr/src/cmd/man/man.c	Tue Jul 15 19:41:38 2014
+++ new/usr/src/cmd/man/man.c	Tue Jul 15 19:41:38 2014
@@ -159,6 +159,7 @@
 static int	sargs = 0;
 static int	psoutput = 0;
 static int	whatis = 0;
+static int	makewhatishere = 0;
 
 static char	*mansec;
 static char	*pager;
@@ -191,6 +192,8 @@
 static char	**split(char *, char);
 static void	usage_man(void);
 static void	usage_whatapro(void);
+static void	usage_catman(void);
+static void	usage_makewhatis(void);
 static void	whatapro(struct man_node *, char *);
 
 static char	language[MAXPATHLEN]; 	/* LC_MESSAGES */
@@ -213,6 +216,7 @@
 	int		ret = 0;
 	char		*opts;
 	char		*mwstr;
+	int		catman = 0;
 
 	(void) setlocale(LC_ALL, "");
 	(void) strcpy(language, setlocale(LC_MESSAGES, (char *)NULL));
@@ -231,6 +235,15 @@
 		apropos++;
 		whatis++;
 		opts = "M:ds:";
+	} else if (strcmp(__progname, "catman") == 0) {
+		catman++;
+		makewhatis++;
+		opts = "M:w";
+	} else if (strcmp(__progname, "makewhatis") == 0) {
+		makewhatis++;
+		makewhatishere++;
+		manpath = ".";
+		opts = "";
 	} else {
 		opts = "M:adfklps:tw";
 	}
@@ -273,6 +286,10 @@
 		default:
 			if (apropos)
 				usage_whatapro();
+			else if (catman)
+				usage_catman();
+			else if (makewhatishere)
+				usage_makewhatis();
 			else
 				usage_man();
 		}
@@ -690,8 +707,10 @@
 	char		s[MAXNAMELEN];
 	int		i;
 
-	if ((fp = fopen(whatpath, "r")) == NULL)
+	if ((fp = fopen(whatpath, "r")) == NULL) {
+		perror(whatpath);
 		return;
+	}
 
 	DPRINTF("-- Found %s: %s\n", WHATIS, whatpath);
 
@@ -1564,4 +1583,21 @@
 	    whatis ? "whatis" : "apropos");
 
 	exit(1);
+}
+
+static void
+usage_catman(void)
+{
+	(void) fprintf(stderr, gettext(
+"usage: catman [-M path] [-w]\n"));
+
+	exit(1);
+}
+
+static void
+usage_makewhatis(void)
+{
+	(void) fprintf(stderr, gettext("usage: makewhatis\n"));
+
+	exit(1);
 }
--- old/usr/src/man/man1/Makefile	Tue Jul 15 19:41:38 2014
+++ new/usr/src/man/man1/Makefile	Tue Jul 15 19:41:38 2014
@@ -52,6 +52,7 @@
 	 	calendar.1			\
 	 	cancel.1			\
 	 	cat.1				\
+	 	catman.1			\
 	 	cd.1				\
 	 	cdrw.1				\
 	 	checknr.1			\
--- /dev/null	Tue Jul 15 19:41:38 2014
+++ new/usr/src/man/man1/catman.1	Tue Jul 15 19:41:38 2014
@@ -0,0 +1,70 @@
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source.  A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.\"
+.\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
+.\"
+.Dd Jul 13, 2014
+.Dt CATAMN 1
+.Os
+.Sh NAME
+.Nm catman
+.Nd generate
+.Nm whatis
+database files
+.Sh SYNOPSIS
+.Nm
+.Op Fl M Ar path
+.Sh DESCRIPTION
+The
+.Nm
+utility generates a set of
+.Nm whatis
+database files suitable for use with
+.Xr apropos 1
+and
+.Xr whatis 1 .
+It is supplied for compatibility reasons.  The same databases can
+be generated using the
+.Fl w
+option with
+.Xr man 1 ,
+and that command should be used instead.
+.Bl -tag -width ".Fl d"
+.It Fl M Ar path
+Generate the
+.Nm whatis
+database files within the specified colon separated manual paths.
+Overrides the
+.Ev MANPATH
+environment variable.
+.El
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev MANPATH"
+.It Ev MANPATH
+Used to specify a colon seperated list of manual paths within
+which to generate
+.Nm whatis
+database files.
+.El
+.Sh DIAGNOSTICS
+The
+.Nm
+utility exits 0 on success, and non-zero otherwise.
+.Sh INTERFACE STABILITY
+Obsolete.
+.Sh CODE SET INDEPENDENCE
+Enabled.
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr man 1 ,
+.Xr whatis 1
--- old/usr/src/pkg/manifests/system-man.mf	Tue Jul 15 19:41:38 2014
+++ new/usr/src/pkg/manifests/system-man.mf	Tue Jul 15 19:41:38 2014
@@ -27,10 +27,13 @@
 dir path=usr/share/man
 dir path=usr/share/man/man1
 dir path=usr/share/man/man5
+file path=usr/bin/catman mode=0555
 file path=usr/bin/man mode=0555
 file path=usr/bin/mandoc mode=0555
+file path=usr/lib/makewhatis mode=0555
 file path=usr/lib/mandoc_preconv mode=0555
 file path=usr/share/man/man1/apropos.1
+file path=usr/share/man/man1/catman.1
 file path=usr/share/man/man1/man.1
 file path=usr/share/man/man1/mandoc.1
 file path=usr/share/man/man5/eqn.5
