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

From: Kajtár Zsolt <kajtarzsolt1googlemail.com>
Date: 2012-08-10 19:49:18
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> 

> On 2012-08-09, at 20:26, Groepaz wrote:
> 
>>> Thinking aloud (might be completely bad idea)... how about something 
>>> in unix style (so that it could fit somehow into POSIX ways):
>>> 
>>> "/floppy/unit/subunit/file"
>> 
>> urks. please not. the unit number is so useless and so few people would
>>  actually need them, its a perfect candidate for some "magic
>> variable".

This path stuff is not that bad at all. But slightly differently.

/<targetspecificdeviceunitslotwhatever>/<rest of the path>/

So effectively we could "mount" devices to a fake directory structure. By
default the current directory would be the current device of course.

Chdir could navigate around in it. Slashes would be counted to know when we
are in a root directory (==0) and when in a device directory (!=0). ".."
would be interpreted to adjust this count of course. Or if we have memory to
throw away then just store the current path in memory completely.

Path belonging to the device directory would be converted in a target
specific way e.g. to CMD syntax for C64, where "." and ".." needs special
handling as well. (Except on IDE64, but let's stick to CMD for maximum
compatibility) Some filenames need to be converted in a target specific way,
like "$tmp" to ":$tmp" for CBM DOS.

Path touching the root directory's child directories would select the device
(chdir) or temporarily override it (absolute path to file)

Relative path could be used if no device selection is needed if already in a
device directory or in a subdirectory of device.

The root directory can't be used to store/read files directly as it's not
real, that why this is not the default location after startup. However if
would be possible to readdir it to discover the
targetspecificdeviceunitslotwhatever directories which can be used in
chdir/readdir/open/etc. as required.

If the "targetspecificdeviceunitslotwhatever" contains more slashes it would
be possible to address stuff like units, partitions, slots, etc. Of course
then these "directories" are fake as well.

As for what "targetspecificdeviceunitslotwhatever" would be I don't really
care, that was discussed here in hundred mails already.

Possibly I could think about and describe a few more corner cases, but I'm
almost sure this will be slightly more than 10 bytes to implement. And then
we could argue on how this new cross platform OS integrated into libc will
be called ;)

- -- 
						    -soci-
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlAlSZkACgkQyBOVYiJltRZ6GwCg54gI8QC/0Q8BBeXy0H4rkklG
4DkAn0ojpMSvZQUBOmnA/pRTbsb0xkVB
=92al
-----END PGP SIGNATURE-----
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Aug 10 19:49:35 2012

This archive was generated by hypermail 2.1.8 : 2012-08-10 19:49:38 CEST