glibc/stdio-common/tst-sprintf.c
Ulrich Drepper 40a54e4d8d Update.
2003-05-27  Jakub Jelinek  <jakub@redhat.com>

	* stdio-common/vfprintf.c (process_arg, process_string_arg): Use
	pa_int/pa_u_int instead of pa_short_int, pa_u_short_int and pa_char.
	* stdio-common/printf-parse.h (union printf_arg): Remove pa_char,
	pa_short_int, pa_u_short_int and pa_float.

2003-05-26  Jakub Jelinek  <jakub@redhat.com>

	* libio/strops.c (_IO_str_init_static): Change into a wrapper around
	_IO_str_init_static_internal.
	(_IO_str_init_static_internal): Moved from _IO_str_init_static,
	change size argument to _IO_size_t, don't limit sprintf to 64M.
	(_IO_str_init_readonly): Call _IO_str_init_static_internal.
	* libio/wstrops.c (_IO_wstr_init_static): Change size argument to
	_IO_size_t, don't limit swprintf to 256M.
	(_IO_wstr_init_readonly): Remove.
	* libio/libioP.h (_IO_str_init_static_internal, _IO_wstr_init_static):
	Adjust prototypes.
	(_IO_wstr_init_readonly): Remove prototype.
	* libio/iovsprintf.c (_IO_vsprintf): Use
	_IO_str_init_static_internal instead of INTUSE(_IO_str_init_static).
	* libio/iovsscanf.c (_IO_vsscanf): Likewise.
	* libio/memstream.c (open_memstream): Likewise.
	* libio/obprintf.c (_IO_obstack_vfprintf): Likewise.
	* libio/vasprintf.c (_IO_vasprintf): Likewise.
	* libio/vsnprintf.c (_IO_vsnprintf): Likewise.
	* stdio-common/tst-sprintf.c (main): Add new test.
2003-05-27 08:03:32 +00:00

41 lines
684 B
C

#include <stdio.h>
#include <string.h>
int
main (void)
{
char buf[100];
int result = 0;
if (sprintf (buf, "%.0ls", L"foo") != 0
|| strlen (buf) != 0)
{
puts ("sprintf (buf, \"%.0ls\", L\"foo\") produced some output");
result = 1;
}
#define SIZE (1024*70000)
#define STR(x) #x
char *dst = malloc (SIZE + 1);
if (dst == NULL)
{
puts ("memory allocation failure");
result = 1;
}
else
{
sprintf (dst, "%*s", SIZE, "");
if (strnlen (dst, SIZE + 1) != SIZE)
{
puts ("sprintf (dst, \"%*s\", " STR(SIZE) ", \"\") did not produce enough output");
result = 1;
}
free (dst);
}
return result;
}