G
YouTube TikTok Games
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/usr.bin/printf/printf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,12 @@ NetBSD_extensions()
expect 99.000000 '%f' '"c'
expect 97 '%g' '"a'

# arguments using the 'c syntax must be consumed exactly once,
# including for floating point conversions
expect '65 66' '%g %g' "'A" "'B"
expect '65.000000 66.000000' '%f %f' "'A" "'B"
expect '6.500000e+01 6.600000e+01' '%e %e' "'A" "'B"

# NetBSD (non-POSIX) format escape extensions
expect '' '\e'
expect '' '\E'
Expand Down
4 changes: 3 additions & 1 deletion usr.bin/printf/printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,10 @@ getdouble(void)
return 0.0;

/* This is a NetBSD extension, not required by POSIX (it is useless) */
if (*(ep = *gargv) == '\"' || *ep == '\'')
if (*(ep = *gargv) == '\"' || *ep == '\'') {
gargv++;
return (long double)wide_char(ep, 1);
}

errno = 0;
val = strtold(*gargv, &ep);
Expand Down