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