Hi, > O_TRUNC "cheats": it actually removes the old file, so that O_CREAT can > make a new (zero-length) file. I see, but I still don't think the current code handles the flags "correctly". Here's a pseudocode based on the (documented) CBM DOS capabilities that is much closer to the POSIX semantics. However it doesn't handle O_APPEND (yet) as I don't know the CBM append capabilities yet... ========== rwflag = oflag & (O_RDONLY | O_WRONLY); if (rwflag == (O_RDONLY | O_WRONLY) || rwflag == 0) return EINVAL; if (rwflag & O_RDONLY) goto "read file"; // --- write file --- exist = "check file"; if (oflag & O_CREAT == 0 && !exist) return ENOENT; if (oflag & O_TRUNC == 0 && exist) return EINVAL; if (oflag & O_EXCL == 0) "delete file"; "write file"; ========== > CBM DOS does have an over-write access mode. But, Commodore didn't document > it. CC65's CBM library doesn't use it. That's cool! Yet another project after the fixed/imporved mouse driver ;-) Best, Oliver ---------------------------------------------------------------------- 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 Feb 10 13:00:03 2010
This archive was generated by hypermail 2.1.8 : 2010-02-10 13:00:06 CET