[net.bugs.4bsd] Catman doesn't handle local man pages

bobvan (09/17/82)

Our 4.1BSD catman(8) didn't support the local, new, and public
sections of the manual, as the Berkeley man(1) command did.  The
fix is simple and is given below as diff -c output.

*** catman.orig.c	Wed Oct  1 19:55:48 1980
--- catman.c	Thu Sep 16 16:30:31 1982
***************
*** 15,20
  		nflag = 0,
  		wflag = 0;
  
  main(ac, av)
  int	ac;
  char	*av[]; {

--- 15,22 -----
  		nflag = 0,
  		wflag = 0;
  
+ char		*rindex();
+ 
  main(ac, av)
  int	ac;
  char	*av[]; {
***************
*** 45,51
  	if (ac == 2)
  		sections = *av;
  	else if (ac < 2)
! 		sections = "12345678";
  	else {
  usage:
  		printf("usage: catman [ -p ] [ -n ] [ -w ] [ sections ]\n");

--- 47,53 -----
  	if (ac == 2)
  		sections = *av;
  	else if (ac < 2)
! 		sections = "12345678lnp";
  	else {
  usage:
  		printf("usage: catman [ -p ] [ -n ] [ -w ] [ sections ]\n");
***************
*** 85,92
  			tsp = rindex(dir.d_name, '.');
  			if (tsp == NULL)
  				continue;
! 			if (!isdigit(*++tsp) || ((*++tsp && !isalpha(*tsp)) || *++tsp))
! 				continue;
  
  			strncpy(msp, dir.d_name, DIRSIZ);
  			if ((inf = fopen(man, "r")) == NULL) {

--- 87,101 -----
  			tsp = rindex(dir.d_name, '.');
  			if (tsp == NULL)
  				continue;
! 			switch (*++tsp) {
! 				case '1': case '2': case '3': case '4':
! 				case '5': case '6': case '7': case '8':
! 				case 'l': case 'n': case 'p':
! 					if (isalpha(*++tsp) || *tsp=='\0')
! 						break;
! 				default:
! 					continue;
! 			}
  
  			strncpy(msp, dir.d_name, DIRSIZ);
  			if ((inf = fopen(man, "r")) == NULL) {
------------------------

				Bob Van Valzah
				(...!decvax!ittvax!tpdcvax!bobvan)