Add a build.conf and get svnrload to build

* build.conf
  (svnrdump): Add new section to build svnrdump.
  (__ALL__): Add svnrdump.
* subversion/svnrload
  (svn:ignore): Copy properties from svnrdump.
* subversion/svnrload/load_editor.c: Change the path to the load
  header.
* subversion/svnrload/parse_dumpstream.c
  Correct ident to match GNU style
  (main): Stub out the callbacks and use the default parser. Also wrap
  functions in SVN_INT_ERR appropriately for error handling.
* subversion/svnrload/svnrload.c
  (main): Stub out function completely in favor of the main in
  parse_dumpstream.c


git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/svnrload@979011 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/build.conf b/build.conf
index 18fe8a9..81eccca 100644
--- a/build.conf
+++ b/build.conf
@@ -175,6 +175,13 @@
 install = bin
 manpages = subversion/svnrdump/svnrdump.1
 
+[svnrload]
+description = Subversion remote repository loader
+type = exe
+path = subversion/svnrload
+libs = libsvn_client libsvn_ra libsvn_delta libsvn_subr apr
+install = bin
+
 # Support for GNOME Keyring
 [libsvn_auth_gnome_keyring]
 description = Subversion GNOME Keyring Library
@@ -1073,7 +1080,7 @@
 [__ALL__]
 type = project
 path = build/win32
-libs = svn svnserve svnadmin svnlook svnversion svnrdump svndumpfilter
+libs = svn svnserve svnadmin svnlook svnversion svnrdump svnrload svndumpfilter
        mod_authz_svn mod_dav_svn svnsync
 
 [__ALL_TESTS__]
diff --git a/subversion/svnrload/load_editor.c b/subversion/svnrload/load_editor.c
index 047c66b..18b0870 100644
--- a/subversion/svnrload/load_editor.c
+++ b/subversion/svnrload/load_editor.c
@@ -28,7 +28,7 @@
 #include "svn_props.h"
 #include "svn_dirent_uri.h"
 
-#include "dump_editor.h"
+#include "load_editor.h"
 
 #define ARE_VALID_COPY_ARGS(p,r) ((p) && SVN_IS_VALID_REVNUM(r))
 
diff --git a/subversion/svnrload/parse_dumpstream.c b/subversion/svnrload/parse_dumpstream.c
index cffc098..45f2387 100644
--- a/subversion/svnrload/parse_dumpstream.c
+++ b/subversion/svnrload/parse_dumpstream.c
@@ -9,8 +9,8 @@
 		    void *parse_baton,
 		    apr_pool_t *pool)
 {
-	printf("new_revision_record called");
-	return SVN_NO_ERROR;
+  printf("new_revision_record called");
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
@@ -19,8 +19,8 @@
                 void *revision_baton,
                 apr_pool_t *pool)
 {
-	printf("new_node_record called");
-	return SVN_NO_ERROR;
+  printf("new_node_record called");
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
@@ -28,8 +28,8 @@
             void *parse_baton,
             apr_pool_t *pool)
 {
-	printf("uuid_record called");
-	return SVN_NO_ERROR;
+  printf("uuid_record called");
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
@@ -37,8 +37,8 @@
                       const char *name,
                       const svn_string_t *value)
 {
-	printf("set_revision_property called");
-	return SVN_NO_ERROR;
+  printf("set_revision_property called");
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
@@ -46,45 +46,45 @@
                   const char *name,
                   const svn_string_t *value)
 {
-	printf("set_node_property called");
-	return SVN_NO_ERROR;
+  printf("set_node_property called");
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
 remove_node_props(void *baton)
 {
-	printf("remove_node_props called");
-	return SVN_NO_ERROR;
+  printf("remove_node_props called");
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
 set_fulltext(svn_stream_t **stream,
              void *node_baton)
 {
-	printf("set_fulltext called");
-	return SVN_NO_ERROR;
+  printf("set_fulltext called");
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
 close_node(void *baton)
 {
-	printf("close_node called");
-	return SVN_NO_ERROR;
+  printf("close_node called");
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
 close_revision(void *baton)
 {
-	printf("close_revision called");
-	return SVN_NO_ERROR;
+  printf("close_revision called");
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
 delete_node_property(void *baton,
                      const char *name)
 {
-	printf("delete_node_property called");
-	return SVN_NO_ERROR;
+  printf("delete_node_property called");
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *
@@ -92,38 +92,42 @@
                 void **handler_baton,
                 void *node_baton)
 {
-	printf("apply_textdelta called");
-	return SVN_NO_ERROR;
+  printf("apply_textdelta called");
+  return SVN_NO_ERROR;
 }
 
-int main()
+int
+main(int argc, char **argv)
 {
-	apr_pool_t *pool;
-	apr_file_t *dumpfile;
-	svn_stream_t *dumpstream;
-	svn_repos_parse_fns2_t *parser;
+  apr_pool_t *pool;
+  apr_file_t *dumpfile;
+  svn_stream_t *dumpstream;
+  svn_repos_parse_fns2_t *parser;
+  struct parser_baton_t *parser_baton;
 
-	if (svn_cmdline_init ("parse_dumpstream", stderr) != EXIT_SUCCESS)
-		return EXIT_FAILURE;
-	pool = svn_pool_create(NULL);
+  if (svn_cmdline_init ("parse_dumpstream", stderr) != EXIT_SUCCESS)
+    return EXIT_FAILURE;
+  pool = svn_pool_create(NULL);
 
-	parser = apr_pcalloc(pool, sizeof(*parser));
+  parser = apr_pcalloc(pool, sizeof(*parser));
 
-	parser->new_revision_record = new_revision_record;
-	parser->new_node_record = new_node_record;
-	parser->uuid_record = uuid_record;
-	parser->set_revision_property = set_revision_property;
-	parser->set_node_property = set_node_property;
-	parser->remove_node_props = remove_node_props;
-	parser->set_fulltext = set_fulltext;
-	parser->close_node = close_node;
-	parser->close_revision = close_revision;
-	parser->delete_node_property = delete_node_property;
-	parser->apply_textdelta = apply_textdelta;
+  /* parser->new_revision_record = new_revision_record; */
+  /* parser->new_node_record = new_node_record; */
+  /* parser->uuid_record = uuid_record; */
+  /* parser->set_revision_property = set_revision_property; */
+  /* parser->set_node_property = set_node_property; */
+  /* parser->remove_node_props = remove_node_props; */
+  /* parser->set_fulltext = set_fulltext; */
+  /* parser->close_node = close_node; */
+  /* parser->close_revision = close_revision; */
+  /* parser->delete_node_property = delete_node_property; */
+  /* parser->apply_textdelta = apply_textdelta; */
 
-	apr_file_open_stdin(&dumpfile, pool);
-	dumpstream = svn_stream_from_aprfile2(dumpfile, FALSE, pool);
-	svn_repos_parse_dumpstream2(dumpstream, parser, NULL, NULL, NULL, pool);
-	svn_pool_destroy(pool);
-	return 0;
+  apr_file_open_stdin(&dumpfile, pool);
+  dumpstream = svn_stream_from_aprfile2(dumpfile, FALSE, pool);
+  SVN_INT_ERR(svn_repos_parse_dumpstream2(dumpstream, parser, NULL,
+                                          NULL, NULL, pool));
+  SVN_INT_ERR(svn_stream_close(dumpstream));
+  svn_pool_destroy(pool);
+  return 0;
 }
diff --git a/subversion/svnrload/svnrload.c b/subversion/svnrload/svnrload.c
index 3623994..82d78b7 100644
--- a/subversion/svnrload/svnrload.c
+++ b/subversion/svnrload/svnrload.c
@@ -327,142 +327,142 @@
   while (0)
 
 
-int
-main(int argc, const char **argv)
-{
-  const char *url = NULL;
-  char *revision_cut = NULL;
-  svn_revnum_t start_revision = svn_opt_revision_unspecified;
-  svn_revnum_t end_revision = svn_opt_revision_unspecified;
-  svn_revnum_t latest_revision = svn_opt_revision_unspecified;
-  svn_boolean_t quiet = FALSE;
-  apr_pool_t *pool = NULL;
-  svn_ra_session_t *session = NULL;
-  const char *config_dir = NULL;
-  const char *username = NULL;
-  const char *password = NULL;
-  svn_boolean_t no_auth_cache = FALSE;
-  svn_boolean_t non_interactive = FALSE;
-  apr_getopt_t *os;
+/* int */
+/* main(int argc, const char **argv) */
+/* { */
+/*   const char *url = NULL; */
+/*   char *revision_cut = NULL; */
+/*   svn_revnum_t start_revision = svn_opt_revision_unspecified; */
+/*   svn_revnum_t end_revision = svn_opt_revision_unspecified; */
+/*   svn_revnum_t latest_revision = svn_opt_revision_unspecified; */
+/*   svn_boolean_t quiet = FALSE; */
+/*   apr_pool_t *pool = NULL; */
+/*   svn_ra_session_t *session = NULL; */
+/*   const char *config_dir = NULL; */
+/*   const char *username = NULL; */
+/*   const char *password = NULL; */
+/*   svn_boolean_t no_auth_cache = FALSE; */
+/*   svn_boolean_t non_interactive = FALSE; */
+/*   apr_getopt_t *os; */
 
-  if (svn_cmdline_init ("svnrdump", stderr) != EXIT_SUCCESS)
-    return EXIT_FAILURE;
+/*   if (svn_cmdline_init ("svnrdump", stderr) != EXIT_SUCCESS) */
+/*     return EXIT_FAILURE; */
 
-  pool = svn_pool_create(NULL);
+/*   pool = svn_pool_create(NULL); */
 
-  SVNRLOAD_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
+/*   SVNRLOAD_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool)); */
 
-  os->interleave = TRUE; /* Options and arguments can be interleaved */
+/*   os->interleave = TRUE; /\* Options and arguments can be interleaved *\/ */
 
-  while (1)
-    {
-      int opt;
-      const char *opt_arg;
-      apr_status_t status = apr_getopt_long(os, svnrload__options, &opt,
-                                            &opt_arg);
+/*   while (1) */
+/*     { */
+/*       int opt; */
+/*       const char *opt_arg; */
+/*       apr_status_t status = apr_getopt_long(os, svnrload__options, &opt, */
+/*                                             &opt_arg); */
 
-      if (APR_STATUS_IS_EOF(status))
-        break;
-      if (status != APR_SUCCESS)
-        {
-          SVNRLOAD_ERR(usage(argv[0], pool));
-          exit(EXIT_FAILURE);
-        }
+/*       if (APR_STATUS_IS_EOF(status)) */
+/*         break; */
+/*       if (status != APR_SUCCESS) */
+/*         { */
+/*           SVNRLOAD_ERR(usage(argv[0], pool)); */
+/*           exit(EXIT_FAILURE); */
+/*         } */
 
-      switch(opt)
-        {
-        case 'r':
-          {
-            revision_cut = strchr(opt_arg, ':');
-            if (revision_cut)
-              {
-                start_revision = (svn_revnum_t)strtoul(opt_arg,
-                                                       &revision_cut, 10);
-                end_revision = (svn_revnum_t)strtoul(revision_cut + 1,
-                                                     NULL, 10);
-              }
-            else
-              start_revision = (svn_revnum_t)strtoul(opt_arg, NULL, 10);
-          }
-          break;
-        case 'q':
-          quiet = TRUE;
-          break;
-        case opt_config_dir:
-          config_dir = opt_arg;
-          break;
-        case opt_version:
-          SVNRLOAD_ERR(version(argv[0], pool));
-          exit(EXIT_SUCCESS);
-          break;
-        case 'h':
-          SVNRLOAD_ERR(help(argv[0], pool));
-          exit(EXIT_SUCCESS);
-          break;
-        case opt_auth_username:
-          SVNRLOAD_ERR(svn_utf_cstring_to_utf8(&username, opt_arg, pool));
-          break;
-        case opt_auth_password:
-          SVNRLOAD_ERR(svn_utf_cstring_to_utf8(&password, opt_arg, pool));
-          break;
-        case opt_auth_nocache:
-          no_auth_cache = TRUE;
-          break;
-        case opt_non_interactive:
-          non_interactive = TRUE;
-          break;
-        }
-    }
+/*       switch(opt) */
+/*         { */
+/*         case 'r': */
+/*           { */
+/*             revision_cut = strchr(opt_arg, ':'); */
+/*             if (revision_cut) */
+/*               { */
+/*                 start_revision = (svn_revnum_t)strtoul(opt_arg, */
+/*                                                        &revision_cut, 10); */
+/*                 end_revision = (svn_revnum_t)strtoul(revision_cut + 1, */
+/*                                                      NULL, 10); */
+/*               } */
+/*             else */
+/*               start_revision = (svn_revnum_t)strtoul(opt_arg, NULL, 10); */
+/*           } */
+/*           break; */
+/*         case 'q': */
+/*           quiet = TRUE; */
+/*           break; */
+/*         case opt_config_dir: */
+/*           config_dir = opt_arg; */
+/*           break; */
+/*         case opt_version: */
+/*           SVNRLOAD_ERR(version(argv[0], pool)); */
+/*           exit(EXIT_SUCCESS); */
+/*           break; */
+/*         case 'h': */
+/*           SVNRLOAD_ERR(help(argv[0], pool)); */
+/*           exit(EXIT_SUCCESS); */
+/*           break; */
+/*         case opt_auth_username: */
+/*           SVNRLOAD_ERR(svn_utf_cstring_to_utf8(&username, opt_arg, pool)); */
+/*           break; */
+/*         case opt_auth_password: */
+/*           SVNRLOAD_ERR(svn_utf_cstring_to_utf8(&password, opt_arg, pool)); */
+/*           break; */
+/*         case opt_auth_nocache: */
+/*           no_auth_cache = TRUE; */
+/*           break; */
+/*         case opt_non_interactive: */
+/*           non_interactive = TRUE; */
+/*           break; */
+/*         } */
+/*     } */
 
-  /* Only continue if the only not option argument is a url, to allow
-     implementing 'svnrdump dump URL' like handling later without breaking
-     backward compatibility */
-  if ((os->ind != os->argc-1)
-      || !svn_path_is_url(os->argv[os->ind]))
-    {
-      SVNRLOAD_ERR(usage(argv[0], pool));
-      exit(EXIT_FAILURE);
-    }
+/*   /\* Only continue if the only not option argument is a url, to allow */
+/*      implementing 'svnrdump dump URL' like handling later without breaking */
+/*      backward compatibility *\/ */
+/*   if ((os->ind != os->argc-1) */
+/*       || !svn_path_is_url(os->argv[os->ind])) */
+/*     { */
+/*       SVNRLOAD_ERR(usage(argv[0], pool)); */
+/*       exit(EXIT_FAILURE); */
+/*     } */
 
-  SVNRLOAD_ERR(svn_utf_cstring_to_utf8(&url, os->argv[os->ind], pool));
+/*   SVNRLOAD_ERR(svn_utf_cstring_to_utf8(&url, os->argv[os->ind], pool)); */
 
-  url = svn_uri_canonicalize(os->argv[os->ind], pool);
+/*   url = svn_uri_canonicalize(os->argv[os->ind], pool); */
 
 
-  SVNRLOAD_ERR(open_connection(&session,
-                               url,
-                               non_interactive,
-                               username,
-                               password,
-                               config_dir,
-                               no_auth_cache,
-                               pool));
+/*   SVNRLOAD_ERR(open_connection(&session, */
+/*                                url, */
+/*                                non_interactive, */
+/*                                username, */
+/*                                password, */
+/*                                config_dir, */
+/*                                no_auth_cache, */
+/*                                pool)); */
 
-  /* Have sane start_revision and end_revision defaults if unspecified */
-  SVNRLOAD_ERR(svn_ra_get_latest_revnum(session, &latest_revision, pool));
-  if (start_revision == svn_opt_revision_unspecified)
-    start_revision = 0;
-  if (end_revision == svn_opt_revision_unspecified)
-    end_revision = latest_revision;
-  if (end_revision > latest_revision)
-    {
-      SVN_INT_ERR(svn_cmdline_fprintf(stderr, pool,
-                                      "Revision %ld does not exist.\n",
-                                      end_revision));
-      exit(EXIT_FAILURE);
-    }
-  if (end_revision < start_revision)
-    {
-      SVN_INT_ERR(svn_cmdline_fprintf(stderr, pool,
-                                      "LOWER cannot be greater "
-                                        "than UPPER.\n"));
-      exit(EXIT_FAILURE);
-    }
+/*   /\* Have sane start_revision and end_revision defaults if unspecified *\/ */
+/*   SVNRLOAD_ERR(svn_ra_get_latest_revnum(session, &latest_revision, pool)); */
+/*   if (start_revision == svn_opt_revision_unspecified) */
+/*     start_revision = 0; */
+/*   if (end_revision == svn_opt_revision_unspecified) */
+/*     end_revision = latest_revision; */
+/*   if (end_revision > latest_revision) */
+/*     { */
+/*       SVN_INT_ERR(svn_cmdline_fprintf(stderr, pool, */
+/*                                       "Revision %ld does not exist.\n", */
+/*                                       end_revision)); */
+/*       exit(EXIT_FAILURE); */
+/*     } */
+/*   if (end_revision < start_revision) */
+/*     { */
+/*       SVN_INT_ERR(svn_cmdline_fprintf(stderr, pool, */
+/*                                       "LOWER cannot be greater " */
+/*                                         "than UPPER.\n")); */
+/*       exit(EXIT_FAILURE); */
+/*     } */
 
-  SVNRLOAD_ERR(replay_range(session, url, start_revision, end_revision,
-                            quiet, pool));
+/*   SVNRLOAD_ERR(replay_range(session, url, start_revision, end_revision, */
+/*                             quiet, pool)); */
 
-  svn_pool_destroy(pool);
+/*   svn_pool_destroy(pool); */
 
-  return 0;
-}
+/*   return 0; */
+/* } */