[net.sources] Bug Fixes to the program CALLS

ksbszabo@wateng.UUCP (Kevin S. B. Szabo) (06/12/84)

A few months ago the program CALLS was distributed on the network.
I have used it to determine the calling sequence of a number of packages
and found it quite useful. I have also found two bugs which 
manifested themselves in the routine scan(), below. The first
is that CALLS() didn't consider the underscore character a valid
part of an identifier. The second was that the scanning
routine didn't flush the end of a 'too long' identifier
and thus managed to see the end of an identifier upon subsequent calls to
scan(). The corrected routine is shown below. 


scan (atom)
char atom[];
{
	char c;
	int i;

	c = lastchar;
	i = 0;
	while( isalpha(c) || isdigit(c) || (c == '_') ){
		atom [i++] = (c=getch());
		if (i == ATOMLENGTH ) break;
		}
	atom [i-1] = '\0';
	while( isalpha(c) || isdigit(c) || (c == '_') ) c = getch();
	lastchar= c;
	return (1);
}
-- 
	Kevin Szabo  watmath!wateng!ksbszabo (Elec Eng, U of Waterloo)