]> git.mxchange.org Git - flightgear.git/commitdiff
Alex Perry :
authorfredb <fredb>
Sun, 19 Oct 2008 16:08:29 +0000 (16:08 +0000)
committerfredb <fredb>
Sun, 19 Oct 2008 16:08:29 +0000 (16:08 +0000)
This patch changes terrasync so it links against the subversion
library if you have it installed.  It supports people who build binary
releases for use by non-developers by removing the runtime external
dependency on having command line svn or rsync available.  Since the
patch changes autoconf to detect libsvn,  I'd appreciate it if people
who release binaries could verify that the detection scripting works
for their platform.

Developer warning:  If you do have libsvn developer libraries
installed, terrasync changes its default option from "-R" to "-S" to
remove the command line dependency.  However, Martin has not yet
uploaded world scenery into the subversion repository so it won't be
useful to fly against and you may want to specify "-R" on the command
line in the short term.  Or run both.

Me: Update MSVC 7.1 project file. Need svn-win32-1.x.y_dev.zip and svn-win32-1.x.y.zip
located at http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100

configure.ac
projects/VC7.1/terrasync.vcproj
src/AIModel/AIAircraft.cxx
src/AIModel/AIAircraft.hxx
src/Model/modelmgr.cxx
utils/TerraSync/Makefile.am
utils/TerraSync/terrasync.cxx

index 59fa9a6594ce12160610fc7152d967eca995d5fb..9add3a028683843b2ba610cc5db65d14a5a0535c 100644 (file)
@@ -597,7 +597,27 @@ if test "x$ac_cv_header_zlib_h" != "xyes"; then
     echo
 fi
 
-
+dnl Check for Subversion library support
+save_LIBS=$LIBS
+save_CPPFLAGS=$CPPFLAGS
+LIBS=""
+CPPFLAGS="-I/usr/include/subversion-1 -I/usr/include/apr-1.0"
+AC_CHECK_LIB(svn_client-1, svn_client_checkout3)
+AC_CHECK_HEADERS([svn_client.h])
+if test "x$ac_cv_header_svn_client_h" != "xyes"; then
+  echo "TerraSync will shell out for command line subversion"
+  svn_LIBS=""
+  svn_CPPFLAGS=""
+else
+  echo "TerraSync will use integrated subversion library"
+  AC_SEARCH_LIBS(svn_client_checkout, svn_client-1)
+  svn_LIBS=$LIBS
+  svn_CPPFLAGS=$CPPFLAGS
+  AC_SUBST(svn_LIBS)
+  AC_SUBST(svn_CPPFLAGS)
+fi
+LIBS=$save_LIBS
+CPPFLAGS=$save_CPPFLAGS
 
 dnl Checks for header files.
 AC_HEADER_STDC
index 4e02f08282ba9f5ab7d718ff2c9f9694bbb5acd9..2f7e7e120854acb78d4200432386267b4734c67b 100755 (executable)
@@ -19,8 +19,8 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..\..\..\SimGear;..\..\..\install\msvc71\OpenSceneGraph\include;..\..\.."
-                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX"
+                               AdditionalIncludeDirectories="..\..\..\SimGear;..\..\..\install\msvc71\OpenSceneGraph\include;..\..\..;&quot;..\..\..\svn-win32-1.5.3\include&quot;;&quot;..\..\..\svn-win32-1.5.3\include\apr&quot;;&quot;..\..\..\svn-win32-1.5.3\include\apr-iconv&quot;;&quot;..\..\..\svn-win32-1.5.3\include\apr-util&quot;"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX;HAVE_SVN_CLIENT_H;HAVE_LIBSVN_CLIENT_1"
                                MinimalRebuild="TRUE"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                                Name="VCCustomBuildTool"/>
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ul_d.lib sg_d.lib net_d.lib ws2_32.lib"
+                               AdditionalDependencies="ul_d.lib sg_d.lib net_d.lib ws2_32.lib libsvn_client-1.lib libsvn_diff-1.lib libsvn_delta-1.lib libsvn_ra-1.lib libsvn_subr-1.lib libsvn_wc-1.lib libapr-1.lib"
                                OutputFile="$(OutDir)/terrasync.exe"
                                LinkIncremental="2"
-                               AdditionalLibraryDirectories="..\..\..\plib"
+                               AdditionalLibraryDirectories="..\..\..\plib;&quot;..\..\..\svn-win32-1.5.3\lib&quot;;&quot;..\..\..\svn-win32-1.5.3\lib\apr&quot;"
                                GenerateDebugInformation="TRUE"
                                ProgramDatabaseFile="$(OutDir)/terrasync.pdb"
                                SubSystem="1"
@@ -70,8 +70,8 @@
                        CharacterSet="2">
                        <Tool
                                Name="VCCLCompilerTool"
-                               AdditionalIncludeDirectories="..\..\..\SimGear;..\..\..\install\msvc71\OpenSceneGraph\include;..\..\.."
-                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX"
+                               AdditionalIncludeDirectories="..\..\..\SimGear;..\..\..\install\msvc71\OpenSceneGraph\include;..\..\..;&quot;..\..\..\svn-win32-1.5.3\include&quot;;&quot;..\..\..\svn-win32-1.5.3\include\apr&quot;;&quot;..\..\..\svn-win32-1.5.3\include\apr-iconv&quot;;&quot;..\..\..\svn-win32-1.5.3\include\apr-util&quot;"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX;HAVE_SVN_CLIENT_H;HAVE_LIBSVN_CLIENT_1"
                                RuntimeLibrary="2"
                                RuntimeTypeInfo="TRUE"
                                UsePrecompiledHeader="0"
                                Name="VCCustomBuildTool"/>
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ul.lib sg.lib net.lib ws2_32.lib"
+                               AdditionalDependencies="ul.lib sg.lib net.lib ws2_32.lib libsvn_client-1.lib libsvn_diff-1.lib libsvn_delta-1.lib libsvn_ra-1.lib libsvn_subr-1.lib libsvn_wc-1.lib libapr-1.lib"
                                OutputFile="$(OutDir)/terrasync.exe"
                                LinkIncremental="1"
-                               AdditionalLibraryDirectories="..\..\..\plib"
+                               AdditionalLibraryDirectories="..\..\..\plib;&quot;..\..\..\svn-win32-1.5.3\lib&quot;;&quot;..\..\..\svn-win32-1.5.3\lib\apr&quot;"
                                GenerateDebugInformation="TRUE"
                                SubSystem="1"
                                OptimizeReferences="2"
index c9f185bf0c60920b8983273692afb369ac5e25e5..3c1d1e4fb6ef4fef1e29f36acd9100ddcac0dce4 100644 (file)
@@ -145,7 +145,8 @@ void FGAIAircraft::setPerformance(const std::string& acclass) {
       FGAIAircraft::dt = dt;
 
      try {
-         updatePrimaryTargetValues(); // target hdg, alt, speed
+         if ( !updatePrimaryTargetValues() ) // target hdg, alt, speed
+             return;
      }
      catch (AI_OutOfSight) {
          return;
@@ -729,7 +730,7 @@ void FGAIAircraft::controlSpeed(FGAIFlightPlan::waypoint* curr, FGAIFlightPlan::
 /**
  * Update target values (heading, alt, speed) depending on flight plan or control properties
  */
-void FGAIAircraft::updatePrimaryTargetValues() {
+bool FGAIAircraft::updatePrimaryTargetValues() {
     if (fp)                      // AI object has a flightplan
     {
         //TODO make this a function of AIBase
@@ -758,7 +759,7 @@ void FGAIAircraft::updatePrimaryTargetValues() {
         }
         timeElapsed = now - fp->getStartTime();
         if (! fp->isActive(now)) { 
-            throw FP_Inactive();
+            return false;
         }
     } else {
         // no flight plan, update target heading, speed, and altitude
@@ -789,6 +790,7 @@ void FGAIAircraft::updatePrimaryTargetValues() {
 
         AccelTo( props->getDoubleValue("controls/flight/target-spd" ) );
     }
+    return true;
 }
 
 void FGAIAircraft::updatePosition() {
index 9722e355693f323c462c381df082360f497fbe93..85fca1040733ea902747c7a9d6715516401ef8f6 100644 (file)
@@ -117,7 +117,7 @@ private:
     void controlHeading(FGAIFlightPlan::waypoint* curr);
     void controlSpeed(FGAIFlightPlan::waypoint* curr,
                       FGAIFlightPlan::waypoint* next);
-    void updatePrimaryTargetValues();
+    bool updatePrimaryTargetValues();
     void updateSecondaryTargetValues();
     void updatePosition();
     void updateHeading();
index 2b547cf027486a0cfcefbad6f69f98329ada551c..41eaa6cd2fe0afde590bd68ce2d6e163e0d99536 100644 (file)
@@ -156,23 +156,23 @@ struct UpdateFunctor : public std::unary_function<FGModelMgr::Instance*, void>
         SGModelPlacement* model = instance->model;
         double lon, lat, elev, roll, pitch, heading;
 
-        try {
-            // Optionally set position from properties
-            if (instance->lon_deg_node != 0)
-                lon = testNan(instance->lon_deg_node->getDoubleValue());
-            if (instance->lat_deg_node != 0)
-                lat = testNan(instance->lat_deg_node->getDoubleValue());
-            if (instance->elev_ft_node != 0)
-                elev = testNan(instance->elev_ft_node->getDoubleValue());
-
-            // Optionally set orientation from properties
-            if (instance->roll_deg_node != 0)
-                roll = testNan(instance->roll_deg_node->getDoubleValue());
-            if (instance->pitch_deg_node != 0)
-                pitch = testNan(instance->pitch_deg_node->getDoubleValue());
-            if (instance->heading_deg_node != 0)
-                heading = testNan(instance->heading_deg_node->getDoubleValue());
-        } catch (const sg_range_exception& e) {
+        // Optionally set position from properties
+        if (instance->lon_deg_node != 0)
+            lon =instance->lon_deg_node->getDoubleValue();
+        if (instance->lat_deg_node != 0)
+            lat = instance->lat_deg_node->getDoubleValue();
+        if (instance->elev_ft_node != 0)
+            elev = instance->elev_ft_node->getDoubleValue();
+
+        // Optionally set orientation from properties
+        if (instance->roll_deg_node != 0)
+            roll = instance->roll_deg_node->getDoubleValue();
+        if (instance->pitch_deg_node != 0)
+            pitch = instance->pitch_deg_node->getDoubleValue();
+        if (instance->heading_deg_node != 0)
+            heading = instance->heading_deg_node->getDoubleValue();
+        if ( osg::isNaN(lon) || osg::isNaN(lat) || osg::isNaN(elev) ||
+             osg::isNaN(roll) || osg::isNaN(pitch) || osg::isNaN(heading) ) {
             const char *path = instance->node->getStringValue("path",
                                                               "unknown");
             SG_LOG(SG_GENERAL, SG_INFO, "Instance of model " << path
index e4de6c3ab0b375f09a9cc3ecb0586ead1bdba3d9..aebd959607c36bbba633a0ea33ebb637e975e0bf 100644 (file)
@@ -4,4 +4,6 @@ bin_PROGRAMS = terrasync
 
 terrasync_SOURCES = terrasync.cxx
 
-terrasync_LDADD = -lplibnet -lplibul -lsgmisc -lsgdebug $(network_LIBS)
+AM_CPPFLAGS = $(svn_CPPFLAGS)
+
+terrasync_LDADD = -lplibnet -lplibul -lsgmisc -lsgdebug $(network_LIBS) $(svn_LIBS)
index 1786be923c3492a1cec48dc34d14dc757b704127..1545aa7b81b050a91dabdb8c748daefacfcaec24 100644 (file)
 #include <simgear/bucket/newbucket.hxx>
 #include <simgear/misc/sg_path.hxx>
 
+#ifdef HAVE_SVN_CLIENT_H
+#  ifdef HAVE_LIBSVN_CLIENT_1
+#    include <svn_auth.h>
+#    include <svn_client.h>
+#    include <svn_cmdline.h>
+#    include <svn_pools.h>
+#  else
+#    undef HAVE_SVN_CLIENT_H
+#  endif
+#endif
+
 using std::string;
 using std::cout;
 using std::endl;
 
+const char* source_base = NULL;
 const char* svn_base =
   "http://terrascenery.googlecode.com/svn/trunk/data/Scenery";
 const char* rsync_base = "scenery.flightgear.org::Scenery";
-const char* source_base = NULL;
 const char* dest_base = "terrasyncdir";
-bool use_svn = false;
-
-const char* svn_cmd = "svn checkout";
 const char* rsync_cmd = 
     "rsync --verbose --archive --delete --perms --owner --group";
 
+#ifdef HAVE_SVN_CLIENT_H
+bool use_svn = true;
+#else
+bool use_svn = false;
+const char* svn_cmd = "svn checkout";
+#endif
 
 // display usage
 static void usage( const string& prog ) {
     cout << "Usage: " << endl
          << prog << " -p <port> "
-        << "[ -R ] [ -s <rsync_source> ] -d <dest>" << endl
+        << "-R [ -s <rsync_source> ] -d <dest>" << endl
          << prog << " -p <port> "
-         << "  -S   [ -s <svn_source> ] -d <dest>" << endl;
+<<<<<<< terrasync.cxx
+         << "-S [ -s <svn_source> ] -d <dest>" << endl;
+#ifdef HAVE_SVN_CLIENT_H
+    cout << "    (defaults to the built in subversion)" << endl;
+#else
+    cout << "    (defaults to rsync, using external commands)" << endl;
+#endif
+}
+
+#ifdef HAVE_SVN_CLIENT_H
+
+// Things we need for doing subversion checkout - often
+apr_pool_t *mysvn_pool = NULL;
+svn_client_ctx_t *mysvn_ctx = NULL;
+svn_opt_revision_t *mysvn_rev = 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 }
+};
+
+// Configure our subversion session
+int mysvn_setup(void) {
+    // Are we already prepared?
+    if (mysvn_pool) return EXIT_SUCCESS;
+    // No, so initialize svn internals generally
+    if (svn_cmdline_init("terrasync", stderr) != EXIT_SUCCESS)
+        return EXIT_FAILURE;
+    apr_pool_t *pool;
+    apr_pool_create(&pool, NULL);
+    svn_error_t *err = NULL;
+    SVN_VERSION_DEFINE(mysvn_version);
+    err = svn_ver_check_list(&mysvn_version, mysvn_checklist);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    err = svn_ra_initialize(pool);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    char *config_dir = NULL;
+    err = svn_config_ensure(config_dir, pool);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    err = svn_client_create_context(&mysvn_ctx, pool);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    err = svn_config_get_config(&(mysvn_ctx->config),
+        config_dir, pool);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    svn_config_t *cfg;
+    cfg = ( svn_config_t*) apr_hash_get(
+        mysvn_ctx->config,
+       SVN_CONFIG_CATEGORY_CONFIG,
+        APR_HASH_KEY_STRING);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    svn_auth_baton_t *ab;
+    err = svn_cmdline_setup_auth_baton(&ab,
+        TRUE, NULL, NULL, config_dir, TRUE, cfg,
+        mysvn_ctx->cancel_func, mysvn_ctx->cancel_baton, pool);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    mysvn_ctx->auth_baton = ab;
+    mysvn_ctx->conflict_func = NULL;
+    mysvn_ctx->conflict_baton = NULL;
+    mysvn_rev = (svn_opt_revision_t*) apr_palloc(pool, 
+        sizeof(svn_opt_revision_t));
+    if (!mysvn_rev)
+        return EXIT_FAILURE;
+    mysvn_rev->kind = svn_opt_revision_head;
+    // Success if we got this far
+    mysvn_pool = pool;
+    return EXIT_SUCCESS;
+}
+
+#endif
+
+// sync one directory tree
+void sync_tree(char* dir) {
+    int rc;
+    char command[512];
+    SGPath path( dest_base );
+
+    path.append( dir );
+    rc = path.create_dir( 0755 );
+    if (rc) {
+        cout << "Return code = " << rc << endl;
+        exit(1);
+    }
+
+    if (use_svn) {
+#ifdef HAVE_SVN_CLIENT_H
+        cout << dir << " ... ";
+       cout.flush();
+        char dest_base_dir[512];
+        snprintf( command, 512,
+            "%s/%s", source_base, dir);
+        snprintf( dest_base_dir, 512,
+            "%s/%s", dest_base, dir);
+       svn_error_t *err = NULL;
+       if (mysvn_setup() != EXIT_SUCCESS)
+           exit(1);
+       apr_pool_t *subpool = svn_pool_create(mysvn_pool);
+       err = svn_client_checkout(NULL,
+           command,
+           dest_base_dir,
+           mysvn_rev,
+           1,
+           mysvn_ctx,
+           subpool);
+       if (err) {
+           // Report errors from the checkout attempt
+           cout << "failed: " << endl
+                << err->message << endl;
+           svn_error_clear(err);
+           return;
+       } else {
+           cout << "done" << endl;
+       }
+       svn_pool_destroy(subpool);
+       return;
+#else
+
+        snprintf( command, 512,
+            "%s %s/%s %s/%s", svn_cmd,
+            source_base, dir,
+           dest_base, dir );
+#endif
+    } else {
+        snprintf( command, 512,
+            "%s %s/%s/ %s/%s/", rsync_cmd,
+            source_base, dir,
+           dest_base, dir );
+    }
+    cout << command << endl;
+    rc = system( command );
+    if (rc) {
+        cout << "Return code = " << rc << endl;
+        if (rc == 5120) exit(1);
+    }
+=======
+         << "-S [ -s <svn_source> ] -d <dest>" << endl;
+#ifdef HAVE_SVN_CLIENT_H
+    cout << "    (defaults to the built in subversion)" << endl;
+#else
+    cout << "    (defaults to rsync, using external commands)" << endl;
+#endif
+}
+
+#ifdef HAVE_SVN_CLIENT_H
+
+// Things we need for doing subversion checkout - often
+apr_pool_t *mysvn_pool = NULL;
+svn_client_ctx_t *mysvn_ctx = NULL;
+svn_opt_revision_t *mysvn_rev = 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 }
+};
+
+// Configure our subversion session
+int mysvn_setup(void) {
+    // Are we already prepared?
+    if (mysvn_pool) return EXIT_SUCCESS;
+    // No, so initialize svn internals generally
+#ifdef _MSC_VER
+    if (svn_cmdline_init("terrasync", 0) != EXIT_SUCCESS)
+        return EXIT_FAILURE;
+#else
+    if (svn_cmdline_init("terrasync", stderr) != EXIT_SUCCESS)
+        return EXIT_FAILURE;
+#endif
+    apr_pool_t *pool;
+    apr_pool_create(&pool, NULL);
+    svn_error_t *err = NULL;
+    SVN_VERSION_DEFINE(mysvn_version);
+    err = svn_ver_check_list(&mysvn_version, mysvn_checklist);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    err = svn_ra_initialize(pool);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    char *config_dir = NULL;
+    err = svn_config_ensure(config_dir, pool);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    err = svn_client_create_context(&mysvn_ctx, pool);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    err = svn_config_get_config(&(mysvn_ctx->config),
+        config_dir, pool);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    svn_config_t *cfg;
+    cfg = ( svn_config_t*) apr_hash_get(
+        mysvn_ctx->config,
+       SVN_CONFIG_CATEGORY_CONFIG,
+        APR_HASH_KEY_STRING);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    svn_auth_baton_t *ab;
+    err = svn_cmdline_setup_auth_baton(&ab,
+        TRUE, NULL, NULL, config_dir, TRUE, cfg,
+        mysvn_ctx->cancel_func, mysvn_ctx->cancel_baton, pool);
+    if (err)
+        return svn_cmdline_handle_exit_error(err, pool, "terrasync: ");
+    mysvn_ctx->auth_baton = ab;
+    mysvn_ctx->conflict_func = NULL;
+    mysvn_ctx->conflict_baton = NULL;
+    mysvn_rev = (svn_opt_revision_t*) apr_palloc(pool, 
+        sizeof(svn_opt_revision_t));
+    if (!mysvn_rev)
+        return EXIT_FAILURE;
+    mysvn_rev->kind = svn_opt_revision_head;
+    // Success if we got this far
+    mysvn_pool = pool;
+    return EXIT_SUCCESS;
+}
+
+#endif
+
+// sync one directory tree
+void sync_tree(char* dir) {
+    int rc;
+    char command[512];
+    SGPath path( dest_base );
+
+    path.append( dir );
+    rc = path.create_dir( 0755 );
+    if (rc) {
+        cout << "Return code = " << rc << endl;
+        exit(1);
+    }
+
+    if (use_svn) {
+#ifdef HAVE_SVN_CLIENT_H
+        cout << dir << " ... ";
+       cout.flush();
+        char dest_base_dir[512];
+        snprintf( command, 512,
+            "%s/%s", source_base, dir);
+        snprintf( dest_base_dir, 512,
+            "%s/%s", dest_base, dir);
+       svn_error_t *err = NULL;
+       if (mysvn_setup() != EXIT_SUCCESS)
+           exit(1);
+       apr_pool_t *subpool = svn_pool_create(mysvn_pool);
+       err = svn_client_checkout(NULL,
+           command,
+           dest_base_dir,
+           mysvn_rev,
+           1,
+           mysvn_ctx,
+           subpool);
+       if (err) {
+           // Report errors from the checkout attempt
+           cout << "failed: " << endl
+                << err->message << endl;
+           svn_error_clear(err);
+           return;
+       } else {
+           cout << "done" << endl;
+       }
+       svn_pool_destroy(subpool);
+       return;
+#else
+
+        snprintf( command, 512,
+            "%s %s/%s %s/%s", svn_cmd,
+            source_base, dir,
+           dest_base, dir );
+#endif
+    } else {
+        snprintf( command, 512,
+            "%s %s/%s/ %s/%s/", rsync_cmd,
+            source_base, dir,
+           dest_base, dir );
+    }
+    cout << command << endl;
+    rc = system( command );
+    if (rc) {
+        cout << "Return code = " << rc << endl;
+        if (rc == 5120) exit(1);
+    }
+>>>>>>> 1.15
 }
 
 
@@ -123,39 +432,6 @@ static void parse_message( const string &msg, int *lat, int *lon ) {
       *lon = nowhere;
       *lat = nowhere;
     }
-
-}
-
-// sync one directory tree
-void sync_tree(char* dir) {
-    int rc;
-    char command[512];
-    SGPath path( dest_base );
-
-    path.append( dir );
-    rc = path.create_dir( 0755 );
-    if (rc) {
-        cout << "Return code = " << rc << endl;
-        exit(1);
-    }
-
-    if (use_svn) {
-        snprintf( command, 512,
-            "%s %s/%s %s/%s", svn_cmd,
-            source_base, dir,
-           dest_base, dir );
-    } else {
-      snprintf( command, 512,
-          "%s %s/%s/ %s/%s/", rsync_cmd,
-          source_base, dir,
-         dest_base, dir );
-    }
-    cout << command << endl;
-    rc = system( command );
-    if (rc) {
-        cout << "Return code = " << rc << endl;
-        if (rc == 5120) exit(1);
-    }
 }
 
 
@@ -235,6 +511,7 @@ static void sync_areas( int lat, int lon, int lat_dir, int lon_dir ) {
 int main( int argc, char **argv ) {
     int port = 5501;
     char host[256] = "";        // accept messages from anyone
+    bool testing = false;
 
     // parse arguments
     int i = 1;
@@ -253,8 +530,7 @@ int main( int argc, char **argv ) {
         } else if ( (string)argv[i] == "-S" ) {
            use_svn = true;
         } else if ( (string)argv[i] == "-T" ) {
-          sync_areas( 37, -123, 0, 0 );
-         exit(0);
+           testing = true;
         } else {
             usage( argv[0] );
             exit(-1);        
@@ -269,6 +545,12 @@ int main( int argc, char **argv ) {
        else
            source_base = rsync_base;
     }
+    
+    // We just want one grid square, no FGFS communications
+    if (testing) {
+          sync_areas( 37, -123, 0, 0 );
+         exit(0);
+    }
 
     // Must call this before any other net stuff
     netInit( &argc,argv );
@@ -354,3 +636,4 @@ int main( int argc, char **argv ) {
         
     return 0;
 }
+