2009-01-17 Bruno Haible <bruno@clisp.org>
+ * modules/vdprintf-posix-tests: New file.
+ * tests/test-vdprintf-posix.sh: New file.
+ * tests/test-vdprintf-posix.c: New file.
+
New modules 'vdprintf', 'vdprintf-posix'.
* lib/stdio.in.h (vdprintf): New declaration.
* lib/vdprintf.c: New file.
--- /dev/null
+Files:
+tests/test-vdprintf-posix.sh
+tests/test-vdprintf-posix.c
+tests/test-fprintf-posix.h
+tests/test-printf-posix.output
+
+Depends-on:
+stdint
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-vdprintf-posix.sh
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
+check_PROGRAMS += test-vdprintf-posix
--- /dev/null
+/* Test of POSIX compatible vdprintf() function.
+ Copyright (C) 2007-2009 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ fflush (stderr); \
+ abort (); \
+ } \
+ } \
+ while (0)
+
+#include "test-fprintf-posix.h"
+
+static int
+my_fprintf (FILE *fp, const char *format, ...)
+{
+ va_list args;
+ int ret;
+
+ va_start (args, format);
+ ret = vdprintf (fileno (fp), format, args);
+ va_end (args);
+ return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+ test_function (my_fprintf);
+ return 0;
+}
--- /dev/null
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles t-vdprintf-posix.tmp t-vdprintf-posix.out"
+./test-vdprintf-posix${EXEEXT} > t-vdprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-vdprintf-posix.tmp > t-vdprintf-posix.out || exit 1
+
+: ${DIFF=diff}
+${DIFF} "${srcdir}/test-printf-posix.output" t-vdprintf-posix.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result