Пример #1
0
DECL(int, OSDynLoad_IsModuleLoaded, char* rpl, unsigned int *handle, int r5 __attribute__((unused))) {

    int result = real_OSDynLoad_IsModuleLoaded(rpl, handle, 1);
    if ((int)bss_ptr != 0x0a000000)
    {
        char buffer[200];
        __os_snprintf(buffer, sizeof(buffer), "OSDynLoad_IsModuleLoaded: %s result %i", rpl, result);
        log_string(bss.global_sock, buffer, BYTE_LOG_STR);
    }

    return result;
}
Пример #2
0
// only for saves on sdcard
DECL(FSStatus, FSMakeDir, FSClient *pClient, FSCmdBlock *pCmd, const char *path, FSRetFlag error) {
    int client = GetCurClient(pClient);
    if (client != -1) {
        // log
        log_string(bss.socket_fs[client], path, BYTE_MAKE_DIR);

        // change path if it is a save folder
        if (is_savefile(path)) {
            int len = strlen(path);
            int len_base = (strlen(bss.save_base) + 8);
            char new_path[len + len_base + 1];
            compute_new_path(new_path, path, len, 1);

            // log new path
            log_string(bss.socket_fs[client], new_path, BYTE_LOG_STR);

            return real_FSMakeDir(pClient, pCmd, new_path, error);
        }
    }
    return real_FSMakeDir(pClient, pCmd, path, error);
}
Пример #3
0
DECL(int, OSDynLoad_GetModuleName, unsigned int *handle, char *name_buffer, int *name_buffer_size) {

    int result = real_OSDynLoad_GetModuleName(handle, name_buffer, name_buffer_size);
    if ((int)bss_ptr != 0x0a000000)
    {
        char buffer[200];
        __os_snprintf(buffer, sizeof(buffer), "OSDynLoad_GetModuleName: %s result %i", (name_buffer && result == 0) ? name_buffer : "NULL", result);
        log_string(bss.global_sock, buffer, BYTE_LOG_STR);
    }

    return result;
}
Пример #4
0
/* *****************************************************************************
 * Replacement functions
 * ****************************************************************************/
DECL(int, FSGetStat, void *pClient, void *pCmd, char *path, void *stats, int error) {
    int client = GetCurClient(pClient);
    if (client != -1) {
        // log
        log_string(bss.socket_fs[client], path, BYTE_STAT);

        // change path if it is a game file
        int is_save = 0;
        if (is_gamefile(path) || (is_save = is_savefile(path))) {
            int len = strlen(path);
            int len_base = (is_save ? (strlen(bss.save_base) + 8) : strlen(bss.mount_base));
            char new_path[len + len_base + 1];
            compute_new_path(new_path, path, len, is_save);
            log_string(bss.socket_fs[client], new_path, BYTE_LOG_STR);

            // return function with new_path if path exists
            return real_FSGetStat(pClient, pCmd, new_path, stats, error);
        }
    }
    return real_FSGetStat(pClient, pCmd, path, stats, error);
}
Пример #5
0
// only for saves on sdcard
DECL(int, FSRemoveAsync, void *pClient, void *pCmd, char *path, int error, FSAsyncParams *asyncParams) {
    int client = GetCurClient(pClient);
    if (client != -1) {
        // log
        log_string(bss.socket_fs[client], path, BYTE_REMOVE);

        // change path if it is a save folder
        if (is_savefile(path)) {
            int len = strlen(path);
            int len_base = (strlen(bss.save_base) + 8);
            char new_path[len + len_base + 1];
            compute_new_path(new_path, path, len, 1);

            // log new path
            log_string(bss.socket_fs[client], new_path, BYTE_LOG_STR);

            return real_FSRemoveAsync(pClient, pCmd, new_path, error, asyncParams);
        }
    }
    return real_FSRemoveAsync(pClient, pCmd, path, error, asyncParams);
}
Пример #6
0
DECL(int, FSOpenFile, void *pClient, void *pCmd, char *path, char *mode, int *handle, int error) {
    int client = GetCurClient(pClient);
    if (client != -1) {
        // log
        log_string(bss.socket_fs[client], path, BYTE_OPEN_FILE);

        // change path if it is a game file
        int is_save = 0;
        if (is_gamefile(path) || (is_save = is_savefile(path))) {
            int len = strlen(path);
            int len_base = (is_save ? (strlen(bss.save_base) + 8) : strlen(bss.mount_base));
            char new_path[len + len_base + 1];
            compute_new_path(new_path, path, len, is_save);
            // log new path
            log_string(bss.socket_fs[client], new_path, BYTE_LOG_STR);
            return real_FSOpenFile(pClient, pCmd, new_path, mode, handle, error);
        }
    }

    return real_FSOpenFile(pClient, pCmd, path, mode, handle, error);
}
Пример #7
0
int16_t log_printf(const char *format, ...)
{
	uint32_t len = BUFFER_EMPTY_SPACE();
	char tmp[len];
	va_list args;

	va_start(args, format);
	vsnprintf(tmp, len, format, args);
	va_end(args);

	return log_string(tmp);
}
Пример #8
0
void connect_db(void)
{
 char buf[MAX_STRING_LENGTH];
	if (!mysql_init(&db))
	{
		log_string(LOG_SQL,"connect_db: error on initialize");
		return;
	}
	mysql_options(&db,MYSQL_OPT_COMPRESS,0);
	if ((mysql_real_connect(&db, DB_HOST, DB_USER, DB_PASS,DB_DB, DB_PORT, DB_SOCKET, CLIENT_MULTI_STATEMENTS)) ==0)
	{
		log_string(LOG_SQL,"connect_db: error on connect");
		sprintf(buf,"Error: %s", mysql_error(&db));
                log_string(LOG_SQL,buf);
 		return;
	}
        db_connect = TRUE;
        db_last_action = 0;
		log_string(LOG_SQL,"SQL Database Connection Opened.");
	return;
}
Пример #9
0
void rare_update( void )
{
   DIR *dp;
   struct dirent *dentry;
   char directory_name[100];
   int adjust = 0;
   short alpha_loop;

   log_string( "Checking daily rare items for players...." );

   for( alpha_loop = 0; alpha_loop <= 25; ++alpha_loop )
   {
      snprintf( directory_name, 100, "%s%c", PLAYER_DIR, 'a' + alpha_loop );
      dp = opendir( directory_name );
      dentry = readdir( dp );
      while( dentry )
      {
         /*
          * Added by Tarl 3 Dec 02 because we are now using CVS 
          */
         if( !str_cmp( dentry->d_name, "CVS" ) )
         {
            dentry = readdir( dp );
            continue;
         }
         if( dentry->d_name[0] != '.' )
         {
            adjust = scan_pfiles( directory_name, dentry->d_name, true );
            if( adjust == 1 )
            {
               adjust_pfile( dentry->d_name );
               adjust = 0;
            }
         }
         dentry = readdir( dp );
      }
      closedir( dp );
   }
   log_string( "Daily rare item updates completed." );
}
Пример #10
0
/*
 * Big mama top level function.
 */
void boot_dbase(void) {
	{
		if ((string_space = calloc(1, MAX_STRING)) == NULL) {
			bug("Boot_dbase: can't alloc %d string space.", MAX_STRING);
			exit(1);
		}

		top_string = string_space;
		fBootDbase = TRUE;
	}

	first_banish_user = NULL;
	first_banish_site = NULL;
	last_banish_user = NULL;
	last_banish_site = NULL;

	/*
	 * Init random number generator.
	 */
	{
		init_mm();
	}

	/*
	 * Loop up the config, helps, and other files.
	 */
	{
		load_config();
		load_helps();
		fBootDbase = FALSE;
		log_string("Load_boards: Loading board and note data");
		load_boards();
		log_string("Load_banishes: Loading banish data");
		load_banishes();
		log_string("Load_validates: Loading validate data");
		load_validates();
	}

	return;
}
Пример #11
0
int		choose_and_open_database(int *fd, int ac, char **av)
{
	log_int("choosing database to open. arguments: ", ac);
	if (ac == 2)
	{
		if (open_file(fd, av[1]) == -1)
		{
			log_string("could not open database: ", av[1]);
			return (-1);
		}
	}
	else
	{
		if (open_file(fd, STANDARD_CSV) == -1)
		{
			log_string("could not open database: ", STANDARD_CSV);
			return (-1);
		}
	}
	log_simple("succesfully opened database");
	return (1);
}
Пример #12
0
void clear_notes(void) {
	NOTE_DATA *curr, *next;

	log_string("Cleaning: note_list");
	for(curr = note_list; curr; curr = next) {
		next = curr->next;
		free_note(curr);
	}
	note_list = NULL;

	log_string("Cleaning: idea_list");
	for(curr = idea_list; curr; curr = next) {
		next = curr->next;
		free_note(curr);
	}
	idea_list = NULL;

	log_string("Cleaning: penalty_list");
	for(curr = penalty_list; curr; curr = next) {
		next = curr->next;
		free_note(curr);
	}
	penalty_list = NULL;

	log_string("Cleaning: news_list");
	for(curr = news_list; curr; curr = next) {
		next = curr->next;
		free_note(curr);
	}
	news_list = NULL;

	log_string("Cleaning: changes_list");
	for(curr = changes_list; curr; curr = next) {
		next = curr->next;
		free_note(curr);
	}
	changes_list = NULL;

}
Пример #13
0
// printf function itself called by the ml_printf macro
void ml_printf(const char *format, ...)
{
	char tmp[MAX_LOGFILE_LINE_LEN*4];
	va_list args;
	
	// format the text
	va_start(args, format);
	vsprintf(tmp, format, args);
	va_end(args);
	
	// log the string including the time
	log_string(LOGFILE_MULTI_LOG, tmp, 1);
}
Пример #14
0
/***********************************************************************//**
 * @brief Generate the exposure cube(s).
 *
 * This method reads the task parameters from the parfile, sets up the
 * observation container, loops over all CTA observations in the container
 * and generates an exposure cube from the CTA observations.
 ***************************************************************************/
void ctexpcube::run(void)
{
    // If we're in debug mode then all output is also dumped on the screen
    if (logDebug()) {
        log.cout(true);
    }

    // Get task parameters
    get_parameters();

    // Warn if there are not enough energy bins
    log_string(TERSE, warn_too_few_energies(m_expcube.energies()));

    // Write input observation container into logger
    log_observations(NORMAL, m_obs, "Input observation");

    // Initialise exposure cube
    init_cube();

    // Write header into logger
    log_header1(TERSE, "Generate exposure cube");

    // Set pointer to logger dependent on chattiness
    GLog* logger = (logNormal()) ? &log : NULL;

    // Fill exposure cube
    m_expcube.fill(m_obs, logger);

    // Write exposure cube into logger
    log_string(EXPLICIT, m_expcube.print(m_chatter));

    // Optionally publish exposure cube
    if (m_publish) {
        publish();
    }

    // Return
    return;
}
Пример #15
0
void start_daemon()
{
        pid_t pid;

        snprintf (errlog, MAX_LOG_CHARS, "JASM System Monitor Starting Up... Version: %s , Build Date: %s", VERSION, buildate);
        wlogev(EV_INFO,errlog);

#ifdef DEBUG
        wlogev(EV_WARN,"You are using JASM debug build");
#endif

        pid = fork();
        switch (pid) {
        case -1:
                snprintf (errlog, MAX_LOG_CHARS, "forking error: %s\n", strerror (errno) );
                wlogev(EV_ERROR,errlog);

                openlog ("JASM", LOG_PID, LOG_DAEMON);
                syslog (LOG_ERR, "Process spawning failed!");
                closelog();
                exit (ERR_SET_PROCESS_SPAWN);
        case 0:
                break;
        default:
                exit (_EXIT_SUCCESS);
        }

        if (setsid() < 0) {
                snprintf (errlog, MAX_LOG_CHARS,"getting new sid failure: %s\n", strerror (errno) );
                wlogev(EV_ERROR,errlog);
                openlog ("JASM", LOG_PID, LOG_DAEMON);
                syslog (LOG_ERR, "Setting sid for new process failed!");
                closelog();
                exit (ERR_SET_PROCESS_BACKGROUND);
        } else {
            log_string ("[PROCESS-SID][setsid()] success");
        }

        //closes fd: stdin, stdout, stderr
        close (0);
        close (1);
        close (2);

        snprintf (errlog, MAX_LOG_CHARS,"PID: %d , Parent PID: %d", getpid(), getppid() );
        wlogev(EV_INFO,errlog);
        wlogev(EV_INFO,"JASM is now ready to get commands! :)");

        openlog ("JASM", LOG_PID, LOG_DAEMON);
        syslog (LOG_INFO, "SUCCESS! New jasm process created! READY!");
        closelog();
}
Пример #16
0
/*
 * Load helps.
 */
void load_helps(void) {
	HELP_DATA *pHelp;
	FILE *fpHelp;

	first_help = NULL;
	last_help = NULL;

	log_string("Load_helps: Loading help file");

	fclose(fpReserve);
	if (!(fpHelp = fopen(HELP_FILE, "r"))) {
		bbs_bug("Load_helps: Could not open to read %s", HELP_FILE);
		fpReserve = fopen(NULL_FILE, "r");
		return;
	}

	while ((pHelp = read_help(fpHelp)) != NULL) {
		if (!str_cmp(pHelp->keyword, "greeting1"))
			greeting1 = pHelp->text;

		if (!str_cmp(pHelp->keyword, "greeting2"))
			greeting2 = pHelp->text;

		if (!str_cmp(pHelp->keyword, "greeting4"))
			greeting4 = pHelp->text;

		if (!str_cmp(pHelp->keyword, "greeting5"))
			greeting5 = pHelp->text;

		if (!str_cmp(pHelp->keyword, "greeting6"))
			greeting6 = pHelp->text;

		LINK(pHelp, first_help, last_help);
	}

	log_string("Load_helps: Done");
	return;
}
Пример #17
0
DECL(int, FSRollbackQuotaAsync, void *pClient, void *pCmd, char *path, int error, FSAsyncParams *asyncParams) {
    int client = GetCurClient(pClient);
    if (client != -1) {
        // log
        char buffer[200];
        __os_snprintf(buffer, sizeof(buffer), "FSRollbackQuotaAsync: %s", path);
        log_string(bss.global_sock, buffer, BYTE_LOG_STR);

        // change path if it is a save folder
        if (is_savefile(path)) {
            int len = strlen(path);
            int len_base = (strlen(bss.save_base) + 8);
            char new_path[len + len_base + 1];
            compute_new_path(new_path, path, len, 1);

            // log new path
            log_string(bss.socket_fs[client], new_path, BYTE_LOG_STR);

            return real_FSRollbackQuotaAsync(pClient, pCmd, new_path, error, asyncParams);
        }
    }
    return real_FSRollbackQuotaAsync(pClient, pCmd, path, error, asyncParams);
}
Пример #18
0
/*
 * Report a bug.
 */
void bbs_bug(const char *str, ...) {
	char buf[STRING];

	strcpy(buf, "[***] BUG: ");
	{
		va_list param;

		va_start(param, str);
		vsprintf(buf + strlen(buf), str, param);
		va_end(param);
	}

	log_string(buf);
}
Пример #19
0
static void log_argv(bson *b, const char *idx, int argc, const char **argv)
{
    bson_append_start_array(b, idx);
    char index[5];

    for (int i = 0; i < argc; i++) {
        char *value = copy_ptr(&argv[i]);
        if(value != NULL) {
            ultostr(i, index, 10);
            log_string(b, index, value, copy_strlen(value));
        }
    }
    bson_append_finish_array(b);
}
Пример #20
0
void clear_materials(void) {
	MAT_TYPE *mat, *mat_next;
		
	log_string("Cleaning: mat_list");		

	for(mat = mat_list; mat; mat = mat_next) {
		mat_next = mat->next;
		
		free_mat(mat);
	}
	mat_list = NULL;
	
	return;
}
Пример #21
0
//The world list is just a file with a line-by-line list of all the areas
//in the game.
void load_world()
{
   FILE *fp;
   ITERATOR iter;
   D_AREA *area;
   char buf[MAX_BUFFER];
   
   area_loader = luaL_newstate();
   luaL_openlibs( area_loader );
   
   log_string( "Loading World" );
   
   if( ( fp = fopen( "../areas/list.are", "r" ) ) == NULL )
   {
      log_string( "FATAL ERROR: Area List (areas/list.are) does not exist!" );
      abort();
      return;
   }
   
   while( !feof( fp ) )
   {
      fgets( buf, MAX_BUFFER, fp );
      buf[strlen(buf)-1] = '\0'; //fgets includes the newline in the read, so we kill it here.
      if( !strcasecmp( buf, "END" ) )
         break;
      load_area( buf );
   }  
   fclose( fp );
   link_exits();
   
   AttachIterator( &iter, area_list );
   while( ( area = (D_AREA*)NextInList( &iter ) ) != NULL )
      reset_area( area );
   DetachIterator( &iter );
   
   return;
}
Пример #22
0
/*
 * LAG alarm!							-Thoric
 */
static void caught_alarm( int signum )
{
   echo_to_all( "&[immortal]Alas, the hideous malevalent entity known only as 'Lag' rises once more!", ECHOTAR_ALL );
   bug( "&RALARM CLOCK! In section %s", alarm_section );

   if( newdesc )
   {
      FD_CLR( newdesc, &in_set );
      FD_CLR( newdesc, &out_set );
      FD_CLR( newdesc, &exc_set );
      log_string( "clearing newdesc" );
   }

   if( fBootDb )
   {
      log_string( "Terminating program. Infinite loop detected during bootup." );
      shutdown_mud( "Infinite loop detected during bootup." );
      abort(  );
   }

   log_string( "&RPossible infinite loop detected during game operation. Restarting game_loop()." );
   signal( SIGALRM, caught_alarm ); // Have to reset the signal handler or the next hit will deadlock
   game_loop(  );

   /*
    * Clean up the loose ends. 
    */
   close_mud(  );

   /*
    * That's all, folks.
    */
   log_string( "Normal termination of game." );
   log_string( "Cleaning up Memory.&d" );
   cleanup_memory(  );
   exit( 0 );
}
Пример #23
0
void write_kingdoms(void)
{
	KINGDOM_DATA *kingdom;
	FILE *fp;
	long i;

	fclose(fpReserve);

	if((fp = fopen(KINGDOM_FILE, "w")) == 0)
	{
		log_string("Error opening kingdom.txt for writing");
		fpReserve = fopen(NULL_FILE, "r");
		return;
	}

	for(kingdom = kingdom_list; kingdom; kingdom = kingdom->next)
	{
		fprintf(fp, "KingdomID      %li\n", kingdom->id);
		fprintf(fp, "Name           %s~\n", kingdom->name);
		fprintf(fp, "Noansiname     %s~\n", kingdom->noansiname);
		fprintf(fp, "Leader         %s~\n", kingdom->leader);
		fprintf(fp, "Members        %s~\n", kingdom->members);
		fprintf(fp, "Trustees       %s~\n", kingdom->trustees);
		fprintf(fp, "Points         %li\n", kingdom->points);
		fprintf(fp, "Realpoints     %li\n", kingdom->realpoints);
		fprintf(fp, "Pks            %li\n", kingdom->pks);
		fprintf(fp, "Assists        %li\n", kingdom->assists);
		fprintf(fp, "Pds            %li\n", kingdom->pds);
		fprintf(fp, "Upkeep         %li\n", kingdom->upkeep);
		fprintf(fp, "Recall         %li\n", kingdom->recall);
		for(i = 0; kingdom->treaties[i]; i++)
			;
		fprintf(fp, "Treaties       %li", i);
		for(i = 0; kingdom->treaties[i]; i++)
			fprintf(fp, " %li", kingdom->treaties[i]);
		fprintf(fp, "\n");
		for(i = 0; kingdom->wars[i]; i++)
			;
		fprintf(fp, "Wars           %li", i);
		for(i = 0; kingdom->wars[i]; i++)
			fprintf(fp, " %li", kingdom->wars[i]);
		fprintf(fp, "\n");
		fprintf(fp, "\n\n");
	}

	fprintf(fp, "\nEnd\n\n");
	fclose(fp);
	fpReserve = fopen(NULL_FILE, "r");
}
Пример #24
0
/*
 * Loads the ban file from the system directory.
 */
void load_bans(void)
{
    FILE *fp;
    BAN_DATA *ban_last;

    if ((fp = fopen(BAN_FILE, "r")) == NULL)
    {
        global.last_boot_result = MISSING;
        log_string("STATUS: No ban file available to load in the system directory.");
        return;
    }

    ban_last = NULL;
    for (;;)
    {
        BAN_DATA *pban;
        if (feof(fp))
        {
            if (global.last_boot_result == UNKNOWN)
            {
                global.last_boot_result = SUCCESS;
            }

            fclose(fp);
            return;
        }

        pban = new_ban();

        pban->name = str_dup(fread_word(fp));
        pban->level = fread_number(fp);
        pban->ban_flags = fread_flag(fp);
        fread_to_eol(fp);

        if (ban_list == NULL)
        {
            ban_list = pban;
        }
        else
        {
            ban_last->next = pban;
        }
        ban_last = pban;
    }

    if (global.last_boot_result == UNKNOWN)
        global.last_boot_result = SUCCESS;

} // end load_bans
int do_hash_padding( __in char* sz_key, __in byte* hex_in, 
					 __in int n_in_len, __out char** sz_hash )
{
	
    char sz_module[FX_RSA_MODULE_LEN+1] = {0};
    char sz_exponent[FX_RSA_EXPNONT_LEN+1] = {0};
	
	int ret = 0, flen = 0;
    BIGNUM *bnn, *bne;
	byte* out;
	RSA *r = NULL;

	/*
	 *	get the value of module/exponent from sz_key
	 */
	
	memcpy( sz_module, sz_key, FX_RSA_MODULE_LEN );
	memcpy( sz_exponent, sz_key + FX_RSA_MODULE_LEN, FX_RSA_EXPNONT_LEN );
	
	/*
	 *	do hash 
	 */
	
	bnn = BN_new();
	bne = BN_new();
	
	BN_hex2bn(&bnn, sz_module);
	BN_hex2bn(&bne, sz_exponent);
	
	r = RSA_new();
	r->n = bnn;
	r->e = bne;
	r->d = NULL;
	
    flen = RSA_size(r);
	out = (byte*)malloc( flen );
	memset( out, 0, flen );

	ret = RSA_public_encrypt( n_in_len, hex_in, out, r, RSA_PKCS1_PADDING );
	if (ret < 0)
	{
		printf("Encrypt failed!\n");
		log_string( "Encrypt failed!" );
		return FX_ERROR_UNKOWN;
    }

	return byte_2_hex_str( out, sz_hash, ret );
		
}
int		simple_grade_format_is_valid(char *grade, int line_number)
{
	int		grade_int;

	log_string("starting simple grade format validation: ", grade);
	grade_int = ft_atoi(grade);
	if (grade_int < 0 || grade_int > 10)
	{
		log_simple("simple grade format validation ended unsuccesfully");
		print_error_message("Grade is not in the 0-10 range.", line_number);
		return (0);
	}
	log_simple("simple grade format validation ended succesfully");
	return (1);
}
Пример #27
0
DECL(int, FSGetFreeSpaceSize, void *pClient, void *pCmd, char *path, uint64_t *returnedFreeSize, int error) {
    int client = GetCurClient(pClient);
    if (client != -1) {
        // log
        //log_string(bss.socket_fs[client], path, BYTE_REMOVE);
        char buffer[200];
        __os_snprintf(buffer, sizeof(buffer), "FSGetFreeSpaceSize: %s", path);
        log_string(bss.global_sock, buffer, BYTE_LOG_STR);

        // change path if it is a save folder
        if (is_savefile(path)) {
            int len = strlen(path);
            int len_base = (strlen(bss.save_base) + 8);
            char new_path[len + len_base + 1];
            compute_new_path(new_path, path, len, 1);

            // log new path
            log_string(bss.socket_fs[client], new_path, BYTE_LOG_STR);

            return real_FSGetFreeSpaceSize(pClient, pCmd, new_path, returnedFreeSize, error);
        }
    }
    return real_FSGetFreeSpaceSize(pClient, pCmd, path, returnedFreeSize, error);
}
Пример #28
0
/* usun arty ktorym uplynela zywotnosc z postaci o imieniu name */
void remove_artefact_art_destroy( char *name )
{
    CHAR_DATA * ch;
    ch = load_char_remote( name );
    /* je¿eli 'ch' nie istnieje */
    if ( !ch )
    {
        char buf[MSL];
        sprintf(buf, "%s: brak pliku postaci %s", __func__, name );
        log_string( buf );
        return;
    }
    save_char_obj( ch, FALSE, TRUE );
    free_char( ch );
}
Пример #29
0
static void SegVio( int signum )
{
   bug( "%s", "}RSEGMENTATION FAULT: Invalid Memory Access&D" );
   log_string( lastplayercmd );

   if( !pclist.empty(  ) )
   {
      list < char_data * >::iterator ich;
      for( ich = pclist.begin(  ); ich != pclist.end(  ); ++ich )
      {
         char_data *ch = *ich;

         if( ch && ch->name && ch->in_room )
            log_printf( "%-20s in room: %d", ch->name, ch->in_room->vnum );
      }
   }

   if( sigsegv == true )
      abort(  );
   else
      sigsegv = true;

   ++crash_count;

   signal( SIGSEGV, SegVio ); // Have to reset the signal handler or the next one raised will crash
   game_loop(  );

   // Clean up the loose ends... hey wait... why is this here? Because: When game_loop returns now, it will come here instead of main()
   close_mud(  );

   // That's all, folks.
   log_string( "Normal termination of game." );
   log_string( "Cleaning up Memory.&d" );
   cleanup_memory(  );
   exit( 0 );
}
Пример #30
0
void load_bounties(  )
{
   FILE *fpList;
   char *target;
   char bountylist[256];
   BOUNTY_DATA *bounty;
   long int amount;

   first_disintegration = NULL;
   last_disintegration = NULL;

   log_string( "Loading disintegrations..." );

   sprintf( bountylist, "%s%s", SYSTEM_DIR, disintegration_LIST );
   if( ( fpList = fopen( bountylist, "r" ) ) == NULL )
   {
      perror( bountylist );
      exit( 1 );
   }

   for( ;; )
   {
      target = feof( fpList ) ? "$" : fread_word( fpList );
      if( target[0] == '$' )
         break;
      CREATE( bounty, BOUNTY_DATA, 1 );
      LINK( bounty, first_disintegration, last_disintegration, next, prev );
      bounty->target = STRALLOC( target );
      amount = fread_number( fpList );
      bounty->amount = amount;
   }
   fclose( fpList );
   log_string( " Done bounties " );

   return;
}