Re: readdir cd9660 direntp-d_type == bug (more)
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
Re: readdir cd9660 direntp-d_type == bug (more)
Hi, 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) cardware (type: unknown) doku (type: unknown) fritz.ico(type: unknown) fritz! (type: unknown) intro.hlp(type: unknown) online (type: unknown) tools(type: unknown) winport (type: unknown) {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 dr-xr-xr-x 1 root wheel 2048 27 Mai 1998 cardware dr-xr-xr-x 1 root wheel 2048 27 Mai 1998 doku dr-xr-xr-x 1 root wheel 2048 27 Mai 1998 fritz! -r-xr-xr-x 1 root wheel766 15 Mai 1998 fritz.ico -r-xr-xr-x 1 root wheel 75833 22 Mai 1998 intro.hlp dr-xr-xr-x 1 root wheel 2048 27 Mai 1998 online dr-xr-xr-x 1 root wheel 2048 27 Mai 1998 tools dr-xr-xr-x 1 root wheel 2048 27 Mai 1998 winport Every other CD I tried shows similar results. With ufs or msdos it displays the correct type (dir, reg, ...). FreeBSD 4.0-CURRENT #0: Thu Jan 21 Bye, Alexander. -- http://netchild.home.pages.de A.Leidinger @ wurzelausix.cs.uni-sb.de binmYSTwHnzqq.bin Description: dirtest.c
Re: readdir cd9660 direntp-d_type == bug (more)
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