diff options
author | Marco Paland <marco@paland.com> | 2018-09-24 15:13:41 +0200 |
---|---|---|
committer | Marco Paland <marco@paland.com> | 2018-09-24 15:13:41 +0200 |
commit | 00f2525d1a712c80c2f2b5ffa648e44fbc29ee05 (patch) | |
tree | 884f4378f7cf78f9f67633118109c40e4ffbbe99 /printf.c | |
parent | 25958b9beb1830eb79033d6095a64f4c5f87effa (diff) | |
download | printf-00f2525d1a712c80c2f2b5ffa648e44fbc29ee05.tar.gz printf-00f2525d1a712c80c2f2b5ffa648e44fbc29ee05.tar.bz2 printf-00f2525d1a712c80c2f2b5ffa648e44fbc29ee05.zip |
feat(printf): add # flag support for %b specifier
Closes #29
Diffstat (limited to 'printf.c')
-rw-r--r-- | printf.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -175,6 +175,9 @@ static size_t _ntoa_format(out_fct_type out, char* buffer, size_t idx, size_t ma if ((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
buf[len++] = 'X';
}
+ if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
+ buf[len++] = 'b';
+ }
if (len < PRINTF_NTOA_BUFFER_SIZE) {
buf[len++] = '0';
}
@@ -535,7 +538,6 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const }
else if (*format == 'b') {
base = 2U;
- flags &= ~FLAGS_HASH; // no hash for bin format
}
else {
base = 10U;
|