util.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. * END COPYRIGHT BLOCK **/
  6. #ifndef BASE_UTIL_H
  7. #define BASE_UTIL_H
  8. #ifndef NOINTNSAPI
  9. #define INTNSAPI
  10. #endif /* !NOINTNSAPI */
  11. /*
  12. * util.h: A hodge podge of utility functions and standard functions which
  13. * are unavailable on certain systems
  14. *
  15. * Rob McCool
  16. */
  17. #ifndef PUBLIC_BASE_UTIL_H
  18. #include "public/base/util.h"
  19. #endif /* !PUBLIC_BASE_UTIL_H */
  20. /* --- Begin common function prototypes --- */
  21. #ifdef INTNSAPI
  22. NSPR_BEGIN_EXTERN_C
  23. NSAPI_PUBLIC char *INTutil_hostname(void);
  24. NSAPI_PUBLIC int INTutil_itoa(int i, char *a);
  25. NSAPI_PUBLIC
  26. int INTutil_vsprintf(char *s, register const char *fmt, va_list args);
  27. NSAPI_PUBLIC int INTutil_sprintf(char *s, const char *fmt, ...);
  28. NSAPI_PUBLIC int INTutil_vsnprintf(char *s, int n, register const char *fmt,
  29. va_list args);
  30. NSAPI_PUBLIC int INTutil_snprintf(char *s, int n, const char *fmt, ...);
  31. NSAPI_PUBLIC int INTutil_strftime(char *s, const char *format, const struct tm *t);
  32. NSAPI_PUBLIC struct tm *INTutil_localtime(const time_t *clock, struct tm *res);
  33. #ifdef NEED_STRCASECMP
  34. NSAPI_PUBLIC int INTutil_strcasecmp(CASECMPARG_T char *one, CASECMPARG_T char *two);
  35. #endif /* NEED_STRCASECMP */
  36. #ifdef NEED_STRNCASECMP
  37. NSAPI_PUBLIC int INTutil_strncasecmp(CASECMPARG_T char *one, CASECMPARG_T char *two, int n);
  38. #endif /* NEED_STRNCASECMP */
  39. /* --- End common function prototypes --- */
  40. NSPR_END_EXTERN_C
  41. #define util_hostname INTutil_hostname
  42. #define util_itoa INTutil_itoa
  43. #define util_vsprintf INTutil_vsprintf
  44. #define util_sprintf INTutil_sprintf
  45. #define util_vsnprintf INTutil_vsnprintf
  46. #define util_snprintf INTutil_snprintf
  47. #define util_strftime INTutil_strftime
  48. #define util_strcasecmp INTutil_strcasecmp
  49. #define util_strncasecmp INTutil_strncasecmp
  50. #define util_localtime INTutil_localtime
  51. #ifdef NEED_STRCASECMP
  52. #define util_strcasecmp INTutil_strcasecmp
  53. #define strcasecmp INTutil_strcasecmp
  54. #endif /* NEED_STRCASECMP */
  55. #ifdef NEED_STRINGS_H /* usually for strcasecmp */
  56. #include <strings.h>
  57. #endif
  58. #ifdef NEED_STRNCASECMP
  59. #define util_strncasecmp INTutil_strncasecmp
  60. #define strncasecmp INTutil_strncasecmp
  61. #endif /* NEED_STRNCASECMP */
  62. #endif /* INTNSAPI */
  63. #endif /* !BASE_UTIL_H */