Re: [cc65] Filenames for POSIX functins on CBM targets

From: Spiro Trikaliotis <ml-cc651trikaliotis.net>
Date: 2012-08-12 14:22:07
Hello,

* On Sat, Aug 11, 2012 at 11:36:49PM +0200 Oliver Schmidt wrote:
 
> I'm pretty sure nobody wants a program with fopen("abc.txt", ...) fail
> with an invalid filename.

Well...

>                 Programs working tape drives and whatever are mot
> likely no cross-target

Why shouldn't they? I expect if I set _curunit to 1, then the program
written for the floppy should also work for the tape (if it does not do
any fancy disk specific stuff).

So, they should be cross-target, yes.

(Note that I have not checked if the cc65 runtime library does not do
some fancy stuff. In fact, prepending "0:" will still work with the
tape, only the resulting file name will be surprising to the programmer,
because the tape will not remove the "0:" from the name...)

> I'm still asking for a reasonable solution for the usual case of
> handling files on floppy (or hard disk) drives.

Well, we might expect different things from the cc65 library. For me,
the library should allow me, the programmer, to do what is possible on
the "bare" platform I am working on. That is, one a c64, I want to be
able to use disk drives and tape drives with open(). This way, all file
names that are supported by the underlying system should be allowed in
any case. (And: No, cbm_k_open() is not an option; it is just too
low-level, and it's use should be restricted to special cases).

If this is not the case, it will not be possible to open some files
written some 20 years ago.

Given that even on one platform only (CBM), it is not possible to find
"disallowed" characters to use a separators, I can only imagine how hard
it is to integrate the other platforms, too.

BTW: You are aware that even Unix/Windows have some differences? While
open("2:hallo") will happily work on Unix, it will not work on Windows -
that is, it will work on Windows with NTFS, but the result will be
different from what most people would expect. With FAT, it will not
work. With ReFS
(https://blogs.msdn.com/b/b8/archive/2012/01/16/building-the-next-generation-file-system-for-windows-refs.aspx?Redirected=true),
I am not sure, as it will not support alternate data streams.


You, on the other hand, seem to expect the cc65 RTL to be an OS in
itself, which neglects the nifty details of each platform (which file
names are allowed, which are not?). Am I right?

Having said this: fopen() is a different beast to me. I expect open()
(which is POSIX, IIRC) to be more low-level, more platform-specific than
fopen() (which is C90/95/99). Thus, if fopen() (and only that) would be
restricted to some characters that are defined by cc65, I think this
would be a compromise I could imagine. Note that I said "can image",
not "like".

Regards,
Spiro.

-- 
Spiro R. Trikaliotis
http://www.trikaliotis.net/
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Aug 12 14:22:28 2012

This archive was generated by hypermail 2.1.8 : 2012-08-12 14:22:31 CEST