[comp.bugs.4bsd] man has a dead variable

chris@mimsy.UUCP (08/30/87)

Index:	ucb/man.c 4.3BSD Fix

Description:
	The `ss' variable in manual() is useless.

Repeat-By:
	Examination.

Fix:
	This also simplifies the subsection scanning code a little.

RCS file: RCS/man.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -c2 -r1.2 -r1.3
*** /tmp/,RCSt1013205	Sun Aug 30 07:30:27 1987
--- /tmp/,RCSt2013205	Sun Aug 30 07:30:29 1987
***************
*** 179,183 ****
  	char path[MAXPATHLEN+1], realname[MAXPATHLEN+1];
  	char cmdbuf[150];
- 	int ss = 0;
  	struct stat stbuf, stbuf2;
  	int last;
--- 179,182 ----
***************
*** 185,188 ****
--- 184,189 ----
  	FILE *it;
  	char abuf[BUFSIZ];
+ 	static char *subsections[] =
+ 		{ "", SUBSEC1, "", SUBSEC3, SUBSEC4, "", "", "", SUBSEC8 };
  
  	strcpy(work, "manx/");
***************
*** 205,224 ****
  				char *cp;
  search:
! 				switch (work[last]) {
! 				case '1': cp = SUBSEC1; break;
! 				case '3': cp = SUBSEC3; break;
! 				case '4': cp = SUBSEC4; break;
! 				case '8': cp = SUBSEC8; break;
! 				default:  cp = ""; break;
! 				}
  				while (*cp) {
  					work[last+1] = *cp++;
! 					if (pathstat(work, path, &stbuf)) {
! 						ss = work[last+1];
  						goto found;
- 					}
  				}
! 				if (ss == 0)
! 					work[last+1] = 0;
  			}
  		}
--- 206,216 ----
  				char *cp;
  search:
! 				cp = subsections[work[last] - '0'];
  				while (*cp) {
  					work[last+1] = *cp++;
! 					if (pathstat(work, path, &stbuf))
  						goto found;
  				}
! 				work[last+1] = 0;
  			}
  		}
***************
*** 248,267 ****
  					if (pathstat(work, path, &stbuf))
  						goto found;
! 					switch (work[last]) {
! 					case '1': cp = SUBSEC1; break;
! 					case '3': cp = SUBSEC3; break;
! 					case '4': cp = SUBSEC4; break;
! 					case '8': cp = SUBSEC8; break;
! 					default:  cp = ""; break;
! 					}
  					while (*cp) {
  						work[last+1] = *cp++;
! 						if (pathstat(work, path, &stbuf)) {
! 							ss = work[last+1];
  							goto found;
- 						}
  					}
! 					if (ss == 0)
! 						work[last+1] = 0;
  				}
  			}
--- 240,250 ----
  					if (pathstat(work, path, &stbuf))
  						goto found;
! 					cp = subsections[sec - '0'];
  					while (*cp) {
  						work[last+1] = *cp++;
! 						if (pathstat(work, path, &stbuf))
  							goto found;
  					}
! 					work[last+1] = 0;
  				}
  			}
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	seismo!mimsy!chris