#include <eggdrop/eggdrop.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include <locale.h>
#include <ltdl.h>
#include "debug.h"
#include "core_config.h"
#include "core_party.h"
#include "core_binds.h"
#include "logfile.h"
#include "terminal.h"
#include "bg.h"
#include "main.h"
Go to the source code of this file.
Defines | |
#define | _POSIX_SOURCE 1 |
#define | RUNMODE_NORMAL 1 |
#define | RUNMODE_SHUTDOWN 2 |
#define | RUNMODE_RESTART 3 |
Functions | |
void | fatal (const char *errmsg) |
static void | got_bus (int z) |
static void | got_segv (int z) |
static void | got_fpe (int z) |
static void | got_term (int z) |
static void | got_quit (int z) |
static void | got_hup (int z) |
static void | print_version (void) |
static void | print_help (char *const *argv) |
static void | do_args (int argc, char **argv) |
static int | core_secondly () |
int | file_check (const char *filename) |
static int | create_userfile (void) |
static void | init_signals (void) |
static void | core_shutdown_or_restart () |
int | main (int argc, char **argv) |
int | core_init () |
int | core_restart (const char *nick) |
int | core_shutdown (int how, const char *nick, const char *reason) |
Variables | |
static const char | rcsid [] = "$Id: main.c,v 1.191 2007-11-06 00:05:40 sven Exp $" |
int | runmode = 1 |
int | backgrd = 1 |
int | make_userfile = 0 |
int | terminal_mode = 0 |
int | debug_run = 0 |
const char * | configfile = NULL |
char | pid_file [512] |
time_t | online_since |
time_t | now |
egg_timeval_t | egg_timeval_now |
int | use_stderr = 1 |
char | version [81] |
static int | lastmin = 99 |
static struct tm | nowtm |
#define RUNMODE_RESTART 3 |
Definition at line 58 of file main.c.
Referenced by core_init(), core_restart(), core_shutdown(), core_shutdown_or_restart(), main(), and terminal_shutdown().
#define RUNMODE_SHUTDOWN 2 |
int core_init | ( | ) |
Definition at line 518 of file main.c.
References backgrd, bg_begin_split(), bg_finish_split(), core_config_t::botname, botnet_set_name(), check_bind_init(), config_exists(), config_get_root(), config_get_str(), config_root, configfile, core_binds_init(), core_config, core_config_init(), core_party_init(), create_userfile(), eggdrop_init(), fatal(), help_load_by_module(), core_config_t::help_path, help_set_default_path(), core_config_t::lockfile, LOG_ALL, logfile_init(), make_userfile, module_add_dir(), module_load(), core_config_t::module_path, now, NULL, putlog(), runmode, RUNMODE_RESTART, script_load(), terminal_init(), terminal_mode, user_load(), and core_config_t::userfile.
Referenced by main().
00519 { 00520 int i; 00521 char *name; 00522 void *config_root, *entry; 00523 char datetime[25]; 00524 static int lockfd = -1; 00525 struct flock lock; 00526 00527 /* init libeggdrop */ 00528 eggdrop_init(); 00529 00530 /* load config */ 00531 if (core_config_init(configfile) != 0) 00532 return (-1); 00533 00534 /* init logging */ 00535 logfile_init(); 00536 00537 /* did the user specify -m? */ 00538 if (make_userfile) { 00539 if (create_userfile()) return(-1); 00540 make_userfile = 0; 00541 } 00542 00543 /* init background mode and pid file */ 00544 if (runmode != RUNMODE_RESTART) { 00545 if (backgrd) bg_begin_split(); 00546 } 00547 00548 /* Check lock file. */ 00549 if (core_config.lockfile && lockfd == -1) { 00550 lockfd = open(core_config.lockfile, O_WRONLY | O_CREAT, S_IWUSR); 00551 if (lockfd < 0) { 00552 fatal("Could not open lock file!"); 00553 } 00554 memset(&lock, 0, sizeof(lock)); 00555 lock.l_type = F_WRLCK; 00556 if (fcntl(lockfd, F_SETLK, &lock) != 0) { 00557 fatal("Lock file is already locked! Is eggdrop already running?"); 00558 } 00559 } 00560 00561 /* just issue this "Loading Eggdrop" message if we are not 00562 * restarting */ 00563 if (runmode != RUNMODE_RESTART) { 00564 strlcpy(datetime, ctime(&now), sizeof(datetime)); 00565 strcpy(&datetime[11], &datetime[20]); 00566 putlog(LOG_ALL, "*", "Loading Eggdrop %s (%s)", VERSION, datetime); 00567 } 00568 00569 /* load userlist */ 00570 if (core_config.userfile) 00571 user_load(core_config.userfile); 00572 00573 /* init core bindings */ 00574 core_binds_init(); 00575 00576 /* init core partyline */ 00577 core_party_init(); 00578 00579 /* Load core help */ 00580 help_load_by_module ("core"); 00581 00582 /* Put the module directory in the ltdl search path. */ 00583 if (core_config.module_path) module_add_dir(core_config.module_path); 00584 00585 /* Set a botname. */ 00586 if (core_config.botname) botnet_set_name(core_config.botname); 00587 00588 /* Initialize help system. */ 00589 if (core_config.help_path) { 00590 help_set_default_path(core_config.help_path); 00591 /* Load all help files here... */ 00592 } 00593 00594 /* Scan the autoload section of config. */ 00595 config_root = config_get_root("eggdrop"); 00596 for (i = 0; (entry = config_exists(config_root, "eggdrop", 0, "autoload", 0, "module", i, NULL)); i++) { 00597 name = NULL; 00598 config_get_str(&name, entry, NULL); 00599 module_load(name); 00600 /* For now we'll just load these help files... */ 00601 help_load_by_module(name); 00602 } 00603 for (i = 0; (entry = config_exists(config_root, "eggdrop", 0, "autoload", 0, "script", i, NULL)); i++) { 00604 name = NULL; 00605 config_get_str(&name, entry, NULL); 00606 script_load(name); 00607 } 00608 00609 /* notify init listeners */ 00610 check_bind_init(); 00611 00612 /* start terminal */ 00613 if (runmode != RUNMODE_RESTART) { 00614 if (backgrd) bg_finish_split(); 00615 } 00616 if (terminal_mode) terminal_init(); 00617 00618 return (0); 00619 }
int core_restart | ( | const char * | nick | ) |
Definition at line 621 of file main.c.
References LOG_MISC, putlog(), runmode, and RUNMODE_RESTART.
Referenced by party_restart().
00622 { 00623 putlog(LOG_MISC, "*", "Restarting..."); 00624 runmode = RUNMODE_RESTART; 00625 return (0); 00626 }
static int core_secondly | ( | ) | [static] |
Definition at line 212 of file main.c.
References _, botnet_autolink(), check_bind_secondly(), check_bind_time(), eggdrop_event(), lastmin, LOG_ALL, LOG_DEBUG, LOG_MISC, now, nowtm, and putlog().
Referenced by main().
00213 { 00214 static int cnt = 0; 00215 int miltime; 00216 00217 check_bind_secondly(); 00218 cnt++; 00219 memcpy(&nowtm, localtime(&now), sizeof(struct tm)); 00220 if (nowtm.tm_min != lastmin) { 00221 int i = 0; 00222 00223 /* Once a minute */ 00224 lastmin = (lastmin + 1) % 60; 00225 eggdrop_event("minutely"); 00226 check_bind_time(&nowtm); 00227 /* In case for some reason more than 1 min has passed: */ 00228 while (nowtm.tm_min != lastmin) { 00229 /* Timer drift, dammit */ 00230 putlog(LOG_DEBUG, "*", "timer: drift (lastmin=%d, now=%d)", lastmin, nowtm.tm_min); 00231 i++; 00232 lastmin = (lastmin + 1) % 60; 00233 eggdrop_event("minutely"); 00234 } 00235 if (i > 1) putlog(LOG_MISC, "*", _("Warning: timer drift (%d minutes)."), i); 00236 00237 miltime = (nowtm.tm_hour * 100) + (nowtm.tm_min); 00238 if (nowtm.tm_min % 5 == 0) { 00239 eggdrop_event("5minutely"); 00240 botnet_autolink(); 00241 } 00242 if (nowtm.tm_min == 0) eggdrop_event("hourly"); 00243 if (!miltime) { /* At midnight */ 00244 char s[25]; 00245 00246 strlcpy(s, ctime(&now), sizeof s); 00247 putlog(LOG_ALL, "*", "--- %.11s%s", s, s + 20); 00248 eggdrop_event("backup"); 00249 eggdrop_event("daily"); 00250 } 00251 } 00252 return(0); 00253 }
int core_shutdown | ( | int | how, | |
const char * | nick, | |||
const char * | reason | |||
) |
Definition at line 628 of file main.c.
References _, BIND_RET_LOG, core_shutdown_or_restart(), LOG_MISC, putlog(), runmode, RUNMODE_RESTART, RUNMODE_SHUTDOWN, SHUTDOWN_GRACEFULL, SHUTDOWN_HARD, SHUTDOWN_RESTART, and SHUTDOWN_SIGTERM.
Referenced by got_term(), and party_die().
00629 { 00630 if (how == SHUTDOWN_SIGTERM) 00631 putlog(LOG_MISC, "*", ("Received TERM signal, shutting down.")); 00632 else if (how != SHUTDOWN_RESTART) 00633 putlog(LOG_MISC, "*", ("Shutdown requested by %s: %s"), nick, 00634 (reason) ? reason : _("No reason")); 00635 00636 /* check how to shut down */ 00637 switch (how) { 00638 00639 case (SHUTDOWN_RESTART): 00640 runmode = RUNMODE_RESTART; 00641 break; 00642 00643 case (SHUTDOWN_GRACEFULL): 00644 runmode = RUNMODE_SHUTDOWN; 00645 break; 00646 00647 /* These two cases are treaded special because something 00648 * unusual happened and we're better off if we exit() NOW 00649 * than doing a gracefull shutdown with freeing all 00650 * memory, closing all sockets, ... */ 00651 case (SHUTDOWN_HARD): 00652 case (SHUTDOWN_SIGTERM): 00653 runmode = RUNMODE_SHUTDOWN; 00654 core_shutdown_or_restart(); 00655 exit(0); 00656 break; 00657 00658 } 00659 00660 return BIND_RET_LOG; 00661 }
static void core_shutdown_or_restart | ( | ) | [static] |
Definition at line 351 of file main.c.
References _, check_bind_shutdown(), core_binds_shutdown(), core_config, core_config_save(), eggdrop_shutdown(), garbage_run(), LOG_MISC, logfile_shutdown(), pid_file, putlog(), runmode, RUNMODE_RESTART, terminal_mode, terminal_shutdown(), user_save(), and core_config_t::userfile.
Referenced by core_shutdown(), and main().
00352 { 00353 /* notifiy shutdown listeners */ 00354 check_bind_shutdown(); 00355 00356 putlog(LOG_MISC, "*", _("Saving user file...")); 00357 user_save(core_config.userfile); 00358 00359 /* destroy terminal */ 00360 if (terminal_mode) 00361 terminal_shutdown(runmode); 00362 00363 /* unload core help */ 00364 //help_unload_by_module("core"); 00365 00366 /* shutdown core binds */ 00367 core_binds_shutdown(); 00368 00369 /* shutdown logging */ 00370 logfile_shutdown(); 00371 00372 putlog(LOG_MISC, "*", _("Saving config file...")); 00373 core_config_save(); 00374 00375 /* shutdown libeggdrop */ 00376 eggdrop_shutdown(); 00377 00378 /* force a garbage run */ 00379 garbage_run(); 00380 00381 /* just remove pid file if didn't restart */ 00382 if (runmode != RUNMODE_RESTART) 00383 unlink(pid_file); 00384 }
static int create_userfile | ( | void | ) | [static] |
Definition at line 268 of file main.c.
References core_config, core_config_save(), NULL, core_config_t::owner, owner, str_redup(), user_count(), user_new(), user_rand_pass(), user_save(), user_set_flags_str(), user_set_pass(), and core_config_t::userfile.
Referenced by core_init().
00269 { 00270 user_t *owner; 00271 char handle[512], password[12]; 00272 int len; 00273 00274 printf("\n"); 00275 if (user_count() != 0) { 00276 printf("You are trying to create a new userfile, but the old one still exists (%s)!\n", core_config.userfile); 00277 printf("Please remove the userfile, or do not pass the -m option.\n\n"); 00278 return(-1); 00279 } 00280 00281 printf("Hello! I see you are creating a new userfile.\n\n"); 00282 printf("Let's create the owner account.\n\n"); 00283 do { 00284 printf("Enter the owner handle: "); 00285 fflush(stdout); 00286 fgets(handle, sizeof(handle), stdin); 00287 for (len = 0; handle[len]; len++) { 00288 if (!ispunct(handle[len]) && !isalnum(handle[len])) break; 00289 } 00290 if (len == 0) printf("Come on, enter a real handle.\n\n"); 00291 } while (len <= 0); 00292 handle[len] = 0; 00293 00294 owner = user_new(handle); 00295 if (!owner) { 00296 printf("Failed to create user record! Out of memory?\n\n"); 00297 return(-1); 00298 } 00299 00300 user_rand_pass(password, sizeof(password)); 00301 user_set_pass(owner, password); 00302 user_set_flags_str(owner, NULL, "+n"); 00303 printf("Your owner handle is '%s' and your password is '%s' (without the quotes).\n\n", handle, password); 00304 memset(password, 0, sizeof(password)); 00305 str_redup(&core_config.owner, handle); 00306 core_config_save(); 00307 user_save(core_config.userfile); 00308 00309 return(0); 00310 }
static void do_args | ( | int | argc, | |
char ** | argv | |||
) | [static] |
Definition at line 146 of file main.c.
References _, backgrd, configfile, debug_run, eggdrop_set_params(), make_userfile, NULL, print_help(), print_version(), and terminal_mode.
Referenced by main().
00147 { 00148 int c; 00149 00150 optarg = 0; 00151 optind = 1; 00152 opterr = 1; 00153 optopt = '?'; 00154 00155 while (1) { 00156 int option_index = 0; 00157 00158 static struct option long_options[] = { 00159 { "help", 0, NULL, 'h' }, 00160 { "version", 0, NULL, 'v' }, 00161 { "load-module", 1, NULL, 'p' }, 00162 { "foreground", 0, NULL, 'n' }, 00163 { "terminal", 0, NULL, 't' }, 00164 { "make-userfile", 0, NULL, 'm' }, 00165 { "debug", 0, NULL, 'd' }, 00166 {NULL, 0, NULL, 0} 00167 }; 00168 00169 c = getopt_long(argc, argv, "hvp:nctmd", long_options, &option_index); 00170 if (c == -1) break; 00171 switch (c) { 00172 case 'n': 00173 backgrd = 0; 00174 break; 00175 case 't': 00176 terminal_mode = 1; 00177 break; 00178 case 'm': 00179 make_userfile = 1; 00180 break; 00181 case 'd': 00182 backgrd = 0; 00183 debug_run = 1; 00184 break; 00185 case 'v': 00186 print_version(); 00187 exit(0); 00188 break; /* this should never be reached */ 00189 case 'h': 00190 print_help(argv); 00191 exit(0); 00192 break; /* this should never be reached */ 00193 case 0: /* Long option with no short option */ 00194 case '?': /* Invalid option. */ 00195 /* getopt_long() already printed an error message. */ 00196 exit(1); 00197 default: /* bug: option not considered. */ 00198 fprintf(stderr, _("%s: option unknown: %c\n"), argv[0], c); 00199 exit(1); 00200 break; /* this should never be reached */ 00201 } 00202 } 00203 if (optind < argc) { 00204 configfile = argv[optind++]; 00205 eggdrop_set_params((const char **)&argv[optind], argc-optind); 00206 } 00207 else configfile = "config.xml"; 00208 }
void fatal | ( | const char * | errmsg | ) |
Definition at line 82 of file main.c.
References flushlogs(), LOG_MISC, and putlog().
Referenced by bg_begin_split(), core_init(), got_bus(), got_fpe(), and got_segv().
int file_check | ( | const char * | filename | ) |
static void got_bus | ( | int | z | ) | [static] |
Definition at line 89 of file main.c.
References fatal().
Referenced by init_signals().
00090 { 00091 fatal("BUS ERROR."); 00092 }
static void got_fpe | ( | int | z | ) | [static] |
Definition at line 99 of file main.c.
References fatal().
Referenced by init_signals().
00100 { 00101 fatal("FLOATING POINT ERROR."); 00102 }
static void got_hup | ( | int | z | ) | [static] |
Definition at line 118 of file main.c.
References _, eggdrop_event(), LOG_MISC, and putlog().
Referenced by init_signals().
00119 { 00120 eggdrop_event("sighup"); 00121 putlog(LOG_MISC, "*", _("Received HUP signal (ignoring).")); 00122 return; 00123 }
static void got_quit | ( | int | z | ) | [static] |
Definition at line 111 of file main.c.
References _, eggdrop_event(), LOG_MISC, and putlog().
Referenced by init_signals().
00112 { 00113 eggdrop_event("sigquit"); 00114 putlog(LOG_MISC, "*", _("Received QUIT signal (ignoring).")); 00115 return; 00116 }
static void got_segv | ( | int | z | ) | [static] |
Definition at line 94 of file main.c.
References fatal().
Referenced by init_signals().
00095 { 00096 fatal("SEGMENT VIOLATION."); 00097 }
static void got_term | ( | int | z | ) | [static] |
Definition at line 104 of file main.c.
References _, core_config, core_shutdown(), core_config_t::die_on_sigterm, eggdrop_event(), LOG_MISC, NULL, putlog(), and SHUTDOWN_SIGTERM.
Referenced by init_signals().
00105 { 00106 eggdrop_event("sigterm"); 00107 if (core_config.die_on_sigterm) core_shutdown(SHUTDOWN_SIGTERM, NULL, NULL); 00108 else putlog(LOG_MISC, "*", _("Received TERM signal (ignoring).")); 00109 }
static void init_signals | ( | void | ) | [static] |
Definition at line 312 of file main.c.
References got_bus(), got_fpe(), got_hup(), got_quit(), got_segv(), got_term(), and NULL.
Referenced by main().
00313 { 00314 struct sigaction sv; 00315 00316 00317 sv.sa_handler = got_bus; 00318 sigemptyset(&sv.sa_mask); 00319 #ifdef SA_RESETHAND 00320 sv.sa_flags = SA_RESETHAND; 00321 #else 00322 sv.sa_flags = 0; 00323 #endif 00324 sigaction(SIGBUS, &sv, NULL); 00325 00326 sv.sa_handler = got_segv; 00327 //sigaction(SIGSEGV, &sv, NULL); 00328 #ifdef SA_RESETHAND 00329 sv.sa_flags = 0; 00330 #endif 00331 00332 sv.sa_handler = got_fpe; 00333 sigaction(SIGFPE, &sv, NULL); 00334 00335 sv.sa_handler = got_term; 00336 sigaction(SIGTERM, &sv, NULL); 00337 00338 sv.sa_handler = got_hup; 00339 sigaction(SIGHUP, &sv, NULL); 00340 00341 sv.sa_handler = got_quit; 00342 sigaction(SIGQUIT, &sv, NULL); 00343 00344 sv.sa_handler = SIG_IGN; 00345 sigaction(SIGPIPE, &sv, NULL); 00346 00347 sv.sa_handler = SIG_IGN; 00348 sigaction(SIGUSR1, &sv, NULL); 00349 }
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 386 of file main.c.
References botnet_autolink(), configfile, core_init(), core_secondly(), core_shutdown_or_restart(), debug_run, do_args(), file_check(), garbage_run(), init_flag_map(), init_signals(), lastmin, LOG_DEBUG, now, nowtm, NULL, online_since, putlog(), runmode, RUNMODE_NORMAL, RUNMODE_RESTART, egg_timeval::sec, sockbuf_update_all(), timer_create_repeater, timer_destroy(), timer_get_shortest(), timer_run(), timer_update_now(), egg_timeval::usec, and version.
00387 { 00388 int timeout; 00389 00390 #ifdef DEBUG 00391 { 00392 # include <sys/resource.h> 00393 struct rlimit cdlim; 00394 00395 cdlim.rlim_cur = RLIM_INFINITY; 00396 cdlim.rlim_max = RLIM_INFINITY; 00397 setrlimit(RLIMIT_CORE, &cdlim); 00398 } 00399 #endif 00400 00401 init_signals(); 00402 00403 #ifdef ENABLE_NLS 00404 setlocale(LC_MESSAGES, ""); 00405 bindtextdomain(PACKAGE, LOCALEDIR); 00406 textdomain(PACKAGE); 00407 #endif 00408 00409 /* Initialize ltdl. */ 00410 LTDL_SET_PRELOADED_SYMBOLS(); 00411 if (lt_dlinit()) { 00412 printf("Fatal error initializing ltdl: %s\n", lt_dlerror()); 00413 return(-1); 00414 } 00415 00416 snprintf(version, sizeof version, "Eggdrop v%s (C) 1997 Robey Pointer (C) 2004 Eggheads Development Team", VERSION); 00417 00418 #ifdef STOP_UAC 00419 { 00420 int nvpair[2]; 00421 00422 nvpair[0] = SSIN_UACPROC; 00423 nvpair[1] = UAC_NOPRINT; 00424 setsysinfo(SSI_NVPAIRS, (char *) nvpair, 1, NULL, 0); 00425 } 00426 #endif 00427 00428 timer_update_now(&egg_timeval_now); 00429 now = egg_timeval_now.sec; 00430 memcpy(&nowtm, localtime(&now), sizeof(struct tm)); 00431 lastmin = nowtm.tm_min; 00432 00433 srandom(now % (getpid() + getppid())); 00434 00435 do_args(argc, argv); 00436 printf("\n%s\n", version); 00437 printf("WARNING: Do NOT run this DEVELOPMENT version for any purpose other than testing.\n\n"); 00438 00439 /* we may not run as root */ 00440 if (((int) getuid() == 0) || ((int) geteuid() == 0)) { 00441 fprintf(stderr, "ERROR\n"); 00442 fprintf(stderr, "\tEggdrop will not run as root!\n\n"); 00443 return -1; 00444 } 00445 00446 init_flag_map(); 00447 00448 /* config file may not be world read/writeable */ 00449 if (file_check(configfile)) { 00450 fprintf(stderr, "ERROR\n"); 00451 if (errno) { 00452 fprintf(stderr, "\tFailed to load config file '%s': %s\n\n", configfile, strerror(errno)); 00453 } else { 00454 fprintf(stderr, "\tCheck file permissions on your config file '%s'!\n", configfile); 00455 fprintf(stderr, "\tMake sure other groups and users cannot read/write it.\n\n"); 00456 } 00457 return -1; 00458 } 00459 00460 /* set uptime */ 00461 online_since = now; 00462 00463 do { 00464 int tid; 00465 egg_timeval_t howlong; 00466 00467 /* default select timeout is 1 sec */ 00468 howlong.sec = 1; 00469 howlong.usec = 0; 00470 00471 tid = timer_create_repeater(&howlong, "main loop", core_secondly); 00472 00473 /* init core */ 00474 if (core_init() != 0) 00475 break; 00476 00477 /* set normal running mode */ 00478 runmode = RUNMODE_NORMAL; 00479 00480 /* try to link other bots */ 00481 botnet_autolink(); 00482 00483 putlog(LOG_DEBUG, "*", "Entering main loop."); 00484 00485 /* main loop */ 00486 while (!debug_run && runmode == RUNMODE_NORMAL) { 00487 /* Update the time. */ 00488 timer_update_now(&egg_timeval_now); 00489 now = egg_timeval_now.sec; 00490 00491 /* Run any expired timers. */ 00492 timer_run(); 00493 00494 /* Figure out how long to wait for activity. */ 00495 if (timer_get_shortest(&howlong)) timeout = 1000; 00496 else timeout = howlong.sec * 1000 + howlong.usec / 1000; 00497 00498 /* Wait and monitor sockets. */ 00499 sockbuf_update_all(timeout); 00500 00501 /* Run any scheduled cleanups. */ 00502 garbage_run(); 00503 } 00504 00505 /* shutdown secondly timer */ 00506 timer_destroy(tid); 00507 00508 /* Save user file, config file, ... */ 00509 core_shutdown_or_restart(); 00510 00511 /* the only chance to loop again is that running = 2, meaning 00512 we have a restart */ 00513 } while (runmode == RUNMODE_RESTART); 00514 00515 return 0; 00516 }
static void print_help | ( | char *const * | argv | ) | [static] |
Definition at line 130 of file main.c.
References _, and print_version().
Referenced by do_args().
00131 { 00132 print_version(); 00133 printf(_("\nUsage: %s [OPTIONS]... [FILE]\n"), argv[0]); 00134 printf(_("\n\ 00135 -h, --help Print help and exit\n\ 00136 -v, --version Print version and exit\n\ 00137 -n, --foreground Don't go into the background (default=off)\n\ 00138 -c --channel-stats (with -n) Display channel stats every 10 seconds\n\ 00139 -t --terminal (with -n) Use terminal to simulate dcc-chat\n\ 00140 -m --make-userfile Userfile creation mode\n\ 00141 -d --debug Do a debugging dry-run\n\ 00142 FILE optional config filename (default 'config.xml')\n")); 00143 printf("\n"); 00144 }
static void print_version | ( | void | ) | [static] |
int backgrd = 1 |
const char* configfile = NULL |
Definition at line 68 of file main.c.
Referenced by core_config_save(), core_init(), do_args(), and main().
int lastmin = 99 [static] |
int make_userfile = 0 |
time_t now |
Definition at line 72 of file main.c.
Referenced by chanserv_update_stats(), check_expired_bans(), check_expired_exempts(), check_expired_invites(), cleanup_old_members(), cmd_files(), cmd_mkdir(), cmd_pls_mask(), core_init(), core_secondly(), date_timezone(), dcc_files(), dcc_files_pass(), dcc_send_info(), disp_dcc_files_pass(), display_ban(), display_exempt(), display_invite(), filedb_add(), filedb_initdb(), filedb_open(), filedb_timestamp(), filedb_update(), filesys_DCC_CHAT(), filesys_dcc_send_hostresolved(), gotpong(), logfile_cycle(), logfile_minutely(), main(), modefight_cleanup(), NamedDay(), NamedMonth(), on_putlog(), party_timers(), raw_dcc_resend_send(), script_newsomething(), script_setlaston(), script_timer_info(), server_secondly(), tcl_mkdir(), tell_bans(), tell_exempts(), tell_invites(), u_addmask(), and write_channels().
struct tm nowtm [static] |
Definition at line 80 of file main.c.
Referenced by core_secondly(), logfile_minutely(), and main().
time_t online_since |
Definition at line 71 of file main.c.
Referenced by init_uptime(), main(), send_uptime(), and uptime_set_send().
char pid_file[512] |
const char rcsid[] = "$Id: main.c,v 1.191 2007-11-06 00:05:40 sven Exp $" [static] |
int runmode = 1 |
Definition at line 60 of file main.c.
Referenced by core_init(), core_restart(), core_shutdown(), core_shutdown_or_restart(), and main().
int terminal_mode = 0 |
Definition at line 63 of file main.c.
Referenced by core_init(), core_shutdown_or_restart(), do_args(), and on_putlog().
int use_stderr = 1 |
char version[81] |
Definition at line 77 of file main.c.
Referenced by got_nlinked(), main(), on_new_bot(), and print_version().