2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
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.
16 * Test program for portab.h and friends ;-)
30 /* Oops, something failed!? */
31 fprintf(stderr, "Oops, test for %s failed!?\n", Reason);
40 snprintf(str, sizeof(str), "%s", "1234567890");
42 Panic("snprintf NULL byte");
44 Panic("snprintf string length");
52 if (strlcpy(str, "1234567890", sizeof(str)) != 10)
53 Panic("strlcpy return code");
55 Panic("strlcpy NULL byte");
57 Panic("strlcpy string length");
65 if (strlcpy(str, "12", sizeof(str)) != 2)
66 Panic("strlcpy for strlcat");
67 if (strlcat(str, "1234567890", sizeof(str)) != 12)
68 Panic("strlcat return code");
70 Panic("strlcat NULL byte");
72 Panic("strlcat string length");
77 Check_vsnprintf(const int Len, const char *Format, ...)
80 Check_vsnprintf(Len, Format, va_alist)
94 if (vsnprintf(str, sizeof(str), Format, ap) != Len)
95 Panic("vsnprintf return code");
99 Panic("vsnprintf NULL byte");
100 if (strlen(str) != 4)
101 Panic("vsnprintf string length");
107 /* validate datatypes */
112 if (sizeof(UINT8) != 1)
114 if (sizeof(UINT16) != 2)
116 if (sizeof(UINT32) != 4)
119 /* check functions */
123 Check_vsnprintf(2+10, "%s%s", "ab", "1234567890");