| 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 |
|
| 10 |
#ifdef HAVE_CONFIG_H |
| 11 |
#include <config.h> |
| 12 |
#endif |
| 13 |
|
| 14 |
#ifndef BASE_UTIL_H |
| 15 |
#define BASE_UTIL_H |
| 16 |
|
| 17 |
#ifndef NOINTNSAPI |
| 18 |
#define INTNSAPI |
| 19 |
#endif /* !NOINTNSAPI */ |
| 20 |
|
| 21 |
/* |
| 22 |
* util.h: A hodge podge of utility functions and standard functions which |
| 23 |
* are unavailable on certain systems |
| 24 |
* |
| 25 |
* Rob McCool |
| 26 |
*/ |
| 27 |
|
| 28 |
#ifndef PUBLIC_NSAPI_H |
| 29 |
#include "public/nsapi.h" |
| 30 |
#endif /* !PUBLIC_NSAPI_H */ |
| 31 |
|
| 32 |
|
| 33 |
/* --- Begin common function prototypes --- */ |
| 34 |
|
| 35 |
#ifdef INTNSAPI |
| 36 |
|
| 37 |
NSPR_BEGIN_EXTERN_C |
| 38 |
|
| 39 |
NSAPI_PUBLIC int INTutil_itoa(int i, char *a); |
| 40 |
|
| 41 |
NSAPI_PUBLIC |
| 42 |
int INTutil_vsprintf(char *s, const char *fmt, va_list args); |
| 43 |
|
| 44 |
NSAPI_PUBLIC int INTutil_sprintf(char *s, const char *fmt, ...) |
| 45 |
#ifdef __GNUC__ |
| 46 |
__attribute__((format(printf, 2, 3))); |
| 47 |
#else |
| 48 |
; |
| 49 |
#endif |
| 50 |
|
| 51 |
NSAPI_PUBLIC int INTutil_vsnprintf(char *s, int n, const char *fmt, va_list args); |
| 52 |
|
| 53 |
NSAPI_PUBLIC int INTutil_snprintf(char *s, int n, const char *fmt, ...) |
| 54 |
#ifdef __GNUC__ |
| 55 |
__attribute__((format(printf, 3, 4))); |
| 56 |
#else |
| 57 |
; |
| 58 |
#endif |
| 59 |
|
| 60 |
NSAPI_PUBLIC int INTutil_strftime(char *s, const char *format, const struct tm *t); |
| 61 |
|
| 62 |
NSAPI_PUBLIC struct tm *INTutil_localtime(const time_t *clock, struct tm *res); |
| 63 |
|
| 64 |
#ifdef NEED_STRCASECMP |
| 65 |
NSAPI_PUBLIC int INTutil_strcasecmp(CASECMPARG_T char *one, CASECMPARG_T char *two); |
| 66 |
#endif /* NEED_STRCASECMP */ |
| 67 |
|
| 68 |
#ifdef NEED_STRNCASECMP |
| 69 |
NSAPI_PUBLIC int INTutil_strncasecmp(CASECMPARG_T char *one, CASECMPARG_T char *two, int n); |
| 70 |
#endif /* NEED_STRNCASECMP */ |
| 71 |
|
| 72 |
/* --- End common function prototypes --- */ |
| 73 |
|
| 74 |
NSPR_END_EXTERN_C |
| 75 |
|
| 76 |
#define util_itoa INTutil_itoa |
| 77 |
#define util_vsprintf INTutil_vsprintf |
| 78 |
#define util_sprintf INTutil_sprintf |
| 79 |
#define util_vsnprintf INTutil_vsnprintf |
| 80 |
#define util_snprintf INTutil_snprintf |
| 81 |
#define util_strftime INTutil_strftime |
| 82 |
#define util_strcasecmp INTutil_strcasecmp |
| 83 |
#define util_strncasecmp INTutil_strncasecmp |
| 84 |
#define util_localtime INTutil_localtime |
| 85 |
|
| 86 |
#ifdef NEED_STRINGS_H /* usually for strcasecmp */ |
| 87 |
#include <strings.h> |
| 88 |
#endif |
| 89 |
|
| 90 |
#endif /* INTNSAPI */ |
| 91 |
|
| 92 |
#endif /* !BASE_UTIL_H */ |