1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- The printf() family now ignores argument specifications, as in "%2$d %1$d",

which are used for localization on some platforms. This is a non-standard
  feature and the way clib2 treats it for now is just intended to avoid
  trouble while performing the conversion.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15178 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2008-03-10 15:28:11 +00:00
parent a41212e575
commit 234a17cc07
2 changed files with 40 additions and 9 deletions

View File

@ -1,3 +1,8 @@
- The printf() family now ignores argument specifications, as in "%2$d %1$d",
which are used for localization on some platforms. This is a non-standard
feature and the way clib2 treats it for now is just intended to avoid
trouble while performing the conversion.
- [jlangner]: changed the GNUmakefile.68k to also build soft-float variants of all
our libraries. In addition the specs file now also respects the -msoft-float
option at link time and sets the default link directory accordingly.

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_vfprintf.c,v 1.25 2006-11-13 09:32:28 obarthel Exp $
* $Id: stdio_vfprintf.c,v 1.26 2008-03-10 15:28:11 obarthel Exp $
*
* :ts=4
*
@ -143,8 +143,12 @@ vfprintf(FILE * stream,const char * format, va_list arg)
int output_len;
const char *prefix;
char prefix_buffer[8];
int argument_digits;
int argument_number;
int argument_index;
int result = EOF;
int len = 0;
int i;
int c;
#if defined(FLOATING_POINT_SUPPORT)
@ -203,6 +207,36 @@ vfprintf(FILE * stream,const char * format, va_list arg)
continue;
}
/* If a string of digits, terminated by a '$' character appears here,
it indicates which argument should be accessed. We evaluate this
data but for now will ignore it altogether. */
argument_index = argument_number = argument_digits = 0;
for(i = 0 ; format[i] != '\0' ; i++)
{
if(format[i] == '$')
{
if(argument_digits > 0)
{
argument_index = argument_number;
format = &format[i+1];
}
break;
}
else if ('0' <= format[i] && format[i] <= '9')
{
argument_number = (10 * argument_number) + (format[i] - '0');
argument_digits++;
}
else
{
break;
}
}
format_flags = 0;
fill_character = ' ';
@ -772,7 +806,6 @@ vfprintf(FILE * stream,const char * format, va_list arg)
int max_digits = -1;
int exponent = 0;
int digit;
int i;
/* This takes care of the sign. */
if(v < 0.0)
@ -1352,8 +1385,6 @@ vfprintf(FILE * stream,const char * format, va_list arg)
}
else
{
int i;
output_len = precision;
for(i = 0 ; i < precision ; i++)
@ -1532,8 +1563,6 @@ vfprintf(FILE * stream,const char * format, va_list arg)
if(FLAG_IS_SET(format_flags,FORMATF_LeftJustified))
{
int i;
if(prefix != NULL)
{
for(i = 0 ; prefix[i] != '\0' ; i++)
@ -1590,8 +1619,6 @@ vfprintf(FILE * stream,const char * format, va_list arg)
}
else
{
int i;
/* If we have to add the prefix later, make sure that
we don't add too many fill characters in front of
it now. */
@ -1644,7 +1671,6 @@ vfprintf(FILE * stream,const char * format, va_list arg)
}
}
for(i = 0 ; i < output_len ; i++)
{
if(__putc(output_buffer[i],stream,buffer_mode) == EOF)