Query about <dirent.h>

Moderator, John S. Quarterman std-unix at longway.TIC.COM
Sun Nov 26 06:33:54 AEST 1989


From: Andy Tanenbaum <uunet!cs.vu.nl!ast>

In article <442 at longway.TIC.COM> gwyn at brl.arpa (Doug Gwyn) writes:
>That's what happens when programmers assume things that are not promised
>by the standards.
I don't follow.  What is it that that the standards don't promise.  Surely
a programmer may declare a struct dirent, since readdir() returns a pointer
to one of them.  Furthermore, a programmer may assume that d_name is an
array of characters that can hold a file name.  I don't see how you can
put a file name in 1 character.  I don't see any alternative than to
allocate NAME_MAX+1 characters there.  Why doesn't the standard require
<dirent.h> to have <limits.h> as a prerequisite, so that NAME_MAX
is at least known.

Andy Tanenbaum (ast at cs.vu.nl)

Volume-Number: Volume 17, Number 72



More information about the Comp.std.unix mailing list