🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.unix
Article #117

Re: Query about <dirent.h>

#117
From: Moderator, John S. Quarterman
Date: Fri, 24 Nov 1989 10:30
26 lines
1288 bytes
From: Andy Tanenbaum <uunet!cs.vu.nl!ast>

In article <438@longway.TIC.COM> gwyn@brl.arpa (Doug Gwyn) writes:

>You, the implementer, could manually replace that NAME_MAX with the
>appropriate value (perhaps found by inspecting <limits.h>). 

It is true I could just put 14 there, or #define it to be _NAME_MAX in that
file, but that seems poor programming practice.  If that constant ever gets
changed in <limits.h> but not in <dirent.h> disaster will strike.

>What I did in my implementation was to cheat:
>	char	d_name[1];

What happens when a program allocates a struct dirent in a program?  The
compiler will not allocate enough storage and it will crash when used.

Is it legal to add a line

#include <limits.h> 

in <dirent.h>?

Andy Tanenbaum (ast@cs.vu.nl)

Volume-Number: Volume 17, Number 69
Technical Details
Message-ID: <441@longway.TIC.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!longway!std-unix
References: <437@longway.TIC.COM> <438@longway.TIC.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!longway!std-unix
From: std-unix@longway.TIC.COM (Moderator, John S. Quarterman)
Newsgroups: comp.std.unix
Subject: Re: Query about <dirent.h>
Message-ID: <441@longway.TIC.COM>
Date: 24 Nov 89 10:30:00 GMT
References: <437@longway.TIC.COM> <438@longway.TIC.COM>
Reply-To: Andy Tanenbaum <uunet!cs.vu.nl!ast>
Organization: VU Informatica, Amsterdam
Lines: 26
Approved: jsq@longway.tic.com (Moderator, John S. Quarterman)