X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fportab%2Fportabtest.c;h=0a2098ede6896571540c34b05bf9705c32855aca;hb=6fdd3479f126a866c022c39dcd424d6042de6875;hp=457410ca956de4646beb079a91bf297db943c379;hpb=f0d633b5ac8dbf1cef26778bd0f3b2cf1b2242f3;p=ngircd-alex.git diff --git a/src/portab/portabtest.c b/src/portab/portabtest.c index 457410ca..0a2098ed 100644 --- a/src/portab/portabtest.c +++ b/src/portab/portabtest.c @@ -14,30 +14,50 @@ #include "portab.h" -static char UNUSED id[] = "$Id: portabtest.c,v 1.9 2002/12/12 11:38:46 alex Exp $"; +static char UNUSED id[] = "$Id: portabtest.c,v 1.13 2005/07/31 20:13:11 alex Exp $"; #include "imp.h" +#include #include +#include +#include #include "exp.h" +static void Panic PARAMS (( char *Reason, int Code )); + + GLOBAL int -main( VOID ) +main( void ) { - /* Datentypen pruefen */ - if( FALSE != 0 ) return 1; - if( TRUE != 1 ) return 1; - if( sizeof( INT8 ) != 1 ) return 1; - if( sizeof( UINT8 ) != 1 ) return 1; - if( sizeof( INT16 ) != 2 ) return 1; - if( sizeof( UINT16 ) != 2 ) return 1; - if( sizeof( INT32 ) != 4 ) return 1; - if( sizeof( UINT32 ) != 4 ) return 1; + /* validate datatypes */ + if( false != 0 ) Panic( "false", 1 ); + if( true != 1 ) Panic( "true", 1 ); + if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 ); + if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 ); + if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 ); + +#ifdef PROTOTYPES + /* check functions */ + if( ! snprintf ) Panic( "snprintf", 2 ); + if( ! vsnprintf ) Panic( "vsnprintf", 2 ); + if( ! strlcpy ) Panic( "strlcpy", 2 ); + if( ! strlcat ) Panic( "strlcat", 2 ); +#endif - /* kein Fehler */ + /* ok, no error */ return 0; } /* portab_check_types */ +static void +Panic( char *Reason, int Code ) +{ + /* Oops, something failed!? */ + fprintf( stderr, "Oops, test for %s failed!?", Reason ); + exit( Code ); +} /* Panic */ + + /* -eof- */