From a2bca0df04e000cd90227e651c9501043e36115f Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Wed, 13 Jul 2022 18:34:29 -0500 Subject: [PATCH] Implement O_APPEND mode. This was documented as supported, but not actually implemented. --- fcntl.asm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fcntl.asm b/fcntl.asm index 6d0750b..2a4186d 100644 --- a/fcntl.asm +++ b/fcntl.asm @@ -800,6 +800,7 @@ nbuff equ 3 new buffer pointer lda files,X beq lb0 sta wrRefnum + sta smRefnum stx filds lda files+2,X make sure the file is open for writing and #O_WRONLY+O_RDWR @@ -851,7 +852,12 @@ lb0e sta [nbuff] long M lb0f move4 nbuff,wrDataBuffer set the data buffer start -lb0g OSWrite wrRec write the bytes +lb0g ldx filds if the file is in O_APPEND mode then + lda files+2,X + and #O_APPEND + beq lb0h + OSSet_Mark smRec set mark to EOF +lb0h OSWrite wrRec write the bytes bcc lb1 if an error occurred then lda #EIO errno = EIO sta >errno @@ -875,4 +881,9 @@ wrRefnum ds 2 wrDataBuffer ds 4 wrRequestCount ds 4 wrTransferCount ds 4 + +smRec dc i'3' SetMark record +smRefnum ds 2 +smBase dc i'1' EOF-displacement mode +smDisplacement dc i4'0' displacement = 0 end