"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:
Tim J. Robbins 2002-10-11 22:59:22 +00:00
parent 74a4ba21f7
commit 284d56227c

View File

@ -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 */