diff options
author | Timo Sirainen <cras@irssi.org> | 2000-10-26 18:12:20 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-10-26 18:12:20 +0000 |
commit | df10f182c019e7cda96793de193e30e66ab2abfc (patch) | |
tree | 0ffaf1b0d0527637b05f596cdced17d09e0ec3ac /src/core | |
parent | c6808b3724de2c5a91401ed4c9d7dbc3fb54a66a (diff) | |
download | irssi-df10f182c019e7cda96793de193e30e66ab2abfc.zip |
Some fixes for compiling with Win32 :)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@783 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/misc.c | 23 | ||||
-rw-r--r-- | src/core/net-internal.h | 6 | ||||
-rw-r--r-- | src/core/network.c | 2 | ||||
-rw-r--r-- | src/core/network.h | 6 | ||||
-rw-r--r-- | src/core/settings.c | 2 | ||||
-rw-r--r-- | src/core/special-vars.c | 14 |
6 files changed, 42 insertions, 11 deletions
diff --git a/src/core/misc.c b/src/core/misc.c index 55f61dda..73b66128 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -23,7 +23,9 @@ #include "pidwait.h" #include <errno.h> -#include <regex.h> +#ifdef HAVE_REGEX_H +# include <regex.h> +#endif typedef struct { GInputCondition condition; @@ -168,10 +170,13 @@ int strarray_find(char **array, const char *item) int execute(const char *cmd) { char **args; +#ifndef WIN32 int pid; +#endif g_return_val_if_fail(cmd != NULL, -1); +#ifndef WIN32 pid = fork(); if (pid == -1) return FALSE; if (pid != 0) { @@ -185,6 +190,12 @@ int execute(const char *cmd) _exit(99); return -1; +#else + args = g_strsplit(cmd, " ", -1); + _spawnvp(_P_DETACH, args[0], args); + g_strfreev(args); + return 0; +#endif } GSList *gslist_find_string(GSList *list, const char *key) @@ -337,6 +348,7 @@ char *stristr_full(const char *data, const char *key) int regexp_match(const char *str, const char *regexp) { +#ifdef HAVE_REGEX_H regex_t preg; int ret; @@ -347,13 +359,16 @@ int regexp_match(const char *str, const char *regexp) regfree(&preg); return ret == 0; +#else + return FALSE; +#endif } /* Create the directory and all it's parent directories */ int mkpath(const char *path, int mode) { struct stat statbuf; - const char *p; + const char *p; char *dir; g_return_val_if_fail(path != NULL, -1); @@ -367,7 +382,11 @@ int mkpath(const char *path, int mode) dir = g_strndup(path, (int) (p-path)); if (stat(dir, &statbuf) != 0) { +#ifndef WIN32 if (mkdir(dir, mode) == -1) { +#else + if (_mkdir(dir) == -1) { +#endif g_free(dir); return -1; } diff --git a/src/core/net-internal.h b/src/core/net-internal.h index 79da708e..dd870a1b 100644 --- a/src/core/net-internal.h +++ b/src/core/net-internal.h @@ -2,5 +2,7 @@ #include <socks.h> #endif -#include <netdb.h> -#include <arpa/inet.h> +#ifndef WIN32 +# include <netdb.h> +# include <arpa/inet.h> +#endif diff --git a/src/core/network.c b/src/core/network.c index 4a60a963..8d246bb6 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -303,7 +303,7 @@ int net_getsockname(int handle, IPADDR *addr, int *port) #ifdef HAVE_IPV6 if (getsockname(handle, &so.sin6, &len) == -1) #else - if (getsockname(handle, &so.sin, &len) == -1) + if (getsockname(handle, (struct sockaddr *) &so.sin, &len) == -1) #endif return -1; diff --git a/src/core/network.h b/src/core/network.h index 613434c4..31817cdb 100644 --- a/src/core/network.h +++ b/src/core/network.h @@ -2,8 +2,10 @@ #define __NETWORK_H #include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> +#ifndef WIN32 +# include <sys/socket.h> +# include <netinet/in.h> +#endif struct _ipaddr { unsigned short family; diff --git a/src/core/settings.c b/src/core/settings.c index 80406261..3bfddec5 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -310,7 +310,7 @@ static void init_configfile(void) str = g_strdup_printf("%s/.irssi", g_get_home_dir()); if (stat(str, &statbuf) != 0) { /* ~/.irssi not found, create it. */ - if (mkdir(str, 0700) != 0) { + if (mkpath(str, 0700) != 0) { g_error(_("Couldn't create %s/.irssi directory"), g_get_home_dir()); } diff --git a/src/core/special-vars.c b/src/core/special-vars.c index 1aa081e9..0b83658f 100644 --- a/src/core/special-vars.c +++ b/src/core/special-vars.c @@ -29,7 +29,9 @@ #include "queries.h" #include "window-item-def.h" -#include <sys/utsname.h> +#ifdef HAVE_SYS_UTSNAME_H +# include <sys/utsname.h> +#endif #define ALIGN_RIGHT 0x01 #define ALIGN_CUT 0x02 @@ -673,6 +675,7 @@ static char *expando_dollar(SERVER_REC *server, void *item, int *free_ret) /* system name */ static char *expando_sysname(SERVER_REC *server, void *item, int *free_ret) { +#ifdef HAVE_SYS_UTSNAME_H struct utsname un; if (uname(&un) == -1) @@ -680,12 +683,15 @@ static char *expando_sysname(SERVER_REC *server, void *item, int *free_ret) *free_ret = TRUE; return g_strdup(un.sysname); - +#else + return NULL; +#endif } /* system release */ static char *expando_sysrelease(SERVER_REC *server, void *item, int *free_ret) { +#ifdef HAVE_SYS_UTSNAME_H struct utsname un; if (uname(&un) == -1) @@ -693,7 +699,9 @@ static char *expando_sysrelease(SERVER_REC *server, void *item, int *free_ret) *free_ret = TRUE; return g_strdup(un.release); - +#else + return NULL; +#endif } /* Server tag */ |