mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 09:09:54 -05:00
32 lines
606 B
C
32 lines
606 B
C
/*
|
|
* @(#) varargs.c 1.1 91/09/01 23:08:45
|
|
*
|
|
* This program can be used to verify that the stdarg.h file is set up
|
|
* correctly for your system. If it works, it should print one line with the
|
|
* text "stdarg.h works".
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include "stdarg.h"
|
|
|
|
main(int argc, char *argv[])
|
|
{
|
|
varargs_test("%s %s\n", "stdarg.h", "works");
|
|
}
|
|
|
|
varargs_test(char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
while (*fmt) {
|
|
if (strncmp("%s", fmt, 2) == 0) {
|
|
fputs(va_arg(ap, char *), stdout);
|
|
fmt += 2;
|
|
} else {
|
|
putchar(*fmt);
|
|
fmt++;
|
|
}
|
|
}
|
|
va_end(ap);
|
|
}
|