]> arthur.barton.de Git - ngircd-alex.git/blob - src/portab/portabtest.c
2675409abe61780b26313da652ac1bfac97a9a36
[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
12
13 #include "portab.h"
14
15 /**
16  * @file
17  * Test program for portab.h and friends ;-)
18  */
19
20 #include "imp.h"
21 #include <stdarg.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25
26 #include "exp.h"
27
28
29 static void Panic PARAMS (( char *Reason, int Code ));
30
31
32 GLOBAL int
33 main( void )
34 {
35         /* validate datatypes */
36         if( false != 0 ) Panic( "false", 1 );
37         if( true != 1 ) Panic( "true", 1 );
38         if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 );
39         if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 );
40         if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 );
41
42 #ifdef PROTOTYPES
43         /* check functions */
44         if( ! snprintf ) Panic( "snprintf", 2 );
45         if( ! vsnprintf ) Panic( "vsnprintf", 2 );
46         if( ! strlcpy ) Panic( "strlcpy", 2 );
47         if( ! strlcat ) Panic( "strlcat", 2 );
48 #endif
49         
50         /* ok, no error */
51         return 0;
52 } /* portab_check_types */
53
54
55 static void
56 Panic( char *Reason, int Code )
57 {
58         /* Oops, something failed!? */
59         fprintf( stderr, "Oops, test for %s failed!?", Reason );
60         exit( Code );
61 } /* Panic */
62
63
64 /* -eof- */