]> git.sur5r.net Git - bacula/bacula/commitdiff
Added compatibility for MinGW.
authorNicolas Boichat <nicolas@boichat.ch>
Mon, 19 Apr 2004 20:54:03 +0000 (20:54 +0000)
committerNicolas Boichat <nicolas@boichat.ch>
Mon, 19 Apr 2004 20:54:03 +0000 (20:54 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1253 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/filed/win32/winbacula.h
bacula/src/filed/win32/winres.rc
bacula/src/findlib/attribs.c
bacula/src/win32/compat/compat.cpp
bacula/src/win32/compat/compat.h
bacula/src/win32/compat/unistd.h
bacula/src/win32/compat/winconfig.h

index 36dcee03c001080ddc5aa8850f86464ecd492779..ea33d26a50c95ee498414fb1d2da99925158c757 100755 (executable)
@@ -17,7 +17,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
 //  USA.
 //
-// If the source code for the VNC system is not available from the place 
+// If the source code for the VNC system is not available from the place
 // whence you received this file, check http://www.uk.research.att.com/vnc or contact
 // the authors on vnc@uk.research.att.com for information on obtaining it.
 //
 #include <process.h>
 #include "winres.h"
 
+#ifdef HAVE_MINGW
+#include "compat.h"
+#endif
+
 // Application specific messages
 
 // Message used for system tray notifications
index 1aad255ea51399ee2de66801783e2f4633a78b17..e4e997b1419e7849820c07552021618bc3a484d8 100644 (file)
@@ -20,7 +20,7 @@ IDI_JOB_ERROR           ICON    DISCARDABLE     "error.ico"
 // Menu
 //
 
-IDR_TRAYMENU MENU DISCARDABLE 
+IDR_TRAYMENU MENU DISCARDABLE
 BEGIN
     POPUP "tray"
     BEGIN
@@ -91,7 +91,7 @@ IDB_BACULABMP           BITMAP  DISCARDABLE     "bacula.bmp"
 // String Table
 //
 
-STRINGTABLE DISCARDABLE 
+STRINGTABLE DISCARDABLE
 BEGIN
     IDI_BACULA              "Bacula"
 END
@@ -103,7 +103,7 @@ END
 #ifdef properties_implemented
 
 IDD_PROPERTIES DIALOG DISCARDABLE  0, 0, 221, 204
-STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | 
+STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP |
     WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Bacula Properties"
 FONT 8, "MS Sans Serif"
@@ -128,7 +128,9 @@ BEGIN
     DEFPUSHBUTTON   "OK",IDOK,190,120,50,15
 //  CONTROL         "\3", IDC_BACULABMP,"Static",SS_ICON | SS_CENTERIMAGE |
 //                  SS_SUNKEN,7,5,73,65
+#ifndef HAVE_MINGW
     CONTROL         IDB_BACULABMP,IDB_BACULABMP,"Static",SS_BITMAP|SS_SUNKEN,7,5,32,32
+#endif
 
     LTEXT           "      by Kern Sibbald",IDC_NAME,134,38,78,10
     LTEXT           "For more information, see:",-1,115,60,100,10
@@ -150,7 +152,7 @@ END
 //
 
 IDD_STATUS DIALOG DISCARDABLE  0, 0, 411, 244
-STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | 
+STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP |
     WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Bacula Status"
 FONT 8, "Courier New"
@@ -165,7 +167,7 @@ END
 //
 
 IDD_EVENTS DIALOG DISCARDABLE  0, 0, 411, 204
-STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | 
+STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP |
     WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Bacula Events"
 FONT 8, "Courier New"
index 99237457fbeaef06d8d45bc44c914ac5f60ca061..d73622e8219021ec98032db14a641b5cfd7b291f 100755 (executable)
@@ -117,10 +117,17 @@ void encode_stat(char *buf, FF_PKT *ff_pkt, int data_stream)
    *p++ = ' ';
    p += to_base64((int64_t)statp->st_size, p);
    *p++ = ' ';
+#ifndef HAVE_MINGW
    p += to_base64((int64_t)statp->st_blksize, p);
    *p++ = ' ';
    p += to_base64((int64_t)statp->st_blocks, p);
    *p++ = ' ';
+#else
+   p += to_base64((int64_t)0, p); /* output place holder */
+   *p++ = ' ';
+   p += to_base64((int64_t)0, p); /* output place holder */
+   *p++ = ' ';
+#endif
    p += to_base64((int64_t)statp->st_atime, p);
    *p++ = ' ';
    p += to_base64((int64_t)statp->st_mtime, p);
@@ -174,12 +181,21 @@ int decode_stat(char *buf, struct stat *statp, int32_t *LinkFI)
    p += from_base64(&val, p);
    statp->st_size = val;
    p++;
+#ifndef HAVE_MINGW
    p += from_base64(&val, p);
    statp->st_blksize = val;
    p++;
    p += from_base64(&val, p);
    statp->st_blocks = val;
    p++;
+#else
+   p += from_base64(&val, p);
+//   statp->st_blksize = val;
+   p++;
+   p += from_base64(&val, p);
+//   statp->st_blocks = val;
+   p++;
+#endif
    p += from_base64(&val, p);
    statp->st_atime = val;
    p++;
index 90d20b784b4d36573abc3b71c8fd0bdc9c6fa1cd..e6c197aed3b94576d3f0787278b6fcf000f33213 100644 (file)
@@ -34,7 +34,9 @@
 #define USE_WIN32_COMPAT_IO 1
 
 extern void d_msg(const char *file, int line, int level, const char *fmt,...);
+#ifndef HAVE_MINGW
 extern DWORD   g_platform_id;
+#endif
 
 // from CYGWIN (should be diff between Jan 1 1601 and Jan 1 1970
 #ifdef HAVE_MINGW
@@ -360,6 +362,8 @@ stat(const char *file, struct stat *sb)
     return 0;
 }
 
+#endif //HAVE_MINGW
+
 int
 lstat(const char *file, struct stat *sb)
 {
@@ -372,8 +376,6 @@ sleep(int sec)
     Sleep(sec * 1000);
 }
 
-#endif //HAVE_MINGW
-
 int
 geteuid(void)
 {
@@ -496,7 +498,6 @@ getgrgid(uid_t)
     return NULL;
 }
 
-#ifndef HAVE_MINGW
 // implement opendir/readdir/closedir on top of window's API
 typedef struct _dir
 {
@@ -519,6 +520,7 @@ opendir(const char *path)
     char *tspec = (char *)malloc(max_len);
     if (tspec == NULL) goto err1;
 
+#ifndef HAVE_MINGW
     if (g_platform_id != VER_PLATFORM_WIN32_WINDOWS) {
         // allow path to be 32767 bytes
         tspec[0] = '\\';
@@ -530,6 +532,9 @@ opendir(const char *path)
     } else {
         cygwin_conv_to_win32_path(path, tspec);
     }
+#else
+    cygwin_conv_to_win32_path(path, tspec);
+#endif
     strncat(tspec, "\\*", max_len);
     rval->spec = tspec;
 
@@ -590,6 +595,7 @@ copyin(struct dirent &dp, const char *fname)
         *cp = 0;
     return dp.d_reclen;
 }
+
 int
 readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
 {
@@ -609,7 +615,6 @@ readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
     dp->valid = FindNextFile(dp->dirh, &dp->data);
     return 0;
 }
-#endif //HAVE_MINGW
 
 int
 inet_aton(const char *a, struct in_addr *inp)
index a75b9bad2b7aa1e64571596607bef225486301b5..90b1f93ece8d8bdf046e338327a16b0a419523bc 100644 (file)
@@ -129,6 +129,7 @@ typedef UINT32 uid_t;
 typedef UINT32 gid_t;
 typedef UINT32 mode_t;
 typedef INT64  ssize_t;
+#endif //HAVE_MINGW
 
 struct dirent {
     uint64_t    d_ino;
@@ -137,8 +138,6 @@ struct dirent {
     char        d_name[256];
 };
 
-#endif //HAVE_MINGW
-
 typedef void DIR;
 
 #ifndef __cplusplus
@@ -290,10 +289,8 @@ int readlink(const char *, char *, int);
 
 int geteuid();
 
-#ifndef HAVE_MINGW
 DIR *opendir(const char *name);
 int closedir(DIR *dir);
-#endif //HAVE_MINGW
 
 struct passwd {
     char *foo;
index 7273fef6deb36f7cc1a92fe89da75db00128bbff..ac1b9baa49e07f81328ccc923879d3fbb1beff19 100644 (file)
@@ -1 +1,5 @@
+#ifndef HAVE_MINGW
 #include "compat.h"
+#else
+#include_next<unistd.h>
+#endif
index cf67ce7f41897c5536f25ecbab35bbe1ce72f0d6..5f0d78b2692ea84fd89d4a8f5f8fc7bd3a78ea1e 100644 (file)
 /* #undef ino_t */
 
 /* Define to 1 if utime.h exists and declares struct utimbuf.  */
-/* #undef HAVE_UTIME_H 1 */
+#ifdef HAVE_MINGW
+#define HAVE_UTIME_H 1
+#endif
 
 #if (HAVE_MYSQL||HAVE_PGSQL||HAVE_MSQL||HAVE_IODBC||HAVE_UNIXODBC||HAVE_SOLID||HAVE_VIRT||HAVE_IBASE||HAVE_ORACLE8||HAVE_ORACLE7||HAVE_EASYSOFT)
 #define HAVE_SQL