summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2014-06-12 19:03:18 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2014-06-12 19:03:18 +0200
commitf5c9a8080f0932335457fe5cb0dff38c2d491cb5 (patch)
tree26ec33246b846a54a6a52747519ca80c3c1000b7 /src
parent89f93872d8e024c761cc55335518f7d48d414fdb (diff)
downloadlibrcc-f5c9a8080f0932335457fe5cb0dff38c2d491cb5.tar.gz
librcc-f5c9a8080f0932335457fe5cb0dff38c2d491cb5.tar.bz2
librcc-f5c9a8080f0932335457fe5cb0dff38c2d491cb5.tar.xz
librcc-f5c9a8080f0932335457fe5cb0dff38c2d491cb5.zip
Mingw compatibility fixes by trialuser
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/librcc.c8
-rw-r--r--src/rccconfig.c4
-rw-r--r--src/rccexternal.c4
-rw-r--r--src/rcchome.c5
-rw-r--r--src/rcclock.c8
-rw-r--r--src/rccxml.c4
7 files changed, 33 insertions, 2 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7477fd9..8b49d55 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -66,5 +66,5 @@ SET(rcc_SRCS
${HEADERS}
)
-ADD_LIBRARY(rcc ${rcc_SRCS})
+ADD_LIBRARY(rcc SHARED ${rcc_SRCS})
TARGET_LINK_LIBRARIES(rcc ${LIBXML2_LIBRARY} ${ICONV_LIBRARY} ${ENCA_LIBRARY} ${LIBRCD_LIBRARY} ${ZLIB_LIBRARY} ${WSOCK_LIBRARY})
diff --git a/src/librcc.c b/src/librcc.c
index b11c2ee..0fb9211 100644
--- a/src/librcc.c
+++ b/src/librcc.c
@@ -347,10 +347,18 @@ int rccInitDb4(rcc_context ctx, const char *name, rcc_db4_flags flags) {
if (!dbname) return -1;
sprintf(dbname,"%s/.rcc/",rcc_home_dir);
+#ifdef _WIN32
+ mkdir(dbname);
+#else
mkdir(dbname, 00755);
+#endif
sprintf(dbname,"%s/.rcc/%s.db/",rcc_home_dir,name);
+#ifdef _WIN32
+ mkdir(dbname);
+#else
mkdir(dbname, 00755);
+#endif
ctx->db4ctx = rccDb4CreateContext(dbname, flags);
free(dbname);
diff --git a/src/rccconfig.c b/src/rccconfig.c
index 204d82f..3748bab 100644
--- a/src/rccconfig.c
+++ b/src/rccconfig.c
@@ -35,6 +35,10 @@ rcc_language_alias rcc_default_aliases[RCC_MAX_ALIASES + 1];
rcc_language_alias rcc_default_aliases_embeded[RCC_MAX_ALIASES + 1] = {
/* { "cs_SK", "sk" },
{ "ru_UA", "uk" },*/
+#ifdef _WIN32
+ { "Russian_Russia", "ru" },
+ { "Ukrainian_Ukraine", "uk" },
+#endif
{ NULL, NULL }
};
diff --git a/src/rccexternal.c b/src/rccexternal.c
index eba1f71..1441f24 100644
--- a/src/rccexternal.c
+++ b/src/rccexternal.c
@@ -70,6 +70,7 @@ static char *addr = NULL;
#endif /* HAVE_UNISTD_H */
int rccExternalInit() {
+#ifndef _WIN32 // WNOHANG is not defined
#ifdef HAVE_UNISTD_H
# ifdef HAVE_SIGNAL_H
struct sigaction act;
@@ -111,10 +112,12 @@ int rccExternalInit() {
}
# endif /* HAVE_SYS_STAT_H */
#endif /* HAVE_UNISTD_H */
+#endif /* _WIN32 */
_exit(1);
}
void rccExternalFree() {
+#ifndef _WIN32 // WNOHANG is not defined
#ifdef HAVE_UNISTD_H
int retry;
pid_t res;
@@ -135,6 +138,7 @@ void rccExternalFree() {
pid = (pid_t)-1;
if (addr) free(addr);
#endif /* HAVE_UNISTD_H */
+#endif /* _WIN32 */
}
#ifdef HAVE_SYS_SELECT_H
diff --git a/src/rcchome.c b/src/rcchome.c
index bf72df1..becbaac 100644
--- a/src/rcchome.c
+++ b/src/rcchome.c
@@ -49,8 +49,11 @@ void rccHomeSet() {
#ifdef HAVE_PWD_H
struct passwd *pw;
#endif /* HAVE_PWD_H */
-
+#ifdef _WIN32
+ tmp = getenv ("HOMEPATH");
+#else
tmp = getenv ("HOME");
+#endif
if (tmp) rcc_home_dir = strdup (tmp);
#ifdef HAVE_PWD_H
else {
diff --git a/src/rcclock.c b/src/rcclock.c
index e5dda52..b72fd9f 100644
--- a/src/rcclock.c
+++ b/src/rcclock.c
@@ -63,10 +63,18 @@ int rccLock() {
if (!stmp) return -1;
sprintf(stmp,"%s/.rcc/", rcc_home_dir);
+#ifdef _WIN32
+ mkdir(stmp);
+#else
mkdir(stmp, 00755);
+#endif
sprintf(stmp,"%s/.rcc/locks/", rcc_home_dir);
+#ifdef _WIN32
+ mkdir(stmp);
+#else
mkdir(stmp, 00700);
+#endif
sprintf(stmp,"%s/.rcc/locks/rcc.lock", rcc_home_dir);
diff --git a/src/rccxml.c b/src/rccxml.c
index 39992f2..e79067f 100644
--- a/src/rccxml.c
+++ b/src/rccxml.c
@@ -340,7 +340,11 @@ int rccSave(rcc_context ctx, const char *name) {
if (!config) return -1;
sprintf(config,"%s/.rcc/",rcc_home_dir);
+#ifdef _WIN32
+ mkdir(config);
+#else
mkdir(config, 00755);
+#endif
sprintf(config,"%s/.rcc/%s.xml",rcc_home_dir,name);
fd = open(config, O_CREAT|O_RDWR,00644);