beech@ms.uky.edu (Wayne Beech) (11/21/89)
Hello, Does anyone know the rationale behind not specifically defining a set of functions to work with directories in ansi C; things like opendir(), next_dir_entry(), isdir(), etc. if you are writing a program that works with directories that is expected to run on unix and non-unix machines how do you handle this? with a bunch of #ifdef UNIX #elif SOMEOTHERMACHINE ....? -- ============================================================================= UUCP : !ukma!beech BITNET: beech@ukma DOMAIN: beech@ms.uky.edu
news@haddock.ima.isc.com (overhead) (11/22/89)
In article <13288@s.ms.uky.edu> beech@ms.uky.edu (Wayne Beech) writes: >Does anyone know the rationale behind not specifically defining a set of >functions to work with directories in ansi C; things like opendir(), >next_dir_entry(), isdir(), etc. if you are writing a program that works >with directories that is expected to run on unix and non-unix machines how >do you handle this? with a bunch of #ifdef UNIX #elif SOMEOTHERMACHINE ....? I would hope that UNIX and non-UNIX OSs would used the POSIX semantics for this. POSIX is a standard, and covers this issue. The ANSI C document has a finite scope (as does any standard or document of finite length). Directory stuff is one of those areas I now do without ifdefs. Sometimes, I have to provide my own directory library routines, implemented with what they gave me, but more systems are being provided using the POSIX and ANSI C guides. This has been a help. Stephen.
henry@utzoo.uucp (Henry Spencer) (11/23/89)
In article <13288@s.ms.uky.edu> beech@ms.uky.edu (Wayne Beech) writes: >Does anyone know the rationale behind not specifically defining a set of >functions to work with directories in ansi C... The very concept of "directory" is not portable, never mind the set of operations you can perform on one. X3J11 decided early that (with the exception of the free-standing/hosted split) it did *not* want a standard with multiple levels or optional parts. Ignoring the free-standing business, there is *one* C standard. This is a Good Thing. It did limit the committee to providing only functions that could be implemented on an enormous range of systems, however. -- A bit of tolerance is worth a | Henry Spencer at U of Toronto Zoology megabyte of flaming. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu