+static bool Use_Log = true;
+static CONF_SERVER New_Server;
+static int New_Server_Idx;
+
+static size_t Conf_Channel_Count;
+static void Set_Defaults PARAMS(( bool InitServers ));
+static bool Read_Config PARAMS(( bool ngircd_starting ));
+static bool Validate_Config PARAMS(( bool TestOnly, bool Rehash ));
+
+static void Handle_GLOBAL PARAMS(( int Line, char *Var, char *Arg ));
+static void Handle_OPERATOR PARAMS(( int Line, char *Var, char *Arg ));
+static void Handle_SERVER PARAMS(( int Line, char *Var, char *Arg ));
+static void Handle_CHANNEL PARAMS(( int Line, char *Var, char *Arg ));
+
+static void Config_Error PARAMS(( const int Level, const char *Format, ... ));
+
+static void Config_Error_NaN PARAMS(( const int LINE, const char *Value ));
+static void Config_Error_TooLong PARAMS(( const int LINE, const char *Value ));
+
+static void Init_Server_Struct PARAMS(( CONF_SERVER *Server ));
+
+#ifdef WANT_IPV6
+#define DEFAULT_LISTEN_ADDRSTR "::,0.0.0.0"
+#else
+#define DEFAULT_LISTEN_ADDRSTR "0.0.0.0"
+#endif
+
+#ifdef SSL_SUPPORT
+struct SSLOptions Conf_SSLOptions;
+
+static void
+ConfSSL_Init(void)
+{
+ free(Conf_SSLOptions.KeyFile);
+ Conf_SSLOptions.KeyFile = NULL;
+
+ free(Conf_SSLOptions.CertFile);
+ Conf_SSLOptions.CertFile = NULL;
+
+ free(Conf_SSLOptions.DHFile);
+ Conf_SSLOptions.DHFile = NULL;
+ array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
+}
+
+static bool
+can_open(const char *name, const char *file)
+{
+ FILE *fp = fopen(file, "r");
+ if (fp)
+ fclose(fp);
+ else
+ fprintf(stderr, "ERROR: %s \"%s\": %s\n",
+ name, file, strerror(errno));
+ return fp != NULL;
+}
+
+static bool
+ConfSSL_Puts(void)
+{
+ bool ret = true;
+
+ if (Conf_SSLOptions.KeyFile) {
+ printf( " SSLKeyFile = %s\n", Conf_SSLOptions.KeyFile);
+ ret = can_open("SSLKeyFile", Conf_SSLOptions.KeyFile);
+ }
+ if (Conf_SSLOptions.CertFile) {
+ printf( " SSLCertFile = %s\n", Conf_SSLOptions.CertFile);
+ if (!can_open("SSLCertFile", Conf_SSLOptions.CertFile))
+ ret = false;
+ }
+ if (Conf_SSLOptions.DHFile) {
+ printf( " SSLDHFile = %s\n", Conf_SSLOptions.DHFile);
+ if (!can_open("SSLDHFile", Conf_SSLOptions.DHFile))
+ ret = false;
+ }
+ if (array_bytes(&Conf_SSLOptions.KeyFilePassword))
+ puts(" SSLKeyFilePassword = <secret>" );
+ array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
+
+ return ret;
+}
+#endif
+
+static char *
+strdup_warn(const char *str)
+{
+ char *ptr = strdup(str);
+ if (!ptr)
+ Config_Error(LOG_ERR, "Could not allocate mem for string: %s", str);
+ return ptr;
+}