|
|
|
@ -578,13 +578,19 @@ g_tcp_select(int sck1, int sck2)
|
|
|
|
|
return rv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
void APP_CC
|
|
|
|
|
g_random(char* data, int len)
|
|
|
|
|
{
|
|
|
|
|
#if defined(_WIN32)
|
|
|
|
|
memset(data, 0x44, len);
|
|
|
|
|
int index;
|
|
|
|
|
|
|
|
|
|
srand(g_time1());
|
|
|
|
|
for (index = 0; index < len; index++)
|
|
|
|
|
{
|
|
|
|
|
data[index] = (char)rand(); /* rand returns a number between 0 and
|
|
|
|
|
RAND_MAX */
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
|
@ -596,13 +602,14 @@ g_random(char* data, int len)
|
|
|
|
|
}
|
|
|
|
|
if (fd != -1)
|
|
|
|
|
{
|
|
|
|
|
read(fd, data, len);
|
|
|
|
|
if (read(fd, data, len) != len)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
close(fd);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
int APP_CC
|
|
|
|
|
g_abs(int i)
|
|
|
|
@ -802,7 +809,6 @@ g_mkdir(const char* dirname)
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* gets the current working directory and puts up to maxlen chars in
|
|
|
|
|
dirname
|
|
|
|
@ -811,15 +817,16 @@ char* APP_CC
|
|
|
|
|
g_get_current_dir(char* dirname, int maxlen)
|
|
|
|
|
{
|
|
|
|
|
#if defined(_WIN32)
|
|
|
|
|
GetCurrentDirectory(maxlen, dirname);
|
|
|
|
|
GetCurrentDirectoryA(maxlen, dirname);
|
|
|
|
|
return 0;
|
|
|
|
|
#else
|
|
|
|
|
getcwd(dirname, maxlen);
|
|
|
|
|
if (getcwd(dirname, maxlen) == 0)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* returns error, zero on success and -1 on failure */
|
|
|
|
|
int APP_CC
|
|
|
|
|