portabtest.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. int allow_severity = 0, deny_severity = 0;
  23. static void Panic PARAMS (( char *Reason, int Code ));
  24. GLOBAL int
  25. main( void )
  26. {
  27. /* validate datatypes */
  28. if( false != 0 ) Panic( "false", 1 );
  29. if( true != 1 ) Panic( "true", 1 );
  30. if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 );
  31. if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 );
  32. if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 );
  33. #ifdef PROTOTYPES
  34. /* check functions */
  35. if( ! snprintf ) Panic( "snprintf", 2 );
  36. if( ! vsnprintf ) Panic( "vsnprintf", 2 );
  37. if( ! strlcpy ) Panic( "strlcpy", 2 );
  38. if( ! strlcat ) Panic( "strlcat", 2 );
  39. #endif
  40. /* ok, no error */
  41. return 0;
  42. } /* portab_check_types */
  43. static void
  44. Panic( char *Reason, int Code )
  45. {
  46. /* Oops, something failed!? */
  47. fprintf( stderr, "Oops, test for %s failed!?", Reason );
  48. exit( Code );
  49. } /* Panic */
  50. /* -eof- */