forked from PsychoticNinja/irssi
Remove all WIN32 ifdefs (unifdef -UWIN32)
Just use cygwin. This looks like it wasn't enough to do anything useful, and I don't think anyone cares about supporting win32 the hard way.
This commit is contained in:
parent
544d5a8bba
commit
96766b7f05
@ -34,9 +34,6 @@
|
|||||||
# include <dirent.h>
|
# include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef WIN32
|
|
||||||
# include <win32-compat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#ifdef HAVE_GMODULE
|
#ifdef HAVE_GMODULE
|
||||||
|
@ -83,7 +83,6 @@ static void sig_reload_config(int signo)
|
|||||||
|
|
||||||
static void read_settings(void)
|
static void read_settings(void)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
|
||||||
static int signals[] = {
|
static int signals[] = {
|
||||||
SIGINT, SIGQUIT, SIGTERM,
|
SIGINT, SIGQUIT, SIGTERM,
|
||||||
SIGALRM, SIGUSR1, SIGUSR2
|
SIGALRM, SIGUSR1, SIGUSR2
|
||||||
@ -124,7 +123,6 @@ static void read_settings(void)
|
|||||||
settings_set_bool("override_coredump_limit", FALSE);
|
settings_set_bool("override_coredump_limit", FALSE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_gui_dialog(const char *type, const char *text)
|
static void sig_gui_dialog(const char *type, const char *text)
|
||||||
@ -225,9 +223,7 @@ void core_init(void)
|
|||||||
client_start_time = time(NULL);
|
client_start_time = time(NULL);
|
||||||
|
|
||||||
modules_init();
|
modules_init();
|
||||||
#ifndef WIN32
|
|
||||||
pidwait_init();
|
pidwait_init();
|
||||||
#endif
|
|
||||||
|
|
||||||
net_disconnect_init();
|
net_disconnect_init();
|
||||||
signals_init();
|
signals_init();
|
||||||
@ -303,9 +299,7 @@ void core_deinit(void)
|
|||||||
signals_deinit();
|
signals_deinit();
|
||||||
net_disconnect_deinit();
|
net_disconnect_deinit();
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
pidwait_deinit();
|
pidwait_deinit();
|
||||||
#endif
|
|
||||||
modules_deinit();
|
modules_deinit();
|
||||||
|
|
||||||
g_free(irssi_dir);
|
g_free(irssi_dir);
|
||||||
|
@ -430,11 +430,7 @@ int mkpath(const char *path, int mode)
|
|||||||
|
|
||||||
dir = g_strndup(path, (int) (p-path));
|
dir = g_strndup(path, (int) (p-path));
|
||||||
if (stat(dir, &statbuf) != 0) {
|
if (stat(dir, &statbuf) != 0) {
|
||||||
#ifndef WIN32
|
|
||||||
if (mkdir(dir, mode) == -1)
|
if (mkdir(dir, mode) == -1)
|
||||||
#else
|
|
||||||
if (_mkdir(dir) == -1)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
g_free(dir);
|
g_free(dir);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -116,7 +116,6 @@ void net_disconnect_init(void)
|
|||||||
|
|
||||||
void net_disconnect_deinit(void)
|
void net_disconnect_deinit(void)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
|
||||||
NET_DISCONNECT_REC *rec;
|
NET_DISCONNECT_REC *rec;
|
||||||
time_t now, max;
|
time_t now, max;
|
||||||
int first, fd;
|
int first, fd;
|
||||||
@ -155,5 +154,4 @@ void net_disconnect_deinit(void)
|
|||||||
first = 0;
|
first = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -77,14 +77,11 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe,
|
|||||||
{
|
{
|
||||||
RESOLVED_IP_REC rec;
|
RESOLVED_IP_REC rec;
|
||||||
const char *errorstr;
|
const char *errorstr;
|
||||||
#ifndef WIN32
|
|
||||||
int pid;
|
int pid;
|
||||||
#endif
|
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
g_return_val_if_fail(addr != NULL, FALSE);
|
g_return_val_if_fail(addr != NULL, FALSE);
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
/* parent */
|
/* parent */
|
||||||
@ -97,7 +94,6 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe,
|
|||||||
g_warning("net_connect_thread(): fork() failed! "
|
g_warning("net_connect_thread(): fork() failed! "
|
||||||
"Using blocking resolving");
|
"Using blocking resolving");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* child */
|
/* child */
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
@ -138,10 +134,8 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
_exit(99);
|
_exit(99);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* we used blocking lookup */
|
/* we used blocking lookup */
|
||||||
return 0;
|
return 0;
|
||||||
@ -157,9 +151,7 @@ int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec)
|
|||||||
rec->host4 = NULL;
|
rec->host4 = NULL;
|
||||||
rec->host6 = NULL;
|
rec->host6 = NULL;
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
fcntl(g_io_channel_unix_get_fd(pipe), F_SETFL, O_NONBLOCK);
|
fcntl(g_io_channel_unix_get_fd(pipe), F_SETFL, O_NONBLOCK);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* get ip+error */
|
/* get ip+error */
|
||||||
if (g_io_channel_read_block(pipe, rec, sizeof(*rec)) == -1) {
|
if (g_io_channel_read_block(pipe, rec, sizeof(*rec)) == -1) {
|
||||||
@ -201,9 +193,7 @@ void net_disconnect_nonblock(int pid)
|
|||||||
{
|
{
|
||||||
g_return_if_fail(pid > 0);
|
g_return_if_fail(pid > 0);
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
kill(pid, SIGKILL);
|
kill(pid, SIGKILL);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void simple_init(SIMPLE_THREAD_REC *rec, GIOChannel *handle)
|
static void simple_init(SIMPLE_THREAD_REC *rec, GIOChannel *handle)
|
||||||
|
@ -160,13 +160,9 @@ void net_sendbuffer_flush(NET_SENDBUF_REC *rec)
|
|||||||
|
|
||||||
/* set the socket blocking while doing this */
|
/* set the socket blocking while doing this */
|
||||||
handle = g_io_channel_unix_get_fd(rec->handle);
|
handle = g_io_channel_unix_get_fd(rec->handle);
|
||||||
#ifndef WIN32
|
|
||||||
fcntl(handle, F_SETFL, 0);
|
fcntl(handle, F_SETFL, 0);
|
||||||
#endif
|
|
||||||
while (!buffer_send(rec)) ;
|
while (!buffer_send(rec)) ;
|
||||||
#ifndef WIN32
|
|
||||||
fcntl(handle, F_SETFL, O_NONBLOCK);
|
fcntl(handle, F_SETFL, O_NONBLOCK);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the socket handle */
|
/* Returns the socket handle */
|
||||||
|
@ -45,11 +45,7 @@ union sockaddr_union {
|
|||||||
GIOChannel *g_io_channel_new(int handle)
|
GIOChannel *g_io_channel_new(int handle)
|
||||||
{
|
{
|
||||||
GIOChannel *chan;
|
GIOChannel *chan;
|
||||||
#ifdef WIN32
|
|
||||||
chan = g_io_channel_win32_new_socket(handle);
|
|
||||||
#else
|
|
||||||
chan = g_io_channel_unix_new(handle);
|
chan = g_io_channel_unix_new(handle);
|
||||||
#endif
|
|
||||||
g_io_channel_set_encoding(chan, NULL, NULL);
|
g_io_channel_set_encoding(chan, NULL, NULL);
|
||||||
g_io_channel_set_buffered(chan, FALSE);
|
g_io_channel_set_buffered(chan, FALSE);
|
||||||
return chan;
|
return chan;
|
||||||
@ -188,9 +184,7 @@ GIOChannel *net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* set socket options */
|
/* set socket options */
|
||||||
#ifndef WIN32
|
|
||||||
fcntl(handle, F_SETFL, O_NONBLOCK);
|
fcntl(handle, F_SETFL, O_NONBLOCK);
|
||||||
#endif
|
|
||||||
setsockopt(handle, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
|
setsockopt(handle, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
|
||||||
setsockopt(handle, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof(opt));
|
setsockopt(handle, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof(opt));
|
||||||
|
|
||||||
@ -211,11 +205,7 @@ GIOChannel *net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip)
|
|||||||
sin_set_port(&so, port);
|
sin_set_port(&so, port);
|
||||||
ret = connect(handle, &so.sa, SIZEOF_SOCKADDR(so));
|
ret = connect(handle, &so.sa, SIZEOF_SOCKADDR(so));
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
if (ret < 0 && errno != EINPROGRESS)
|
if (ret < 0 && errno != EINPROGRESS)
|
||||||
#else
|
|
||||||
if (ret < 0 && WSAGetLastError() != WSAEWOULDBLOCK)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int old_errno = errno;
|
int old_errno = errno;
|
||||||
close(handle);
|
close(handle);
|
||||||
@ -238,9 +228,7 @@ GIOChannel *net_connect_unix(const char *path)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* set socket options */
|
/* set socket options */
|
||||||
#ifndef WIN32
|
|
||||||
fcntl(handle, F_SETFL, O_NONBLOCK);
|
fcntl(handle, F_SETFL, O_NONBLOCK);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* connect */
|
/* connect */
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
@ -297,9 +285,7 @@ GIOChannel *net_listen(IPADDR *my_ip, int *port)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* set socket options */
|
/* set socket options */
|
||||||
#ifndef WIN32
|
|
||||||
fcntl(handle, F_SETFL, O_NONBLOCK);
|
fcntl(handle, F_SETFL, O_NONBLOCK);
|
||||||
#endif
|
|
||||||
setsockopt(handle, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
|
setsockopt(handle, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
|
||||||
setsockopt(handle, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof(opt));
|
setsockopt(handle, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof(opt));
|
||||||
|
|
||||||
@ -342,9 +328,7 @@ GIOChannel *net_accept(GIOChannel *handle, IPADDR *addr, int *port)
|
|||||||
if (addr != NULL) sin_get_ip(&so, addr);
|
if (addr != NULL) sin_get_ip(&so, addr);
|
||||||
if (port != NULL) *port = sin_get_port(&so);
|
if (port != NULL) *port = sin_get_port(&so);
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
fcntl(ret, F_SETFL, O_NONBLOCK);
|
fcntl(ret, F_SETFL, O_NONBLOCK);
|
||||||
#endif
|
|
||||||
return g_io_channel_new(ret);
|
return g_io_channel_new(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,12 +6,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifndef WIN32
|
|
||||||
# include <sys/socket.h>
|
# include <sys/socket.h>
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
# include <netdb.h>
|
# include <netdb.h>
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef AF_INET6
|
#ifndef AF_INET6
|
||||||
# ifdef PF_INET6
|
# ifdef PF_INET6
|
||||||
|
@ -168,9 +168,7 @@ void fe_common_core_init(void)
|
|||||||
keyboard_init();
|
keyboard_init();
|
||||||
printtext_init();
|
printtext_init();
|
||||||
formats_init();
|
formats_init();
|
||||||
#ifndef WIN32
|
|
||||||
fe_exec_init();
|
fe_exec_init();
|
||||||
#endif
|
|
||||||
fe_expandos_init();
|
fe_expandos_init();
|
||||||
fe_help_init();
|
fe_help_init();
|
||||||
fe_ignore_init();
|
fe_ignore_init();
|
||||||
@ -211,9 +209,7 @@ void fe_common_core_deinit(void)
|
|||||||
keyboard_deinit();
|
keyboard_deinit();
|
||||||
printtext_deinit();
|
printtext_deinit();
|
||||||
formats_deinit();
|
formats_deinit();
|
||||||
#ifndef WIN32
|
|
||||||
fe_exec_deinit();
|
fe_exec_deinit();
|
||||||
#endif
|
|
||||||
fe_expandos_deinit();
|
fe_expandos_deinit();
|
||||||
fe_help_deinit();
|
fe_help_deinit();
|
||||||
fe_ignore_deinit();
|
fe_ignore_deinit();
|
||||||
|
@ -271,20 +271,6 @@ static void check_files(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
static void winsock_init(void)
|
|
||||||
{
|
|
||||||
WORD wVersionRequested;
|
|
||||||
WSADATA wsaData;
|
|
||||||
|
|
||||||
wVersionRequested = MAKEWORD(2, 2);
|
|
||||||
|
|
||||||
if (WSAStartup(wVersionRequested, &wsaData) != 0) {
|
|
||||||
printf("Error initializing winsock\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -315,9 +301,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
check_files();
|
check_files();
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
winsock_init();
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SOCKS
|
#ifdef HAVE_SOCKS
|
||||||
SOCKSinit(argv[0]);
|
SOCKSinit(argv[0]);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user