X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fportab%2Fportabtest.c;h=09afbfd18cb13d1c70495c2175e8df5422d4dd00;hp=d7e8d8146be58a56326d89489c3833df9ebde094;hb=33fae67579eeab31d7f96f9e53f0529f584b0b1f;hpb=dd4535b7f14bef69039efde600f5d2f4540351cd diff --git a/src/portab/portabtest.c b/src/portab/portabtest.c index d7e8d814..09afbfd1 100644 --- a/src/portab/portabtest.c +++ b/src/portab/portabtest.c @@ -2,43 +2,62 @@ * ngIRCd -- The Next Generation IRC Daemon * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) * - * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen - * der GNU General Public License (GPL), wie von der Free Software Foundation - * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2 - * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version. - * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste - * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. - * - * $Id: portabtest.c,v 1.8 2002/09/09 10:05:10 alex Exp $ - * - * portabtest.c: Testprogramm fuer portab.h + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * Please read the file COPYING, README and AUTHORS for more information. */ - #include "portab.h" +/** + * @file + * Test program for portab.h and friends ;-) + */ + #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- */