kprint: add support for L modifier in %f

This is just a parsing trick because long double and double are the same
type on this platform.
This commit is contained in:
Lephe 2021-05-21 09:17:01 +02:00
parent 21e91b30d5
commit bc3b8f5602
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -69,7 +69,7 @@ void kprint_register(int spec, kprint_formatter_t kformat)
/* Non-letters */
if(spec < 'a' || spec > 'z') return;
/* Size-specifying letters */
if(spec == 'h' || spec == 'l' || spec == 'z') return;
if(spec == 'h' || spec == 'l' || spec == 'L' || spec == 'z') return;
kprint_formatters[spec - 'a'] = kformat;
}
@ -142,7 +142,8 @@ kprint_options_t kprint_opt(char const **options_ptr)
for(int c; (c = *options); options++)
{
int c_low = c | 0x20;
if(c_low >= 'a' && c_low <= 'z' && c != 'h' && c != 'l') break;
if(c_low >= 'a' && c_low <= 'z' && c != 'h' && c != 'l' &&
c != 'L') break;
if(c == '.')
{
@ -178,6 +179,7 @@ kprint_options_t kprint_opt(char const **options_ptr)
if(c == 'h') opt.size--;
if(c == 'l') opt.size++;
if(c == 'z') opt.size = 3;
if(c == 'L') {}
if(c >= '1' && c <= '9') state = length, options--;
}