strtoul: return 0 when given an empty string, as required by the C standards.

The issue was introduced in commit 6e9790667.

errno is now set to EINVAL in this case. (This is not required by the C standards, but is consistent with various other implementations.)

This fixes the cases in #23 related to strtol() and strtoul().
This commit is contained in:
Stephen Heumann 2019-06-09 19:12:51 -05:00
parent 7a20f5f71d
commit 571c601b66

View File

@ -926,6 +926,9 @@ cn4 inc4 str next char
cn5 lda foundOne if no digits were found, flag the error cn5 lda foundOne if no digits were found, flag the error
bne rt1 bne rt1
lda #EINVAL
sta >errno
bra rt2
; ;
; flag an error ; flag an error
; ;