91 static void lock(
int which)
   125 #ifndef HAVE_LOCALTIME_R   130     localtime_r(&t, &tm);
   141 #ifndef HAVE_GMTIME_R   184 #if HAVE_FUNC_GETHOSTBYNAME_R_6   188     struct hostent *tmphp, hp;
   195     *buff = (
char*) gw_malloc(bufflen);
   196     while ((res=gethostbyname_r(
name, &hp,*buff, bufflen, &tmphp, &herr)) == ERANGE) {
   199     *buff = (
char*) gw_realloc(*buff, bufflen);
   202     if (res != 0 || tmphp == NULL) {
   203         error(herr, 
"Error while gw_gethostbyname occurs.");
   214 #elif HAVE_FUNC_GETHOSTBYNAME_R_5   219     size_t bufflen = 1024;
   221     struct hostent *tmphp = NULL;
   223     *buff = gw_malloc(bufflen);
   224     while ((tmphp = gethostbyname_r(
name, ent, *buff, bufflen, &herr)) == NULL && (errno == ERANGE)) {
   227         *buff = (
char *) gw_realloc(*buff, bufflen);
   231         error(herr, 
"Error while gw_gethostbyname occurs.");
   257     size_t bufflen = 9000;
   271     bufptr = *buff = gw_malloc(bufflen);
   272     ent->h_name = bufptr;
   274     len = strlen(p->h_name) + 1;
   275     strncpy(bufptr, p->h_name, len);
   279 #define MEMALIGN(x) ((x)+(8-(((unsigned long)(x))&0x7)))   284     ent->h_aliases = (
char**)bufptr;
   287     for (i = 0; p->h_aliases[i] != NULL; ++i)
   291     bufptr += (i + 1) * 
sizeof(
char*);
   294     for(i = 0; (str = p->h_aliases[i]); i++) {
   295         len = strlen(str) + 1;
   296         strncpy(bufptr, str, len);
   297         ent->h_aliases[i] = bufptr;
   301     ent->h_aliases[i] = NULL;
   303     ent->h_addrtype = p->h_addrtype;
   304     ent->h_length = p->h_length;
   309     ent->h_addr_list = (
char**)bufptr;
   312     for (i = 0; p->h_addr_list[i] != NULL; ++i)
   316     bufptr += (i + 1) * 
sizeof(
char*);
   320     str = p->h_addr_list[i];
   321     while (str != NULL) {
   322         memcpy(bufptr, str, len);
   323         ent->h_addr_list[i] = bufptr;
   325         str = p->h_addr_list[++i];
   327     ent->h_addr_list[i] = NULL;
 void gwlib_protected_shutdown(void)
 
void error(int err, const char *fmt,...)
 
struct tm gw_gmtime(time_t t)
 
static void lock(int which)
 
size_t gw_strftime(char *s, size_t max, const char *format, const struct tm *tm)
 
static void unlock(int which)
 
time_t gw_mktime(struct tm *tm)
 
static Mutex locks[NUM_LOCKS]
 
void gwlib_protected_init(void)
 
#define mutex_init_static(mutex)
 
void mutex_destroy(Mutex *mutex)
 
#define gethostbyname(a, b, c)
 
int gw_gethostbyname(struct hostent *ent, const char *name, char **buff)
 
struct tm gw_localtime(time_t t)
 
#define strftime(a, b, c, d)