mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
"Left precision" and "right precision" are not flags, but separate parts
of the format string that appear after the field width.
This commit is contained in:
parent
74a4ba21f7
commit
284d56227c
1 changed files with 15 additions and 13 deletions
|
|
@ -174,18 +174,6 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
|
|||
case '-': /* alignment (left) */
|
||||
flags |= LEFT_JUSTIFY;
|
||||
continue;
|
||||
case '#': /* left || right precision */
|
||||
case '.':
|
||||
if (*fmt == '#')
|
||||
ntmp = &left_prec;
|
||||
else
|
||||
ntmp = &right_prec;
|
||||
|
||||
if (!isdigit((unsigned char)*++fmt))
|
||||
goto format_error;
|
||||
GET_NUMBER(*ntmp);
|
||||
fmt--;
|
||||
continue;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -201,7 +189,21 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
|
|||
if (dst + width >= s + maxsize)
|
||||
goto e2big_error;
|
||||
}
|
||||
|
||||
|
||||
/* Left precision */
|
||||
if (*fmt == '#') {
|
||||
if (!isdigit((unsigned char)*++fmt))
|
||||
goto format_error;
|
||||
GET_NUMBER(left_prec);
|
||||
}
|
||||
|
||||
/* Right precision */
|
||||
if (*fmt == '.') {
|
||||
if (!isdigit((unsigned char)*++fmt))
|
||||
goto format_error;
|
||||
GET_NUMBER(right_prec);
|
||||
}
|
||||
|
||||
/* Conversion Characters */
|
||||
switch (*fmt++) {
|
||||
case 'i': /* use internaltion currency format */
|
||||
|
|
|
|||
Loading…
Reference in a new issue