]> arthur.barton.de Git - ngircd-alex.git/blob - src/portab/portabtest.c
8284c1d027d2af09640f7924050a8148b35bffd3
[ngircd-alex.git] / src / portab / portabtest.c
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * Please read the file COPYING, README and AUTHORS for more information.
10  */
11
12 #include "portab.h"
13
14 /**
15  * @file
16  * Test program for portab.h and friends ;-)
17  */
18
19 #include "imp.h"
20 #include <stdarg.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24
25 #include "exp.h"
26
27 static void Panic PARAMS((char *Reason));
28
29 GLOBAL int
30 main(void)
31 {
32         /* validate datatypes */
33         if (false != 0)
34                 Panic("false");
35         if (true != 1)
36                 Panic("true");
37         if (sizeof(UINT8) != 1)
38                 Panic("UINT8");
39         if (sizeof(UINT16) != 2)
40                 Panic("UINT16");
41         if (sizeof(UINT32) != 4)
42                 Panic("UINT32");
43
44 #ifdef PROTOTYPES
45         /* check functions */
46         if (!snprintf)
47                 Panic("snprintf");
48         if (!vsnprintf)
49                 Panic("vsnprintf");
50         if (!strlcpy)
51                 Panic("strlcpy");
52         if (!strlcat)
53                 Panic("strlcat");
54 #endif
55         
56         /* ok, no error */
57         return 0;
58 } /* portab_check_types */
59
60 static void
61 Panic(char *Reason)
62 {
63         /* Oops, something failed!? */
64         fprintf(stderr, "Oops, test for %s failed!?", Reason);
65         exit(1);
66 } /* Panic */
67
68 /* -eof- */