util.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. #include <config.h>
  11. #endif
  12. #ifndef BASE_UTIL_H
  13. #define BASE_UTIL_H
  14. #ifndef NOINTNSAPI
  15. #define INTNSAPI
  16. #endif /* !NOINTNSAPI */
  17. /*
  18. * util.h: A hodge podge of utility functions and standard functions which
  19. * are unavailable on certain systems
  20. *
  21. * Rob McCool
  22. */
  23. #ifndef PUBLIC_NSAPI_H
  24. #include "public/nsapi.h"
  25. #endif /* !PUBLIC_NSAPI_H */
  26. /* --- Begin common function prototypes --- */
  27. #ifdef INTNSAPI
  28. NSPR_BEGIN_EXTERN_C
  29. NSAPI_PUBLIC int INTutil_itoa(int i, char *a);
  30. NSAPI_PUBLIC
  31. int INTutil_vsprintf(char *s, const char *fmt, va_list args);
  32. NSAPI_PUBLIC int INTutil_sprintf(char *s, const char *fmt, ...)
  33. #ifdef __GNUC__
  34. __attribute__((format(printf, 2, 3)));
  35. #else
  36. ;
  37. #endif
  38. NSAPI_PUBLIC int INTutil_vsnprintf(char *s, int n, const char *fmt, va_list args);
  39. NSAPI_PUBLIC int INTutil_snprintf(char *s, int n, const char *fmt, ...)
  40. #ifdef __GNUC__
  41. __attribute__((format(printf, 3, 4)));
  42. #else
  43. ;
  44. #endif
  45. NSAPI_PUBLIC int INTutil_strftime(char *s, const char *format, const struct tm *t);
  46. NSAPI_PUBLIC struct tm *INTutil_localtime(const time_t *clock, struct tm *res);
  47. #ifdef NEED_STRCASECMP
  48. NSAPI_PUBLIC int INTutil_strcasecmp(CASECMPARG_T char *one, CASECMPARG_T char *two);
  49. #endif /* NEED_STRCASECMP */
  50. #ifdef NEED_STRNCASECMP
  51. NSAPI_PUBLIC int INTutil_strncasecmp(CASECMPARG_T char *one, CASECMPARG_T char *two, int n);
  52. #endif /* NEED_STRNCASECMP */
  53. /* --- End common function prototypes --- */
  54. NSPR_END_EXTERN_C
  55. #define util_itoa INTutil_itoa
  56. #define util_vsprintf INTutil_vsprintf
  57. #define util_sprintf INTutil_sprintf
  58. #define util_vsnprintf INTutil_vsnprintf
  59. #define util_snprintf INTutil_snprintf
  60. #define util_strftime INTutil_strftime
  61. #define util_strcasecmp INTutil_strcasecmp
  62. #define util_strncasecmp INTutil_strncasecmp
  63. #define util_localtime INTutil_localtime
  64. #ifdef NEED_STRINGS_H /* usually for strcasecmp */
  65. #include <strings.h>
  66. #endif
  67. #endif /* INTNSAPI */
  68. #endif /* !BASE_UTIL_H */