1996-10-31 20:40:28 +00:00
|
|
|
/* Exit with status 0 if vsprintf returns the length of the string printed.
|
|
|
|
Some systems return a pointer to the string instead. */
|
2003-03-23 07:06:27 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
1996-10-31 20:40:28 +00:00
|
|
|
|
2003-03-23 07:06:27 +00:00
|
|
|
static int func(const char *fmt, ...)
|
1996-10-31 20:40:28 +00:00
|
|
|
{
|
2003-03-23 07:06:27 +00:00
|
|
|
va_list ap;
|
1996-10-31 20:40:28 +00:00
|
|
|
char buf[128];
|
2003-03-23 07:06:27 +00:00
|
|
|
int result;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
result = vsprintf(buf, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
if (func("1234", 0) == 4)
|
1996-10-31 20:40:28 +00:00
|
|
|
exit (0);
|
|
|
|
exit (-1);
|
|
|
|
}
|