Fix compiler warning due to missing function prototype.
[svn.git] / tools / server-side / svnauthz-validate.c
blob6ddb18a39b7ab20eb93f485110f1bc4319b541f5
1 /*
2 * svnauthz-validate.c : Load and validate an authz file.
4 * ====================================================================
5 * Copyright (c) 2000-2006 CollabNet. All rights reserved.
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
13 * This software consists of voluntary contributions made by many
14 * individuals. For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
19 * svnauthz-validate.c : load and validate an authz file, returns
20 * value == 0 if syntax of authz file is correct
21 * value == 1 if syntax of authz file is invalid or file not found
22 * value == 2 in case of general error
26 #include "svn_pools.h"
27 #include "svn_repos.h"
28 #include "svn_cmdline.h"
30 int
31 main(int argc, const char **argv)
33 apr_pool_t *pool;
34 svn_error_t *err;
35 svn_authz_t *authz;
36 const char *authz_file;
38 if (argc <= 1)
40 printf("Usage: %s PATH \n\n", argv[0]);
41 printf("Loads the authz file at PATH and validates its syntax. \n"
42 "Returns:\n"
43 " 0 when syntax is OK.\n"
44 " 1 when syntax is invalid.\n"
45 " 2 operational error\n");
46 return 2;
49 authz_file = argv[1];
51 /* Initialize the app. Send all error messages to 'stderr'. */
52 if (svn_cmdline_init(argv[0], stderr) != EXIT_SUCCESS)
53 return 2;
55 pool = svn_pool_create(NULL);
57 /* Read the access file and validate it. */
58 err = svn_repos_authz_read(&authz, authz_file, TRUE, pool);
60 svn_pool_destroy(pool);
62 if (err)
64 svn_handle_error2(err, stderr, FALSE, "svnauthz-validate: ");
65 return 1;
67 else
69 return 0;