[net.unix-wizards] Small bug in dirtree

greg (01/18/83)

  There are two small bugs in the dirtree program submitted by Greg Ordy.
One is due to the fact that the program assumes that the directory
entrys "." and ".." are always entrys 1 and 2 of the directory. On our
system at least thats not only the case. The fix is:

	Delete the line that says:

	fseek(fp, (long) (2 * (sizeof(de))), 0);	/Pass up . and .. */

	In the routine build_tree, and change the line that says:

	if(de.d_ino == 0)

		-to-

	if((de.d_ino == 0) || (strcmp(de.d_name,"..") == 0) || (strcmp(de.d_name,".") == 0))

	In the same routine (build_tree).

	The other bug has to do with clipping. To fix it add the line:

	clipped++;

	After the fprintf in routine display() that says:

	fprintf(stderr,"Truncated structure. Col....


Greg Travis
pur-ee!isrnix!greg