]> Nishi Git Mirror - dataworks.git/commitdiff
will add windows support later
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Sat, 18 May 2024 12:58:28 +0000 (12:58 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Sat, 18 May 2024 12:58:28 +0000 (12:58 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@34 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Library/dw_util.h
Library/util.c
common.mk

index b95fcd4ec2ac70c3910b205471962a5a6926276c..1c5c1782aa639512fdc48999e5ec71e8f54d9278 100644 (file)
@@ -41,10 +41,13 @@ extern "C" {
 #endif
 
 #include <stdbool.h>
+#include <stdio.h>
 
 #include "dataworks.h"
 
 bool __dw_strcaseequ(const char* a, const char* b);
+bool __dw_lockfile(FILE* fp);
+bool __dw_unlockfile(FILE* fp);
 
 #define __dw_xstr(x) #x
 #define __dw_str(x) __dw_xstr(x)
index dddb91c243af59ec55e21e5010a41be8a5172b12..9edf28208670536af9a8ed581c02f20450405328 100644 (file)
 #include <ctype.h>
 #include <stdbool.h>
 #include <string.h>
+#ifdef __MINGW32__
+#include <fileapi.h>
+#else
+#include <unistd.h>
+#endif
 
 bool __dw_strcaseequ(const char* a, const char* b) {
        if(strlen(a) != strlen(b)) return false;
@@ -40,3 +45,21 @@ bool __dw_strcaseequ(const char* a, const char* b) {
        }
        return true;
 }
+
+bool __dw_lockfile(FILE* fp){
+#ifdef __MINGW32__
+       OVERLAPPED overlap = {0};
+       LockFileEx(fp, LOCKFILE_EXCLUSIVE_LOCK, 0, MAXDWORD, MAXDWORD, &overlap);
+#else
+       lockf(fp, F_LOCK);
+#endif
+       return false;
+}
+
+bool __dw_unlockfile(FILE* fp){
+#ifdef __MINGW32__
+#else
+       lockf(fp, F_ULOCK);
+#endif
+       return false;
+}
index 6a475a6a31cec83e7f841cc2314107cec9ee7143..ef4cde332e3b7a8f7682ca26e7c4506bb1add037 100644 (file)
--- a/common.mk
+++ b/common.mk
@@ -36,15 +36,17 @@ clean:
        $(MAKE) -C ./Client clean $(COMPILE_FLAGS)
        $(MAKE) -C ./Document clean $(COMPILE_FLAGS)
 
-archive-prepare: no-doc
+archive-prepare: all
        rm -f *.zip *.tar.gz
        rm -rf dataworks-dist
        mkdir -p dataworks-dist
        mkdir -p dataworks-dist/Client
        mkdir -p dataworks-dist/Library
+       mkdir -p dataworks-dist/Document
        cp Library/*$(LIB_SUFFIX) dataworks-dist/Library/
        cp Library/*.h dataworks-dist/Library/
        cp Client/dataworks$(EXEC_SUFFIX) dataworks-dist/Client/
+       cp -rf Document/doc/html dataworks-dist/Document/html
 
 archive-cleanup:
        rm -rf dataworks-dist