Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

ares_compat.c

Go to the documentation of this file.
00001 /******************************************************************************/
00002 /* This file has been modified by Sergio Perez Alcañiz <serpeal@disca.upv.es> */
00003 /*            Departamento de Informática de Sistemas y Computadores          */
00004 /*            Universidad Politécnica de Valencia                             */
00005 /*            Valencia (Spain)                                                */
00006 /*            April 2003                                                      */
00007 /******************************************************************************/
00008 
00009 #include "ares_private.h"
00010 #include <rtl_time.h>
00011 
00012 extern int gettimeofday(struct timeval *tv, struct timezone *tz);
00013 /* Compare S1 and S2, ignoring case, returning less than, equal to or
00014    greater than zero if S1 is lexicographically less than,
00015    equal to or greater than S2.  */
00016 int
00017 strcasecmp (const char *s1, const char *s2)
00018 {
00019   register const unsigned char *p1 = (const unsigned char *) s1;
00020   register const unsigned char *p2 = (const unsigned char *) s2;
00021   unsigned char c1, c2;
00022 
00023   if (p1 == p2)
00024     return 0;
00025 
00026 
00027 
00028 
00029   do
00030     {
00031       c1 = tolower (*p1++);
00032       c2 = tolower (*p2++);
00033       if (c1 == '\0')
00034         break;
00035     }
00036   while (c1 == c2);
00037 
00038   return c1 - c2;
00039 }
00040 
00041 char *strdup(const char *s)
00042 {
00043         char *ns;
00044 
00045         if(!s)
00046             return NULL;
00047 
00048         ns = malloc(strlen(s)+1);
00049         if(ns)
00050                 strcpy(ns, s);
00051 
00052         return ns;
00053 }
00054 
00055 
00056 time_t time(time_t *tp)
00057 {
00058 
00059   struct timeval time;
00060 
00061 //      long ticks = RetrieveClock();
00062 //      long secs;
00063 
00064 //      secs = (ticks * 4 + ticks * 8 / 13) / 1000;
00065 
00066 
00067   gettimeofday(&time, NULL);
00068 
00069   if(tp)
00070     *tp = (long) time.tv_sec;
00071 
00072 
00073 
00074         return (time_t) time.tv_sec;
00075 }

Generated on Wed Jan 14 12:58:55 2004 for RTL-lwIP-0.4 by doxygen 1.3.4