Ejemplo n.º 1
0
int main(int argc, char **argv)
{
#ifdef MEM_DEBUG
	dmalloc_debug(0x1df47dfb);
#endif
	*socket_path = 0;
	strcpy(attach_ttyname, ttyname(0));
	init_socketpath();
	parse_args(argc, argv);
        chdir(getenv("HOME"));
	reattach_tty(old_tty, old_pass);
	return 0;
}
Ejemplo n.º 2
0
Archivo: client.c Proyecto: jpmuga/bird
int
main(int argc, char **argv)
{
#ifdef HAVE_LIBDMALLOC
  if (!getenv("DMALLOC_OPTIONS"))
    dmalloc_debug(0x2f03d00);
#endif

  interactive = isatty(0);
  parse_args(argc, argv);
  cmd_build_tree();
  server_connect();
  select_loop();
  return 0;
}
Ejemplo n.º 3
0
static void l2tp_init(void)
{
    l2tp_log(LOG_INFO, "started");
#ifdef L2TP_DMALLOC
    /* dmalloc debug options are set in the environment. However,
     * certain options cause problems to this application. We
     * therefore ensure that the troublesome options are disabled,
     * regardless of the user's settings.  The disabled options
     * are: alloc-blank, free-blank, force-linear.  If these
     * options are enabled, it causes strange problems in the
     * generated RPC code.
     */
    dmalloc_debug(dmalloc_debug_current() & 0xff5dffff);
    l2tp_dmalloc_mark = dmalloc_mark();
    if (getenv("DMALLOC_OPTIONS") != NULL) {
        l2tp_log(LOG_WARNING, "DMALLOC debugging enabled");
    }
#endif
    l2tp_my_pid = getpid();

    atexit(l2tp_cleanup);
    L2TP_DEBUG(L2TP_FUNC, "%s (%s %s): trace flags = %08lx", __FUNCTION__, __DATE__, __TIME__, l2tp_opt_trace_flags);
    usl_set_debug(l2tp_opt_debug, l2tp_system_log);

    usl_signal_terminate_hook = l2tp_die;
    usl_signal_init();
    usl_fd_init();
    usl_timer_init();
    usl_pid_init();
    l2tp_net_init();

    l2tp_rand_fd = open("/dev/random", O_RDONLY);
    if (l2tp_rand_fd < 0) {
        fprintf(stderr, "No /dev/random device found. Exiting.\n");
        exit(1);
    }

    usl_signal_notifier_add(l2tp_signal_handler, NULL);

    l2tp_avp_init();
    l2tp_peer_init();
    l2tp_api_init();
    l2tp_xprt_init();
    l2tp_tunnel_init();
    l2tp_session_init();
    l2tp_ppp_init();
}
Ejemplo n.º 4
0
int main(int argc, char *argv[])
{
  FILE *fp;

#if USING_DMALLOC
  dmalloc_debug(1);
#endif

	/* start the clock (which is used by the Logit fnc) */
  (void) refetch_ticker();
  GetArgs(argc, argv);
  if (conf_file_read(confname)) {
    Logit("Failed to read config file \"%s\"", confname);
    strcpy(confname, "./nngs.cnf");
    conf_file_write(confname);
    Logit("Created \"%s\"", confname);
  }
  Logit("Starting %s (%s %s) From: %s"
  , conffile.version_string, conffile.compile_date, conffile.compile_time, confname);
  if (daemonise()) {
    Logit("Failed to daemonise, giving up");
    main_exit(1);
  }
  conf_file_write("written.cnf");
  signal(SIGTERM, TerminateServer);
  signal(SIGINT, TerminateServer);
#if 0
  signal(SIGPIPE, SIG_IGN);
#else
  signal(SIGPIPE, BrokenPipe);
#endif
  signal(SIGCHLD, reapchild);
  mink_init();
  startuptime = time(NULL);
  srand(startuptime);
  read_ban_ip_list();
  if (!all_the_internets() ) {
    fprintf(stderr, "Network initialize failed on ports %s.\n"
    , conffile.server_ports);
    main_exit(1);
  }
  player_high = 0;
  game_high = 0;
  bytes_sent = 0;
  bytes_received = 0;

#ifdef SGI
  /*mallopt(100, 1);*/  /* Turn on malloc(3X) debugging (Irix only) */
#endif
  command_init();
  EmoteInit(conffile.emotes_file);
  help_init();
  /*Logit("commands_init()");*/
  commands_init();
  /*Logit("channel_init()");*/
  channel_init();
  /*Logit("player_array_init()");*/
  player_array_init();
  player_init();
  ladder_init(NUM_LADDERS);
  Ladder9 = ladder_new(LADDERSIZE);
  Ladder19 = ladder_new(LADDERSIZE);

  completed_games = 0;
  num_logins = num_logouts = new_players = 0;

  num_9 = 0;
  fp = xyfopen(FILENAME_LADDER9, "r");
  if (fp) {
    num_9 = ladder_load(fp, Ladder9);
    Logit("%d players loaded from file %s", num_9, filename() );
    fclose(fp);
  }

  num_19 = 0;
  fp = xyfopen(FILENAME_LADDER19, "r");
  if (fp) {
    num_19 = ladder_load(fp, Ladder19);
    Logit("%d players loaded from file %s", num_19, filename() );
    fclose(fp);
  }

  /* mink_init();*/
  if (conffile.admin_name) create_admin_account(conffile.admin_name );
  Logit("Server up and running.");
  main_event_loop();
  Logit("Closing down.");
  net_closeAll();
  main_exit(0);
  return 0;
}