[cc65] Common macros for dirent.d_type (was: Need to pass drive number in addition to device number to cbm_opendir)

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-06-03 18:50:30
Hi Uz,

> I might start over with your C module, but as you probably know it is not
> usable as is and will need some work.

I just noticed that there are now opendir() and friends for the CBM
machines - thanks :-)

There is however one small issue that keeps one from cross-target
directory handling: The readdir() functions tend to return additional
"things" beside files. On the Apple2 it returns subdirectories and on
the CBMs it returns the directory header (hope that the correct term).

So one needs to look at the field 'd_type' to filter out the
additional "things" - and it's great that the name of the field to
look at has the same name on the Apple2 and the CBMs. However there's
no single set of macros to compare the content of d_type against.

So I propose to define at least one cross-target macro that contains
the target-specific value of d_type for an ordinary file. In case
there's no good definition of the term 'ordinary file' a usable
definition could probably be an item one can successfully use in
open() and friends.

And if the macro in question just isn't defined at all for targets
without a field 'd_type' in 'struct dirent' it would be quite easy to
handle those targets with coding like this

#ifdef <macroname>
  if (dir->d_type == <macroname>)
    continue;
#endif

Thanks in advance for your consideration,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Jun 3 18:51:01 2012

This archive was generated by hypermail 2.1.8 : 2012-06-03 18:51:04 CEST