#include "copyright.h"#include "autoconf.h"#include "config.h"#include "externs.h"#include <sys/stat.h>#include <signal.h>#include "attrs.h"#include "command.h"#include "functions.h"#include "comsys.h"#include "file_c.h"#include "mguests.h"#include "muxcli.h"#include "pcre.h"#include "powers.h"#include "help.h"Include dependency graph for game.cpp:

Go to the source code of this file.
Data Structures | |
| struct | DUMP_PROCEDURE |
Defines | |
| #define | POPEN_READ_OP "r" |
| #define | POPEN_WRITE_OP "w" |
| #define | LOAD_GAME_SUCCESS 0 |
| #define | LOAD_GAME_NO_INPUT_DB (-1) |
| #define | LOAD_GAME_CANNOT_OPEN (-2) |
| #define | LOAD_GAME_LOADING_PROBLEM (-3) |
| #define | CLI_DO_CONFIG_FILE CLI_USER+0 |
| #define | CLI_DO_MINIMAL CLI_USER+1 |
| #define | CLI_DO_VERSION CLI_USER+2 |
| #define | CLI_DO_USAGE CLI_USER+3 |
| #define | CLI_DO_INFILE CLI_USER+4 |
| #define | CLI_DO_OUTFILE CLI_USER+5 |
| #define | CLI_DO_CHECK CLI_USER+6 |
| #define | CLI_DO_LOAD CLI_USER+7 |
| #define | CLI_DO_UNLOAD CLI_USER+8 |
| #define | CLI_DO_BASENAME CLI_USER+9 |
| #define | CLI_DO_PID_FILE CLI_USER+10 |
| #define | CLI_DO_ERRORPATH CLI_USER+11 |
| #define | NUM_CLI_OPTIONS 12 |
| #define | DBCONVERT_NAME1 "dbconvert" |
| #define | DBCONVERT_NAME2 "dbconvert.exe" |
Functions | |
| void | do_dump (dbref executor, dbref caller, dbref enactor, int key) |
| void | report (void) |
| bool | regexp_match (char *pattern, char *str, int case_opt, char *args[], int nargs) |
| static int | atr_match1 (dbref thing, dbref parent, dbref player, char type, char *str, char *raw_str, int check_exclude, int hash_insert) |
| bool | atr_match (dbref thing, dbref player, char type, char *str, char *raw_str, bool check_parents) |
| static bool | check_filter (dbref object, dbref player, int filter, const char *msg) |
| static char * | add_prefix (dbref object, dbref player, int prefix, const char *msg, const char *dflt) |
| static char * | dflt_from_msg (dbref sender, dbref sendloc) |
| bool | html_escape (const char *src, char *dest, char **destp) |
| void | notify_check (dbref target, dbref sender, const char *msg, int key) |
| void | notify_except (dbref loc, dbref player, dbref exception, const char *msg, int key) |
| void | notify_except2 (dbref loc, dbref player, dbref exc1, dbref exc2, const char *msg) |
| static void | report_timecheck (dbref player, bool yes_screen, bool yes_log, bool yes_clear) |
| void | do_timecheck (dbref executor, dbref caller, dbref enactor, int key) |
| void | do_shutdown (dbref executor, dbref caller, dbref enactor, int key, char *message) |
| void | dump_database_internal (int dump_type) |
| static void | dump_database (void) |
| void | fork_and_dump (int key) |
| static int | load_game (int ccPageFile) |
| bool | list_check (dbref thing, dbref player, char type, char *str, char *raw_str, bool check_parent) |
| bool | Hearer (dbref thing) |
| void | do_readcache (dbref executor, dbref caller, dbref enactor, int key) |
| static void | process_preload (void) |
| static void | info (int fmt, int flags, int ver) |
| static void | dbconvert (void) |
| static void | write_pidfile (const char *pFilename) |
| static void | CLI_CallBack (CLI_OptionEntry *p, char *pValue) |
| int DCL_CDECL | main (int argc, char *argv[]) |
Variables | |
| static DUMP_PROCEDURE | DumpProcedures [NUM_DUMP_TYPES] |
| static char * | standalone_infile = NULL |
| static char * | standalone_outfile = NULL |
| static char * | standalone_basename = NULL |
| static bool | standalone_check = false |
| static bool | standalone_load = false |
| static bool | standalone_unload = false |
| long | DebugTotalFiles = 3 |
| long | DebugTotalSockets = 0 |
| static bool | bMinDB = false |
| static bool | bSyntaxError = false |
| static char * | conffile = NULL |
| static bool | bVersion = false |
| static char * | pErrorBasename = "" |
| static bool | bServerOption = false |
| static CLI_OptionEntry | OptionTable [NUM_CLI_OPTIONS] |
| #define CLI_DO_BASENAME CLI_USER+9 |
| #define CLI_DO_CHECK CLI_USER+6 |
| #define CLI_DO_CONFIG_FILE CLI_USER+0 |
| #define CLI_DO_INFILE CLI_USER+4 |
| #define CLI_DO_LOAD CLI_USER+7 |
| #define CLI_DO_MINIMAL CLI_USER+1 |
| #define CLI_DO_OUTFILE CLI_USER+5 |
| #define CLI_DO_PID_FILE CLI_USER+10 |
| #define CLI_DO_UNLOAD CLI_USER+8 |
| #define CLI_DO_USAGE CLI_USER+3 |
| #define CLI_DO_VERSION CLI_USER+2 |
| #define DBCONVERT_NAME2 "dbconvert.exe" |
| #define LOAD_GAME_CANNOT_OPEN (-2) |
| #define LOAD_GAME_LOADING_PROBLEM (-3) |
| #define LOAD_GAME_NO_INPUT_DB (-1) |
| #define LOAD_GAME_SUCCESS 0 |
| #define POPEN_READ_OP "r" |
| #define POPEN_WRITE_OP "w" |
| static char* add_prefix | ( | dbref | object, | |
| dbref | player, | |||
| int | prefix, | |||
| const char * | msg, | |||
| const char * | dflt | |||
| ) | [static] |
Definition at line 467 of file game.cpp.
References alloc_lbuf, atr_pget, EV_EVAL, EV_FIGNORE, EV_TOP, free_lbuf, MAX_GLOBAL_REGS, mux_exec(), PopIntegers(), PopPointers(), PushIntegers(), PushPointers(), restore_global_regs(), safe_chr, safe_str, and save_global_regs().
Referenced by notify_check().
00469 { 00470 int aflags; 00471 dbref aowner; 00472 char *buf, *nbuf, *cp, *str; 00473 00474 buf = atr_pget(object, prefix, &aowner, &aflags); 00475 if (!*buf) 00476 { 00477 cp = buf; 00478 safe_str(dflt, buf, &cp); 00479 } 00480 else 00481 { 00482 char **preserve = NULL; 00483 int *preserve_len = NULL; 00484 preserve = PushPointers(MAX_GLOBAL_REGS); 00485 preserve_len = PushIntegers(MAX_GLOBAL_REGS); 00486 save_global_regs("add_prefix_save", preserve, preserve_len); 00487 00488 nbuf = cp = alloc_lbuf("add_prefix"); 00489 str = buf; 00490 mux_exec(nbuf, &cp, object, player, player, 00491 EV_FIGNORE | EV_EVAL | EV_TOP, &str, (char **)NULL, 0); 00492 free_lbuf(buf); 00493 00494 restore_global_regs("add_prefix_restore", preserve, preserve_len); 00495 PopIntegers(preserve_len, MAX_GLOBAL_REGS); 00496 PopPointers(preserve, MAX_GLOBAL_REGS); 00497 00498 buf = nbuf; 00499 } 00500 if (cp != buf) 00501 { 00502 safe_chr(' ', buf, &cp); 00503 } 00504 safe_str(msg, buf, &cp); 00505 *cp = '\0'; 00506 return buf; 00507 }
| bool atr_match | ( | dbref | thing, | |
| dbref | player, | |||
| char | type, | |||
| char * | str, | |||
| char * | raw_str, | |||
| bool | check_parents | |||
| ) |
Definition at line 322 of file game.cpp.
References AMATCH_CMD, AMATCH_LISTEN, atr_match1(), Good_obj, Halted, hashflush(), ITER_PARENTS, match(), mudstate, No_Command, Parent, statedata::parent_htab, and strip_ansi().
Referenced by list_check(), notify_check(), and process_command().
00330 { 00331 int lev, result; 00332 bool exclude, insert; 00333 dbref parent; 00334 00335 // If thing is halted or we are matching $-commands on a NO_COMMAND 00336 // object, don't check anything 00337 // 00338 if ( Halted(thing) 00339 || ( AMATCH_CMD == type 00340 && No_Command(thing))) 00341 { 00342 return false; 00343 } 00344 00345 // If we're matching ^-commands, strip ANSI 00346 // 00347 if (AMATCH_LISTEN == type) 00348 { 00349 // Remember, strip_ansi returns a pointer to a static buffer 00350 // within itself. 00351 // 00352 size_t junk; 00353 str = strip_ansi(str, &junk); 00354 } 00355 00356 // If not checking parents, just check the thing 00357 // 00358 bool match = false; 00359 if (!check_parents) 00360 { 00361 return (atr_match1(thing, thing, player, type, str, raw_str, false, false) > 0); 00362 } 00363 00364 // Check parents, ignoring halted objects 00365 // 00366 exclude = false; 00367 insert = true; 00368 hashflush(&mudstate.parent_htab); 00369 ITER_PARENTS(thing, parent, lev) 00370 { 00371 if (!Good_obj(Parent(parent))) 00372 { 00373 insert = false; 00374 } 00375 result = atr_match1(thing, parent, player, type, str, raw_str, 00376 exclude, insert); 00377 if (result > 0) 00378 { 00379 match = true; 00380 } 00381 else if (result < 0) 00382 { 00383 return match; 00384 } 00385 exclude = true; 00386 } 00387 return match; 00388 }
| static int atr_match1 | ( | dbref | thing, | |
| dbref | parent, | |||
| dbref | player, | |||
| char | type, | |||
| char * | str, | |||
| char * | raw_str, | |||
| int | check_exclude, | |||
| int | hash_insert | |||
| ) | [static] |
Definition at line 158 of file game.cpp.
References A_LUSE, AF_CASE, AF_NOPARSE, AF_NOPROG, AF_PRIVATE, AF_REGEXP, AMATCH_CMD, AMATCH_LISTEN, atr_get_str(), atr_head(), atr_next(), atr_num(), atr_pop(), atr_push(), statedata::bfCommands, statedata::bfListens, statedata::bfNoCommands, statedata::bfNoListens, CBitField::Clear(), could_doit(), free_lbuf, statedata::global_regs, hashaddLEN(), hashfindLEN(), CBitField::IsSet(), LBUF_SIZE, match(), mudstate, NOTHING, NUM_ENV_VARS, statedata::parent_htab, PCRE_CASELESS, regexp_match(), CBitField::Set(), wait_que(), and wild().
Referenced by atr_match().
00168 { 00169 // See if we can do it. Silently fail if we can't. 00170 // 00171 if (!could_doit(player, parent, A_LUSE)) 00172 { 00173 return -1; 00174 } 00175 00176 int match = 0; 00177 if ( AMATCH_CMD == type 00178 && mudstate.bfNoCommands.IsSet(parent)) 00179 { 00180 return match; 00181 } 00182 else if ( AMATCH_LISTEN == type 00183 && mudstate.bfNoListens.IsSet(parent)) 00184 { 00185 return match; 00186 } 00187 00188 bool bFoundCommands = false; 00189 bool bFoundListens = false; 00190 00191 char *as; 00192 atr_push(); 00193 for (int atr = atr_head(parent, &as); atr; atr = atr_next(&as)) 00194 { 00195 ATTR *ap = atr_num(atr); 00196 00197 // Never check NOPROG attributes. 00198 // 00199 if ( !ap 00200 || (ap->flags & AF_NOPROG)) 00201 { 00202 continue; 00203 } 00204 00205 // We need to grab the attribute even before we know whether we'll use 00206 // it or not in order to maintain cached knowledge about ^-Commands 00207 // and $-Commands. 00208 // 00209 dbref aowner; 00210 int aflags; 00211 char buff[LBUF_SIZE]; 00212 atr_get_str(buff, parent, atr, &aowner, &aflags); 00213 00214 if (aflags & AF_NOPROG) 00215 { 00216 continue; 00217 } 00218 00219 char *s = NULL; 00220 if ( AMATCH_CMD == buff[0] 00221 || AMATCH_LISTEN == buff[0]) 00222 { 00223 s = strchr(buff+1, ':'); 00224 if (s) 00225 { 00226 if (AMATCH_CMD == buff[0]) 00227 { 00228 bFoundCommands = true; 00229 } 00230 else 00231 { 00232 bFoundListens = true; 00233 } 00234 } 00235 } 00236 00237 // If we aren't the bottom level, check if we saw this attr 00238 // before. Also exclude it if the attribute type is PRIVATE. 00239 // 00240 if ( check_exclude 00241 && ( (ap->flags & AF_PRIVATE) 00242 || (aflags & AF_PRIVATE) 00243 || hashfindLEN(&(ap->number), sizeof(ap->number), &mudstate.parent_htab))) 00244 { 00245 continue; 00246 } 00247 00248 // If we aren't the top level, remember this attr so we 00249 // exclude it from now on. 00250 // 00251 if (hash_insert) 00252 { 00253 hashaddLEN(&(ap->number), sizeof(ap->number), &atr, &mudstate.parent_htab); 00254 } 00255 00256 // Check for the leadin character after excluding the attrib. 00257 // This lets non-command attribs on the child block commands 00258 // on the parent. 00259 // 00260 if (buff[0] != type) 00261 { 00262 continue; 00263 } 00264 00265 // Was there a ':'? 00266 // 00267 if (!s) 00268 { 00269 continue; 00270 } 00271 *s++ = '\0'; 00272 00273 char *args[NUM_ENV_VARS]; 00274 if ( ( 0 != (aflags & AF_REGEXP) 00275 && regexp_match(buff + 1, (aflags & AF_NOPARSE) ? raw_str : str, 00276 ((aflags & AF_CASE) ? 0 : PCRE_CASELESS), args, NUM_ENV_VARS)) 00277 || ( 0 == (aflags & AF_REGEXP) 00278 && wild(buff + 1, (aflags & AF_NOPARSE) ? raw_str : str, 00279 args, NUM_ENV_VARS))) 00280 { 00281 match = 1; 00282 CLinearTimeAbsolute lta; 00283 wait_que(thing, player, player, false, lta, NOTHING, 0, s, 00284 args, NUM_ENV_VARS, mudstate.global_regs); 00285 00286 for (int i = 0; i < NUM_ENV_VARS; i++) 00287 { 00288 if (args[i]) 00289 { 00290 free_lbuf(args[i]); 00291 } 00292 } 00293 } 00294 } 00295 atr_pop(); 00296 00297 if (bFoundCommands) 00298 { 00299 mudstate.bfNoCommands.Clear(parent); 00300 mudstate.bfCommands.Set(parent); 00301 } 00302 else 00303 { 00304 mudstate.bfCommands.Clear(parent); 00305 mudstate.bfNoCommands.Set(parent); 00306 } 00307 00308 if (bFoundListens) 00309 { 00310 mudstate.bfNoListens.Clear(parent); 00311 mudstate.bfListens.Set(parent); 00312 } 00313 else 00314 { 00315 mudstate.bfListens.Clear(parent); 00316 mudstate.bfNoListens.Set(parent); 00317 } 00318 return match; 00319 }
Definition at line 395 of file game.cpp.
References AF_CASE, AF_REGEXP, alloc_lbuf, atr_pget, CMuxAlarm::bAlarmed, EV_EVAL, EV_FIGNORE, EV_STRIP_CURLY, EV_TOP, free_lbuf, MAX_GLOBAL_REGS, MEMFREE, mudstate, mux_exec(), MuxAlarm, parse_to(), PCRE_CASELESS, pcre_compile(), pcre_exec(), PopIntegers(), PopPointers(), PushIntegers(), PushPointers(), quick_wild(), restore_global_regs(), save_global_regs(), and statedata::wild_invk_ctr.
Referenced by notify_check().
00396 { 00397 int aflags; 00398 dbref aowner; 00399 char *buf, *nbuf, *cp, *dp, *str; 00400 00401 buf = atr_pget(object, filter, &aowner, &aflags); 00402 if (!*buf) 00403 { 00404 free_lbuf(buf); 00405 return true; 00406 } 00407 char **preserve = NULL; 00408 int *preserve_len = NULL; 00409 preserve = PushPointers(MAX_GLOBAL_REGS); 00410 preserve_len = PushIntegers(MAX_GLOBAL_REGS); 00411 save_global_regs("check_filter_save", preserve, preserve_len); 00412 nbuf = dp = alloc_lbuf("check_filter"); 00413 str = buf; 00414 mux_exec(nbuf, &dp, object, player, player, 00415 EV_FIGNORE | EV_EVAL | EV_TOP, &str, (char **)NULL, 0); 00416 *dp = '\0'; 00417 dp = nbuf; 00418 free_lbuf(buf); 00419 restore_global_regs("check_filter_restore", preserve, preserve_len); 00420 PopIntegers(preserve_len, MAX_GLOBAL_REGS); 00421 PopPointers(preserve, MAX_GLOBAL_REGS); 00422 00423 if (!(aflags & AF_REGEXP)) 00424 { 00425 do 00426 { 00427 cp = parse_to(&dp, ',', EV_STRIP_CURLY); 00428 mudstate.wild_invk_ctr = 0; 00429 if ( MuxAlarm.bAlarmed 00430 || quick_wild(cp, msg)) 00431 { 00432 free_lbuf(nbuf); 00433 return false; 00434 } 00435 } while (dp != NULL); 00436 } 00437 else 00438 { 00439 int case_opt = (aflags & AF_CASE) ? 0 : PCRE_CASELESS; 00440 do 00441 { 00442 int erroffset; 00443 const char *errptr; 00444 cp = parse_to(&dp, ',', EV_STRIP_CURLY); 00445 pcre *re; 00446 if ( !MuxAlarm.bAlarmed 00447 && (re = pcre_compile(cp, case_opt, &errptr, &erroffset, NULL)) != NULL) 00448 { 00449 const int ovecsize = 33; 00450 int ovec[ovecsize]; 00451 int matches = pcre_exec(re, NULL, msg, strlen(msg), 0, 0, 00452 ovec, ovecsize); 00453 if (0 <= matches) 00454 { 00455 MEMFREE(re); 00456 free_lbuf(nbuf); 00457 return false; 00458 } 00459 MEMFREE(re); 00460 } 00461 } while (dp != NULL); 00462 } 00463 free_lbuf(nbuf); 00464 return true; 00465 }
| static void CLI_CallBack | ( | CLI_OptionEntry * | p, | |
| char * | pValue | |||
| ) | [static] |
Definition at line 2312 of file game.cpp.
References statedata::bStandAlone, CLI_DO_BASENAME, CLI_DO_CHECK, CLI_DO_CONFIG_FILE, CLI_DO_INFILE, CLI_DO_LOAD, CLI_DO_MINIMAL, CLI_DO_OUTFILE, CLI_DO_PID_FILE, CLI_DO_UNLOAD, CLI_DO_USAGE, CLI_DO_VERSION, CLI_OptionEntry::m_Unique, mudconf, mudstate, and confdata::pid_file.
Referenced by main().
02313 { 02314 if (p) 02315 { 02316 switch (p->m_Unique) 02317 { 02318 case CLI_DO_PID_FILE: 02319 bServerOption = true; 02320 mudconf.pid_file = pValue; 02321 break; 02322 02323 case CLI_DO_CONFIG_FILE: 02324 bServerOption = true; 02325 conffile = pValue; 02326 break; 02327 02328 case CLI_DO_MINIMAL: 02329 bServerOption = true; 02330 bMinDB = true; 02331 break; 02332 02333 case CLI_DO_VERSION: 02334 bServerOption = true; 02335 bVersion = true; 02336 break; 02337 02338 case CLI_DO_ERRORPATH: 02339 bServerOption = true; 02340 pErrorBasename = pValue; 02341 break; 02342 02343 #ifndef MEMORY_BASED 02344 case CLI_DO_INFILE: 02345 mudstate.bStandAlone = true; 02346 standalone_infile = pValue; 02347 break; 02348 02349 case CLI_DO_OUTFILE: 02350 mudstate.bStandAlone = true; 02351 standalone_outfile = pValue; 02352 break; 02353 02354 case CLI_DO_CHECK: 02355 mudstate.bStandAlone = true; 02356 standalone_check = true; 02357 break; 02358 02359 case CLI_DO_LOAD: 02360 mudstate.bStandAlone = true; 02361 standalone_load = true; 02362 break; 02363 02364 case CLI_DO_UNLOAD: 02365 mudstate.bStandAlone = true; 02366 standalone_unload = true; 02367 break; 02368 02369 case CLI_DO_BASENAME: 02370 mudstate.bStandAlone = true; 02371 standalone_basename = pValue; 02372 break; 02373 #endif 02374 02375 case CLI_DO_USAGE: 02376 default: 02377 bSyntaxError = true; 02378 break; 02379 } 02380 } 02381 else 02382 { 02383 bSyntaxError = true; 02384 } 02385 }
| static void dbconvert | ( | void | ) | [static] |
Definition at line 2104 of file game.cpp.
References al_store(), cache_pass2(), cache_redirect(), cf_init(), CLOSE, db_free(), db_read(), db_write(), DBCK_FULL, do_dbck(), F_MUX, HF_OPEN_STATUS_ERROR, HF_OPEN_STATUS_NEW, HF_OPEN_STATUS_OLD, info(), init_attrtab(), init_dbfile(), LBUF_SIZE, Log, MBUF_SIZE, NOTHING, OUTPUT_FLAGS, OUTPUT_VERSION, POOL_BOOL, pool_init(), POOL_LBUF, POOL_MBUF, POOL_SBUF, SBUF_SIZE, SeedRandomNumberGenerator(), CLogFile::SetBasename(), SIZEOF_PATHNAME, CLogFile::StartLogging(), CLogFile::tinyprintf(), UNLOAD_FLAGS, UNLOAD_VERSION, and CLogFile::WriteString().
Referenced by main().
02105 { 02106 int setflags, clrflags, ver; 02107 int db_ver, db_format, db_flags; 02108 02109 Log.SetBasename("-"); 02110 Log.StartLogging(); 02111 02112 SeedRandomNumberGenerator(); 02113 02114 pool_init(POOL_LBUF, LBUF_SIZE); 02115 pool_init(POOL_MBUF, MBUF_SIZE); 02116 pool_init(POOL_SBUF, SBUF_SIZE); 02117 pool_init(POOL_BOOL, sizeof(struct boolexp)); 02118 02119 cf_init(); 02120 02121 // Decide what conversions to do and how to format the output file. 02122 // 02123 setflags = clrflags = ver = 0; 02124 bool do_redirect = false; 02125 02126 bool do_write = true; 02127 if (standalone_check) 02128 { 02129 do_write = false; 02130 } 02131 if (standalone_load) 02132 { 02133 clrflags = 0xffffffff; 02134 setflags = OUTPUT_FLAGS; 02135 ver = OUTPUT_VERSION; 02136 do_redirect = true; 02137 } 02138 else if (standalone_unload) 02139 { 02140 clrflags = 0xffffffff; 02141 setflags = UNLOAD_FLAGS; 02142 ver = UNLOAD_VERSION; 02143 } 02144 02145 // Open the database 02146 // 02147 init_attrtab(); 02148 02149 char dirfile[SIZEOF_PATHNAME]; 02150 char pagfile[SIZEOF_PATHNAME]; 02151 strcpy(dirfile, standalone_basename); 02152 strcat(dirfile, ".dir"); 02153 strcpy(pagfile, standalone_basename); 02154 strcat(pagfile, ".pag"); 02155 02156 int cc = init_dbfile(dirfile, pagfile, 650); 02157 if (cc == HF_OPEN_STATUS_ERROR) 02158 { 02159 Log.tinyprintf("Can't open database in (%s, %s) files\n", dirfile, pagfile); 02160 exit(1); 02161 } 02162 else if (cc == HF_OPEN_STATUS_OLD) 02163 { 02164 if (setflags == OUTPUT_FLAGS) 02165 { 02166 Log.tinyprintf("Would overwrite existing database (%s, %s)\n", dirfile, pagfile); 02167 CLOSE; 02168 exit(1); 02169 } 02170 } 02171 else if (cc == HF_OPEN_STATUS_NEW) 02172 { 02173 if (setflags == UNLOAD_FLAGS) 02174 { 02175 Log.tinyprintf("Database (%s, %s) is empty.\n", dirfile, pagfile); 02176 CLOSE; 02177 exit(1); 02178 } 02179 } 02180 02181 FILE *fpIn = fopen(standalone_infile, "rb"); 02182 if (!fpIn) 02183 { 02184 exit(1); 02185 } 02186 02187 // Go do it. 02188 // 02189 if (do_redirect) 02190 { 02191 cache_redirect(); 02192 } 02193 setvbuf(fpIn, NULL, _IOFBF, 16384); 02194 db_read(fpIn, &db_format, &db_ver, &db_flags); 02195 if (do_redirect) 02196 { 02197 cache_pass2(); 02198 } 02199 Log.WriteString("Input: "); 02200 info(db_format, db_flags, db_ver); 02201 02202 if (standalone_check) 02203 { 02204 do_dbck(NOTHING, NOTHING, NOTHING, DBCK_FULL); 02205 } 02206 fclose(fpIn); 02207 02208 if (do_write) 02209 { 02210 FILE *fpOut = fopen(standalone_outfile, "wb"); 02211 if (!fpOut) 02212 { 02213 exit(1); 02214 } 02215 02216 db_flags = (db_flags & ~clrflags) | setflags; 02217 if (db_format != F_MUX) 02218 { 02219 db_ver = 3; 02220 } 02221 if (ver != 0) 02222 { 02223 db_ver = ver; 02224 } 02225 Log.WriteString("Output: "); 02226 info(F_MUX, db_flags, db_ver); 02227 setvbuf(fpOut, NULL, _IOFBF, 16384); 02228 #ifndef MEMORY_BASED 02229 // Save cached modified attribute list 02230 // 02231 al_store(); 02232 #endif // MEMORY_BASED 02233 db_write(fpOut, F_MUX, db_ver | db_flags); 02234 fclose(fpOut); 02235 } 02236 CLOSE; 02237 db_free(); 02238 exit(0); 02239 }
Definition at line 509 of file game.cpp.
References alloc_lbuf, Good_obj, Name, safe_chr, and safe_str.
Referenced by notify_check().
00510 { 00511 char *tp, *tbuff; 00512 00513 tp = tbuff = alloc_lbuf("notify_check.fwdlist"); 00514 safe_str("From ", tbuff, &tp); 00515 if (Good_obj(sendloc)) 00516 { 00517 safe_str(Name(sendloc), tbuff, &tp); 00518 } 00519 else 00520 { 00521 safe_str(Name(sender), tbuff, &tp); 00522 } 00523 safe_chr(',', tbuff, &tp); 00524 *tp = '\0'; 00525 return tbuff; 00526 }
Definition at line 27 of file game.cpp.
References statedata::dumping, fork_and_dump(), mudstate, notify, and UNUSED_PARAMETER.
00028 { 00029 UNUSED_PARAMETER(caller); 00030 UNUSED_PARAMETER(enactor); 00031 00032 #ifndef WIN32 00033 if (mudstate.dumping) 00034 { 00035 notify(executor, "Dumping in progress. Try again later."); 00036 return; 00037 } 00038 #endif 00039 notify(executor, "Dumping..."); 00040 fork_and_dump(key); 00041 }
Definition at line 1994 of file game.cpp.
References fcache_load(), helpindex_load(), and UNUSED_PARAMETER.
01995 { 01996 UNUSED_PARAMETER(caller); 01997 UNUSED_PARAMETER(enactor); 01998 UNUSED_PARAMETER(key); 01999 02000 helpindex_load(executor); 02001 fcache_load(executor); 02002 }
Definition at line 1172 of file game.cpp.
References al_store(), Can_SiteAdmin, CLOSE, confdata::crashdb, DebugTotalFiles, dump_database_internal(), DUMP_I_PANIC, emergency_shutdown(), ENDLINE, ENDLOG, local_presync_database(), LOG_ALWAYS, log_name(), log_text(), mudconf, mudstate, Name, NOPERM_MESSAGE, notify, O_BINARY, Owner, pcache_sync(), raw_broadcast(), SHUTDN_PANIC, statedata::shutdown_flag, STARTLOG, confdata::status_file, SYNC, and UNUSED_PARAMETER.
01179 { 01180 UNUSED_PARAMETER(caller); 01181 UNUSED_PARAMETER(enactor); 01182 01183 if (!Can_SiteAdmin(executor)) 01184 { 01185 notify(executor, NOPERM_MESSAGE); 01186 return; 01187 } 01188 01189 raw_broadcast(0, "GAME: Shutdown by %s", Name(Owner(executor))); 01190 STARTLOG(LOG_ALWAYS, "WIZ", "SHTDN"); 01191 log_text("Shutdown by "); 01192 log_name(executor); 01193 ENDLOG; 01194 01195 STARTLOG(LOG_ALWAYS, "WIZ", "SHTDN"); 01196 log_text("Shutdown status: "); 01197 log_text(message); 01198 ENDLOG; 01199 01200 int fd = open(mudconf.status_file, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0600); 01201