]> arthur.barton.de Git - ngircd-alex.git/blob - src/portab/portabtest.c
Fixed spelling mistake :-)
[ngircd-alex.git] / src / portab / portabtest.c
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
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  * test program for portab.h and friends ;-)
12  */
13
14
15 #include "portab.h"
16
17 static char UNUSED id[] = "$Id: portabtest.c,v 1.11 2003/01/04 10:40:01 alex Exp $";
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
28 LOCAL VOID Panic PARAMS (( CHAR *Reason, INT Code ));
29
30
31 GLOBAL int
32 main( VOID )
33 {
34         /* validate datatypes */
35         if( FALSE != 0 ) Panic( "FALSE", 1 );
36         if( TRUE != 1 ) Panic( "TRUE", 1 );
37         if( sizeof( INT8 ) != 1 ) Panic( "INT8", 1 );
38         if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 );
39         if( sizeof( INT16 ) != 2 ) Panic( "INT16", 1 );
40         if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 );
41         if( sizeof( INT32 ) != 4 ) Panic( "INT32", 1 );
42         if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 );
43
44 #ifdef PROTOTYPES
45         /* check functions */
46         if( ! snprintf ) Panic( "snprintf", 2 );
47         if( ! vsnprintf ) Panic( "vsnprintf", 2 );
48         if( ! strlcpy ) Panic( "strlcpy", 2 );
49         if( ! strlcat ) Panic( "strlcat", 2 );
50 #endif
51         
52         /* ok, no error */
53         return 0;
54 } /* portab_check_types */
55
56
57 LOCAL VOID
58 Panic( CHAR *Reason, INT Code )
59 {
60         /* Oops, something failed!? */
61         fprintf( stderr, "Oops, test for %s failed!?", Reason );
62         exit( Code );
63 } /* Panic */
64
65
66 /* -eof- */