]> git.mxchange.org Git - flightgear.git/blobdiff - utils/TerraSync/terrasync.cxx
Merge branch 'next' into comm-subsystem
[flightgear.git] / utils / TerraSync / terrasync.cxx
index f6c33c9b64c3e393ae6f2749c127dc22d88a43e8..d15078d9a8dccdbcd1e79a2497ae23d7a01dd3d6 100644 (file)
 #include <time.h>
 #include <unistd.h>
 #elif defined(_MSC_VER)
-#include <io.h>
+#   include <io.h>
+#   ifndef HAVE_SVN_CLIENT_H
+#       include <time.h>
+#       include <process.h>
+#   endif
 #endif
 
 #include <stdlib.h>             // atoi() atof() abs() system()
@@ -47,9 +51,7 @@
 #include <deque>
 #include <map>
 
-#include <plib/netSocket.h>
-#include <plib/ul.h>
-
+#include <simgear/io/raw_socket.hxx>
 #include <simgear/bucket/newbucket.hxx>
 #include <simgear/misc/sg_path.hxx>
 
@@ -115,7 +117,7 @@ static void usage( const string& prog ) {
 deque<string> waitingTiles;
 typedef map<string,time_t> CompletedTiles;
 CompletedTiles completedTiles;
-netSocket theSocket;
+simgear::Socket theSocket;
 
 #ifdef HAVE_SVN_CLIENT_H
 
@@ -128,10 +130,6 @@ svn_opt_revision_t *mysvn_rev_peg = NULL;
 static const svn_version_checklist_t mysvn_checklist[] = {
     { "svn_subr",   svn_subr_version },
     { "svn_client", svn_client_version },
-    { "svn_wc",     svn_wc_version },
-    { "svn_ra",     svn_ra_version },
-    { "svn_delta",  svn_delta_version },
-    { "svn_diff",   svn_diff_version },
     { NULL, NULL }
 };
 
@@ -185,8 +183,10 @@ int mysvn_setup(void) {
     if (err)
         return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
     mysvn_ctx->auth_baton = ab;
+#if (SVN_VER_MINOR >= 5)
     mysvn_ctx->conflict_func = NULL;
     mysvn_ctx->conflict_baton = NULL;
+#endif
     // Now our magic revisions
     mysvn_rev = (svn_opt_revision_t*) apr_palloc(pool, 
         sizeof(svn_opt_revision_t));
@@ -231,16 +231,31 @@ void sync_tree(const char* dir) {
        if (mysvn_setup() != EXIT_SUCCESS)
            exit(1);
        apr_pool_t *subpool = svn_pool_create(mysvn_pool);
+       
+#if (SVN_VER_MINOR >= 5)
        err = svn_client_checkout3(NULL,
            command,
            dest_base_dir,
            mysvn_rev_peg,
            mysvn_rev,
            svn_depth_infinity,
-           0,
-           0,
+           0, // ignore-externals = false
+           0, // allow unver obstructions = false
            mysvn_ctx,
            subpool);
+#else
+    // version 1.4 API
+    err = svn_client_checkout2(NULL,
+           command,
+           dest_base_dir,
+           mysvn_rev_peg,
+           mysvn_rev,
+           1, // recurse=true - same as svn_depth_infinity for checkout3 above
+           0, // ignore externals = false
+           mysvn_ctx,
+           subpool);
+#endif
+           
        if (err) {
            // Report errors from the checkout attempt
            cout << "failed: " << endl
@@ -273,19 +288,19 @@ void sync_tree(const char* dir) {
     }
 }
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
 typedef void (__cdecl * sighandler_t)(int);
-#elif defined( __APPLE__ )
+#elif defined( __APPLE__ ) || defined (__FreeBSD__)
 typedef sig_t sighandler_t;
 #endif
 
 bool terminating = false;
 sighandler_t prior_signal_handlers[32];
 int termination_triggering_signals[] = {
-#ifndef _MSC_VER
-    SIGHUP, SIGINT, SIGQUIT, SIGKILL,
-#else
+#if defined(_MSC_VER) || defined(__MINGW32__)
     SIGINT, SIGILL, SIGFPE, SIGSEGV, SIGTERM, SIGBREAK, SIGABRT,
+#else
+    SIGHUP, SIGINT, SIGQUIT, SIGKILL, SIGTERM,
 #endif
     0};  // zero terminated
 
@@ -517,7 +532,7 @@ int main( int argc, char **argv ) {
     }
     
     // Must call this before any other net stuff
-    netInit( &argc,argv );
+    simgear::Socket::initSockets();
 
     if ( ! theSocket.open( false ) ) {  // open a UDP socket
         printf("error opening socket\n");
@@ -628,7 +643,11 @@ int main( int argc, char **argv ) {
            terminating = true;
        } else
 
-        ulSleep( 1 );
+        #ifdef _WIN32
+                Sleep(1000);
+#else
+               sleep(1);
+#endif
     } // while !terminating
         
     return 0;