void check_pfiles( time_t reset ) { /* * This only counts them up on reboot if the cleanup isn't needed - Samson 1-2-00 */ if( reset == 255 && new_pfile_time_t > current_time ) { reset = 0; /* Call me paranoid, but it might be meaningful later on */ log_string( "Counting pfiles....." ); pfile_scan( TRUE ); return; } if( new_pfile_time_t <= current_time ) { if( sysdata.CLEANPFILES == TRUE ) { char buf[MSL]; /* * Makes a backup copy of existing pfiles just in case - Samson */ sprintf( buf, "tar -cf %spfiles.tar %s*", PLAYER_DIR, PLAYER_DIR ); /* * Would use the shell pipe for this, but alas, it requires a ch in order * to work, this also gets called during boot_db before the rare item * checks for the rent code - Samson */ system( buf ); new_pfile_time_t = current_time + 86400; save_timedata( ); log_string( "Automated pfile cleanup beginning...." ); pfile_scan( FALSE ); #ifdef SAMSONRENT if( reset == 0 ) rent_update( ); #endif } else { new_pfile_time_t = current_time + 86400; save_timedata( ); log_string( "Counting pfiles....." ); pfile_scan( TRUE ); #ifdef SAMSONRENT if( reset == 0 ) rent_update( ); #endif } } return; }
void do_pfiles( CHAR_DATA * ch, char *argument ) { char buf[512]; if( IS_NPC( ch ) ) { send_to_char( "Mobs cannot use this command!\r\n", ch ); return; } if( argument[0] == '\0' || !argument ) { /* * Makes a backup copy of existing pfiles just in case - Samson */ snprintf( buf, 512, "tar -czf %spfiles.tar %s*", PLAYER_DIR, PLAYER_DIR ); /* * GAH, the shell pipe won't process the command that gets pieced * together in the preceeding lines! God only knows why. - Samson */ system( buf ); snprintf( buf, 512, "Manual pfile cleanup started by %s.", ch->name ); log_string( buf ); pfile_scan( FALSE ); #ifdef SAMSONRENT rent_update( ); #endif return; } if( !str_cmp( argument, "settime" ) ) { new_pfile_time_t = current_time + 86400; save_timedata( ); send_to_char( "New cleanup time set for 24 hrs from now.\r\n", ch ); return; } if( !str_cmp( argument, "count" ) ) { snprintf( buf, 512, "Pfile count started by %s.", ch->name ); log_string( buf ); pfile_scan( TRUE ); return; } send_to_char( "Invalid argument.\r\n", ch ); return; }
void do_pfiles( CHAR_DATA * ch, char *argument ) { char buf[MSL]; char arg1[MIL]; char x[3]; if( IS_NPC( ch ) ) { send_to_char( "Mobs cannot use this command!\n\r", ch ); return; } if ( !argument || argument[0] == '\0' ) { send_to_char( "&RSyntax: pfiles <scan/settime/count/letter/force>\n\r", ch); return; } if( !str_cmp( argument, "scan") ) { /* * Makes a backup copy of existing pfiles just in case - Samson */ sprintf( buf, "tar -cf %spfiles.tar %s*", PLAYER_DIR, PLAYER_DIR ); /* * GAH, the shell pipe won't process the command that gets pieced * together in the preceeding lines! God only knows why. - Samson */ system( buf ); sprintf( log_buf, "Manual pfile cleanup started by %s.", ch->name ); log_string( log_buf ); pfile_scan( FALSE ); return; } if( !str_cmp( argument, "settime" ) ) { new_pfile_time_t = current_time + 86400; save_timedata( ); send_to_char( "New cleanup time set for 24 hrs from now.\n\r", ch ); return; } if( !str_cmp( argument, "count" ) ) { sprintf( log_buf, "Pfile count started by %s.", ch->name ); log_string( log_buf ); pfile_scan( TRUE ); return; } argument = one_argument( argument, arg1); if ( !str_cmp( arg1, "letter" ) ) { if ( (argument[0] == '\0') || !argument ) { send_to_char("&RSyntax: pfiles letter (letter A-Z)\n\r", ch ); return; } if( !is_number( argument ) || ( argument[1] != '\0' ) ) { snprintf( x, 2, argument ); x[0] = tolower(x[0]); show_pfiles( ch, x ); } else { send_to_char("You can only use a letter in this scan!\n\r",ch); return; } return; } if ( !str_cmp( arg1, "forcers" ) ) { scan_forcers( ch ); return; } send_to_char( "Invalid argument.\n\r", ch ); return; }