1 /* t-common.h - Common code for the tests.
2 * Copyright (C) 2013 g10 Code GmbH
4 * This file is part of libgpg-error.
6 * libgpg-error is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * libgpg-error is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
22 #include "../src/gpg-error.h"
25 # error Macro PGM not defined.
31 static int errorcount;
35 die (const char *format, ...)
43 fprintf (stderr, "%s: ", PGM);
44 va_start (arg_ptr, format) ;
45 vfprintf (stderr, format, arg_ptr);
47 if (*format && format[strlen(format)-1] != '\n')
57 fail (const char *format, ...)
65 fprintf (stderr, "%s: ", PGM);
66 va_start (arg_ptr, format);
67 vfprintf (stderr, format, arg_ptr);
69 if (*format && format[strlen(format)-1] != '\n')
76 die ("stopped after 50 errors.");
81 show (const char *format, ...)
90 fprintf (stderr, "%s: ", PGM);
91 va_start (arg_ptr, format);
92 vfprintf (stderr, format, arg_ptr);
93 if (*format && format[strlen(format)-1] != '\n')