Query about <dirent.h>
Moderator, John S. Quarterman
std-unix at longway.TIC.COM
Wed Nov 22 22:38:36 AEST 1989
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]
However, doing this means that <limits.h> must be included. As far as I
can see, the following is a conforming application:
#include <dirent.h>
main()
{
(void) opendir("/usr");
}
If one uses NAME_MAX in <dirent.h>, we have a conforming application that
won't even compile.
Another solution is to put
#define _NAME_MAX 14
in <dirent.h> and use that (assuming the result of the discussion on
name space pollution permits this). It might work, but it is hardly
elegant.
What's an implementer to do?
Andy Tanenbaum (ast at cs.vu.nl)
Volume-Number: Volume 17, Number 65
More information about the Comp.std.unix
mailing list