* Europagate, 1995
*
* $Log: main.c,v $
- * Revision 1.9 1995/02/23 08:32:17 adam
+ * Revision 1.10 1995/03/01 14:32:25 adam
+ * Better diagnostics. Default is, that only one database selected when
+ * several are known.
+ *
+ * Revision 1.9 1995/02/23 08:32:17 adam
* Changed header.
*
* Revision 1.7 1995/02/22 15:22:33 adam
info.override_portno = NULL;
info.override_hostname = NULL;
info.databases = NULL;
+ info.database = NULL;
#if USE_FML
info.fml = NULL;
#endif
}
else
{
- gw_log (GW_LOG_FATAL, "main", "missing target name");
+ gw_log (GW_LOG_FATAL, KERNEL_LOG, "missing target name");
exit (1);
}
break;
}
else
{
- gw_log (GW_LOG_FATAL, "main", "missing language name");
+ gw_log (GW_LOG_FATAL, KERNEL_LOG, "missing language name");
exit (1);
}
break;
}
else
{
- gw_log (GW_LOG_FATAL, "main", "missing language name");
+ gw_log (GW_LOG_FATAL, KERNEL_LOG, "missing language name");
exit (1);
}
break;
}
else
{
- gw_log (GW_LOG_FATAL, "main", "missing portno");
+ gw_log (GW_LOG_FATAL, KERNEL_LOG, "missing portno");
exit (1);
}
break;
}
else
{
- gw_log (GW_LOG_FATAL, "main", "missing hostname");
+ gw_log (GW_LOG_FATAL, KERNEL_LOG, "missing hostname");
exit (1);
}
break;
}
else
{
- gw_log (GW_LOG_FATAL, "main", "missing log filename");
+ gw_log (GW_LOG_FATAL, KERNEL_LOG, "missing log filename");
exit (1);
}
break;
default:
- gw_log (GW_LOG_FATAL, "main", "unknown option %s", *argv);
+ gw_log (GW_LOG_FATAL, KERNEL_LOG, "unknown option %s", *argv);
exit (1);
}
}
gw_res_close (info.kernel_res);
info.kernel_res = gw_res_init ();
- gw_log (GW_LOG_DEBUG, "main", "reading kernel resource, default %s",
+ gw_log (GW_LOG_DEBUG, KERNEL_LOG, "reading kernel resource, default %s",
info.default_res);
if (*info.target)
- gw_log (GW_LOG_DEBUG, "main", "reading kernel resource, target %s",
+ gw_log (GW_LOG_DEBUG, KERNEL_LOG, "reading kernel resource, target %s",
info.target);
if (info.lang)
- gw_log (GW_LOG_DEBUG, "main", "reading kernel resource, lang %s",
+ gw_log (GW_LOG_DEBUG, KERNEL_LOG, "reading kernel resource, lang %s",
info.lang);
if (gw_res_merge (info.kernel_res, info.default_res))
{
- gw_log (GW_LOG_WARN, "main", "Couldn't read resource file %s",
+ gw_log (GW_LOG_WARN, KERNEL_LOG, "Couldn't read resource file %s",
info.default_res);
return;
}
sprintf (fname, "%s/%s", path_prefix, v);
bib_inf = fopen (fname, "r");
if (!bib_inf)
- gw_log (GW_LOG_WARN, "main", "cannot open %s", fname);
+ gw_log (GW_LOG_WARN, KERNEL_LOG, "cannot open %s", fname);
else
{
- gw_log (GW_LOG_DEBUG, "main", "reading bib file %s", fname);
+ gw_log (GW_LOG_DEBUG, KERNEL_LOG, "reading bib file %s", fname);
ccl_qual_file (info.bibset, bib_inf);
fclose (bib_inf);
}
}
if (info.databases)
free (info.databases);
+ if (info.database)
+ free (info.database);
v = gw_res_get (info.kernel_res, "gw.databases", "");
info.databases = gw_strdup (v);
for (cp = info.databases; (cp = strchr (cp, ' ')); cp++)
*cp = ',';
+ v = gw_res_get (info.kernel_res, "gw.database", "");
+ if (*v == '\0' && *info.databases)
+ {
+ int len;
+ cp = strchr (info.databases, ',');
+
+ len = cp ? (cp-info.databases) : strlen (info.databases);
+ info.database = malloc (len+1);
+ assert (info.database);
+ memcpy (info.database, info.databases, len);
+ info.database[len] = '\0';
+ }
+ else
+ {
+ info.database = gw_strdup (v);
+ for (cp = info.database; (cp = strchr (cp, ' ')); cp++)
+ *cp = ',';
+ }
if (info.override_portno)
info.port = atoi (info.override_portno);
if (info.override_hostname)
sprintf (fname, "%s/%s", path_prefix, v);
fml_inf = fopen (fname, "r");
if (!fml_inf)
- gw_log (GW_LOG_WARN, "main", "cannot open fml script %s", fname);
+ gw_log (GW_LOG_WARN, KERNEL_LOG,
+ "cannot open fml script %s", fname);
else
{
info.fml = fml_open ();