Query about <dirent.h>

Mark H. Colburn mark at jhereg.Minnetech.MN.ORG
Fri Nov 24 23:58:23 AEST 1989


From: mark at jhereg.Minnetech.MN.ORG (Mark H. Colburn)

In article <437 at longway.TIC.COM> Andy Tanenbaum <uunet!cs.vu.nl!ast> writes:
>From: Andy Tanenbaum <uunet!cs.vu.nl!ast>
>
>The <dirent.h> header is required by P1003.1 to have a field
>	d_name []
>
>Now the question arises about what size to use there.  One possibility is
>	d_name[NAME_MAX+1]
>

At least three implementations that I know of define dname as follows:

	d_name[1];

And, they put it at the end of the strucutre.  In this way, when the
structure is allocated, the implementation may allocate enough space for
the directory name, no matter what it is.  For a good, publicly available
example, you might want to check out Doug Gwyn's dirent library.

-- 
Mark H. Colburn                       mark at Minnetech.MN.ORG
Open Systems Architects, Inc.

Volume-Number: Volume 17, Number 71



More information about the Comp.std.unix mailing list