[net.sources] dtree patches for 4.1, kudos

john@starfire.UUCP (John Lind) (10/10/85)

Dtree came along at a good time -- it was just what some of my users wanted.
I did have a little bit of trouble with long names for both directories and
files, and I will enclose the (probably kludgy) fixes that I made.  14 
character directory names cause problems with stating the files, and 14
character file names messed up the output.  These patches are "least path
of resistance", but they work.

I lost the header lines to the original posting, else I would have sent
the problem and the patched to the author for his reactions.  I was not
sure, after reading the comments, who might have posted it.  At any rate,
my thanks to whoever did the posting.

89c89
< #define	TWIDDLE	4
---
> #define	TWIDDLE	2		/* 16 bit bus */
409c409
< 		sprintf(sub, "%s", dp->d_name);
---
> 		sprintf(sub, "%.*s", MAXNAMLEN, dp->d_name);
670c670,671
< 			printf("|-%.*s",Maxes[Level],l->e_name);
---
> 			printf("|-%.*s",Maxes[Level] > MAXNAMLEN ? MAXNAMLEN :
> 						Maxes[Level],l->e_name);
------
"The question 'Can machines think?' is as ill-posed and uninteresting as
 the question 'Can submarines swim?'" -- Dr. E.W. Dijkstra, EWD-854

John Lind, Starfire Consulting Services
E-mail: ihnp4!umn-cs!starfire!john
USnail: PO Box 13001, Mpls MN  55414