Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencompat.c
Go to the documentation of this file.
00001 #include "rosdhcp.h" 00002 00003 size_t strlcpy(char *d, const char *s, size_t bufsize) 00004 { 00005 size_t len = strlen(s); 00006 size_t ret = len; 00007 if (bufsize > 0) { 00008 if (len >= bufsize) 00009 len = bufsize-1; 00010 memcpy(d, s, len); 00011 d[len] = 0; 00012 } 00013 return ret; 00014 } 00015 00016 // not really random :( 00017 u_int32_t arc4random() 00018 { 00019 static int did_srand = 0; 00020 u_int32_t ret; 00021 00022 if (!did_srand) { 00023 srand(0); 00024 did_srand = 1; 00025 } 00026 00027 ret = rand() << 10 ^ rand(); 00028 return ret; 00029 } 00030 00031 00032 int inet_aton(const char *cp, struct in_addr *inp) 00033 /* inet_addr code from ROS, slightly modified. */ 00034 { 00035 ULONG Octets[4] = {0,0,0,0}; 00036 ULONG i = 0; 00037 00038 if(!cp) 00039 return 0; 00040 00041 while(*cp) 00042 { 00043 CHAR c = *cp; 00044 cp++; 00045 00046 if(c == '.') 00047 { 00048 i++; 00049 continue; 00050 } 00051 00052 if(c < '0' || c > '9') 00053 return 0; 00054 00055 Octets[i] *= 10; 00056 Octets[i] += (c - '0'); 00057 00058 if(Octets[i] > 255) 00059 return 0; 00060 } 00061 00062 inp->S_un.S_addr = (Octets[3] << 24) + (Octets[2] << 16) + (Octets[1] << 8) + Octets[0]; 00063 return 1; 00064 } 00065 Generated on Sun May 27 2012 04:23:26 for ReactOS by
1.7.6.1
|