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

From: Groepaz <groepaz1gmx.net>
Date: 2012-08-11 19:23:12
On Saturday 11 August 2012, you wrote:
> 1.
> Is it possible to pass a pure filename to a device? The reason I'm
> asking is that the cc65 C lib prepends a "0:" to every filename that
> doesn't already have "<num>:" prefix. Or is there another obvious ;-)
> reason why this is done?

its completely optional (and thats why its unusual) and defaults to 0. there 
are however some quirky situations where prepending it will result in 
different behaviour, the most famous (and already mentioned by someone) case 
is:

load "*",8   - loads the last opened file.
load "0:*",8 - loads the first file on disk.

i would assume things like that are the reason to prepend it always.
 
> The C library explicitly looks for "0:" or "1:" but no higher driver
> numbers. Where does this restriction stem from? Is this restriction
> useful / necessary / desirable?

there are no devices with more than two drives =) but in theory there could 
be, ofcourse. 

(that said i vaguely remember another quirky behaviour that comes from using 
higher numbers on an actual dual-drive..... dont remember what exactly the 
problem was though. the 1541 for example accepts 0:, does NOT accept 1:, but 
accepts any higher numbers :))

> 3.
> In this thread there were several filename examples given containing
> an '@' char. Those are currently not recognized by the C library. So
> the qeustion is what the '@' does and if it is relevant for POSIX i/o
> scenarios - meaning the C library possibly needs to be fixed.

the @ sign means "overwrite"

save "test",8
save "test",8    (again - gives "file exists")
save "@:test",8   will overwrite the existing file

and as always, the "@" introduces quirky behavior (its so buggy that it may 
even result in data loss) and shouldnt be used in any case IMHO - however, 
since like 0: it is interpreted/handled by the drive, i dont like the idea of 
adding extra code to filter it out either :)


-- 

http://www.hitmen-console.org    http://magicdisk.untergrund.net
http://www.pokefinder.org        http://ftp.pokefinder.org

Every program has at least one bug and can be shortened by at least one 
instruction --- from which, by induction, one can deduce that every program 
can be reduced to one instruction which doesn't work.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Aug 11 19:22:48 2012

This archive was generated by hypermail 2.1.8 : 2012-08-11 19:22:51 CEST