[srvx-commits] CVS: services/src main.c,1.136,1.137
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2002-09-05 14:54:50
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv32644/src
Modified Files:
main.c
Log Message:
miscellaneous cleanups (mostly removing non-standard multi-line strings)
Index: main.c
===================================================================
RCS file: /cvsroot/srvx/services/src/main.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -C2 -r1.136 -r1.137
*** main.c 18 Aug 2002 05:50:24 -0000 1.136
--- main.c 5 Sep 2002 14:54:46 -0000 1.137
***************
*** 21,25 ****
#define PID_FILE "srvx.pid"
! #include "common.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
--- 21,40 ----
#define PID_FILE "srvx.pid"
! #include "conf.h"
! #include "gline.h"
! #include "ioset.h"
! #include "modcmd.h"
! #include "policer.h"
! #include "saxdb.h"
! #include "sendmail.h"
! #include "timeq.h"
!
! #include "chanserv.h"
! #include "global.h"
! #include "helpserv.h"
! #include "modules.h"
! #include "opserv.h"
! #include "sockcheck.h"
!
#ifdef HAVE_GETOPT_H
#include <getopt.h>
***************
*** 44,63 ****
#endif
- #include "conf.h"
- #include "gline.h"
- #include "ioset.h"
- #include "modcmd.h"
- #include "policer.h"
- #include "saxdb.h"
- #include "sendmail.h"
- #include "timeq.h"
-
- #include "chanserv.h"
- #include "global.h"
- #include "helpserv.h"
- #include "modules.h"
- #include "opserv.h"
- #include "sockcheck.h"
-
extern FILE *replay_file;
--- 59,62 ----
***************
*** 147,153 ****
/* If the configuration is being reloaded, set the current uplink
! to the reloaded equivalent, if possible.
!
! XXX: May want to include the bind_address in the equivalence test. */
if(cManager.uplink
&& enabled
--- 146,150 ----
/* If the configuration is being reloaded, set the current uplink
! to the reloaded equivalent, if possible. */
if(cManager.uplink
&& enabled
***************
*** 580,615 ****
void usage(char *self) {
/* We can assume we have getopt_long(). */
! printf("Usage: %s [-c config] [-r log] [-f] [-V] [-v|-h]\n\
! -c, --config selects a different configuration file.\n\
! -f, --foreground run srvx in the foreground.\n\
! -h, --help prints this usage message.\n\
! -k, --check checks the configuration file's syntax.\n\
! -r, --replay replay a log file (debug)\n\
! -v, --version prints this program's version.\n\
! -V, --verbose send log messages to the console.\n", self);
}
void version() {
! printf(" --------------------------------------------------\n\
! - srvx "VERSION" ("CODENAME"), Built: " __DATE__ ", " __TIME__".\n\
! - Copyright (C) 2000 - 2002, srvx Development Team\n\
! --------------------------------------------------\n");
}
void license() {
! printf("\n\
! This program is free software; you can redistribute it and/or modify\n\
! it under the terms of the GNU General Public License as published by\n\
! the Free Software Foundation; either version 2 of the License, or\n\
! (at your option) any later version.\n\
! \n\
! This program is distributed in the hope that it will be useful,\n\
! but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
! GNU General Public License for more details.\n\
! \n\
! You should have received a copy of the GNU General Public License\n\
! along with this program; if not, write to the Free Software\n\
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n");
}
--- 577,612 ----
void usage(char *self) {
/* We can assume we have getopt_long(). */
! printf("Usage: %s [-c config] [-r log] [-f] [-V] [-v|-h]\n"
! "-c, --config selects a different configuration file.\n"
! "-f, --foreground run srvx in the foreground.\n"
! "-h, --help prints this usage message.\n"
! "-k, --check checks the configuration file's syntax.\n"
! "-r, --replay replay a log file (debug)\n"
! "-v, --version prints this program's version.\n"
! "-V, --verbose send log messages to the console.\n", self);
}
void version() {
! printf(" --------------------------------------------------\n"
! " - "PACKAGE_STRING" ("CODENAME"), Built: " __DATE__ ", " __TIME__".\n"
! " - Copyright (C) 2000 - 2002, srvx Development Team\n"
! " --------------------------------------------------\n");
}
void license() {
! printf("\n"
! "This program is free software; you can redistribute it and/or modify\n"
! "it under the terms of the GNU General Public License as published by\n"
! "the Free Software Foundation; either version 2 of the License, or\n"
! "(at your option) any later version.\n"
! "\n"
! "This program is distributed in the hope that it will be useful,\n"
! "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
! "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
! "GNU General Public License for more details.\n"
! "\n"
! "You should have received a copy of the GNU General Public License\n"
! "along with this program; if not, write to the Free Software\n"
! "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n");
}
***************
*** 666,675 ****
break;
case 'k':
! if(conf_read(services_config))
! {
printf("%s appears to be a valid configuration file.\n", services_config);
! }
! else
! {
printf("%s is an invalid configuration file.\n", services_config);
}
--- 663,669 ----
break;
case 'k':
! if (conf_read(services_config)) {
printf("%s appears to be a valid configuration file.\n", services_config);
! } else {
printf("%s is an invalid configuration file.\n", services_config);
}
***************
*** 701,708 ****
}
! if(daemon)
! {
! silent = 1;
! }
version();
--- 695,699 ----
}
! if (daemon) silent = 1;
version();
***************
*** 726,730 ****
boot_time = now;
} else {
! boot_time = now = time(NULL);
}
init_logs();
--- 717,721 ----
boot_time = now;
} else {
! boot_time = time(&now);
}
init_logs();
***************
*** 741,753 ****
/* Attempt to fork into the background if daemon mode is on. */
pid = fork();
! if(pid == -1)
log(MAIN_LOG, LOG_ERROR, "Unable to fork: %s\n", strerror(errno));
! else if(pid > 0)
! {
int temp_silent = silent;
silent = 0;
log(MAIN_LOG, LOG_INFO, "Forking into the background (pid: %i)...\n\n", pid);
silent = temp_silent;
-
exit(0);
}
--- 732,742 ----
/* Attempt to fork into the background if daemon mode is on. */
pid = fork();
! if (pid < 0) {
log(MAIN_LOG, LOG_ERROR, "Unable to fork: %s\n", strerror(errno));
! } else if (pid > 0) {
int temp_silent = silent;
silent = 0;
log(MAIN_LOG, LOG_INFO, "Forking into the background (pid: %i)...\n\n", pid);
silent = temp_silent;
exit(0);
}
***************
*** 772,777 ****
saxdb_init();
timeq_init();
- sendmail_init();
gline_init();
sockcheck_init();
init_structs();
--- 761,766 ----
saxdb_init();
timeq_init();
gline_init();
+ sendmail_init();
sockcheck_init();
init_structs();
***************
*** 782,795 ****
modcmd_finalize();
saxdb_finalize();
- if (replay_file) log(MAIN_LOG, LOG_INFO, "Beginning replay...\n");
! /* The first exit func to be called *should* be write_databases(). */
reg_exit_func(saxdb_write_all);
-
- if (!replay_file) now = time(NULL);
- srand(now);
if (replay_file) {
replay_event_loop();
} else {
ioset_run();
}
--- 771,783 ----
modcmd_finalize();
saxdb_finalize();
! /* The first exit func to be called *should* be saxdb_write_all(). */
reg_exit_func(saxdb_write_all);
if (replay_file) {
+ log(MAIN_LOG, LOG_INFO, "Beginning replay...\n");
+ srand(now);
replay_event_loop();
} else {
+ srand(time(&now));
ioset_run();
}
|