summaryrefslogtreecommitdiff
path: root/db.c
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-03-02 13:53:33 -0500
committerJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-03-02 13:53:33 -0500
commit9155a365e1e0a7e9fec47447f86af09117b30edb (patch)
tree6c54cfee6f4784aa777cef186dbca9aa1f856efd /db.c
parentffe739eeb12d1bf9dadb2144e95fef79820c6844 (diff)
downloadprism-9155a365e1e0a7e9fec47447f86af09117b30edb.tar.gz
prism-9155a365e1e0a7e9fec47447f86af09117b30edb.zip
Added support for building with GNU C (Linux, etc.). Fixed minor bugs in diff routine.
Diffstat (limited to 'db.c')
-rw-r--r--db.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/db.c b/db.c
index 39a28c6..9784d79 100644
--- a/db.c
+++ b/db.c
@@ -5,11 +5,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys\types.h>
-#include <sys\stat.h>
-#include <direct.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <errno.h>
+
+#ifdef __GNUC__
+#define MKDIR(x) mkdir(x, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
+#else
+#include <direct.h>
#include <io.h>
+#define MKDIR(x) mkdir(x)
+#endif
#include "prism.h"
#include "db.h"
@@ -47,7 +53,7 @@ int initdb()
FILE *fpdb;
FILE *fpmsg;
- if(mkdir(PDB_DIR) != 0) {
+ if(MKDIR(PDB_DIR) != 0) {
if(errno == EEXIST)
return PRET_EXISTS;
else if(errno == EACCES)
@@ -211,7 +217,7 @@ int res;
#if defined(MSDOS) || defined(WIN32)
res = strcmpi(filename, reader);
#else
- res = strcmpi(filename, reader);
+ res = strcmp(filename, reader);
#endif
if(res == 0) {
info->id = strtol(line,&reader,16);