Re: [cc65] Re: readdir bug

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-09-19 10:50:03
Hi Shawn,

>> I just did some testing on the Atari, and Multidemo.c does not work
>> correctly.  In fact, what happens is that it will read only ONE directory
>> entry past the first EMD driver that it tries, no matter if more directory
>> entries exist.
>>
>> I took out all the overlay and emdriver loading stuff and the directory
>> reading by itself works, so there is some conflict/bug between the
>> interaction with the EMD driver loading/unloading and the directory reading
>> routines (at least on the Atari.)
>
> Loading the EMD driver will use open/read/close, so this looks like a similar
> error like the one on the commodores. Do you know if it is possible on the
> Atari to read the directory line by line and between these read, open, read
> and close some other file?

It would be great if you could check if the program below is able to
display all directory entries on the Atari. Because that would help to
decide what type of cross-target workaround is appropriate.

Thanks in advance, Oliver

====================
#include <stdio.h>
#include <fcntl.h>
#include <dirent.h>

void main(void)
{
    DIR* dir;
    struct dirent* ent;

    dir = opendir(".");
    while (ent = readdir(dir)) {
        int f;

        printf("%s", ent->d_name);

        if (!_DE_ISREG(ent->d_type)) {
            printf(" skipped\n");
            continue;
        }

        if ((f = open(ent->d_name, O_RDONLY)) != -1) {
            printf(" opened\n");
            close(f);
        }
    }
    closedir(dir);
}
====================
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Sep 19 10:50:19 2012

This archive was generated by hypermail 2.1.8 : 2012-09-19 10:50:22 CEST