Fix perror() issues.

perror() should write only a single new-line. Also, it should not write the prefix string, colon and space if the prefix string pointer is NULL or if it points to an empty string.
This commit is contained in:
Stephen Heumann 2018-09-09 21:43:14 -05:00
parent 2be73c4e5d
commit 24ec2ae9bc
1 changed files with 9 additions and 5 deletions

View File

@ -2141,6 +2141,13 @@ s equ 4 string address
tsc set up DP addressing
phd
tcd
lda s skip prefix string if it is NULL/empty
ora s+2
beq lb0
lda [s]
and #$00FF
beq lb0
ph4 >stderr write the error string
ph4 s
@ -2151,7 +2158,7 @@ s equ 4 string address
ph4 >stderr
pea ' '
jsl fputc
ph4 >stderr write the error message
lb0 ph4 >stderr write the error message
lda >errno
cmp #maxErr+1
blt lb1
@ -2164,12 +2171,9 @@ lb1 asl A
lda >sys_errlist,X
pha
jsl fputs
ph4 >stderr write lf, cr
ph4 >stderr write lf
pea 10
jsl fputc
ph4 >stderr
pea 13
jsl fputc
pld remove parm and return
lda 2,S