GLOBAL int
main(int argc, const char *argv[])
{
+ const char *name_ptr = NULL, *motd_ptr = NULL;
bool ok, configtest = false;
bool NGIRCd_NoDaemon = false;
int i;
/* long option */
if (strcmp(argv[i], "--config") == 0) {
if (i + 1 < argc) {
- /* Ok, there's an parameter left */
+ /* Ok, there's a parameter left */
strlcpy(NGIRCd_ConfFile, argv[i+1],
sizeof(NGIRCd_ConfFile));
/* next parameter */
puts(""); Show_Help( ); puts( "" );
exit(0);
}
+ if (strcmp(argv[i], "--motd") == 0) {
+ if (i + 1 < argc) {
+ /* Next parameter is MOTD phrase */
+ motd_ptr = argv[i +1];
+ i++; ok = true;
+ }
+ }
+ if (strcmp(argv[i], "--name") == 0) {
+ if (i + 1 < argc) {
+ /* Next parameter is server name */
+ name_ptr = argv[i +1];
+ i++; ok = true;
+ }
+ }
if (strcmp(argv[i], "--nodaemon") == 0) {
NGIRCd_NoDaemon = true;
ok = true;
exit(1);
}
+ if (argv[i][n] == 'i') {
+ if (!argv[i][n+1] && i+1 < argc) {
+ name_ptr = argv[i +1];
+ i++; n = strlen(argv[i]);
+ ok = true;
+ }
+ }
+
+ if (argv[i][n] == 'm') {
+ if (!argv[i][n+1] && i+1 < argc) {
+ motd_ptr = argv[i +1];
+ i++; n = strlen(argv[i]);
+ ok = true;
+ }
+ }
+
if (argv[i][n] == 'n') {
NGIRCd_NoDaemon = true;
ok = true;
}
+
if (argv[i][n] == 'p') {
NGIRCd_Passive = true;
ok = true;
if (configtest) {
Show_Version(); puts("");
- exit(Conf_Test());
+ exit(Conf_Test(name_ptr, motd_ptr));
}
while (!NGIRCd_SignalQuit) {
Log_Init(!NGIRCd_NoDaemon);
Random_Init();
- Conf_Init();
+ Conf_Init(name_ptr, motd_ptr);
Log_ReInit();
/* Initialize the "main program":
puts( " -d, --debug log extra debug messages" );
#endif
puts( " -f, --config <f> use file <f> as configuration file" );
+ puts( " -i, --name <id> set the server ID (\"name\") to <id>" );
+ puts( " -m, --motd <txt> set the MOTD phrase to <txt>");
puts( " -n, --nodaemon don't fork and don't detach from controlling terminal" );
puts( " -p, --passive disable automatic connections to other servers" );
#ifdef SNIFFER