Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2001 Pekka Riikonen
+ Copyright (C) 2001 - 2005 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
*/
/* $Id$ */
-#include "silcincludes.h"
+#include "silc.h"
/* XXX GNU regex may work on Win32 too!! */
char *silc_string_regexify(const char *string)
int silc_gettimeofday(struct timeval *tv)
{
FILETIME ft;
- __SilcInt64 msec;
+ __int64 msec;
GetSystemTimeAsFileTime(&ft);
- msec = (__SilcInt64) ft.dwHighDateTime << DWLEN | ft.dwLowDateTime;
+ msec = (__int64) ft.dwHighDateTime << DWLEN | ft.dwLowDateTime;
msec = (msec - FILETIME_1970) / 10;
tv->tv_sec = (long) (msec / 1000000);
tv->tv_usec = (long) (msec % 1000000);
return 0;
}
+
+char *silc_get_username(void)
+{
+ DWORD maxlen = 128;
+ char username[128];
+ GetUserName(username, &maxlen);
+ return strdup(username);
+}
+
+char *silc_get_real_name(void)
+{
+ return silc_get_username();
+}
+
+int silc_file_set_nonblock(int fd)
+{
+ return fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+}