mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
Some fixes for compiling with Win32 :)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@783 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c6808b3724
commit
df10f182c0
@ -27,6 +27,8 @@ $libtool_flags --disable-static --output=libtool-static --no-verify $ac_aux_dir/
|
||||
|
||||
AC_CHECK_HEADERS(string.h stdlib.h unistd.h dirent.h sys/ioctl.h libintl.h)
|
||||
|
||||
# check posix headers..
|
||||
AC_CHECK_HEADERS(sys/time.h sys/utsname.h regex.h)
|
||||
|
||||
AC_ARG_WITH(socks,
|
||||
[ --with-socks Build with socks support],
|
||||
|
@ -22,7 +22,9 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@ -32,6 +34,9 @@
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#ifdef WIN32
|
||||
# include <win32-compat.h>
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
#include <gmodule.h>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user