Ah. I agree that directory support appears to be less system-
specific (more general) than globbing, particularly since the
latter more or less requires the former.
David Tribble has put together several proposals for C200X, including
one for directory access functions
<
http://david.tribble.com/text/c0xdir.html>. A search of the archives
of this newsgroup (or was it comp.std.c?) should turn up some
discussion of the proposals.
Thanks for the pointer; I missed the earlier discussions. It's
an interesting proposal. I'm glad to see that he includes test
macros for some individual facilities (eg setting the "current
directory").
Well, you could consider POSIX to be a standard that provides
directory access functions. POSIX is a standard for an operating
system interface, not necessarily for an operating system, and the
interface has been implemented on systems that aren't particularly
Unix-like. On the other hand, I think POSIX implementations on
"exotic" systems tend to be emulation layers rather than interfaces to
the underlying OS.
The glorious AS/400 is an interesting case. Early versions of
OS/400 supported only a single filesystem (probably derived from
either the IBM System/38 or IBM's cancelled Future Systems project,
or both). It has a flat (non-hierarchical) set of "libraries",
which contain any number of a variety of "objects" of various
"types". There are "*PGM", "*SRVPGM", and "*MODULE" objects, for
example, which are kinds of objects that contain executable code.
There are *FILE objects, which are containers for arbitrary data.
There are various kinds of IPC objects and journal objects and
queue objects and so on - in the older version of OS/400 I have on
one machine here, about 75 types of objects in all. These are
strong types - you can't open a *PGM object as if it were a data
file.
*FILE objects are composed of "members", which contain "records".
The members of a *FILE object are often what someone coming from,
say, a Unix background would think of as a file. For example, C
source code is kept in one or more *FILE objects of the "PF"
("program file") subtype, and each C "source file" is actually a
member of a *FILE object. In my application, all the header files
are (named) members of a single *FILE object named "H". (For source
code, the records of a member are lines of source.) The equivalent
to an "include file search path" for the OS/400 C compiler is a
list of *FILE objects to search for the header member named by the
#include directive.
So directory support for this filesystem should consider libraries
as "directories", but it also probably needs to handle *FILE objects
as both "files" (for the purpose of operating on the contents of a
library) and as "directories" (for the purpose of examining the
members of a file).
Later versions of OS/400 support multiple filesystems. The original
one became IFS, the Integrated File System. Tacked on alongside it,
for POSIX compatibility, is HFS, the Hierarchical File System.
OS/400 programs that use the appropriate (POSIX) APIs can operate
on files contained in an HFS, but HFS can't be used for everything,
at least in the version of OS/400 I'm running. You need IFS for
standard OS/400 applications.
The standard library functions - fopen, etc - work on both
filesystems. More complex system-specific tasks on IFS objects
require using OS/400 APIs. The POSIX ones mostly don't work with
IFS.
--
Michael Wojcik (e-mail address removed)
The lark is exclusively a Soviet bird. The lark does not like the
other countries, and lets its harmonious song be heard only over the
fields made fertile by the collective labor of the citizens of the
happy land of the Soviets. -- D. Bleiman