[comp.bugs.4bsd] Man without a title will derefernece a null pointer. +Fix

gww@marduk.UUCP (Gary Winiger) (09/05/87)

Subject: Man without a title will derefernece a null pointer. +Fix
Index:	ucb/man 4.3BSD +Fix

Description:
	Man without a title but with switches will dereference a null
	pointer when trying to reference the title.
Repeat-By:
	man -l
Fix:
	The attached code resolves this problem at Elxsi.

Gary..
{ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww
--------- cut --------- snip --------- :.,$w diff -------------
*** /tmp/,RCSt1002229	Tue Dec 23 16:47:27 1986
--- man.c	Tue Dec 23 16:46:33 1986
***************
*** 1,5 ****
--- 1,8 ----
  /*
   * $Log:	man.c,v $
+  * Revision 1.2  86/12/23  16:44:26  gww
+  * Correct null pointer reference when no title is given.
+  * 
   * Revision 1.1  86/12/22  13:43:58  gww
   * Initial revision
   * 
***************
*** 17,23 ****
  #endif not lint
  
  #ifndef lint
! static char *ERcsId = "$Header: man.c,v 1.1 86/12/22 13:43:58 gww Exp $ ENIX BSD";
  static char sccsid[] = "@(#)man.c	5.12 (Berkeley) 3/20/86";
  #endif not lint
  
--- 20,26 ----
  #endif not lint
  
  #ifndef lint
! static char *ERcsId = "$Header: man.c,v 1.2 86/12/23 16:44:26 gww Exp $ ENIX BSD";
  static char sccsid[] = "@(#)man.c	5.12 (Berkeley) 3/20/86";
  #endif not lint
  
***************
*** 123,128 ****
--- 126,135 ----
  			break;
  		}
  		argc--, argv++;
+ 	}
+ 	if (argc < 1) {
+ 		fprintf(stderr, "Usage: man [ section ] name ...\n");
+ 		exit(1);
  	}
  	if (troffit == 0 && nomore == 0 && !isatty(1))
  		nomore++;