funny behaviour of whereis

terryl at tekchips.UUCP terryl at tekchips.UUCP
Tue Oct 16 05:57:05 AEST 1984


     Recently I tried getting whereis to look in a local directory to find
some local fonts people have done around here, and unless I specified the
full font name (which looks something like "font-name.size.font"), whereis
wouldn't find it. After looking at the source to whereis, I tracked down the
problem to the routine itsit:

itsit(cp, dp)
	register char *cp, *dp;
{
	register int i = strlen(dp);

	if (dp[0] == 's' && dp[1] == '.' && itsit(cp, dp+2))
		return (1);
	while (*cp && *dp && *cp == *dp)
		cp++, dp++, i--;
	if (*cp == 0 && *dp == 0)
		return (1);
	while (isdigit(*dp))
		dp++;
	if (*cp == 0 && *dp++ == '.') {
		--i;
		while (i > 0 && *dp)
			if (--i, *dp++ == '.')
				return (*dp++ == 'C' && *dp++ == 0);
		return (1);
	}
	return (0);
}

     Now the compares for 's' and '.' is checking for SCCS files, so that's
very reasonable, but down there in the third while loop, itsit is looking
for a second '.' in the directory entry it was passed, and if if finds a
second '.', only return success if the LAST extension on the directory entry
is ".C". Now my questions are, why does whereis know about only ".C" files
(which are compacted files)???Why does it even care???What if some other
program comes along that puts a different extension on the original file
name(Sure am glad RCS puts a ",v" extension on its file names!!!!)????


				Terry Laskodi
				     of
				Tektronix



More information about the Comp.unix.wizards mailing list