Re: [hatari-devel] Character conversion for filenames in GEMDOS HD emulation

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi Eero,

>> Here is a patch which integrates these functions into Hatari:
>> https://gist.github.com/a8b0ba0aa6d3bc8adab5
>
> Regarding this part of your patch:
> * ommented out because this is risky. When deleting files which
> * contain invalid characters, the inserted wildcard '?' may match
> * also on other files, and an arbitrary file may be deleted.
>
> What kind of use-case you had in mind?
>
> The file you get on emulated Atari and select to be deleted,
> should be the same that gets deleted.  Tools that use wildcards
> for this kind of things are typically under MiNT, and that
> bypasses GEMDOS emulation.

To test the character conversion I have written a small program which
creates files with special characters:

#include <stdio.h>
#include <tos.h>

void main(void)
{
    char name[20];
    int i, fd, err;
    Dcreate("C:\\TEST");
    for (i=32; i<256; i++) {
        sprintf(name, "C:\\TEST\\%c.TXT", i);
        fd = Fcreate(name, 0);
        err = fd<0;
        if (!err)
            err = Fclose(fd);
        printf("%3d - '%s' - %s\n", i, name, err?"err":"ok");
    }
    exit(0);
}

When I run this on the emulated Atari, I get a file <character>.TXT for
each character (code 32..255) of the AtariST character set. Files which
special characters are displayed as "@.TXT" by the GEMDOS HD emulation.

When I now try to delete some of those files by dragging them into
the trash icon, the GEMDOS emulation replaces "@.TXT" by "?.TXT".
But this pattern matches on all files in the folder, so arbitrary files
are deleted.

With the character conversion patch the files won't be shown as "@.TXT"
in the first place and therefore I think the replacement by "?.TXT" to match
invalid characters will no longer be necessary.

Max



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/