--- /dev/null
+Index: src/dird/dird.c
+===================================================================
+--- src/dird/dird.c (revision 7482)
++++ src/dird/dird.c (working copy)
+@@ -40,7 +40,7 @@
+ /* Forward referenced subroutines */
+ void terminate_dird(int sig);
+ static bool check_resources();
+-static bool check_catalog();
++static bool check_catalog(bool printit=false);
+ static void dir_sql_query(JCR *jcr, const char *cmd);
+
+ /* Exported subroutines */
+@@ -99,6 +99,7 @@
+ " -r <job> run <job> now\n"
+ " -s no signals\n"
+ " -t test - read configuration and exit\n"
++" -B print catalog configuration and exit\n"
+ " -u userid\n"
+ " -v verbose user messages\n"
+ " -? print this message.\n"
+@@ -124,6 +125,7 @@
+ JCR *jcr;
+ bool no_signals = false;
+ bool test_config = false;
++ bool print_catalog = false;
+ char *uid = NULL;
+ char *gid = NULL;
+
+@@ -140,7 +142,7 @@
+
+ console_command = run_console_command;
+
+- while ((ch = getopt(argc, argv, "c:d:fg:r:stu:v?")) != -1) {
++ while ((ch = getopt(argc, argv, "c:d:fg:r:stu:vB?")) != -1) {
+ switch (ch) {
+ case 'c': /* specify config file */
+ if (configfile != NULL) {
+@@ -186,6 +188,11 @@
+ test_config = true;
+ break;
+
++ case 'B': /* print catalog config */
++ test_config = true;
++ print_catalog = true;
++ break;
++
+ case 'u': /* set uid */
+ uid = optarg;
+ break;
+@@ -249,7 +256,7 @@
+
+ drop(uid, gid); /* reduce privileges if requested */
+
+- if (!check_catalog()) {
++ if (!check_catalog(print_catalog)) {
+ Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
+ }
+
+@@ -876,7 +883,7 @@
+ return OK;
+ }
+
+-static bool check_catalog()
++static bool check_catalog(bool printit)
+ {
+ bool OK = true;
+ bool need_tls;
+@@ -907,6 +914,18 @@
+ continue;
+ }
+
++ if (printit) { /* print catalog information for scripting purpose */
++ fprintf(stdout,
++ "catalog=%s\ndb_type=%s\ndb_name=%s\ndb_driver=%s\ndb_user=%s\n"
++ "db_password=%s\ndb_address=%s\ndb_port=%i\n"
++ "db_socket=%s\n",
++ catalog->name(), db_get_type(), NPRTB(catalog->db_name),
++ NPRTB(catalog->db_driver),
++ NPRTB(catalog->db_user), NPRTB(catalog->db_password),
++ NPRTB(catalog->db_address), catalog->db_port,
++ NPRTB(catalog->db_socket));
++ }
++
+ /* Loop over all pools, defining/updating them in each database */
+ POOL *pool;
+ foreach_res(pool, R_POOL) {
+Index: src/baconfig.h
+===================================================================
+--- src/baconfig.h (revision 7482)
++++ src/baconfig.h (working copy)
+@@ -79,7 +79,8 @@
+
+ /* Allow printing of NULL pointers */
+ #define NPRT(x) (x)?(x):_("*None*")
+-
++#define NPRTB(x) (x)?(x):""
++
+ #if defined(HAVE_WIN32)
+
+ #define WIN32_REPARSE_POINT 1