diff options
author | Robert de Bath <rdebath@poboxes.com> | 1996-03-24 17:45:55 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:29:43 +0200 |
commit | fe22c37817ce338fbbc90b239320248c270957fa (patch) | |
tree | d9550410c4a20bdd382fcc58d2d3d7c5e04e5245 /unproto/varargs.c | |
parent | a7aba15e8efffb1c5d3097656f1a93955a64f01f (diff) | |
parent | 42192453ea219b80d0bf9f41e51e36d3d4d0740b (diff) | |
download | dev86-fe22c37817ce338fbbc90b239320248c270957fa.tar.gz |
Import Dev86-0.0.4.tar.gzv0.0.4
Diffstat (limited to 'unproto/varargs.c')
-rw-r--r-- | unproto/varargs.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/unproto/varargs.c b/unproto/varargs.c new file mode 100644 index 0000000..4ca56d8 --- /dev/null +++ b/unproto/varargs.c @@ -0,0 +1,32 @@ + /* + * @(#) 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); +} |