>attached is the source of a test program.
>
>With the CD of my ISDN card it produces:
>
>{0} <FreeBSD 4.0-CURRENT>
>(15) netch...@ttyp1 > ./dirtest /cdrom
>
>/cdrom:
>.                                        (type: unknown)
>..                                       (type: unknown)
>autorun.inf                              (type: unknown)

This is because the cd9660 file system doesn't implement d_type.

>{0} <FreeBSD 4.0-CURRENT>
>(16) netch...@ttyp1 > ls -l /cdrom
>total 173
>-r-xr-xr-x  1 root  wheel     54 22 Mai  1998 autorun.inf

ls works because it stats the file.

>#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
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.

Bruce

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

Reply via email to