On 22 Jan, Bruce Evans wrote:

>>/cdrom:
>>.                                        (type: unknown)
>>..                                       (type: unknown)
>>autorun.inf                              (type: unknown)
> 
> This is because the cd9660 file system doesn't implement d_type.

man dirent or man readdir didn`t note that it`s possible to have this
behavior.

>>#define _POSIX_SOURCE
>>
>>#include <sys/types.h>
>>#include <dirent.h>
>>...
>>  while((dent_p = readdir(dir_p)))
>>  {
>>    printf("%-40s (type: %s)\n", dent_p->d_name, types[dent_p->d_type]);
>>  }
> 
> This probably shouldn't compile, since d_type isn't in POSIX.1.  POSIX.1

It compiles, output above.

> only guarantees d_name in struct dirent.  Names beginning with d_ are
> reserved for use in <dirent.h>, but FreeBSD normally attempts to give
> strict POSIX.1 if _POSIX_SOURCE is defined.

So it`s a bug, but in a different way I want. :(

Without _POSIX_SOURCE it didn`t work either.
Is it useless, because we can only say "it works _perhaps_" (and we
have to stat the entry), or is it a bug?

Bye,
Alexander.

-- 
http://netchild.home.pages.de     A.Leidinger @ wurzelausix.cs.uni-sb.de


To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message

Reply via email to