X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fportab%2Fportabtest.c;h=055799eabb68be0a4ae88911a7b8e5b077e435f1;hp=d2cb9204e63afff20a5b89569d7e2559a783bdb1;hb=0b91df05e0b85980292956973b339ecce31e28ed;hpb=c1a278b0ebbf10ea7e54b37c9feae5a40aa6dd20 diff --git a/src/portab/portabtest.c b/src/portab/portabtest.c index d2cb9204..055799ea 100644 --- a/src/portab/portabtest.c +++ b/src/portab/portabtest.c @@ -2,62 +2,65 @@ * 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. + * 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. * - * $Id: portabtest.c,v 1.6 2002/06/26 12:48:20 alex Exp $ - * - * portabtest.c: Testprogramm fuer portab.h + * test program for portab.h and friends ;-) */ #include "portab.h" +static char UNUSED id[] = "$Id: portabtest.c,v 1.11 2003/01/04 10:40:01 alex Exp $"; + #include "imp.h" +#include #include +#include +#include #include "exp.h" -LOCAL BOOLEAN portab_check_types PARAMS(( VOID )); +LOCAL VOID Panic PARAMS (( CHAR *Reason, INT Code )); GLOBAL int main( VOID ) { - INT ret = 0; - - printf( "- system type: %s/%s/%s\n", TARGET_CPU, TARGET_VENDOR, TARGET_OS ); + /* validate datatypes */ + if( FALSE != 0 ) Panic( "FALSE", 1 ); + if( TRUE != 1 ) Panic( "TRUE", 1 ); + if( sizeof( INT8 ) != 1 ) Panic( "INT8", 1 ); + if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 ); + if( sizeof( INT16 ) != 2 ) Panic( "INT16", 1 ); + if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 ); + if( sizeof( INT32 ) != 4 ) Panic( "INT32", 1 ); + if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 ); - printf( "- datatypes: "); - if( ! portab_check_types( )) - { - puts( "FAILED!" ); - ret = 1; - } - else puts( "ok." ); - - return ret; -} /* main */ +#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 + + /* ok, no error */ + return 0; +} /* portab_check_types */ -LOCAL BOOLEAN -portab_check_types( VOID ) +LOCAL VOID +Panic( CHAR *Reason, INT Code ) { - if( FALSE != 0 ) return 0; - if( TRUE != 1 ) return 0; - if( sizeof( INT8 ) != 1 ) return 0; - if( sizeof( UINT8 ) != 1 ) return 0; - if( sizeof( INT16 ) != 2 ) return 0; - if( sizeof( UINT16 ) != 2 ) return 0; - if( sizeof( INT32 ) != 4 ) return 0; - if( sizeof( UINT32 ) != 4 ) return 0; - return 1; -} /* portab_check_types */ + /* Oops, something failed!? */ + fprintf( stderr, "Oops, test for %s failed!?", Reason ); + exit( Code ); +} /* Panic */ /* -eof- */