portabtest.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #include "portab.h"
  14. static char UNUSED id[] = "$Id: portabtest.c,v 1.13 2005/07/31 20:13:11 alex Exp $";
  15. #include "imp.h"
  16. #include <stdarg.h>
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #include "exp.h"
  21. static void Panic PARAMS (( char *Reason, int Code ));
  22. GLOBAL int
  23. main( void )
  24. {
  25. /* validate datatypes */
  26. if( false != 0 ) Panic( "false", 1 );
  27. if( true != 1 ) Panic( "true", 1 );
  28. if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 );
  29. if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 );
  30. if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 );
  31. #ifdef PROTOTYPES
  32. /* check functions */
  33. if( ! snprintf ) Panic( "snprintf", 2 );
  34. if( ! vsnprintf ) Panic( "vsnprintf", 2 );
  35. if( ! strlcpy ) Panic( "strlcpy", 2 );
  36. if( ! strlcat ) Panic( "strlcat", 2 );
  37. #endif
  38. /* ok, no error */
  39. return 0;
  40. } /* portab_check_types */
  41. static void
  42. Panic( char *Reason, int Code )
  43. {
  44. /* Oops, something failed!? */
  45. fprintf( stderr, "Oops, test for %s failed!?", Reason );
  46. exit( Code );
  47. } /* Panic */
  48. /* -eof- */