mux/src/externs.h File Reference

#include "db.h"
#include "match.h"
#include "mudconf.h"
#include "svdrand.h"

Include dependency graph for externs.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PortInfo
struct  TASK_RECORD
class  CTaskHeap
class  CScheduler

Defines

#define notify(p, m)   notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN)
#define notify_saypose(p, m)   notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_SAYPOSE)
#define notify_html(p, m)   notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_HTML)
#define notify_quiet(p, m)   notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME)
#define notify_with_cause(p, c, m)   notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN)
#define notify_with_cause_ooc(p, c, m)   notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_OOC)
#define notify_with_cause_html(p, c, m)   notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_HTML)
#define notify_quiet_with_cause(p, c, m)   notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME)
#define notify_all(p, c, m)   notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS|MSG_F_UP|MSG_F_CONTENTS)
#define notify_all_from_inside(p, c, m)   notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS_A|MSG_F_UP|MSG_F_CONTENTS|MSG_S_INSIDE)
#define notify_all_from_inside_saypose(p, c, m)   notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS_A|MSG_F_UP|MSG_F_CONTENTS|MSG_S_INSIDE|MSG_SAYPOSE)
#define notify_all_from_inside_html(p, c, m)   notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS_A|MSG_F_UP|MSG_F_CONTENTS|MSG_S_INSIDE|MSG_HTML)
#define DUMP_I_NORMAL   0
#define DUMP_I_PANIC   1
#define DUMP_I_RESTART   2
#define DUMP_I_FLAT   3
#define DUMP_I_SIGNAL   4
#define NUM_DUMP_TYPES   5
#define ENDLINE   "\n"
#define match_controlled(player, name)   match_controlled_handler(player, name, false)
#define match_controlled_quiet(player, name)   match_controlled_handler(player, name, true)
#define IEEE_MAKE_NAN   1
#define IEEE_MAKE_IND   2
#define IEEE_MAKE_PINF   3
#define IEEE_MAKE_NINF   4
#define Protect(f)   (cmdp->perms & f)
#define Invalid_Objtype(x)
#define atr_get(t, a, o, f)   atr_get_real(t,a,o,f, __FILE__, __LINE__)
#define atr_pget(t, a, o, f)   atr_pget_real(t,a,o,f, __FILE__, __LINE__)
#define check_zone(player, thing)   check_zone_handler(player, thing, false)
#define ATTRIB_ACCESS   1
#define ATTRIB_RENAME   2
#define ATTRIB_DELETE   4
#define ATTRIB_INFO   8
#define BOOT_QUIET   1
#define BOOT_PORT   2
#define CEMIT_NOHEADER   1
#define CHOWN_ONE   1
#define CHOWN_ALL   2
#define CHOWN_NOZONE   8
#define CLIST_FULL   1
#define CLIST_HEADERS   2
#define CLONE_LOCATION   0
#define CLONE_INHERIT   1
#define CLONE_PRESERVE   2
#define CLONE_INVENTORY   4
#define CLONE_SET_COST   8
#define CLONE_SET_LOC   16
#define CLONE_SET_NAME   32
#define CLONE_FROM_PARENT   64
#define CBOOT_QUIET   1
#define COMTITLE_ON   1
#define COMTITLE_OFF   2
#define CRE_INVENTORY   0
#define CRE_LOCATION   1
#define CRE_SET_LOC   2
#define CSET_PUBLIC   0
#define CSET_PRIVATE   1
#define CSET_LOUD   2
#define CSET_QUIET   3
#define CSET_LIST   4
#define CSET_OBJECT   5
#define CSET_SPOOF   6
#define CSET_NOSPOOF   7
#define CSET_HEADER   8
#define CSET_LOG   9
#define DBCK_DEFAULT   1
#define DBCK_FULL   2
#define DECOMP_DBREF   1
#define DEST_ONE   1
#define DEST_OVERRIDE   4
#define DEST_INSTANT   8
#define DIG_TELEPORT   1
#define DOLIST_SPACE   0
#define DOLIST_DELIMIT   1
#define DOLIST_NOTIFY   2
#define DOING_MESSAGE   0
#define DOING_HEADER   1
#define DOING_POLL   2
#define DOING_UNIQUE   3
#define DOING_MASK   15
#define DOING_QUIET   16
#define DROP_QUIET   1
#define DUMP_STRUCT   1
#define DUMP_TEXT   2
#define DUMP_FLATFILE   4
#define EXAM_DEFAULT   0
#define EXAM_BRIEF   1
#define EXAM_LONG   2
#define EXAM_DEBUG   4
#define EXAM_PARENT   8
#define FIXDB_OWNER   1
#define FIXDB_LOC   2
#define FIXDB_CON   4
#define FIXDB_EXITS   8
#define FIXDB_NEXT   16
#define FIXDB_PENNIES   32
#define FIXDB_ZONE   64
#define FIXDB_LINK   128
#define FIXDB_PARENT   256
#define FIXDB_NAME   2048
#define FLAG_REMOVE   1
#define GET_QUIET   1
#define GIVE_QUIET   64
#define GLOB_ENABLE   1
#define GLOB_DISABLE   2
#define HALT_ALL   1
#define HOOK_BEFORE   1
#define HOOK_AFTER   2
#define HOOK_PERMIT   4
#define HOOK_IGNORE   8
#define HOOK_IGSWITCH   16
#define HOOK_AFAIL   32
#define HOOK_CLEAR   64
#define HOOK_LIST   128
#define ICMD_DISABLE   0
#define ICMD_IGNORE   1
#define ICMD_ON   2
#define ICMD_OFF   4
#define ICMD_CLEAR   8
#define ICMD_CHECK   16
#define ICMD_DROOM   32
#define ICMD_IROOM   64
#define ICMD_CROOM   128
#define ICMD_LROOM   256
#define ICMD_LALLROOM   512
#define KILL_KILL   1
#define KILL_SLAY   2
#define LOOK_LOOK   1
#define LOOK_OUTSIDE   8
#define MAIL_STATS   1
#define MAIL_DSTATS   2
#define MAIL_FSTATS   3
#define MAIL_DEBUG   4
#define MAIL_NUKE   5
#define MAIL_FOLDER   6
#define MAIL_LIST   7
#define MAIL_READ   8
#define MAIL_CLEAR   9
#define MAIL_UNCLEAR   10
#define MAIL_PURGE   11
#define MAIL_FILE   12
#define MAIL_TAG   13
#define MAIL_UNTAG   14
#define MAIL_FORWARD   15
#define MAIL_SEND   16
#define MAIL_EDIT   17
#define MAIL_URGENT   18
#define MAIL_ALIAS   19
#define MAIL_ALIST   20
#define MAIL_PROOF   21
#define MAIL_ABORT   22
#define MAIL_QUICK   23
#define MAIL_REVIEW   24
#define MAIL_RETRACT   25
#define MAIL_CC   26
#define MAIL_SAFE   27
#define MAIL_REPLY   28
#define MAIL_REPLYALL   29
#define MAIL_BCC   30
#define MAIL_QUOTE   0x100
#define MALIAS_DESC   1
#define MALIAS_CHOWN   2
#define MALIAS_ADD   3
#define MALIAS_REMOVE   4
#define MALIAS_DELETE   5
#define MALIAS_RENAME   6
#define MALIAS_LIST   8
#define MALIAS_STATUS   9
#define MARK_SET   0
#define MARK_CLEAR   1
#define MOTD_ALL   0
#define MOTD_WIZ   1
#define MOTD_DOWN   2
#define MOTD_FULL   4
#define MOTD_LIST   8
#define MOTD_BRIEF   16
#define MOVE_QUIET   1
#define NFY_NFY   0
#define NFY_NFYALL   1
#define NFY_DRAIN   2
#define NFY_QUIET   3
#define OPEN_LOCATION   0
#define OPEN_INVENTORY   1
#define PCRE_PLAYER   1
#define PCRE_ROBOT   2
#define PEMIT_PEMIT   1
#define PEMIT_OEMIT   2
#define PEMIT_WHISPER   3
#define PEMIT_FSAY   4
#define PEMIT_FEMIT   5
#define PEMIT_FPOSE   6
#define PEMIT_FPOSE_NS   7
#define PEMIT_CONTENTS   8
#define PEMIT_HERE   16
#define PEMIT_ROOM   32
#define PEMIT_LIST   64
#define PEMIT_HTML   128
#define PS_BRIEF   0
#define PS_LONG   1
#define PS_SUMM   2
#define PS_ALL   4
#define QUERY_SQL   1
#define QUEUE_KICK   1
#define QUEUE_WARP   2
#define QUOTA_SET   1
#define QUOTA_FIX   2
#define QUOTA_TOT   4
#define QUOTA_REM   8
#define QUOTA_ALL   16
#define SAY_SAY   1
#define SAY_NOSPACE   1
#define SAY_POSE   2
#define SAY_POSE_NOSPC   3
#define SAY_PREFIX   4
#define SAY_EMIT   5
#define SAY_NOEVAL   8
#define SHOUT_SHOUT   1
#define SHOUT_WALLPOSE   2
#define SHOUT_WALLEMIT   3
#define SHOUT_WIZSHOUT   4
#define SHOUT_WIZPOSE   5
#define SHOUT_WIZEMIT   6
#define SHOUT_ADMINSHOUT   7
#define SAY_NOTAG   32
#define SAY_HERE   64
#define SAY_ROOM   128
#define SAY_HTML   256
#define SET_QUIET   1
#define SHOUT_DEFAULT   0
#define SHOUT_WIZARD   1
#define SHOUT_ADMIN   2
#define SHUTDN_NORMAL   0
#define SHUTDN_PANIC   1
#define SHUTDN_EXIT   2
#define SHUTDN_COREDUMP   4
#define SRCH_SEARCH   1
#define SRCH_MARK   2
#define SRCH_UNMARK   3
#define STAT_PLAYER   0
#define STAT_ALL   1
#define STAT_ME   2
#define SWITCH_DEFAULT   0
#define SWITCH_ANY   1
#define SWITCH_ONE   2
#define SWEEP_ME   1
#define SWEEP_HERE   2
#define SWEEP_COMMANDS   4
#define SWEEP_LISTEN   8
#define SWEEP_PLAYER   16
#define SWEEP_CONNECT   32
#define SWEEP_EXITS   64
#define SWEEP_SCAN   128
#define SWEEP_VERBOSE   256
#define TELEPORT_DEFAULT   1
#define TELEPORT_QUIET   2
#define TELEPORT_LIST   4
#define TIMECHK_RESET   1
#define TIMECHK_SCREEN   2
#define TIMECHK_LOG   4
#define TOAD_NO_CHOWN   1
#define TRIG_QUIET   1
#define TWARP_QUEUE   1
#define TWARP_DUMP   2
#define TWARP_CLEAN   4
#define TWARP_IDLE   8
#define TWARP_EVENTS   32
#define WAIT_UNTIL   1
#define HUSH_ENTER   1
#define HUSH_LEAVE   2
#define HUSH_EXIT   4
#define EV_FIGNORE   0x00000000
#define EV_FMAND   0x00000100
#define EV_FCHECK   0x00000200
#define EV_STRIP_CURLY   0x00000400
#define EV_EVAL   0x00000800
#define EV_STRIP_TS   0x00001000
#define EV_STRIP_LS   0x00002000
#define EV_STRIP_ESC   0x00004000
#define EV_STRIP_AROUND   0x00008000
#define EV_TOP   0x00010000
#define EV_NOTRACE   0x00020000
#define EV_NO_COMPRESS   0x00040000
#define EV_NO_LOCATION   0x00080000
#define EV_NOFCHECK   0x00100000
#define MSG_PUP_ALWAYS   0x00000001UL
#define MSG_INV   0x00000002UL
#define MSG_INV_L   0x00000004UL
#define MSG_INV_EXITS   0x00000008UL
#define MSG_NBR   0x00000010UL
#define MSG_NBR_A   0x00000020UL
#define MSG_NBR_EXITS   0x00000040UL
#define MSG_NBR_EXITS_A   0x00000080UL
#define MSG_LOC   0x00000100UL
#define MSG_LOC_A   0x00000200UL
#define MSG_FWDLIST   0x00000400UL
#define MSG_ME   0x00000800UL
#define MSG_S_INSIDE   0x00001000UL
#define MSG_S_OUTSIDE   0x00002000UL
#define MSG_HTML   0x00004000UL
#define MSG_OOC   0x00008000UL
#define MSG_SAYPOSE   0x00010000UL
#define MSG_ME_ALL   (MSG_ME|MSG_INV_EXITS|MSG_FWDLIST)
#define MSG_F_CONTENTS   (MSG_INV)
#define MSG_F_UP   (MSG_NBR_A|MSG_LOC_A)
#define MSG_F_DOWN   (MSG_INV_L)
#define LK_IDESC   0x0001
#define LK_OBEYTERSE   0x0002
#define LK_SHOWATTR   0x0004
#define LK_SHOWEXIT   0x0008
#define LK_SHOWVRML   0x0010
#define VE_LOC_XAM   0x01
#define VE_LOC_DARK   0x02
#define VE_LOC_LIGHT   0x04
#define VE_BASE_DARK   0x10
#define SA_EXIT   1
#define SA_DFLT   2
#define STARTLOG(key, p, s)   if ((((key) & mudconf.log_options) != 0) && start_log(p, s)) {
#define ENDLOG   end_log(); }
#define LOG_SIMPLE(key, p, s, m)
#define safe_nothing(b, p)   safe_copy_buf(FUNC_FAIL_MESSAGE,3,(b),(p))
#define safe_noperm(b, p)   safe_copy_buf(FUNC_NOPERM_MESSAGE,21,(b),(p))
#define safe_nomatch(b, p)   safe_copy_buf(FUNC_NOMATCH_MESSAGE,12,(b),(p))
#define safe_range(b, p)   safe_copy_buf(OUT_OF_RANGE,16,(b),(p))
#define safe_ambiguous(b, p)   safe_copy_buf(FUNC_AMBIGUOUS,13,(b),(p))
#define safe_notfound(b, p)   safe_copy_buf(FUNC_NOT_FOUND,13,(b),(p))
#define MAX_LISTEN_PORTS   10
#define PRIORITY_SYSTEM   100
#define PRIORITY_PLAYER   200
#define PRIORITY_OBJECT   300
#define PRIORITY_SUSPEND   400
#define PRIORITY_CF_DEQUEUE_ENABLED   PRIORITY_OBJECT
#define PRIORITY_CF_DEQUEUE_DISABLED   (PRIORITY_PLAYER-1)
#define IU_DONE   0
#define IU_NEXT_TASK   1
#define IU_REMOVE_TASK   2
#define IU_UPDATE_TASK   3
#define CIF_TOTALTIME   0
#define CIF_LONGESTCONNECT   1
#define CIF_LASTCONNECT   2
#define CIF_NUMCONNECTS   3
#define fetch_totaltime(t)   (fetch_ConnectionInfoField((t), CIF_TOTALTIME))
#define fetch_longestconnect(t)   (fetch_ConnectionInfoField((t), CIF_LONGESTCONNECT))
#define fetch_lastconnect(t)   (fetch_ConnectionInfoField((t), CIF_LASTCONNECT))
#define fetch_numconnections(t)   (fetch_ConnectionInfoField((t), CIF_NUMCONNECTS))

Typedefs

typedef void FTASK (void *, int)
typedef struct TASK_RECORDPTASK_RECORD
typedef int SCHCMP (PTASK_RECORD, PTASK_RECORD)
typedef int SCHLOOK (PTASK_RECORD)

Functions

void boot_slave (dbref executor, dbref caller, dbref enactor, int key)
 Lauch reverse-DNS slave process.
void close_sockets (bool emergency, char *message)
void CleanUpSlaveSocket (void)
void CleanUpSlaveProcess (void)
void cf_log_notfound (dbref, char *, const char *, char *)
int cf_modify_bits (int *, char *, void *, UINT32, dbref, char *)
void DCL_CDECL cf_log_syntax (dbref player, char *cmd, const char *fmt,...)
void ValidateConfigurationDbrefs (void)
int cf_read (void)
void cf_init (void)
void cf_list (dbref, char *, char **)
void cf_display (dbref, char *, char *, char **)
void list_cf_access (dbref)
int cf_set (char *, char *, dbref)
 CF_HAND (cf_cf_access)
 CF_HAND (cf_access)
 CF_HAND (cf_cmd_alias)
 CF_HAND (cf_acmd_access)
 CF_HAND (cf_attr_access)
 CF_HAND (cf_func_access)
 CF_HAND (cf_flag_access)
 CF_HAND (cf_flag_name)
 CF_HAND (cf_art_rule)
void local_startup (void)
void local_presync_database (void)
void local_presync_database_sigsegv (void)
void local_dump_database (int)
void local_dump_complete_signal (void)
void local_shutdown (void)
void local_dbck (void)
void local_connect (dbref, int, int)
void local_disconnect (dbref, int)
void local_data_create (dbref)
void local_data_clone (dbref, dbref)
void local_data_free (dbref)
void load_mail (FILE *)
int dump_mail (FILE *)
mailmail_fetch (dbref, int)
void DCL_CDECL raw_broadcast (int, char *,...)
void list_siteinfo (dbref)
void logged_out0 (dbref executor, dbref caller, dbref enactor, int key)
void logged_out1 (dbref executor, dbref caller, dbref enactor, int key, char *arg)
void init_logout_cmdtab (void)
void desc_reload (dbref)
void make_portlist (dbref, dbref, char *, char **)
int nfy_que (dbref, int, int, int)
int halt_que (dbref, dbref)
void wait_que (dbref executor, dbref caller, dbref enactor, bool, CLinearTimeAbsolute &, dbref, int, char *, char *[], int, char *[])
char * crypt (const char *inptr, const char *inkey)
void tcache_init (void)
char * parse_to (char **, char, int)
char * parse_arglist (dbref executor, dbref caller, dbref enactor, char *, char, int, char *[], int, char *[], int, int *)
int get_gender (dbref)
void mux_exec (char *buff, char **bufc, dbref executor, dbref caller, dbref enactor, int eval, char **dstr, char *cargs[], int ncargs)
void save_global_regs (const char *, char *[], int[])
void save_and_clear_global_regs (const char *, char *[], int[])
void restore_global_regs (const char *, char *[], int[])
char ** PushPointers (int nNeeded)
void PopPointers (char **p, int nNeeded)
int * PushIntegers (int nNeeded)
void PopIntegers (int *pi, int nNeeded)
void notify_except (dbref, dbref, dbref, const char *, int key)
void notify_except2 (dbref, dbref, dbref, dbref, const char *)
void notify_check (dbref, dbref, const char *, int)
bool Hearer (dbref)
void report (void)
bool atr_match (dbref thing, dbref player, char type, char *str, char *raw_str, bool check_parents)
bool regexp_match (char *pattern, char *str, int case_opt, char *args[], int nargs)
bool list_check (dbref thing, dbref player, char type, char *str, char *raw_str, bool check_parent)
bool html_escape (const char *src, char *dest, char **destp)
void dump_database_internal (int)
void fork_and_dump (int key)
void helpindex_clean (int)
void helpindex_load (dbref)
void helpindex_init (void)
void help_helper (dbref executor, int iHelpfile, char *topic_arg, char *buff, char **bufc)
int cf_ntab_access (int *, char *, void *, UINT32, dbref, char *)
bool start_log (const char *primary, const char *secondary)
void end_log (void)
void log_perror (const char *, const char *, const char *, const char *)
void log_text (const char *)
void log_number (int)
void DCL_CDECL log_printf (const char *fmt,...)
void log_name (dbref)
void log_name_and_loc (dbref)
void log_type_and_name (dbref)
void look_in (dbref, dbref, int)
void show_vrml_url (dbref, dbref)
size_t decode_attr_flags (int aflags, char *buff)
void move_object (dbref, dbref)
void move_via_generic (dbref, dbref, dbref, int)
bool move_via_teleport (dbref, dbref, dbref, int)
void move_exit (dbref, dbref, bool, const char *, int)
void do_enter_internal (dbref, dbref, bool)
dbref start_home (void)
dbref default_home (void)
bool can_set_home (dbref, dbref, dbref)
dbref new_home (dbref)
dbref clone_home (dbref, dbref)
void divest_object (dbref)
dbref create_obj (dbref, int, const char *, int)
void destroy_obj (dbref)
void empty_obj (dbref)
dbref create_player (char *name, char *pass, dbref executor, bool isrobot, const char **pmsg)
void AddToPublicChannel (dbref player)
bool add_player_name (dbref, const char *)
bool delete_player_name (dbref, const char *)
dbref lookup_player (dbref, char *, bool)
void load_player_names (void)
void badname_add (char *)
void badname_remove (char *)
bool badname_check (char *)
void badname_list (dbref, const char *)
void ChangePassword (dbref player, const char *szPassword)
const char * mux_crypt (const char *szPassword, const char *szSalt, int *piType)
int QueueMax (dbref)
 Returns the player's upper limit of queued commands.
int a_Queue (dbref, int)
 Adjusts the count of queued commands up or down.
void pcache_reload (dbref)
 Re-initializes Money and QueueMax items from the database.
void pcache_init (void)
 Initializes the player cache.
char *DCL_CDECL tprintf (const char *,...)
void DCL_CDECL safe_tprintf_str (char *, char **, const char *,...)
dbref insert_first (dbref, dbref)
dbref remove_first (dbref, dbref)
dbref reverse_list (dbref)
bool member (dbref, dbref)
bool could_doit (dbref, dbref, int)
bool can_see (dbref, dbref, bool)
void add_quota (dbref, int)
bool canpayfees (dbref, dbref, int, int)
void giveto (dbref, int)
bool payfor (dbref, int)
char * MakeCanonicalObjectName (const char *pName, int *pnName, bool *pbValid)
char * MakeCanonicalExitName (const char *pName, int *pnName, bool *pbValid)
bool ValidatePlayerName (const char *pName)
bool ok_password (const char *szPassword, const char **pmsg)
void handle_ears (dbref, bool, bool)
dbref match_possessed (dbref, dbref, char *, dbref, bool)
void parse_range (char **, dbref *, dbref *)
bool parse_thing_slash (dbref, char *, char **, dbref *)
bool get_obj_and_lock (dbref, char *, dbref *, ATTR **, char *, char **)
dbref where_is (dbref)
dbref where_room (dbref)
bool locatable (dbref, dbref, dbref)
bool nearby (dbref, dbref)
bool exit_visible (dbref, dbref, int)
bool exit_displayable (dbref, dbref, int)
void did_it (dbref, dbref, int, const char *, int, const char *, int, char *[], int)
bool bCanReadAttr (dbref executor, dbref target, ATTR *tattr, bool bParentCheck)
bool bCanSetAttr (dbref executor, dbref target, ATTR *tattr)
bool bCanLockAttr (dbref executor, dbref target, ATTR *tattr)
bool parse_attrib (dbref, char *, dbref *, ATTR **)
bool parse_attrib_wild (dbref, char *, dbref *, bool, bool, bool)
void edit_string (char *, char **, char *, char *)
dbref match_controlled_handler (dbref player, const char *name, bool bQuiet)
void set_modified (dbref thing)
bool eval_boolexp (dbref, dbref, dbref, BOOLEXP *)
BOOLEXPparse_boolexp (dbref, const char *, bool)
bool eval_boolexp_atr (dbref, dbref, dbref, char *)
bool xlate (char *)
double MakeSpecialFloat (int iWhich)
char * unparse_boolexp (dbref, BOOLEXP *)
char * unparse_boolexp_quiet (dbref, BOOLEXP *)
char * unparse_boolexp_decompile (dbref, BOOLEXP *)
char * unparse_boolexp_function (dbref, BOOLEXP *)
int chown_all (dbref from_player, dbref to_player, dbref acting_player, int key)
void olist_push (void)
void olist_pop (void)
void olist_add (dbref)
dbref olist_first (void)
dbref olist_next (void)
bool wild (char *, char *, char *[], int)
bool wild_match (char *, const char *)
bool quick_wild (const char *, const char *)
bool check_access (dbref player, int mask)
void set_prefix_cmds (void)
 Fills in the table of single-character prefix commands.
char * process_command (dbref executor, dbref caller, dbref enactor, bool, char *, char *[], int)
bool Commer (dbref)
void s_Pass (dbref, const char *)
void s_Name (dbref, const char *)
void s_Moniker (dbref thing, const char *s)
const char * Name (dbref thing)
const char * PureName (dbref thing)
const char * Moniker (dbref thing)
int fwdlist_load (FWDLIST *, dbref, char *)
void fwdlist_set (dbref, FWDLIST *)
void fwdlist_clr (dbref)
int fwdlist_rewrite (FWDLIST *, char *)
FWDLISTfwdlist_get (dbref)
void atr_push (void)
void atr_pop (void)
int atr_head (dbref, char **)
int atr_next (char **)
int init_dbfile (char *game_dir_file, char *game_pag_file, int nCachePages)
void atr_cpy (dbref dest, dbref source, bool bInternal)
void atr_chown (dbref)
void atr_clr (dbref, int)
void atr_add_raw_LEN (dbref, int, const char *, int)
void atr_add_raw (dbref, int, const char *)
void atr_add (dbref, int, char *, dbref, int)
void atr_set_flags (dbref, int, int)
const char * atr_get_raw_LEN (dbref, int, size_t *)
const char * atr_get_raw (dbref, int)
char * atr_get_LEN (dbref, int, dbref *, int *, size_t *)
char * atr_get_real (dbref, int, dbref *, int *, const char *, const int)
char * atr_pget_LEN (dbref, int, dbref *, int *, size_t *)
char * atr_pget_real (dbref, int, dbref *, int *, const char *, const int)
char * atr_get_str_LEN (char *s, dbref, int, dbref *, int *, size_t *)
char * atr_get_str (char *, dbref, int, dbref *, int *)
char * atr_pget_str_LEN (char *, dbref, int, dbref *, int *, size_t *)
char * atr_pget_str (char *, dbref, int, dbref *, int *)
bool atr_get_info (dbref, int, dbref *, int *)
bool atr_pget_info (dbref, int, dbref *, int *)
void atr_free (dbref)
bool check_zone_handler (dbref player, dbref thing, bool bPlayerCheck)
void ReleaseAllResources (dbref obj)
bool fwdlist_ck (dbref player, dbref thing, int anum, char *atext)
int ReplaceFile (char *old_name, char *new_name)
void RemoveFile (char *name)
void destroy_player (dbref agent, dbref victim)
void do_pemit_list (dbref player, int key, bool bDoContents, int pemit_flags, char *list, int chPoseType, char *message)
void do_pemit_single (dbref player, int key, bool bDoContents, int pemit_flags, char *recipient, int chPoseType, char *message)
void do_say (dbref executor, dbref caller, dbref enactor, int key, char *message)
int boot_off (dbref player, const char *message)
void do_mail_clear (dbref player, char *msglist)
void do_mail_purge (dbref player)
void malias_cleanup (dbref player)
void count_mail (dbref player, int folder, int *rcount, int *ucount, int *ccount)
void check_mail_expiration (void)
void check_mail (dbref player, int folder, bool silent)
const char * mail_fetch_message (dbref player, int num)
int mail_fetch_from (dbref player, int num)
void raw_notify_html (dbref player, const char *msg)
void do_lock (dbref executor, dbref caller, dbref enactor, int key, int nargs, char *name, char *keytext)
void check_events (void)
void list_system_resources (dbref player)
void init_timer (void)
void dispatch_DatabaseDump (void *pUnused, int iUnused)
void dispatch_FreeListReconstruction (void *pUnused, int iUnused)
void dispatch_IdleCheck (void *pUnused, int iUnused)
void dispatch_CheckEvents (void *pUnused, int iUnused)
void dispatch_CacheTick (void *pUnused, int iUnused)
int fetch_cmds (dbref target)
void fetch_ConnectionInfoFields (dbref target, long anFields[4])
long fetch_ConnectionInfoField (dbref target, int iField)
void put_ConnectionInfoFields (dbref target, long anFields[4], CLinearTimeAbsolute &ltaLogout)
CLinearTimeAbsolute fetch_logouttime (dbref target)
void FLOAT_Initialize (void)
void mux_FPInit ()
void mux_FPSet ()
void mux_FPRestore ()
double ulp (double)
double mux_strtod (const char *s00, char **se)
char * mux_dtoa (double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
void build_version (void)
void init_version (void)
void pcache_sync (void)
 Flushes any dirty player items to the database.
void pcache_trim (void)
 Ages and trims the player cache of stale entries.
void cache_redirect (void)
void cache_pass2 (void)
char * modSpeech (dbref player, char *message, bool bWhich, char *command)
void stack_clr (dbref obj)
bool parse_and_get_attrib (dbref, char *[], char **, dbref *, char *, char **)

Variables

NAMETAB sigactions_nametab []
bool break_called
const signed char mux_RegisterSet [256]
const char * ColorTable [256]
int anum_alc_top
const char * NOMATCH_MESSAGE
const char * AMBIGUOUS_MESSAGE
const char * NOPERM_MESSAGE
const char * FUNC_FAIL_MESSAGE
const char * FUNC_NOMATCH_MESSAGE
const char * OUT_OF_RANGE
const char * FUNC_NOT_FOUND
const char * FUNC_AMBIGUOUS
const char * FUNC_NOPERM_MESSAGE
PortInfo aMainGamePorts [MAX_LISTEN_PORTS]
int nMainGamePorts
int maxd
unsigned int ndescriptors
long DebugTotalFiles
long DebugTotalSockets
pid_t game_pid
CScheduler scheduler
NAMETAB enable_names []
CLinearTimeAbsolute cs_ltime


Define Documentation

#define atr_get ( t,
a,
o,
 )     atr_get_real(t,a,o,f, __FILE__, __LINE__)

Definition at line 369 of file externs.h.

Referenced by add_mail_message(), add_quota(), add_to(), atr_chown(), atr_cpy(), atr_set_flags(), check_connect(), check_pass(), cmdtest(), connect_player(), could_doit(), db_write_object(), dbclean_RenumberAttributes(), debug_examine(), do_chanlog(), do_chown(), do_comlast(), do_decomp(), do_edit_msg(), do_examine(), do_expmail_stop(), do_icmd(), do_last(), do_mail_proof(), do_newpassword(), do_page(), do_password(), do_postpend(), do_prepend(), do_prog(), do_report(), eval_boolexp(), exam_wildattrs(), fetch_ConnectionInfoField(), fetch_ConnectionInfoFields(), fetch_logouttime(), FUNCTION(), fwdlist_get(), handle_prog(), idle_timeout_val(), look_atrs1(), modSpeech(), mung_quotas(), mux_exec(), nfy_que(), notify_check(), pay_quota(), process_cmdent(), process_command(), process_hook(), PureName(), record_login(), SendChannelMessage(), and show_quota().

#define atr_pget ( t,
a,
o,
 )     atr_pget_real(t,a,o,f, __FILE__, __LINE__)

Definition at line 372 of file externs.h.

Referenced by add_prefix(), check_attr(), check_filter(), connect_player(), default_handler(), desc_reload(), destroy_player(), did_it(), do_alias(), do_chanlist(), do_toad(), eval_boolexp(), exam_wildattrs(), FUNCTION(), get_exit_dest(), get_gender(), give_money(), hasattr_handler(), look_contents(), look_exits(), look_in(), mail_return(), move_exit(), page_return(), parse_and_get_attrib(), player_folder(), process_command(), show_a_desc(), show_desc(), and show_vrml_url().

#define ATTRIB_ACCESS   1

Definition at line 389 of file externs.h.

Referenced by do_attribute().

#define ATTRIB_DELETE   4

Definition at line 391 of file externs.h.

Referenced by do_attribute().

#define ATTRIB_INFO   8

Definition at line 392 of file externs.h.

#define ATTRIB_RENAME   2

Definition at line 390 of file externs.h.

Referenced by do_attribute().

#define BOOT_PORT   2

Definition at line 394 of file externs.h.

Referenced by do_boot().

#define BOOT_QUIET   1

Definition at line 393 of file externs.h.

Referenced by do_boot().

#define CBOOT_QUIET   1

Definition at line 410 of file externs.h.

Referenced by do_chboot().

#define CEMIT_NOHEADER   1

Definition at line 395 of file externs.h.

Referenced by do_cemit().

#define check_zone ( player,
thing   )     check_zone_handler(player, thing, false)

Definition at line 381 of file externs.h.

#define CHOWN_ALL   2

Definition at line 397 of file externs.h.

#define CHOWN_NOZONE   8

Definition at line 399 of file externs.h.

Referenced by chown_all(), destroy_player(), and do_toad().

#define CHOWN_ONE   1

Definition at line 396 of file externs.h.

#define CIF_LASTCONNECT   2

Definition at line 977 of file externs.h.

Referenced by shutdownsock().

#define CIF_LONGESTCONNECT   1

Definition at line 976 of file externs.h.

Referenced by shutdownsock().

#define CIF_NUMCONNECTS   3

Definition at line 978 of file externs.h.

Referenced by shutdownsock().

#define CIF_TOTALTIME   0

Definition at line 975 of file externs.h.

Referenced by shutdownsock().

#define CLIST_FULL   1

Definition at line 400 of file externs.h.

Referenced by do_chanlist().

#define CLIST_HEADERS   2

Definition at line 401 of file externs.h.

Referenced by do_chanlist().

#define CLONE_FROM_PARENT   64

Definition at line 409 of file externs.h.

Referenced by do_clone().

#define CLONE_INHERIT   1

Definition at line 403 of file externs.h.

Referenced by do_clone().

#define CLONE_INVENTORY   4

Definition at line 405 of file externs.h.

Referenced by do_clone().

#define CLONE_LOCATION   0

Definition at line 402 of file externs.h.

#define CLONE_PRESERVE   2

Definition at line 404 of file externs.h.

Referenced by do_clone().

#define CLONE_SET_COST   8

Definition at line 406 of file externs.h.

Referenced by do_clone().

#define CLONE_SET_LOC   16

Definition at line 407 of file externs.h.

#define CLONE_SET_NAME   32

Definition at line 408 of file externs.h.

#define COMTITLE_OFF   2

Definition at line 412 of file externs.h.

Referenced by do_comtitle().

#define COMTITLE_ON   1

Definition at line 411 of file externs.h.

Referenced by do_comtitle().

#define CRE_INVENTORY   0

Definition at line 413 of file externs.h.

#define CRE_LOCATION   1

Definition at line 414 of file externs.h.

#define CRE_SET_LOC   2

Definition at line 415 of file externs.h.

#define CSET_HEADER   8

Definition at line 424 of file externs.h.

Referenced by do_chopen().

#define CSET_LIST   4

Definition at line 420 of file externs.h.

Referenced by do_chopen().

#define CSET_LOG   9

Definition at line 425 of file externs.h.

Referenced by do_chopen().

#define CSET_LOUD   2

Definition at line 418 of file externs.h.

Referenced by do_chopen().

#define CSET_NOSPOOF   7

Definition at line 423 of file externs.h.

Referenced by do_chopen().

#define CSET_OBJECT   5

Definition at line 421 of file externs.h.

Referenced by do_chopen().

#define CSET_PRIVATE   1

Definition at line 417 of file externs.h.

Referenced by do_chopen().

#define CSET_PUBLIC   0

Definition at line 416 of file externs.h.

Referenced by do_chopen().

#define CSET_QUIET   3

Definition at line 419 of file externs.h.

Referenced by do_chopen().

#define CSET_SPOOF   6

Definition at line 422 of file externs.h.

Referenced by do_chopen().

#define DBCK_DEFAULT   1

Definition at line 426 of file externs.h.

#define DBCK_FULL   2

Definition at line 427 of file externs.h.

Referenced by check_dead_refs(), check_loc_contents(), check_loc_exits(), and dbconvert().

#define DECOMP_DBREF   1

Definition at line 428 of file externs.h.

Referenced by do_decomp().

#define DEST_INSTANT   8

Definition at line 432 of file externs.h.

Referenced by do_destroy().

#define DEST_ONE   1

Definition at line 430 of file externs.h.

#define DEST_OVERRIDE   4

Definition at line 431 of file externs.h.

Referenced by do_destroy().

#define DIG_TELEPORT   1

Definition at line 433 of file externs.h.

Referenced by do_dig().

#define DOING_HEADER   1

Definition at line 438 of file externs.h.

Referenced by do_doing().

#define DOING_MASK   15

Definition at line 441 of file externs.h.

Referenced by do_doing().

#define DOING_MESSAGE   0

Definition at line 437 of file externs.h.

Referenced by do_doing().

#define DOING_POLL   2

Definition at line 439 of file externs.h.

#define DOING_QUIET   16

Definition at line 442 of file externs.h.

Referenced by do_doing().

#define DOING_UNIQUE   3

Definition at line 440 of file externs.h.

Referenced by do_doing().

#define DOLIST_DELIMIT   1

Definition at line 435 of file externs.h.

Referenced by do_dolist().

#define DOLIST_NOTIFY   2

Definition at line 436 of file externs.h.

Referenced by do_dolist().

#define DOLIST_SPACE   0

Definition at line 434 of file externs.h.

#define DROP_QUIET   1

Definition at line 443 of file externs.h.

Referenced by do_drop().

#define DUMP_FLATFILE   4

Definition at line 446 of file externs.h.

Referenced by fork_and_dump().

#define DUMP_I_FLAT   3

Definition at line 178 of file externs.h.

Referenced by do_backup(), and fork_and_dump().

#define DUMP_I_NORMAL   0

Definition at line 175 of file externs.h.

Referenced by do_backup(), dump_database(), and fork_and_dump().

#define DUMP_I_PANIC   1

Definition at line 176 of file externs.h.

Referenced by do_shutdown(), and dump_database_internal().

#define DUMP_I_RESTART   2

Definition at line 177 of file externs.h.

Referenced by do_restart(), and sighandler().

#define DUMP_I_SIGNAL   4

Definition at line 179 of file externs.h.

Referenced by dump_database_internal(), and sighandler().

#define DUMP_STRUCT   1

Definition at line 444 of file externs.h.

Referenced by fork_and_dump().

#define DUMP_TEXT   2

Definition at line 445 of file externs.h.

Referenced by fork_and_dump().

#define ENDLINE   "\n"

Definition at line 197 of file externs.h.

Referenced by add_comsys(), AssertionFailed(), cache_del(), cache_pass2(), cache_put(), db_read(), db_write(), del_comsys(), do_log(), do_mail_nuke(), do_shutdown(), dup_bool(), end_log(), eval_boolexp(), get_list(), init_dbfile(), CHashPage::Insert(), load_channels(), load_comsys(), load_comsystem(), load_game(), load_malias(), log_perror(), main(), make_socket(), CGuests::MakeGuestChar(), OutOfMemory(), pool_err(), putbool_subexp(), ReplaceFile(), report_timecheck(), save_comsys(), CHashPage::Split(), start_log(), unparse_boolexp1(), and write_pidfile().

#define ENDLOG   end_log(); }

Definition at line 721 of file externs.h.

Referenced by boot_slave(), CF_HAND(), cf_log_notfound(), cf_log_syntax(), cf_status_from_succfail(), check_connect(), do_backup(), do_boot(), do_command(), do_fixdb(), do_global(), do_link(), do_logged_out_internal(), do_mail_read(), do_name(), do_newpassword(), do_pcreate(), do_quota(), do_restart(), do_shout(), do_shutdown(), do_toad(), dump_database(), eval_boolexp(), failconn(), fcache_read(), fork_and_dump(), get_slave_result(), helpindex_read(), init_dbfile(), init_version(), CHashFile::Insert(), load_game(), Log_header_err(), Log_pointer_err(), log_signal(), log_signal_ignore(), Log_simple_err(), LogStatBuf(), main(), new_connection(), new_mail_message(), pool_err(), pool_free(), pool_free_lbuf(), process_command(), purge_going(), queue_write_LEN(), report(), report_timecheck(), ReportTopic(), shovechars(), shutdownsock(), sighandler(), Task_RunQueueEntry(), ValidateHelpFileIndex(), and write_pidfile().

#define EV_EVAL   0x00000800

Definition at line 654 of file externs.h.

Referenced by add_mail_message(), add_prefix(), BuildChannelMessage(), check_filter(), default_handler(), delim_check(), did_it(), do_if(), do_postpend(), do_prepend(), do_switch(), do_think(), do_ufun(), eval_boolexp(), filter_handler(), FUNCTION(), get_exit_dest(), get_handler(), look_contents(), look_exits(), look_in(), mail_return(), modSpeech(), mux_exec(), page_return(), parse_arglist(), parse_arglist_lite(), process_cmdent(), process_command(), process_hook(), process_sex(), ReportTopic(), search_perform(), show_a_desc(), switch_handler(), and u_comp().

#define EV_FCHECK   0x00000200

Definition at line 652 of file externs.h.

Referenced by add_mail_message(), BuildChannelMessage(), default_handler(), delim_check(), did_it(), do_if(), do_postpend(), do_prepend(), do_switch(), do_think(), do_ufun(), eval_boolexp(), filter_handler(), FUNCTION(), get_exit_dest(), look_contents(), look_exits(), look_in(), mail_return(), modSpeech(), mux_exec(), page_return(), parse_arglist(), parse_arglist_lite(), process_cmdent(), process_command(), process_hook(), search_perform(), show_a_desc(), switch_handler(), and u_comp().

#define EV_FIGNORE   0x00000000

Definition at line 650 of file externs.h.

Referenced by add_prefix(), check_filter(), default_handler(), did_it(), eval_boolexp(), FUNCTION(), get_handler(), and ReportTopic().

#define EV_FMAND   0x00000100

Definition at line 651 of file externs.h.

Referenced by mux_exec().

#define EV_NO_COMPRESS   0x00040000

Definition at line 661 of file externs.h.

Referenced by FUNCTION(), parse_to(), parse_to_cleanup(), process_cmdent(), and ReportTopic().

#define EV_NO_LOCATION   0x00080000

Definition at line 662 of file externs.h.

Referenced by FUNCTION(), mail_return(), mux_exec(), and page_return().

#define EV_NOFCHECK   0x00100000

Definition at line 663 of file externs.h.

Referenced by FUNCTION(), mux_exec(), and parse_arglist_lite().

#define EV_NOTRACE   0x00020000

Definition at line 660 of file externs.h.

Referenced by mux_exec(), and search_perform().

#define EV_STRIP_AROUND   0x00008000

Definition at line 658 of file externs.h.

Referenced by parse_to_cleanup(), and process_cmdent().

#define EV_STRIP_CURLY   0x00000400

Definition at line 653 of file externs.h.

Referenced by add_mail_message(), check_filter(), default_handler(), do_dolist(), do_postpend(), do_prepend(), filter_handler(), FUNCTION(), mux_exec(), parse_to(), process_cmdent(), process_command(), switch_handler(), and u_comp().

#define EV_STRIP_ESC   0x00004000

Definition at line 657 of file externs.h.

#define EV_STRIP_LS   0x00002000

Definition at line 656 of file externs.h.

Referenced by do_verb(), parse_to(), parse_to_cleanup(), and process_cmdent().

#define EV_STRIP_TS   0x00001000

Definition at line 655 of file externs.h.

Referenced by do_verb(), parse_range(), parse_to_cleanup(), process_cmdent(), and search_setup().

#define EV_TOP   0x00010000

Definition at line 659 of file externs.h.

Referenced by add_prefix(), BuildChannelMessage(), check_filter(), default_handler(), did_it(), do_if(), do_switch(), do_think(), eval_boolexp(), FUNCTION(), get_exit_dest(), look_contents(), look_exits(), look_in(), mail_return(), modSpeech(), mux_exec(), page_return(), process_cmdent(), process_command(), and show_a_desc().

#define EXAM_BRIEF   1

Definition at line 448 of file externs.h.

Referenced by do_examine().

#define EXAM_DEBUG   4

Definition at line 450 of file externs.h.

Referenced by do_examine().

#define EXAM_DEFAULT   0

Definition at line 447 of file externs.h.

Referenced by do_examine().

#define EXAM_LONG   2

Definition at line 449 of file externs.h.

#define EXAM_PARENT   8

Definition at line 451 of file externs.h.

Referenced by do_examine().

#define fetch_lastconnect (  )     (fetch_ConnectionInfoField((t), CIF_LASTCONNECT))

Definition at line 981 of file externs.h.

Referenced by FUNCTION().

#define fetch_longestconnect (  )     (fetch_ConnectionInfoField((t), CIF_LONGESTCONNECT))

Definition at line 980 of file externs.h.

Referenced by FUNCTION().

#define fetch_numconnections (  )     (fetch_ConnectionInfoField((t), CIF_NUMCONNECTS))

Definition at line 982 of file externs.h.

Referenced by FUNCTION().

#define fetch_totaltime (  )     (fetch_ConnectionInfoField((t), CIF_TOTALTIME))

Definition at line 979 of file externs.h.

Referenced by FUNCTION().

#define FIXDB_CON   4

Definition at line 456 of file externs.h.

Referenced by do_fixdb().

#define FIXDB_EXITS   8

Definition at line 457 of file externs.h.

Referenced by do_fixdb().

#define FIXDB_LINK   128

Definition at line 461 of file externs.h.

#define FIXDB_LOC   2

Definition at line 455 of file externs.h.

Referenced by do_fixdb().

#define FIXDB_NAME   2048

Definition at line 463 of file externs.h.

Referenced by do_fixdb().

#define FIXDB_NEXT   16

Definition at line 458 of file externs.h.

Referenced by do_fixdb().

#define FIXDB_OWNER   1

Definition at line 454 of file externs.h.

Referenced by do_fixdb().

#define FIXDB_PARENT   256

Definition at line 462 of file externs.h.

#define FIXDB_PENNIES   32

Definition at line 459 of file externs.h.

Referenced by do_fixdb().

#define FIXDB_ZONE   64

Definition at line 460 of file externs.h.

#define FLAG_REMOVE   1

Definition at line 464 of file externs.h.

Referenced by do_flag().

#define GET_QUIET   1

Definition at line 465 of file externs.h.

Referenced by do_get().

#define GIVE_QUIET   64

Definition at line 466 of file externs.h.

Referenced by give_money(), and give_thing().

#define GLOB_DISABLE   2

Definition at line 468 of file externs.h.

Referenced by do_global().

#define GLOB_ENABLE   1

Definition at line 467 of file externs.h.

Referenced by do_global().

#define HALT_ALL   1

Definition at line 470 of file externs.h.

Referenced by do_halt().

#define HOOK_AFAIL   32

Definition at line 477 of file externs.h.

Referenced by do_hook(), hook_fail(), hook_name(), process_command(), and show_hook().

#define HOOK_AFTER   2

Definition at line 473 of file externs.h.

Referenced by do_hook(), hook_name(), and show_hook().

#define HOOK_BEFORE   1

Definition at line 472 of file externs.h.

Referenced by do_hook(), hook_name(), process_cmdent(), and show_hook().

#define HOOK_CLEAR   64

Definition at line 478 of file externs.h.

Referenced by do_hook().

#define HOOK_IGNORE   8

Definition at line 475 of file externs.h.

Referenced by do_hook(), higcheck(), hook_name(), process_command(), and show_hook().

#define HOOK_IGSWITCH   16

Definition at line 476 of file externs.h.

Referenced by do_hook(), process_command(), and show_hook().

#define HOOK_LIST   128

Definition at line 479 of file externs.h.

Referenced by do_hook().

#define HOOK_PERMIT   4

Definition at line 474 of file externs.h.

Referenced by do_hook(), higcheck(), hook_name(), process_command(), and show_hook().

#define HUSH_ENTER   1

Definition at line 644 of file externs.h.

Referenced by do_enter_internal(), do_teleport_single(), move_via_teleport(), and process_enter_loc().

#define HUSH_EXIT   4

Definition at line 646 of file externs.h.

Referenced by do_move(), move_exit(), and move_via_exit().

#define HUSH_LEAVE   2

Definition at line 645 of file externs.h.

Referenced by do_leave(), do_teleport_single(), move_via_teleport(), and process_leave_loc().

#define ICMD_CHECK   16

Definition at line 485 of file externs.h.

Referenced by do_icmd().

#define ICMD_CLEAR   8

Definition at line 484 of file externs.h.

Referenced by do_icmd().

#define ICMD_CROOM   128

Definition at line 488 of file externs.h.

Referenced by do_icmd().

#define ICMD_DISABLE   0

Definition at line 480 of file externs.h.

#define ICMD_DROOM   32

Definition at line 486 of file externs.h.

Referenced by do_icmd().

#define ICMD_IGNORE   1

Definition at line 481 of file externs.h.

#define ICMD_IROOM   64

Definition at line 487 of file externs.h.

Referenced by do_icmd().

#define ICMD_LALLROOM   512

Definition at line 490 of file externs.h.

Referenced by do_icmd().

#define ICMD_LROOM   256

Definition at line 489 of file externs.h.

Referenced by do_icmd().

#define ICMD_OFF   4

Definition at line 483 of file externs.h.

Referenced by do_icmd().

#define ICMD_ON   2

Definition at line 482 of file externs.h.

Referenced by do_icmd().

#define IEEE_MAKE_IND   2

Definition at line 302 of file externs.h.

Referenced by ParseFloat().

#define IEEE_MAKE_NAN   1

Definition at line 301 of file externs.h.

Referenced by ParseFloat().

#define IEEE_MAKE_NINF   4

Definition at line 304 of file externs.h.

Referenced by ParseFloat().

#define IEEE_MAKE_PINF   3

Definition at line 303 of file externs.h.

Referenced by ParseFloat().

#define Invalid_Objtype (  ) 

Value:

Definition at line 335 of file externs.h.

Referenced by check_command(), and process_cmdent().

#define IU_DONE   0

Definition at line 920 of file externs.h.

Referenced by CallBack_NotifySemaphoreFirstOrQuiet(), CTaskHeap::TraverseOrdered(), and CTaskHeap::TraverseUnordered().

#define IU_NEXT_TASK   1

Definition at line 921 of file externs.h.

Referenced by CallBack_HaltQueue(), CallBack_NotifySemaphoreDrainOrAll(), CallBack_NotifySemaphoreFirstOrQuiet(), CallBack_ShowDispatches(), CallBack_ShowSemaphore(), CallBack_ShowWait(), and CallBack_Warp().

#define IU_REMOVE_TASK   2

Definition at line 922 of file externs.h.

Referenced by CallBack_HaltQueue(), CallBack_NotifySemaphoreDrainOrAll(), and CTaskHeap::TraverseUnordered().

#define IU_UPDATE_TASK   3

Definition at line 923 of file externs.h.

Referenced by CallBack_NotifySemaphoreDrainOrAll(), CallBack_NotifySemaphoreFirstOrQuiet(), CallBack_Warp(), and CTaskHeap::TraverseUnordered().

#define KILL_KILL   1

Definition at line 491 of file externs.h.

Referenced by do_kill().

#define KILL_SLAY   2

Definition at line 492 of file externs.h.

Referenced by do_kill().

#define LK_IDESC   0x0001

Definition at line 692 of file externs.h.

Referenced by look_in(), and show_desc().

#define LK_OBEYTERSE   0x0002

Definition at line 693 of file externs.h.

Referenced by announce_connect(), do_look(), look_in(), move_object(), and show_desc().

#define LK_SHOWATTR   0x0004

Definition at line 694 of file externs.h.

Referenced by do_look(), and look_in().

#define LK_SHOWEXIT   0x0008

Definition at line 695 of file externs.h.

Referenced by announce_connect(), do_look(), look_in(), and move_object().

#define LK_SHOWVRML   0x0010

Definition at line 696 of file externs.h.

Referenced by announce_connect(), and look_in().

#define LOG_SIMPLE ( key,
p,
s,
 ) 

Value:

STARTLOG(key,p,s) \
        log_text(m); \
    ENDLOG

Definition at line 723 of file externs.h.

Referenced by create_obj().

#define LOOK_LOOK   1

Definition at line 493 of file externs.h.

#define LOOK_OUTSIDE   8

Definition at line 494 of file externs.h.

Referenced by do_look().

#define MAIL_ABORT   22

Definition at line 516 of file externs.h.

Referenced by do_mail().

#define MAIL_ALIAS   19

Definition at line 513 of file externs.h.

Referenced by do_mail().

#define MAIL_ALIST   20

Definition at line 514 of file externs.h.

Referenced by do_mail().

#define MAIL_BCC   30

Definition at line 524 of file externs.h.

Referenced by do_mail().

#define MAIL_CC   26

Definition at line 520 of file externs.h.

Referenced by do_mail().

#define MAIL_CLEAR   9

Definition at line 503 of file externs.h.

Referenced by do_mail().

#define MAIL_DEBUG   4

Definition at line 498 of file externs.h.

Referenced by do_mail().

#define MAIL_DSTATS   2

Definition at line 496 of file externs.h.

Referenced by do_mail().

#define MAIL_EDIT   17

Definition at line 511 of file externs.h.

Referenced by do_mail().

#define MAIL_FILE   12

Definition at line 506 of file externs.h.

Referenced by do_mail().

#define MAIL_FOLDER   6

Definition at line 500 of file externs.h.

Referenced by do_mail().

#define MAIL_FORWARD   15

Definition at line 509 of file externs.h.

Referenced by do_mail().

#define MAIL_FSTATS   3

Definition at line 497 of file externs.h.

Referenced by do_mail().

#define MAIL_LIST   7

Definition at line 501 of file externs.h.

Referenced by do_mail().

#define MAIL_NUKE   5

Definition at line 499 of file externs.h.

Referenced by do_mail().

#define MAIL_PROOF   21

Definition at line 515 of file externs.h.

Referenced by do_mail().

#define MAIL_PURGE   11

Definition at line 505 of file externs.h.

Referenced by do_mail().

#define MAIL_QUICK   23

Definition at line 517 of file externs.h.

Referenced by do_mail().

#define MAIL_QUOTE   0x100

Definition at line 525 of file externs.h.

Referenced by do_mail(), and do_mail_reply().

#define MAIL_READ   8

Definition at line 502 of file externs.h.

Referenced by do_mail().

#define MAIL_REPLY   28

Definition at line 522 of file externs.h.

Referenced by do_mail().

#define MAIL_REPLYALL   29

Definition at line 523 of file externs.h.

Referenced by do_mail().

#define MAIL_RETRACT   25

Definition at line 519 of file externs.h.

Referenced by do_mail().

#define MAIL_REVIEW   24

Definition at line 518 of file externs.h.

Referenced by do_mail().

#define MAIL_SAFE   27

Definition at line 521 of file externs.h.

Referenced by do_mail().

#define MAIL_SEND   16

Definition at line 510 of file externs.h.

Referenced by do_mail().

#define MAIL_STATS   1

Definition at line 495 of file externs.h.

Referenced by do_mail().

#define MAIL_TAG   13

Definition at line 507 of file externs.h.

Referenced by do_mail().

#define MAIL_UNCLEAR   10

Definition at line 504 of file externs.h.

Referenced by do_mail().

#define MAIL_UNTAG   14

Definition at line 508 of file externs.h.

Referenced by do_mail().

#define MAIL_URGENT   18

Definition at line 512 of file externs.h.

Referenced by do_mail().

#define MALIAS_ADD   3

Definition at line 529 of file externs.h.

Referenced by do_malias().

#define MALIAS_CHOWN   2

Definition at line 528 of file externs.h.

Referenced by do_malias().

#define MALIAS_DELETE   5

Definition at line 531 of file externs.h.

Referenced by do_malias().

#define MALIAS_DESC   1

Definition at line 527 of file externs.h.

Referenced by do_malias().

#define MALIAS_LIST   8

Definition at line 533 of file externs.h.

Referenced by do_malias().

#define MALIAS_REMOVE   4

Definition at line 530 of file externs.h.

Referenced by do_malias().

#define MALIAS_RENAME   6

Definition at line 532 of file externs.h.

Referenced by do_malias().

#define MALIAS_STATUS   9

Definition at line 534 of file externs.h.

Referenced by do_malias().

#define MARK_CLEAR   1

Definition at line 536 of file externs.h.

Referenced by do_markall().

#define MARK_SET   0

Definition at line 535 of file externs.h.

Referenced by do_markall().

#define match_controlled ( player,
name   )     match_controlled_handler(player, name, false)

Definition at line 289 of file externs.h.

Referenced by do_alias(), do_cut(), do_force(), do_forwardlist(), do_halt(), do_mvattr(), do_name(), do_pemit_single(), do_power(), do_ps(), do_set(), do_sweep(), do_unlock(), and search_setup().

#define match_controlled_quiet ( player,
name   )     match_controlled_handler(player, name, true)

Definition at line 290 of file externs.h.

Referenced by do_destroy(), and FUNCTION().

#define MAX_LISTEN_PORTS   10

Definition at line 811 of file externs.h.

#define MOTD_ALL   0

Definition at line 537 of file externs.h.

Referenced by do_motd().

#define MOTD_BRIEF   16

Definition at line 542 of file externs.h.

Referenced by do_motd().

#define MOTD_DOWN   2

Definition at line 539 of file externs.h.

Referenced by do_motd().

#define MOTD_FULL   4

Definition at line 540 of file externs.h.

Referenced by do_motd().

#define MOTD_LIST   8

Definition at line 541 of file externs.h.

Referenced by do_motd().

#define MOTD_WIZ   1

Definition at line 538 of file externs.h.

Referenced by do_motd().

#define MOVE_QUIET   1

Definition at line 543 of file externs.h.

Referenced by do_enter(), do_leave(), and do_move().

#define MSG_F_CONTENTS   (MSG_INV)

Definition at line 686 of file externs.h.

Referenced by notify_check().

#define MSG_F_DOWN   (MSG_INV_L)

Definition at line 688 of file externs.h.

Referenced by notify_check(), notify_except(), and notify_except2().

#define MSG_F_UP   (MSG_NBR_A|MSG_LOC_A)

Definition at line 687 of file externs.h.

Referenced by notify_check(), notify_except(), and notify_except2().

#define MSG_FWDLIST   0x00000400UL

Definition at line 677 of file externs.h.

Referenced by announce_connect(), announce_disconnect(), and notify_check().

#define MSG_HTML   0x00004000UL

Definition at line 681 of file externs.h.

Referenced by notify_check().

#define MSG_INV   0x00000002UL

Definition at line 668 of file externs.h.

Referenced by announce_connect(), announce_disconnect(), handle_ears(), and notify_check().

#define MSG_INV_EXITS   0x00000008UL

Definition at line 670 of file externs.h.

Referenced by notify_check().

#define MSG_INV_L   0x00000004UL

Definition at line 669 of file externs.h.

Referenced by notify_check().

#define MSG_LOC   0x00000100UL

Definition at line 675 of file externs.h.

Referenced by announce_connect(), announce_disconnect(), handle_ears(), and notify_check().

#define MSG_LOC_A   0x00000200UL

Definition at line 676 of file externs.h.

Referenced by notify_check().

#define MSG_ME   0x00000800UL

Definition at line 678 of file externs.h.

Referenced by handle_ears(), notify_check(), notify_except(), and notify_except2().

#define MSG_ME_ALL   (MSG_ME|MSG_INV_EXITS|MSG_FWDLIST)

Definition at line 685 of file externs.h.

Referenced by notify_except(), and notify_except2().

#define MSG_NBR   0x00000010UL

Definition at line 671 of file externs.h.

Referenced by announce_connect(), announce_disconnect(), handle_ears(), and notify_check().

#define MSG_NBR_A   0x00000020UL

Definition at line 672 of file externs.h.

Referenced by notify_check().

#define MSG_NBR_EXITS   0x00000040UL

Definition at line 673 of file externs.h.

Referenced by announce_connect(), announce_disconnect(), and notify_check().

#define MSG_NBR_EXITS_A   0x00000080UL

Definition at line 674 of file externs.h.

Referenced by notify_check(), notify_except(), and notify_except2().

#define MSG_OOC   0x00008000UL

Definition at line 682 of file externs.h.

Referenced by notify_check().

#define MSG_PUP_ALWAYS   0x00000001UL

Definition at line 667 of file externs.h.

Referenced by notify_check().

#define MSG_S_INSIDE   0x00001000UL

Definition at line 679 of file externs.h.

Referenced by notify_check(), notify_except(), and notify_except2().

#define MSG_S_OUTSIDE   0x00002000UL

Definition at line 680 of file externs.h.

Referenced by notify_check(), notify_except(), and notify_except2().

#define MSG_SAYPOSE   0x00010000UL

Definition at line 683 of file externs.h.

Referenced by do_say(), and notify_check().

#define NFY_DRAIN   2

Definition at line 546 of file externs.h.

Referenced by CallBack_NotifySemaphoreDrainOrAll(), destroy_bad_obj(), destroy_obj(), and do_notify().

#define NFY_NFY   0

Definition at line 544 of file externs.h.

Referenced by CallBack_NotifySemaphoreFirstOrQuiet(), and nfy_que().

#define NFY_NFYALL   1

Definition at line 545 of file externs.h.

#define NFY_QUIET   3

Definition at line 547 of file externs.h.

Referenced by do_notify(), and nfy_que().

#define notify ( p,
 )     notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN)

Definition at line 121 of file externs.h.

Referenced by add_mail_message(), badname_list(), CallBack_ShowDispatches(), CallBack_ShowSemaphore(), CallBack_ShowWait(), canpayfees(), CF_HAND(), cf_log_notfound(), cf_log_syntax(), cf_set(), cf_status_from_succfail(), check_dead_refs(), check_floating(), check_mail(), chown_all(), convert_flags(), create_obj(), dbclean_CheckALISTtoAT(), dbclean_CheckALISTtoDB(), dbclean_CheckANHtoAT(), dbclean_CheckATtoANH(), debug_examine(), decode_power(), decompile_flags(), destroy_obj(), did_it(), disp_from_on(), display_flagtab(), display_powertab(), do_addcommand(), do_admin(), do_apply_marked(), do_attribute(), do_backup(), do_boot(), do_chownall(), do_chzone(), do_clone(), do_command(), do_create(), do_dbck(), do_dbclean(), do_decomp(), do_delcommand(), do_destroy(), do_dig(), do_doing(), do_dolist(), do_drop(), do_dump(), do_edit_msg(), do_enter(), do_enter_internal(), do_entrances(), do_examine(), do_expmail_abort(), do_expmail_start(), do_expmail_stop(), do_find(), do_fixdb(), do_flag(), do_function(), do_get(), do_give(), do_halt(), do_help(), do_hook(), do_icmd(), do_inventory(), do_kill(), do_last(), do_leave(), do_list(), do_listcommands(), do_log(), do_mail(), do_mail_cc(), do_mail_change_folder(), do_mail_debug(), do_mail_file(), do_mail_flags(), do_mail_fwd(), do_mail_list(), do_mail_nuke(), do_mail_proof(), do_mail_purge(), do_mail_quick(), do_mail_read(), do_mail_reply(), do_mail_retract(), do_mail_retract1(), do_mail_review(), do_mail_stats(), do_mail_stub(), do_malias(), do_malias_add(), do_malias_adminlist(), do_malias_chown(), do_malias_create(), do_malias_delete(), do_malias_desc(), do_malias_list(), do_malias_list_all(), do_malias_remove(), do_malias_rename(), do_malias_send(), do_malias_status(), do_markall(), do_moniker(), do_move(), do_notify(), do_page(), do_password(), do_pemit_single(), do_postpend(), do_prepend(), do_processcom(), do_prog(), do_ps(), do_queue(), do_quitprog(), do_report(), do_restart(), do_score(), do_search(), do_shutdown(), do_stats(), do_sweep(), do_teleport(), do_think(), do_train(), do_verb(), do_version(), do_wait(), er_mark_disabled(), eval_boolexp(), exam_wildattrs(), fcache_load(), fh_any(), fh_going_bit(), flag_set(), FUNCTION(), fwdlist_load(), get_stats(), give_money(), give_thing(), help_write(), helpindex_load(), hook_loop(), list_bufstats(), list_costs(), list_sites(), list_system_resources(), CGuests::ListAll(), listset_nametab(), look_contents(), look_exits(), look_in(), look_simple(), mail_check(), make_numlist(), match_status(), move_exit(), move_object(), mux_exec(), page_check(), parse_boolexp_L(), parse_msglist(), pool_trace(), power_set(), process_cmdent(), process_command(), record_login(), ReportMatchedTopics(), search_mark(), search_setup(), send_mail(), setup_que(), show_a_desc(), ShowPsLine(), sp_ok(), sweep_check(), Task_RunQueueEntry(), tcache_finish(), view_atr(), and whisper_pose().

#define notify_all ( p,
c,
 )     notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS|MSG_F_UP|MSG_F_CONTENTS)

Definition at line 131 of file externs.h.

Referenced by do_destroy().

#define notify_all_from_inside ( p,
c,
 )     notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS_A|MSG_F_UP|MSG_F_CONTENTS|MSG_S_INSIDE)

Definition at line 132 of file externs.h.

Referenced by do_pemit_single(), do_say(), and do_train().

#define notify_all_from_inside_html ( p,
c,
 )     notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS_A|MSG_F_UP|MSG_F_CONTENTS|MSG_S_INSIDE|MSG_HTML)

Definition at line 134 of file externs.h.

Referenced by do_say().

#define notify_all_from_inside_saypose ( p,
c,
 )     notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS_A|MSG_F_UP|MSG_F_CONTENTS|MSG_S_INSIDE|MSG_SAYPOSE)

Definition at line 133 of file externs.h.

Referenced by do_say().

#define notify_html ( p,
 )     notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_HTML)

Definition at line 123 of file externs.h.

Referenced by did_it(), look_contents(), look_exits(), look_in(), process_leave_loc(), and show_vrml_url().

#define notify_quiet ( p,
 )     notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME)

Definition at line 124 of file externs.h.

Referenced by can_destroy_player(), destroy_player(), do_alias(), do_boot(), do_chown(), do_clone(), do_create(), do_cut(), do_decomp(), do_destroy(), do_dig(), do_edit(), do_examine(), do_find(), do_forwardlist(), do_function(), do_global(), do_link(), do_lock(), do_look(), do_moniker(), do_motd(), do_mvattr(), do_name(), do_newpassword(), do_notify(), do_parent(), do_pcreate(), do_power(), do_quota(), do_set(), do_setvattr(), do_sweep(), do_teleport_single(), do_toad(), do_trigger(), do_unlink(), do_unlock(), do_use(), do_verb(), do_wait(), do_wipe(), exam_wildattrs(), link_exit(), match_controlled_handler(), move_via_teleport(), open_exit(), parse_linkable_room(), process_command(), set_attr_internal(), and show_quota().

#define notify_quiet_with_cause ( p,
c,
 )     notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME)

Definition at line 128 of file externs.h.

#define notify_saypose ( p,
 )     notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_SAYPOSE)

Definition at line 122 of file externs.h.

Referenced by do_say().

#define notify_with_cause ( p,
c,
 )     notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN)

Definition at line 125 of file externs.h.

Referenced by do_pemit_single(), wall_broadcast(), and whisper_pose().

#define notify_with_cause_html ( p,
c,
 )     notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_HTML)

Definition at line 127 of file externs.h.

Referenced by do_pemit_single().

#define notify_with_cause_ooc ( p,
c,
 )     notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_OOC)

Definition at line 126 of file externs.h.

Referenced by do_kill(), do_page(), give_money(), give_thing(), mail_return(), page_return(), and SendChannelMessage().

#define NUM_DUMP_TYPES   5

Definition at line 180 of file externs.h.

Referenced by dump_database_internal().

#define OPEN_INVENTORY   1

Definition at line 549 of file externs.h.

Referenced by do_open().

#define OPEN_LOCATION   0

Definition at line 548 of file externs.h.

#define PCRE_PLAYER   1

Definition at line 550 of file externs.h.

#define PCRE_ROBOT   2

Definition at line 551 of file externs.h.

Referenced by do_pcreate().

#define PEMIT_CONTENTS   8

Definition at line 559 of file externs.h.

Referenced by do_pemit().

#define PEMIT_FEMIT   5

Definition at line 556 of file externs.h.

Referenced by do_pemit_single().

#define PEMIT_FPOSE   6

Definition at line 557 of file externs.h.

Referenced by do_pemit_single().

#define PEMIT_FPOSE_NS   7

Definition at line 558 of file externs.h.

Referenced by do_pemit_single().

#define PEMIT_FSAY   4

Definition at line 555 of file externs.h.

Referenced by do_pemit_single().

#define PEMIT_HERE   16

Definition at line 560 of file externs.h.

Referenced by do_pemit(), and do_pemit_single().

#define PEMIT_HTML   128

Definition at line 563 of file externs.h.

Referenced by do_pemit(), and do_pemit_single().

#define PEMIT_LIST   64

Definition at line 562 of file externs.h.

Referenced by do_pemit().

#define PEMIT_OEMIT   2

Definition at line 553 of file externs.h.

Referenced by do_pemit_single(), and FUNCTION().

#define PEMIT_PEMIT   1

Definition at line 552 of file externs.h.

Referenced by do_pemit_single(), and FUNCTION().

#define PEMIT_ROOM   32

Definition at line 561 of file externs.h.

Referenced by do_pemit(), and do_pemit_single().

#define PEMIT_WHISPER   3

Definition at line 554 of file externs.h.

Referenced by do_pemit(), and do_pemit_single().

#define PRIORITY_CF_DEQUEUE_DISABLED   (PRIORITY_PLAYER-1)

Definition at line 889 of file externs.h.

Referenced by do_global(), and do_queue().

#define PRIORITY_CF_DEQUEUE_ENABLED   PRIORITY_OBJECT

Definition at line 888 of file externs.h.

Referenced by CScheduler::CScheduler(), do_global(), and do_queue().

#define PRIORITY_OBJECT   300

Definition at line 883 of file externs.h.

Referenced by CallBack_NotifySemaphoreDrainOrAll(), CallBack_NotifySemaphoreFirstOrQuiet(), init_timer(), and wait_que().

#define PRIORITY_PLAYER   200

Definition at line 882 of file externs.h.

Referenced by CallBack_NotifySemaphoreDrainOrAll(), CallBack_NotifySemaphoreFirstOrQuiet(), and wait_que().

#define PRIORITY_SUSPEND   400

Definition at line 884 of file externs.h.

Referenced by wait_que().

#define PRIORITY_SYSTEM   100

Definition at line 881 of file externs.h.

Referenced by dispatch_CacheTick(), dispatch_CheckEvents(), dispatch_DatabaseDump(), dispatch_FreeListReconstruction(), dispatch_IdleCheck(), do_timewarp(), init_timer(), save_command(), sighandler(), and Task_ProcessCommand().

#define Protect (  )     (cmdp->perms & f)

Definition at line 333 of file externs.h.

Referenced by check_command(), and process_cmdent().

#define PS_ALL   4

Definition at line 567 of file externs.h.

Referenced by do_ps().

#define PS_BRIEF   0

Definition at line 564 of file externs.h.

Referenced by do_ps().

#define PS_LONG   1

Definition at line 565 of file externs.h.

Referenced by do_ps(), and ShowPsLine().

#define PS_SUMM   2

Definition at line 566 of file externs.h.

Referenced by CallBack_ShowSemaphore(), CallBack_ShowWait(), and do_ps().

#define QUERY_SQL   1

Definition at line 568 of file externs.h.

#define QUEUE_KICK   1

Definition at line 569 of file externs.h.

Referenced by do_queue().

#define QUEUE_WARP   2

Definition at line 570 of file externs.h.

Referenced by do_queue(), and do_timewarp().

#define QUOTA_ALL   16

Definition at line 575 of file externs.h.

Referenced by do_quota().

#define QUOTA_FIX   2

Definition at line 572 of file externs.h.

Referenced by do_quota(), and mung_quotas().

#define QUOTA_REM   8

Definition at line 574 of file externs.h.

Referenced by do_quota(), and mung_quotas().

#define QUOTA_SET   1

Definition at line 571 of file externs.h.

Referenced by do_quota().

#define QUOTA_TOT   4

Definition at line 573 of file externs.h.

Referenced by do_quota(), and mung_quotas().

#define SA_DFLT   2

Definition at line 717 of file externs.h.

Referenced by cf_init().

#define SA_EXIT   1

Definition at line 716 of file externs.h.

Referenced by sighandler().

#define safe_ambiguous ( b,
 )     safe_copy_buf(FUNC_AMBIGUOUS,13,(b),(p))

Definition at line 742 of file externs.h.

Referenced by safe_match_result().

#define safe_nomatch ( b,
 )     safe_copy_buf(FUNC_NOMATCH_MESSAGE,12,(b),(p))

Definition at line 740 of file externs.h.

Referenced by FUNCTION(), get_handler(), internalPlayerFind(), lattr_handler(), and process_sex().

#define safe_noperm ( b,
 )     safe_copy_buf(FUNC_NOPERM_MESSAGE,21,(b),(p))

Definition at line 739 of file externs.h.

Referenced by check_command(), FUNCTION(), get_handler(), grep_handler(), hasattr_handler(), mux_exec(), parse_and_get_attrib(), scan_zone(), and set_attr_internal().

#define safe_notfound ( b,
 )     safe_copy_buf(FUNC_NOT_FOUND,13,(b),(p))

Definition at line 743 of file externs.h.

Referenced by FUNCTION(), and safe_match_result().

#define safe_nothing ( b,
 )     safe_copy_buf(FUNC_FAIL_MESSAGE,3,(b),(p))

Definition at line 738 of file externs.h.

Referenced by FUNCTION().

#define safe_range ( b,
 )     safe_copy_buf(OUT_OF_RANGE,16,(b),(p))

Definition at line 741 of file externs.h.

Referenced by centerjustcombo(), and FUNCTION().

#define SAY_EMIT   5

Definition at line 585 of file externs.h.

Referenced by do_say(), and FUNCTION().

#define SAY_HERE   64

Definition at line 597 of file externs.h.

Referenced by do_say(), and do_shout().

#define SAY_HTML   256

Definition at line 599 of file externs.h.

Referenced by do_say(), and do_shout().

#define SAY_NOEVAL   8

Definition at line 586 of file externs.h.

Referenced by do_say().

#define SAY_NOSPACE   1

Definition at line 581 of file externs.h.

#define SAY_NOTAG   32

Definition at line 596 of file externs.h.

Referenced by do_say(), do_shout(), and say_shout().

#define SAY_POSE   2

Definition at line 582 of file externs.h.

Referenced by do_say().

#define SAY_POSE_NOSPC   3

Definition at line 583 of file externs.h.

Referenced by do_say().

#define SAY_PREFIX   4

Definition at line 584 of file externs.h.

Referenced by do_say().

#define SAY_ROOM   128

Definition at line 598 of file externs.h.

Referenced by do_say(), and do_shout().

#define SAY_SAY   1

Definition at line 580 of file externs.h.

Referenced by do_say().

#define SET_QUIET   1

Definition at line 600 of file externs.h.

Referenced by do_set(), flag_set(), power_set(), and set_attr_internal().

#define SHOUT_ADMIN   2

Definition at line 603 of file externs.h.

Referenced by do_shout(), and wall_broadcast().

#define SHOUT_ADMINSHOUT   7

Definition at line 593 of file externs.h.

Referenced by do_shout().

#define SHOUT_DEFAULT   0

Definition at line 601 of file externs.h.

#define SHOUT_SHOUT   1

Definition at line 587 of file externs.h.

Referenced by do_shout().

#define SHOUT_WALLEMIT   3

Definition at line 589 of file externs.h.

Referenced by do_shout().

#define SHOUT_WALLPOSE   2

Definition at line 588 of file externs.h.

Referenced by do_shout().

#define SHOUT_WIZARD   1

Definition at line 602 of file externs.h.

Referenced by do_shout(), and wall_broadcast().

#define SHOUT_WIZEMIT   6

Definition at line 592 of file externs.h.

Referenced by do_shout().

#define SHOUT_WIZPOSE   5

Definition at line 591 of file externs.h.

Referenced by do_shout().

#define SHOUT_WIZSHOUT   4

Definition at line 590 of file externs.h.

Referenced by do_shout().

#define SHUTDN_COREDUMP   4

Definition at line 607 of file externs.h.

#define SHUTDN_EXIT   2

Definition at line 606 of file externs.h.

#define SHUTDN_NORMAL   0

Definition at line 604 of file externs.h.

#define SHUTDN_PANIC   1

Definition at line 605 of file externs.h.

Referenced by do_shutdown().

#define SRCH_MARK   2

Definition at line 609 of file externs.h.

Referenced by search_mark().

#define SRCH_SEARCH   1

Definition at line 608 of file externs.h.

Referenced by do_search().

#define SRCH_UNMARK   3

Definition at line 610 of file externs.h.

Referenced by search_mark().

#define STARTLOG ( key,
p,
 )     if ((((key) & mudconf.log_options) != 0) && start_log(p, s)) {

Definition at line 719 of file externs.h.

Referenced by boot_slave(), CF_HAND(), cf_log_notfound(), cf_log_syntax(), cf_status_from_succfail(), check_connect(), do_backup(), do_boot(), do_command(), do_fixdb(), do_global(), do_link(), do_logged_out_internal(), do_mail_read(), do_name(), do_newpassword(), do_pcreate(), do_quota(), do_restart(), do_shout(), do_shutdown(), do_toad(), dump_database(), eval_boolexp(), failconn(), fcache_read(), fork_and_dump(), get_slave_result(), helpindex_read(), init_dbfile(), init_version(), CHashFile::Insert(), load_game(), Log_header_err(), Log_pointer_err(), log_signal(), log_signal_ignore(), Log_simple_err(), LogStatBuf(), main(), new_connection(), new_mail_message(), pool_err(), pool_free(), pool_free_lbuf(), process_command(), purge_going(), queue_write_LEN(), report(), report_timecheck(), ReportTopic(), shovechars(), shutdownsock(), sighandler(), Task_RunQueueEntry(), ValidateHelpFileIndex(), and write_pidfile().

#define STAT_ALL   1

Definition at line 612 of file externs.h.

Referenced by do_stats().

#define STAT_ME   2

Definition at line 613 of file externs.h.

Referenced by do_stats().

#define STAT_PLAYER   0

Definition at line 611 of file externs.h.

Referenced by do_stats().

#define SWEEP_COMMANDS   4

Definition at line 619 of file externs.h.

Referenced by do_sweep(), and sweep_check().

#define SWEEP_CONNECT   32

Definition at line 622 of file externs.h.

Referenced by do_sweep(), and sweep_check().

#define SWEEP_EXITS   64

Definition at line 623 of file externs.h.

Referenced by do_sweep().

#define SWEEP_HERE   2

Definition at line 618 of file externs.h.

Referenced by do_sweep().

#define SWEEP_LISTEN   8

Definition at line 620 of file externs.h.

Referenced by do_sweep(), and sweep_check().

#define SWEEP_ME   1

Definition at line 617 of file externs.h.

Referenced by do_sweep().

#define SWEEP_PLAYER   16

Definition at line 621 of file externs.h.

Referenced by do_sweep(), and sweep_check().

#define SWEEP_SCAN   128

Definition at line 624 of file externs.h.

#define SWEEP_VERBOSE   256

Definition at line 625 of file externs.h.

Referenced by do_sweep().

#define SWITCH_ANY   1

Definition at line 615 of file externs.h.

Referenced by do_switch().

#define SWITCH_DEFAULT   0

Definition at line 614 of file externs.h.

Referenced by do_switch().

#define SWITCH_ONE   2

Definition at line 616 of file externs.h.

Referenced by do_switch().

#define TELEPORT_DEFAULT   1

Definition at line 626 of file externs.h.

#define TELEPORT_LIST   4

Definition at line 628 of file externs.h.

Referenced by do_teleport().

#define TELEPORT_QUIET   2

Definition at line 627 of file externs.h.

Referenced by do_teleport_single().

#define TIMECHK_LOG   4

Definition at line 631 of file externs.h.

Referenced by do_timecheck().

#define TIMECHK_RESET   1

Definition at line 629 of file externs.h.

Referenced by do_timecheck().

#define TIMECHK_SCREEN   2

Definition at line 630 of file externs.h.

Referenced by do_timecheck().

#define TOAD_NO_CHOWN   1

Definition at line 632 of file externs.h.

Referenced by do_toad().

#define TRIG_QUIET   1

Definition at line 633 of file externs.h.

Referenced by do_trigger().

#define TWARP_CLEAN   4

Definition at line 636 of file externs.h.

Referenced by do_timewarp().

#define TWARP_DUMP   2

Definition at line 635 of file externs.h.

Referenced by do_timewarp().

#define TWARP_EVENTS   32

Definition at line 639 of file externs.h.

Referenced by do_timewarp().

#define TWARP_IDLE   8

Definition at line 637 of file externs.h.

Referenced by do_timewarp().

#define TWARP_QUEUE   1

Definition at line 634 of file externs.h.

Referenced by do_timewarp().

#define VE_BASE_DARK   0x10

Definition at line 711 of file externs.h.

Referenced by exit_displayable(), exit_visible(), FUNCTION(), look_exits(), match_exit_internal(), and room_list().

#define VE_LOC_DARK   0x02

Definition at line 708 of file externs.h.

Referenced by exit_displayable(), exit_visible(), FUNCTION(), look_exits(), match_exit_internal(), and room_list().

#define VE_LOC_LIGHT   0x04

Definition at line 709 of file externs.h.

#define VE_LOC_XAM   0x01

Definition at line 707 of file externs.h.

Referenced by exit_visible(), FUNCTION(), match_exit_internal(), and room_list().

#define WAIT_UNTIL   1

Definition at line 640 of file externs.h.

Referenced by do_wait().


Typedef Documentation

typedef void FTASK(void *, int)

Definition at line 867 of file externs.h.

typedef struct TASK_RECORD * PTASK_RECORD

typedef int SCHCMP(PTASK_RECORD, PTASK_RECORD)

Definition at line 891 of file externs.h.

typedef int SCHLOOK(PTASK_RECORD)

Definition at line 892 of file externs.h.


Function Documentation

int a_Queue ( dbref  player,
int  adj 
)

Adjusts the count of queued commands up or down.

cque.cpp uses this as it schedules and performs queued commands.

Parameters:
player dbref of player object responsible for command.
adj new (+) or completed (-) commands being queued.
Returns:
None.

Definition at line 239 of file player_c.cpp.

References Good_obj, OwnsOthers, pcache_find(), and player_cache::queue.

Referenced by CallBack_HaltQueue(), CallBack_NotifySemaphoreDrainOrAll(), halt_que(), setup_que(), and Task_RunQueueEntry().

00240 {
00241     if (  Good_obj(player)
00242        && OwnsOthers(player))
00243     {
00244         PCACHE *pp = pcache_find(player);
00245         pp->queue += adj;
00246         return pp->queue;
00247     }
00248     return 0;
00249 }

bool add_player_name ( dbref  ,
const char *   
)

Definition at line 701 of file player.cpp.

References alloc_lbuf, free_lbuf, Good_obj, hashaddLEN(), hashfindLEN(), hashreplLEN(), ISOUTOFMEMORY, isPlayer, MEMALLOC, MEMFREE, mudstate, mux_strlwr(), statedata::player_htab, and safe_str.

Referenced by CGuests::Create(), create_obj(), do_alias(), do_fixdb(), do_name(), and load_player_names().

00702 {
00703     bool stat;
00704     char *temp, *tp;
00705 
00706     // Convert to all lowercase.
00707     //
00708     tp = temp = alloc_lbuf("add_player_name");
00709     safe_str(name, temp, &tp);
00710     *tp = '\0';
00711     mux_strlwr(temp);
00712 
00713     dbref *p = (int *)hashfindLEN(temp, strlen(temp), &mudstate.player_htab);
00714     if (p)
00715     {
00716         // Entry found in the hashtable.  If a player, succeed if the
00717         // numbers match (already correctly in the hash table), fail
00718         // if they don't.
00719         //
00720         if (Good_obj(*p) && isPlayer(*p))
00721         {
00722             free_lbuf(temp);
00723             if (*p == player)
00724             {
00725                 return true;
00726             }
00727             else
00728             {
00729                 return false;
00730             }
00731         }
00732 
00733         // It's an alias (or an incorrect entry). Clobber it.
00734         //
00735         MEMFREE(p);
00736         p = (dbref *)MEMALLOC(sizeof(int));
00737         ISOUTOFMEMORY(p);
00738 
00739         *p = player;
00740         stat = hashreplLEN(temp, strlen(temp), p, &mudstate.player_htab);
00741         free_lbuf(temp);
00742     }
00743     else
00744     {
00745         p = (dbref *)MEMALLOC(sizeof(int));
00746         ISOUTOFMEMORY(p);
00747 
00748         *p = player;
00749         stat = (hashaddLEN(temp, strlen(temp), p, &mudstate.player_htab) >= 0);
00750         free_lbuf(temp);
00751     }
00752     return stat;
00753 }

void add_quota ( dbref  ,
int   
)

Definition at line 276 of file predicates.cpp.

References A_RQUOTA, atr_add_raw(), atr_get, free_lbuf, mux_atol(), and mux_ltoa().

Referenced by chown_all(), destroy_obj(), do_chown(), and link_exit().

00277 {
00278     dbref aowner;
00279     int aflags;
00280     char buf[20];
00281 
00282     char *quota = atr_get(who, A_RQUOTA, &aowner, &aflags);
00283     mux_ltoa(mux_atol(quota) + payment, buf);
00284     free_lbuf(quota);
00285     atr_add_raw(who, A_RQUOTA, buf);
00286 }

void AddToPublicChannel ( dbref  player  ) 

Definition at line 530 of file player.cpp.

References do_addcom(), mudconf, confdata::public_channel, and confdata::public_channel_alias.

Referenced by check_connect(), and do_pcreate().

00531 {
00532     if (  mudconf.public_channel[0] != '\0'
00533        && mudconf.public_channel_alias[0] != '\0')
00534     {
00535         do_addcom(player, player, player, 0, 2,
00536             mudconf.public_channel_alias, mudconf.public_channel);
00537     }
00538 }

void atr_add ( dbref  ,
int  ,
char *  ,
dbref  ,
int   
)

Definition at line 2008 of file db.cpp.

References AMATCH_CMD, AMATCH_LISTEN, atr_add_raw(), atr_clr(), atr_encode(), statedata::bfCommands, statedata::bfListens, statedata::bfNoCommands, statedata::bfNoListens, CBitField::Clear(), mudstate, and set_modified().

Referenced by add_folder_name(), atr_chown(), atr_cpy(), atr_set_flags(), check_dead_refs(), do_alias(), do_chanlog(), do_chown(), do_edit(), do_edit_msg(), do_forwardlist(), do_mvattr(), SendChannelMessage(), set_attr_internal(), and set_player_folder().

02009 {
02010     set_modified(thing);
02011 
02012     if (!buff || !*buff)
02013     {
02014         atr_clr(thing, atr);
02015     }
02016     else
02017     {
02018         switch (buff[0])
02019         {
02020         case AMATCH_LISTEN:
02021 
02022             // Since this could be a ^-Command, we no longer assert that the
02023             // object has none.
02024             //
02025             mudstate.bfNoListens.Clear(thing);
02026             break;
02027 
02028         case AMATCH_CMD:
02029 
02030             // Since this could be a $-Command, we no longer assert that the
02031             // object has none.
02032             //
02033             mudstate.bfNoCommands.Clear(thing);
02034             break;
02035         }
02036 
02037         // Since this could overwrite an existing ^-Command or $-Command, we
02038         // longer assert that the object has one.
02039         //
02040         mudstate.bfListens.Clear(thing);
02041         mudstate.bfCommands.Clear(thing);
02042 
02043         char *tbuff = atr_encode(buff, thing, owner, flags, atr);
02044         atr_add_raw(thing, atr, tbuff);
02045     }
02046 }

void atr_add_raw ( dbref  ,
int  ,
const char *   
)

Definition at line 2003 of file db.cpp.

References atr_add_raw_LEN().

Referenced by add_quota(), atr_add(), connect_player(), create_obj(), db_read(), dbclean_RenumberAttributes(), did_it(), do_destroy(), do_expmail_start(), do_icmd(), do_lock(), do_mail_cc(), do_mail_fwd(), do_mail_reply(), do_page(), do_pcreate(), do_postpend(), do_prepend(), do_prog(), get_list(), get_slave_result(), mung_quotas(), pay_quota(), pcache_save(), record_login(), s_Moniker(), s_Name(), s_Pass(), s_Pennies(), s_PenniesDirect(), set_modified(), and shutdownsock().

02004 {
02005     atr_add_raw_LEN(thing, atr, szValue, szValue ? strlen(szValue) : 0);
02006 }

void atr_add_raw_LEN ( dbref  ,
int  ,
const char *  ,
int   
)

Definition at line 1843 of file db.cpp.

References A_DAILY, A_FORWARDLIST, A_LIST, A_LISTEN, A_QUEUEMAX, A_STARTUP, A_TIMEOUT, al_add(), atr_clr(), ATRLIST_CHUNK, cache_put(), db, desc_reload(), FLAG_WORD1, FLAG_WORD2, object::fs, HAS_DAILY, HAS_FWDLIST, HAS_LISTEN, HAS_STARTUP, INITIAL_ATRLIST_SIZE, ISOUTOFMEMORY, LBUF_SIZE, makekey(), MEMALLOC, MEMFREE, pcache_reload(), StringCloneLen(), and flagset::word.

Referenced by add_to(), al_store(), atr_add_raw(), and put_ConnectionInfoFields().

01844 {
01845     if (  !szValue
01846        || '\0' == szValue[0])
01847     {
01848         atr_clr(thing, atr);
01849         return;
01850     }
01851 
01852 #ifdef MEMORY_BASED
01853     ATRLIST *list;
01854     bool found = false;
01855     int hi, lo, mid;
01856     char *text = StringCloneLen(szValue, nValue);
01857 
01858     if (!db[thing].pALHead)
01859     {
01860         db[thing].nALAlloc = INITIAL_ATRLIST_SIZE;
01861         list = (ATRLIST *)MEMALLOC(db[thing].nALAlloc*sizeof(ATRLIST));
01862         ISOUTOFMEMORY(list);
01863         db[thing].pALHead  = list;
01864         db[thing].nALUsed  = 1;
01865         list[0].number = atr;
01866         list[0].data = text;
01867         list[0].size = nValue + 1;
01868         found = true;
01869     }
01870     else
01871     {
01872         // Binary search for the attribute
01873         //
01874         lo = 0;
01875         hi = db[thing].nALUsed - 1;
01876 
01877         list = db[thing].pALHead;
01878         while (lo <= hi)
01879         {
01880             mid = ((hi - lo) >> 1) + lo;
01881             if (list[mid].number > atr)
01882             {
01883                 hi = mid - 1;
01884             }
01885             else if (list[mid].number < atr)
01886             {
01887                 lo = mid + 1;
01888             }
01889             else // if (list[mid].number == atr)
01890             {
01891                 MEMFREE(list[mid].data);
01892                 list[mid].data = text;
01893                 list[mid].size = nValue + 1;
01894                 found = true;
01895                 break;
01896             }
01897         }
01898 
01899         if (!found)
01900         {
01901             // We didn't find it, and lo == hi + 1.  The attribute should be
01902             // inserted between (0,hi) and (lo,nALUsed-1).
01903             //
01904             if (db[thing].nALUsed < db[thing].nALAlloc)
01905             {
01906                 memmove( list + lo + 1,
01907                          list + lo,
01908                          (db[thing].nALUsed - lo) * sizeof(ATRLIST));
01909             }
01910             else
01911             {
01912                 // Expand the list.
01913                 //
01914                 db[thing].nALAlloc += ATRLIST_CHUNK;
01915                 list = (ATRLIST *)MEMALLOC(db[thing].nALAlloc
01916                      * sizeof(ATRLIST));
01917                 ISOUTOFMEMORY(list);
01918 
01919                 // Copy bottom part.
01920                 //
01921                 if (lo > 0)
01922                 {
01923                     memcpy(list, db[thing].pALHead, lo * sizeof(ATRLIST));
01924                 }
01925     
01926                 // Copy top part.
01927                 //
01928                 if (lo < db[thing].nALUsed)
01929                 {
01930                     memcpy( list + lo + 1,
01931                             db[thing].pALHead + lo,
01932                             (db[thing].nALUsed - lo) * sizeof(ATRLIST));
01933                 }
01934                 MEMFREE(db[thing].pALHead);
01935                 db[thing].pALHead = list;
01936             }
01937             db[thing].nALUsed++;
01938             list[lo].data = text;
01939             list[lo].number = atr;
01940             list[lo].size = nValue + 1;
01941         }
01942     }
01943 
01944 #else // MEMORY_BASED
01945 
01946     if (nValue > LBUF_SIZE-1)
01947     {
01948         nValue = LBUF_SIZE-1;
01949     }
01950 
01951     Aname okey;
01952     makekey(thing, atr, &okey);
01953     if (atr == A_LIST)
01954     {
01955         // A_LIST is never compressed and it's never listed within itself.
01956         //
01957         cache_put(&okey, szValue, nValue+1);
01958     }
01959     else
01960     {
01961         if (!al_add(thing, atr))
01962         {
01963             return;
01964         }
01965         cache_put(&okey, szValue, nValue+1);
01966     }
01967 #endif // MEMORY_BASED
01968 
01969     switch (atr)
01970     {
01971     case A_STARTUP:
01972 
01973         db[thing].fs.word[FLAG_WORD1] |= HAS_STARTUP;
01974         break;
01975 
01976     case A_DAILY:
01977 
01978         db[thing].fs.word[FLAG_WORD2] |= HAS_DAILY;
01979         break;
01980 
01981     case A_FORWARDLIST:
01982 
01983         db[thing].fs.word[FLAG_WORD2] |= HAS_FWDLIST;
01984         break;
01985 
01986     case A_LISTEN:
01987 
01988         db[thing].fs.word[FLAG_WORD2] |= HAS_LISTEN;
01989         break;
01990 
01991     case A_TIMEOUT:
01992 
01993         desc_reload(thing);
01994         break;
01995 
01996     case A_QUEUEMAX:
01997 
01998         pcache_reload(thing);
01999         break;
02000     }
02001 }

void atr_chown ( dbref   ) 

Definition at line 2359 of file db.cpp.

References AF_LOCK, atr_add(), atr_get, atr_head(), atr_next(), atr_pop(), atr_push(), free_lbuf, and Owner.

Referenced by do_chown().

02360 {
02361     dbref owner = Owner(obj);
02362 
02363     char *as;
02364     atr_push();
02365     for (int atr = atr_head(obj, &as); atr; atr = atr_next(&as))
02366     {
02367         int   aflags;
02368         dbref aowner;
02369         char *buf = atr_get(obj, atr, &aowner, &aflags);
02370         if (  aowner != owner
02371            && !(aflags & AF_LOCK))
02372         {
02373             atr_add(obj, atr, buf, owner, aflags);
02374         }
02375         free_lbuf(buf);
02376     }
02377     atr_pop();
02378 }

void atr_clr ( dbref  ,
int   
)

Definition at line 1739 of file db.cpp.

References A_DAILY, A_FORWARDLIST, A_LISTEN, A_QUEUEMAX, A_STARTUP, A_TIMEOUT, al_delete(), statedata::bfCommands, statedata::bfListens, statedata::bStandAlone, cache_del(), CBitField::Clear(), db, desc_reload(), FLAG_WORD1, FLAG_WORD2, object::fs, fwdlist_clr(), HAS_DAILY, HAS_FWDLIST, HAS_LISTEN, HAS_STARTUP, makekey(), MEMFREE, mudstate, mux_assert, pcache_reload(), and flagset::word.

Referenced by al_store(), atr_add(), atr_add_raw_LEN(), atr_free(), dbclean_CheckALISTtoAT(), dbclean_CheckALISTtoDB(), do_alias(), do_chanlog(), do_expmail_start(), do_forwardlist(), do_icmd(), do_mvattr(), do_unlock(), do_wipe(), nfy_que(), shutdownsock(), and CGuests::WipeAttrs().

01740 {
01741 #ifdef MEMORY_BASED
01742 
01743     if (  !db[thing].nALUsed
01744        || !db[thing].pALHead)
01745     {
01746         return;
01747     }
01748 
01749     mux_assert(0 <= db[thing].nALUsed);
01750 
01751     // Binary search for the attribute.
01752     //
01753     int lo = 0;
01754     int mid;
01755     int hi = db[thing].nALUsed - 1;
01756     ATRLIST *list = db[thing].pALHead;
01757     while (lo <= hi)
01758     {
01759         mid = ((hi - lo) >> 1) + lo;
01760         if (list[mid].number > atr)
01761         {
01762             hi = mid - 1;
01763         }
01764         else if (list[mid].number < atr)
01765         {
01766             lo = mid + 1;
01767         }
01768         else // (list[mid].number == atr)
01769         {
01770             MEMFREE(list[mid].data);
01771             list[mid].data = NULL;
01772             db[thing].nALUsed--;
01773             if (mid != db[thing].nALUsed)
01774             {
01775                 memmove( list + mid,
01776                          list + mid + 1,
01777                          (db[thing].nALUsed - mid) * sizeof(ATRLIST));
01778             }
01779             break;
01780         }
01781     }
01782 #else // MEMORY_BASED
01783     Aname okey;
01784 
01785     makekey(thing, atr, &okey);
01786     cache_del(&okey);
01787     al_delete(thing, atr);
01788 #endif // MEMORY_BASED
01789 
01790     switch (atr)
01791     {
01792     case A_STARTUP:
01793 
01794         db[thing].fs.word[FLAG_WORD1] &= ~HAS_STARTUP;
01795         break;
01796 
01797     case A_DAILY:
01798 
01799         db[thing].fs.word[FLAG_WORD2] &= ~HAS_DAILY;
01800         break;
01801 
01802     case A_FORWARDLIST:
01803 
01804         db[thing].fs.word[FLAG_WORD2] &= ~HAS_FWDLIST;
01805         if (!mudstate.bStandAlone)
01806         {
01807             // We should clear the hashtable, too.
01808             //
01809             fwdlist_clr(thing);
01810         }
01811         break;
01812 
01813     case A_LISTEN:
01814 
01815         db[thing].fs.word[FLAG_WORD2] &= ~HAS_LISTEN;
01816         break;
01817 
01818     case A_TIMEOUT:
01819 
01820         desc_reload(thing);
01821         break;
01822 
01823     case A_QUEUEMAX:
01824 
01825         pcache_reload(thing);
01826         break;
01827 
01828     default:
01829 
01830         // Since this could overwrite an existing ^-Command or $-Command, we
01831         // longer assert that the object has one.
01832         //
01833         mudstate.bfListens.Clear(thing);
01834         mudstate.bfCommands.Clear(thing);
01835         break;
01836     }
01837 }

void atr_cpy ( dbref  dest,
dbref  source,
bool  bInternal 
)

Definition at line 2310 of file db.cpp.

References AF_GOD, AF_INTERNAL, AF_LOCK, AF_NOCLONE, AF_WIZARD, atr_add(), atr_get, atr_head(), atr_next(), atr_num(), atr_pop(), atr_push(), Controls, attr::flags, free_lbuf, God, Owner, and Wizard.

Referenced by CGuests::Create(), do_clone(), and CGuests::MakeGuestChar().

02311 {
02312     dbref owner = Owner(dest);
02313 
02314     char *as;
02315     atr_push();
02316     for (int atr = atr_head(source, &as); atr; atr = atr_next(&as))
02317     {
02318         int   aflags;
02319         dbref aowner;
02320         char *buf = atr_get(source, atr, &aowner, &aflags);
02321 
02322         if (!(aflags & AF_LOCK))
02323         {
02324             // Change owner.
02325             //
02326             aowner = owner;
02327         }
02328 
02329         ATTR *at = atr_num(atr);
02330         if (  atr
02331            && at)
02332         {
02333             if (  !(at->flags & (AF_INTERNAL|AF_NOCLONE))
02334                && (  bInternal
02335                   || God(owner)
02336                   || (  !God(dest)
02337                      && !(aflags & AF_LOCK)
02338                      && (  (  Controls(owner, dest)
02339                            && !(at->flags & (AF_WIZARD|AF_GOD))
02340                            && !(aflags & (AF_WIZARD|AF_GOD)))
02341                         || (  Wizard(owner)
02342                            && !(at->flags & AF_GOD))))))
02343             {
02344                 // Only set attrs that owner has perm to set.
02345                 //
02346                 atr_add(dest, atr, buf, aowner, aflags);
02347             }
02348         }
02349         free_lbuf(buf);
02350     }
02351     atr_pop();
02352 }

void atr_free ( dbref   ) 

Definition at line 2275 of file db.cpp.

References A_LIST, al_store(), atr_clr(), atr_head(), atr_next(), atr_pop(), atr_push(), statedata::bfCommands, statedata::bfListens, statedata::bfNoCommands, statedata::bfNoListens, CBitField::Clear(), db, MEMFREE, statedata::mod_al_id, mudstate, and CBitField::Set().

Referenced by create_obj(), destroy_bad_obj(), and destroy_obj().

02276 {
02277 #ifdef MEMORY_BASED
02278     if (db[thing].pALHead)
02279     {
02280         MEMFREE(db[thing].pALHead);
02281     }
02282     db[thing].pALHead  = NULL;
02283     db[thing].nALAlloc = 0;
02284     db[thing].nALUsed  = 0;
02285 #else // MEMORY_BASED
02286     char *as;
02287     atr_push();
02288     for (int atr = atr_head(thing, &as); atr; atr = atr_next(&as))
02289     {
02290         atr_clr(thing, atr);
02291     }
02292     atr_pop();
02293     if (mudstate.mod_al_id == thing)
02294     {
02295         al_store(); // remove from cache
02296     }
02297     atr_clr(thing, A_LIST);
02298 #endif // MEMORY_BASED
02299 
02300     mudstate.bfCommands.Clear(thing);
02301     mudstate.bfNoCommands.Set(thing);
02302     mudstate.bfListens.Clear(thing);
02303     mudstate.bfNoListens.Set(thing);
02304 }

bool atr_get_info ( dbref  ,
int  ,
dbref ,
int *   
)

Definition at line 2171 of file db.cpp.

References atr_decode_LEN(), atr_get_raw_LEN(), and Owner.

Referenced by bCanLockAttr(), bCanReadAttr(), bCanSetAttr(), check_dead_refs(), debug_examine(), do_chown(), do_comlast(), do_lock(), do_set(), do_unlock(), do_verb(), find_wild_attrs(), and FUNCTION().

02172 {
02173     size_t nLen;
02174     const char *buff = atr_get_raw_LEN(thing, atr, &nLen);
02175     if (!buff)
02176     {
02177         *owner = Owner(thing);
02178         *flags = 0;
02179         return false;
02180     }
02181     atr_decode_LEN(buff, nLen, NULL, thing, owner, flags, &nLen);
02182     return true;
02183 }

char* atr_get_LEN ( dbref  ,
int  ,
dbref ,
int *  ,
size_t *   
)

Definition at line 2157 of file db.cpp.

References alloc_lbuf, and atr_get_str_LEN().

Referenced by grep_util(), Moniker(), Name(), and PureName().

02158 {
02159     char *buff = alloc_lbuf("atr_get");
02160     return atr_get_str_LEN(buff, thing, atr, owner, flags, pLen);
02161 }

const char* atr_get_raw ( dbref  ,
int   
)

Definition at line 2127 of file db.cpp.

References atr_get_raw_LEN().

Referenced by check_zone_handler(), db_write_object(), dbclean_CheckALISTtoAT(), dbclean_CheckALISTtoDB(), do_destroy(), do_mail_cc(), do_mail_fwd(), do_mail_proof(), do_mail_reply(), FUNCTION(), hasattr_handler(), move_exit(), pcache_reload1(), Pennies(), purge_going(), and show_a_desc().

02128 {
02129     size_t Len;
02130     return atr_get_raw_LEN(thing, atr, &Len);
02131 }

const char* atr_get_raw_LEN ( dbref  ,
int  ,
size_t *   
)

Definition at line 2114 of file db.cpp.

References cache_get(), and makekey().

Referenced by al_fetch(), atr_get_info(), atr_get_raw(), atr_get_str_LEN(), atr_head(), atr_pget_info(), atr_pget_str_LEN(), do_postpend(), do_prepend(), and mem_usage().

02115 {
02116     Aname okey;
02117 
02118     makekey(thing, atr, &okey);
02119     int nLen;
02120     const char *a = cache_get(&okey, &nLen);
02121     nLen = a ? (nLen-1) : 0;
02122     *pLen = nLen;
02123     return a;
02124 }

char* atr_get_real ( dbref  ,
int  ,
dbref ,
int *  ,
const char *  ,
const   int 
)

Definition at line 2163 of file db.cpp.

References atr_get_str_LEN(), and pool_alloc_lbuf().

02165 {
02166     size_t nLen;
02167     char *buff = pool_alloc_lbuf("atr_get", file, line);
02168     return atr_get_str_LEN(buff, thing, atr, owner, flags, &nLen);
02169 }

char* atr_get_str ( char *  ,
dbref  ,
int  ,
dbref ,
int *   
)

Definition at line 2151 of file db.cpp.

References atr_get_str_LEN().

Referenced by atr_match1(), Commer(), do_edit(), do_examine(), do_mvattr(), FUNCTION(), Hearer(), CGuests::ListAll(), Name(), process_preload(), and sweep_check().

02152 {
02153     size_t nLen;
02154     return atr_get_str_LEN(s, thing, atr, owner, flags, &nLen);
02155 }

char* atr_get_str_LEN ( char *  s,
dbref  ,
int  ,
dbref ,
int *  ,
size_t *   
)

Definition at line 2133 of file db.cpp.

References atr_decode_LEN(), atr_get_raw_LEN(), and Owner.

Referenced by add_folder_name(), announce_connect(), atr_get_LEN(), atr_get_real(), atr_get_str(), get_folder_name(), and get_folder_number().

02135 {
02136     const char *buff = atr_get_raw_LEN(thing, atr, pLen);
02137     if (!buff)
02138     {
02139         *owner = Owner(thing);
02140         *flags = 0;
02141         *pLen = 0;
02142         *s = '\0';
02143     }
02144     else
02145     {
02146         atr_decode_LEN(buff, *pLen, s, thing, owner, flags, pLen);
02147     }
02148     return s;
02149 }

int atr_head ( dbref  ,
char **   
)

Definition at line 2467 of file db.cpp.

References A_LIST, al_extend(), atr_get_raw_LEN(), atr_next(), atrcount::count, alist::data, db, ISOUTOFMEMORY, statedata::iter_alist, alist::len, MEMALLOC, statedata::mod_al_id, statedata::mod_alist, statedata::mod_alist_len, mudstate, and atrcount::thing.

Referenced by atr_chown(), atr_cpy(), atr_free(), atr_match1(), Commer(), db_write_object(), dbclean_CheckALISTtoAT(), dbclean_CheckALISTtoDB(), dbclean_RemoveStaleAttributeNames(), dbclean_RenumberAttributes(), debug_examine(), do_decomp(), find_wild_attrs(), Hearer(), look_atrs1(), mem_usage(), sweep_check(), and CGuests::WipeAttrs().

02468 {
02469 #ifdef MEMORY_BASED
02470     if (db[thing].nALUsed)
02471     {
02472         ATRCOUNT *atr = (ATRCOUNT *) MEMALLOC(sizeof(ATRCOUNT));
02473         ISOUTOFMEMORY(atr);
02474         atr->thing = thing;
02475         atr->count = 1;
02476         *attrp = (char *)atr;
02477         return db[thing].pALHead[0].number;
02478     }
02479     return 0;
02480 #else // MEMORY_BASED
02481     const char *astr;
02482     size_t alen;
02483 
02484     // Get attribute list.  Save a read if it is in the modify atr list
02485     //
02486     if (thing == mudstate.mod_al_id)
02487     {
02488         astr = mudstate.mod_alist;
02489         alen = mudstate.mod_alist_len;
02490     }
02491     else
02492     {
02493         astr = atr_get_raw_LEN(thing, A_LIST, &alen);
02494     }
02495 
02496     // If no list, return nothing.
02497     //
02498     if (!alen)
02499     {
02500         return 0;
02501     }
02502 
02503     // Set up the list and return the first entry.
02504     //
02505     al_extend(&mudstate.iter_alist.data, &mudstate.iter_alist.len, alen+1, false);
02506     memcpy(mudstate.iter_alist.data, astr, alen+1);
02507     *attrp = mudstate.iter_alist.data;
02508     return atr_next(attrp);
02509 #endif // MEMORY_BASED
02510 }

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 }

int atr_next ( char **   ) 

Definition at line 2384 of file db.cpp.

References al_decode(), atrcount::count, db, MEMFREE, and atrcount::thing.

Referenced by atr_chown(), atr_cpy(), atr_free(), atr_head(), atr_match1(), Commer(), db_write_object(), dbclean_CheckALISTtoAT(), dbclean_CheckALISTtoDB(), dbclean_RemoveStaleAttributeNames(), dbclean_RenumberAttributes(), debug_examine(), do_decomp(), find_wild_attrs(), Hearer(), look_atrs1(), mem_usage(), sweep_check(), and CGuests::WipeAttrs().

02385 {
02386 #ifdef MEMORY_BASED
02387     ATRCOUNT *atr;
02388 
02389     if (!attrp || !*attrp)
02390     {
02391         return 0;
02392     }
02393     else
02394     {
02395         atr = (ATRCOUNT *) * attrp;
02396         if (atr->count >= db[atr->thing].nALUsed)
02397         {
02398             MEMFREE(atr);
02399             atr = NULL;
02400             return 0;
02401         }
02402         atr->count++;
02403         return db[atr->thing].pALHead[atr->count - 1].number;
02404     }
02405 
02406 #else // MEMORY_BASED
02407     if (!*attrp || !**attrp)
02408     {
02409         return 0;
02410     }
02411     else
02412     {
02413         return al_decode(attrp);
02414     }
02415 #endif // MEMORY_BASED
02416 }

bool atr_pget_info ( dbref  ,
int  ,
dbref ,
int *   
)

Definition at line 2241 of file db.cpp.

References AF_PRIVATE, atr_decode_LEN(), atr_get_raw_LEN(), atr_num(), attr::flags, Good_obj, ITER_PARENTS, Owner, and Parent.

Referenced by bCanReadAttr(), do_alias(), do_forwardlist(), FUNCTION(), and set_attr_internal().

02242 {
02243     dbref parent;
02244     int lev;
02245     ATTR *ap;
02246 
02247     ITER_PARENTS(thing, parent, lev)
02248     {
02249         size_t nLen;
02250         const char *buff = atr_get_raw_LEN(parent, atr, &nLen);
02251         if (buff && *buff)
02252         {
02253             atr_decode_LEN(buff, nLen, NULL, thing, owner, flags, &nLen);
02254             if ((lev == 0) || !(*flags & AF_PRIVATE))
02255             {
02256                 return true;
02257             }
02258         }
02259         if ((lev == 0) && Good_obj(Parent(parent)))
02260         {
02261             ap = atr_num(atr);
02262             if (!ap || ap->flags & AF_PRIVATE)
02263                 break;
02264         }
02265     }
02266     *owner = Owner(thing);
02267     *flags = 0;
02268     return false;
02269 }

char* atr_pget_LEN ( dbref  ,
int  ,
dbref ,
int *  ,
size_t *   
)

Definition at line 2227 of file db.cpp.

References alloc_lbuf, and atr_pget_str_LEN().

Referenced by FUNCTION(), and get_handler().

02228 {
02229     char *buff = alloc_lbuf("atr_pget");
02230     return atr_pget_str_LEN(buff, thing, atr, owner, flags, pLen);
02231 }

char* atr_pget_real ( dbref  ,
int  ,
dbref ,
int *  ,
const char *  ,
const   int 
)

Definition at line 2233 of file db.cpp.

References atr_pget_str_LEN(), and pool_alloc_lbuf().

02235 {
02236     size_t nLen;
02237     char *buff = pool_alloc_lbuf("atr_pget", file, line);
02238     return atr_pget_str_LEN(buff, thing, atr, owner, flags, &nLen);
02239 }

char* atr_pget_str ( char *  ,
dbref  ,
int  ,
dbref ,
int *   
)

Definition at line 2221 of file db.cpp.

References atr_pget_str_LEN().

Referenced by do_set(), do_use(), FUNCTION(), and load_player_names().

02222 {
02223     size_t nLen;
02224     return atr_pget_str_LEN(s, thing, atr, owner, flags, &nLen);
02225 }

char* atr_pget_str_LEN ( char *  ,
dbref  ,
int  ,
dbref ,
int *  ,
size_t *   
)

Definition at line 2185 of file db.cpp.

References AF_PRIVATE, atr_decode_LEN(), atr_get_raw_LEN(), atr_num(), attr::flags, Good_obj, ITER_PARENTS, Owner, and Parent.

Referenced by announce_connect(), announce_disconnect(), atr_pget_LEN(), atr_pget_real(), atr_pget_str(), and mux_exec().

02186 {
02187     dbref parent;
02188     int lev;
02189     ATTR *ap;
02190     const char *buff;
02191 
02192     ITER_PARENTS(thing, parent, lev)
02193     {
02194         buff = atr_get_raw_LEN(parent, atr, pLen);
02195         if (buff && *buff)
02196         {
02197             atr_decode_LEN(buff, *pLen, s, thing, owner, flags, pLen);
02198             if (  lev == 0
02199                || !(*flags & AF_PRIVATE))
02200             {
02201                 return s;
02202             }
02203         }
02204         if (  lev == 0
02205            && Good_obj(Parent(parent)))
02206         {
02207             ap = atr_num(atr);
02208             if (!ap || ap->flags & AF_PRIVATE)
02209             {
02210                 break;
02211             }
02212         }
02213     }
02214     *owner = Owner(thing);
02215     *flags = 0;
02216     *s = '\0';
02217     *pLen = 0;
02218     return s;
02219 }

void atr_pop ( void   ) 

Definition at line 2436 of file db.cpp.

References alist::data, free_sbuf, statedata::iter_alist, alist::len, MEMFREE, mudstate, and alist::next.

Referenced by atr_chown(), atr_cpy(), atr_free(), atr_match1(), Commer(), dbclean_CheckALISTtoAT(), dbclean_CheckALISTtoDB(), dbclean_RemoveStaleAttributeNames(), dbclean_RenumberAttributes(), find_wild_attrs(), and Hearer().

02437 {
02438 #ifndef MEMORY_BASED
02439     ALIST *old_alist = mudstate.iter_alist.next;
02440 
02441     if (mudstate.iter_alist.data)
02442     {
02443         MEMFREE(mudstate.iter_alist.data);
02444         mudstate.iter_alist.data = NULL;
02445     }
02446     if (old_alist)
02447     {
02448         mudstate.iter_alist.data = old_alist->data;
02449         mudstate.iter_alist.len = old_alist->len;
02450         mudstate.iter_alist.next = old_alist->next;
02451         char *cp = (char *)old_alist;
02452         free_sbuf(cp);
02453     }
02454     else
02455     {
02456         mudstate.iter_alist.data = NULL;
02457         mudstate.iter_alist.len = 0;
02458         mudstate.iter_alist.next = NULL;
02459     }
02460 #endif // !MEMORY_BASED
02461 }

void atr_push ( void   ) 

Definition at line 2422 of file db.cpp.

References alloc_sbuf, alist::data, statedata::iter_alist, alist::len, mudstate, and alist::next.

Referenced by atr_chown(), atr_cpy(), atr_free(), atr_match1(), Commer(), dbclean_CheckALISTtoAT(), dbclean_CheckALISTtoDB(), dbclean_RemoveStaleAttributeNames(), dbclean_RenumberAttributes(), find_wild_attrs(), and Hearer().

02423 {
02424 #ifndef MEMORY_BASED
02425     ALIST *new_alist = (ALIST *) alloc_sbuf("atr_push");
02426     new_alist->data = mudstate.iter_alist.data;
02427     new_alist->len = mudstate.iter_alist.len;
02428     new_alist->next = mudstate.iter_alist.next;
02429 
02430     mudstate.iter_alist.data = NULL;
02431     mudstate.iter_alist.len = 0;
02432     mudstate.iter_alist.next = new_alist;
02433 #endif // !MEMORY_BASED
02434 }

void atr_set_flags ( dbref  ,
int  ,
int   
)

Definition at line 2048 of file db.cpp.

References atr_add(), atr_get, and free_lbuf.

Referenced by do_lock(), do_set(), do_unlock(), and FUNCTION().

02049 {
02050     dbref aowner;
02051     int aflags;
02052     char *buff = atr_get(thing, atr, &aowner, &aflags);
02053     atr_add(thing, atr, buff, aowner, flags);
02054     free_lbuf(buff);
02055 }

void badname_add ( char *   ) 

Definition at line 876 of file player.cpp.

References statedata::badname_head, ISOUTOFMEMORY, MEMALLOC, mudstate, badname_struc::name, badname_struc::next, and StringClone().

Referenced by CF_HAND().

00877 {
00878     // Make a new node and link it in at the top.
00879     //
00880     BADNAME *bp = (BADNAME *)MEMALLOC(sizeof(BADNAME));
00881     ISOUTOFMEMORY(bp);
00882     bp->name = StringClone(bad_name);
00883     bp->next = mudstate.badname_head;
00884     mudstate.badname_head = bp;
00885 }

bool badname_check ( char *   ) 

Definition at line 914 of file player.cpp.

References statedata::badname_head, mudstate, badname_struc::name, badname_struc::next, quick_wild(), and statedata::wild_invk_ctr.

Referenced by create_obj(), do_alias(), and do_name().

00915 {
00916     BADNAME *bp;
00917 
00918     // Walk the badname list, doing wildcard matching.  If we get a hit then
00919     // return false.  If no matches in the list, return true.
00920     //
00921     for (bp = mudstate.badname_head; bp; bp = bp->next)
00922     {
00923         mudstate.wild_invk_ctr = 0;
00924         if (quick_wild(bp->name, bad_name))
00925         {
00926             return false;
00927         }
00928     }
00929     return true;
00930 }

void badname_list ( dbref  ,
const char *   
)

Definition at line 932 of file player.cpp.

References alloc_lbuf, statedata::badname_head, free_lbuf, mudstate, badname_struc::name, badname_struc::next, notify, safe_chr, and safe_str.

Referenced by do_list().

00933 {
00934     BADNAME *bp;
00935     char *buff, *bufp;
00936 
00937     // Construct an lbuf with all the names separated by spaces.
00938     //
00939     buff = bufp = alloc_lbuf("badname_list");
00940     safe_str(prefix, buff, &bufp);
00941     for (bp = mudstate.badname_head; bp; bp = bp->next)
00942     {
00943         safe_chr(' ', buff, &bufp);
00944         safe_str(bp->name, buff, &bufp);
00945     }
00946     *bufp = '\0';
00947 
00948     // Now display it.
00949     //
00950     notify(player, buff);
00951     free_lbuf(buff);
00952 }

void badname_remove ( char *   ) 

Definition at line 887 of file player.cpp.

References statedata::badname_head, MEMFREE, mudstate, badname_struc::name, badname_struc::next, and string_compare().

Referenced by CF_HAND().

00888 {
00889     // Look for an exact match on the bad name and remove if found.
00890     //
00891     BADNAME *bp;
00892     BADNAME *backp = NULL;
00893     for (bp = mudstate.badname_head; bp; backp = bp, bp = bp->next)
00894     {
00895         if (!string_compare(bad_name, bp->name))
00896         {
00897             if (backp)
00898             {
00899                 backp->next = bp->next;
00900             }
00901             else
00902             {
00903                 mudstate.badname_head = bp->next;
00904             }
00905             MEMFREE(bp->name);
00906             bp->name = NULL;
00907             MEMFREE(bp);
00908             bp = NULL;
00909             return;
00910         }
00911     }
00912 }

bool bCanLockAttr ( dbref  executor,
dbref  target,
ATTR tattr 
)

Definition at line 1980 of file predicates.cpp.

References AF_CONST, AF_GOD, AF_INTERNAL, AF_IS_LOCK, AF_WIZARD, atr_get_info(), attr::flags, God, attr::number, Owner, and Wizard.

Referenced by do_lock(), and do_unlock().

01981 {
01982     if (!tattr)
01983     {
01984         return false;
01985     }
01986 
01987     int mDeny = AF_INTERNAL|AF_IS_LOCK|AF_CONST;
01988     if (!God(executor))
01989     {
01990         if (God(target))
01991         {
01992             return false;
01993         }
01994         if (Wizard(executor))
01995         {
01996             mDeny = AF_INTERNAL|AF_IS_LOCK|AF_CONST|AF_GOD;
01997         }
01998         else
01999         {
02000             mDeny = AF_INTERNAL|AF_IS_LOCK|AF_CONST|AF_WIZARD|AF_GOD;
02001         }
02002     }
02003 
02004     dbref aowner;
02005     int aflags;
02006     if (  (tattr->flags & mDeny)
02007        || !atr_get_info(target, tattr->number, &aowner, &aflags)
02008        || (aflags & mDeny))
02009     {
02010         return false;
02011     }
02012     else if (  Wizard(executor)
02013             || Owner(executor) == aowner)
02014     {
02015         return true;
02016     }
02017     else
02018     {
02019         return false;
02020     }
02021 }

bool bCanReadAttr ( dbref  executor,
dbref  target,
ATTR tattr,
bool  bParentCheck 
)

Definition at line 1871 of file predicates.cpp.

References A_DESC, AF_DARK, AF_INTERNAL, AF_MDARK, AF_VISUAL, atr_get_info(), atr_pget_info(), statedata::bStandAlone, Examinable, attr::flags, God, mudconf, mudstate, nearby(), attr::number, Owner, confdata::read_rem_desc, and WizRoy.

Referenced by debug_examine(), do_decomp(), do_verb(), eval_boolexp(), exam_wildattrs(), find_wild_attrs(), FUNCTION(), get_handler(), hasattr_handler(), list_attraccess(), and look_atrs1().

01872 {
01873     if (!tattr)
01874     {
01875         return false;
01876     }
01877 
01878     dbref aowner;
01879     int aflags;
01880 
01881     if (  !mudstate.bStandAlone
01882        && bCheckParent)
01883     {
01884         atr_pget_info(target, tattr->number, &aowner, &aflags);
01885     }
01886     else
01887     {
01888         atr_get_info(target, tattr->number, &aowner, &aflags);
01889     }
01890 
01891     int mAllow = AF_VISUAL;
01892     if (  (tattr->flags & mAllow)
01893        || (aflags & mAllow))
01894     {
01895         if (  mudstate.bStandAlone
01896            || tattr->number != A_DESC
01897            || mudconf.read_rem_desc
01898            || nearby(executor, target))
01899         {
01900             return true;
01901         }
01902     }
01903     int mDeny = 0;
01904     if (WizRoy(executor))
01905     {
01906         if (God(executor))
01907         {
01908             mDeny = AF_INTERNAL;
01909         }
01910         else
01911         {
01912             mDeny = AF_INTERNAL|AF_DARK;
01913         }
01914     }
01915     else if (  Owner(executor) == aowner
01916             || Examinable(executor, target))
01917     {
01918         mDeny = AF_INTERNAL|AF_DARK|AF_MDARK;
01919     }
01920     if (mDeny)
01921     {
01922         if (  (tattr->flags & mDeny)
01923            || (aflags & mDeny))
01924         {
01925             return false;
01926         }
01927         else
01928         {
01929             return true;
01930         }
01931     }
01932     return false;
01933 }

bool bCanSetAttr ( dbref  executor,
dbref  target,
ATTR tattr 
)

Definition at line 1935 of file predicates.cpp.

References AF_CONST, AF_GOD, AF_INTERNAL, AF_IS_LOCK, AF_LOCK, AF_WIZARD, atr_get_info(), Controls, attr::flags, God, attr::number, and Wizard.

Referenced by do_alias(), do_chown(), do_edit(), do_mvattr(), do_notify(), do_set(), do_wait(), do_wipe(), FUNCTION(), set_attr_internal(), and CGuests::WipeAttrs().

01936 {
01937     if (!tattr)
01938     {
01939         return false;
01940     }
01941 
01942     int mDeny = AF_INTERNAL|AF_IS_LOCK|AF_CONST;
01943     if (!God(executor))
01944     {
01945         if (God(target))
01946         {
01947             return false;
01948         }
01949         if (Wizard(executor))
01950         {
01951             mDeny = AF_INTERNAL|AF_IS_LOCK|AF_CONST|AF_LOCK|AF_GOD;
01952         }
01953         else if (Controls(executor, target))
01954         {
01955             mDeny = AF_INTERNAL|AF_IS_LOCK|AF_CONST|AF_LOCK|AF_WIZARD|AF_GOD;
01956         }
01957         else
01958         {
01959             return false;
01960         }
01961     }
01962 
01963     dbref aowner;
01964     int aflags;
01965     if (  (tattr->flags & mDeny)
01966 #ifdef FIRANMUX
01967        || Immutable(target)
01968 #endif
01969        || (  atr_get_info(target, tattr->number, &aowner, &aflags)
01970           && (aflags & mDeny)))
01971     {
01972         return false;
01973     }
01974     else
01975     {
01976         return true;
01977     }
01978 }

int boot_off ( dbref  player,
const char *  message 
)

Definition at line 1085 of file netcommon.cpp.

References DESC_SAFEITER_PLAYER, queue_string(), queue_write_LEN(), R_BOOT, and shutdownsock().

Referenced by destroy_player(), do_boot(), and do_toad().

01086 {
01087     DESC *d, *dnext;
01088     int count = 0;
01089     DESC_SAFEITER_PLAYER(player, d, dnext)
01090     {
01091         if (message && *message)
01092         {
01093             queue_string(d, message);
01094             queue_write_LEN(d, "\r\n", 2);
01095         }
01096         shutdownsock(d, R_BOOT);
01097         count++;
01098     }
01099     return count;
01100 }

void boot_slave ( dbref  executor,
dbref  caller,
dbref  enactor,
int   
)

Lauch reverse-DNS slave process.

This spawns the reverse-DNS slave process and creates a socket-oriented, bi-directional communiocation path between that process and this process. Any existing slave process is killed.

Parameters:
executor dbref of Executor.
caller dbref of Caller.
enactor dbref of Enactor.
Returns:
None.

Definition at line 649 of file bsd.cpp.

References CleanUpSlaveProcess(), CleanUpSlaveSocket(), CMuxAlarm::Clear(), DebugTotalSockets, ENDLOG, LOG_ALWAYS, log_number(), log_text(), make_nonblocking(), maxd, MuxAlarm, slave_pid, slave_socket, and STARTLOG.

Referenced by main(), and shovechars().

00650 {
00651     char *pFailedFunc = 0;
00652     int sv[2];
00653     int i;
00654     int maxfds;
00655 
00656 #ifdef HAVE_GETDTABLESIZE
00657     maxfds = getdtablesize();
00658 #else // HAVE_GETDTABLESIZE
00659     maxfds = sysconf(_SC_OPEN_MAX);
00660 #endif // HAVE_GETDTABLESIZE
00661 
00662     CleanUpSlaveSocket();
00663     CleanUpSlaveProcess();
00664 
00665     if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sv) < 0)
00666     {
00667         pFailedFunc = "socketpair() error: ";
00668         goto failure;
00669     }
00670 
00671     // Set to nonblocking.
00672     //
00673     if (make_nonblocking(sv[0]) < 0)
00674     {
00675         pFailedFunc = "make_nonblocking() error: ";
00676         close(sv[0]);
00677         close(sv[1]);
00678         goto failure;
00679     }
00680     slave_pid = fork();
00681     switch (slave_pid)
00682     {
00683     case -1:
00684 
00685         pFailedFunc = "fork() error: ";
00686         close(sv[0]);
00687         close(sv[1]);
00688         goto failure;
00689 
00690     case 0:
00691 
00692         // If we don't clear this alarm, the child will eventually receive a
00693         // SIG_PROF.
00694         //
00695         MuxAlarm.Clear();
00696 
00697         // Child.  The following calls to dup2() assume only the minimal
00698         // dup2() functionality.  That is, the destination descriptor is
00699         // always available for it, and sv[1] is never that descriptor.
00700         // It is likely that the standard defined behavior of dup2()
00701         // would handle the job by itself more directly, but a little
00702         // extra code is low-cost insurance.
00703         //
00704         close(sv[0]);
00705         if (sv[1] != 0)
00706         {
00707             close(0);
00708             if (dup2(sv[1], 0) == -1)
00709             {
00710                 _exit(1);
00711             }
00712         }
00713         if (sv[1] != 1)
00714         {
00715             close(1);
00716             if (dup2(sv[1], 1) == -1)
00717             {
00718                 _exit(1);
00719             }
00720         }
00721         for (i = 3; i < maxfds; i++)
00722         {
00723             close(i);
00724         }
00725         execlp("bin/slave", "slave", NULL);
00726         _exit(1);
00727     }
00728     close(sv[1]);
00729 
00730     slave_socket = sv[0];
00731     DebugTotalSockets++;
00732     if (make_nonblocking(slave_socket) < 0)
00733     {
00734         pFailedFunc = "make_nonblocking() error: ";
00735         CleanUpSlaveSocket();
00736         goto failure;
00737     }
00738     if (maxd <= slave_socket)
00739     {
00740         maxd = slave_socket + 1;
00741     }
00742 
00743     STARTLOG(LOG_ALWAYS, "NET", "SLAVE");
00744     log_text("DNS lookup slave started on fd ");
00745     log_number(slave_socket);
00746     ENDLOG;
00747     return;
00748 
00749 failure:
00750 
00751     CleanUpSlaveProcess();
00752     STARTLOG(LOG_ALWAYS, "NET", "SLAVE");
00753     log_text(pFailedFunc);
00754     log_number(errno);
00755     ENDLOG;
00756 }

void build_version ( void   ) 

Definition at line 27 of file version.cpp.

References mudstate, MUX_BUILD_NUM, MUX_RELEASE_DATE, MUX_VERSION, statedata::short_ver, and statedata::version.

Referenced by main().

00028 {
00029 #ifdef WIN32
00030 #if defined(ALPHA)
00031         sprintf( mudstate.version, "MUX %s for Win32 #%s [ALPHA]",
00032             MUX_VERSION, MUX_BUILD_NUM);
00033         sprintf( mudstate.short_ver, "MUX %s Alpha Win32", MUX_VERSION);
00034 #elif defined(BETA)
00035         sprintf( mudstate.version, "MUX %s for Win32 #%s [BETA]",
00036             MUX_VERSION, MUX_BUILD_NUM);
00037         sprintf( mudstate.short_ver, "MUX %s Beta Win32", MUX_VERSION);
00038 #else // RELEASED
00039         sprintf( mudstate.version, "MUX %s for Win32 #%s [%s]",
00040             MUX_VERSION, MUX_BUILD_NUM, MUX_RELEASE_DATE);
00041         sprintf( mudstate.short_ver, "MUX %s Win32", MUX_VERSION);
00042 #endif // ALPHA, BETA, RELEASED
00043 #else // WIN32
00044 #if defined(ALPHA)
00045         sprintf( mudstate.version, "MUX %s #%s [ALPHA]", MUX_VERSION,
00046             MUX_BUILD_NUM);
00047         sprintf( mudstate.short_ver, "MUX %s Alpha", MUX_VERSION);
00048 #elif defined(BETA)
00049         sprintf( mudstate.version, "MUX %s #%s [BETA]", MUX_VERSION,
00050             MUX_BUILD_NUM);
00051         sprintf( mudstate.short_ver, "MUX %s Beta", MUX_VERSION);
00052 #else // RELEASED
00053         sprintf( mudstate.version, "MUX %s #%s [%s]", MUX_VERSION,
00054             MUX_BUILD_NUM, MUX_RELEASE_DATE);
00055         sprintf( mudstate.short_ver, "MUX %s", MUX_VERSION);
00056 #endif // ALPHA, BETA, RELEASED
00057 #endif // WIN32
00058 }

void cache_pass2 ( void   ) 

Definition at line 77 of file attrcache.cpp.

References tagAttrRecord::attrKey, tagAttrRecord::attrText, cache_put(), cache_redirected, cnt, ENDLINE, mux_assert, N_TEMP_FILES, tagCacheEntryHeader::nSize, RemoveFile(), and TempFiles.

Referenced by dbconvert().

00078 {
00079     ATTR_RECORD Record;
00080     cache_redirected = false;
00081     fprintf(stderr, "2nd Pass:\n");
00082     for (int i = 0; i < N_TEMP_FILES; i++)
00083     {
00084         fprintf(stderr, "File %d: ", i);
00085         long int li = fseek(TempFiles[i], 0, SEEK_SET);
00086         mux_assert(0L == li);
00087 
00088         int cnt = 1000;
00089         size_t nSize;
00090         for (;;)
00091         {
00092             size_t cc = fread(&nSize, 1, sizeof(nSize), TempFiles[i]);
00093             if (cc != sizeof(nSize))
00094             {
00095                 break;
00096             }
00097             cc = fread(&Record, 1, nSize, TempFiles[i]);
00098             mux_assert(cc == nSize);
00099             cache_put(&Record.attrKey, Record.attrText, nSize - sizeof(Aname));
00100             if (cnt-- == 0)
00101             {
00102                 fputc('.', stderr);
00103                 fflush(stderr);
00104                 cnt = 1000;
00105             }
00106         }
00107         fclose(TempFiles[i]);
00108         char TempFileName[20];
00109         sprintf(TempFileName, "$convtemp.%d", i);
00110         RemoveFile(TempFileName);
00111         fprintf(stderr, ENDLINE);
00112     }
00113 }

void cache_redirect ( void   ) 

Definition at line 64 of file attrcache.cpp.

References cache_redirected, mux_assert, N_TEMP_FILES, and TempFiles.

Referenced by dbconvert().

00065 {
00066     for (int i = 0; i < N_TEMP_FILES; i++)
00067     {
00068         char TempFileName[20];
00069         sprintf(TempFileName, "$convtemp.%d", i);
00070         TempFiles[i] = fopen(TempFileName, "wb+");
00071         mux_assert(TempFiles[i]);
00072         setvbuf(TempFiles[i], NULL, _IOFBF, 16384);
00073     }
00074     cache_redirected = true;
00075 }

bool can_see ( dbref  ,
dbref  ,
bool   
)

Definition at line 134 of file predicates.cpp.

References Connected, Dark, confdata::dark_sleepers, isExit, isPlayer, IsReal, Light, mudconf, MyopicExam, Puppet, and confdata::see_own_dark.

Referenced by look_contents().

00135 {
00136     // Don't show if all the following apply: Sleeping players should not be
00137     // seen.  The thing is a disconnected player.  The player is not a
00138     // puppet.
00139     //
00140     if (  mudconf.dark_sleepers
00141        && isPlayer(thing)
00142        && !Connected(thing)
00143        && !Puppet(thing))
00144     {
00145         return false;
00146     }
00147 
00148     // You don't see yourself or exits.
00149     //
00150     if (  player == thing
00151        || isExit(thing))
00152     {
00153         return false;
00154     }
00155 
00156     // If loc is not dark, you see it if it's not dark or you control it.  If
00157     // loc is dark, you see it if you control it.  Seeing your own dark
00158     // objects is controlled by mudconf.see_own_dark.  In dark locations, you
00159     // also see things that are LIGHT and !DARK.
00160     //
00161     if (can_see_loc)
00162     {
00163 #ifdef REALITY_LVLS
00164        return ((!Dark(thing) && IsReal(player, thing)) ||
00165 #else
00166         return (!Dark(thing) ||
00167 #endif /* REALITY_LVLS */
00168             (mudconf.see_own_dark && MyopicExam(player, thing)));
00169     }
00170     else
00171     {
00172 #ifdef REALITY_LVLS
00173         return ((Light(thing) && !Dark(thing) && IsReal(player, thing)) ||
00174 #else
00175         return ((Light(thing) && !Dark(thing)) ||
00176 #endif /* REALITY_LVLS */
00177             (mudconf.see_own_dark && MyopicExam(player, thing)));
00178     }
00179 }

bool can_set_home ( dbref  ,
dbref  ,
dbref   
)

Definition at line 124 of file object.cpp.

References Abode, Controls, Going, Good_obj, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.

Referenced by clone_home(), do_link(), and new_home().

00125 {
00126     if (  !Good_obj(player)
00127        || !Good_obj(home)
00128        || thing == home)
00129     {
00130         return false;
00131     }
00132 
00133     switch (Typeof(home))
00134     {
00135     case TYPE_PLAYER:
00136     case TYPE_ROOM:
00137     case TYPE_THING:
00138         if (Going(home))
00139         {
00140             return false;
00141         }
00142         if (  Controls(player, home)
00143            || Abode(home))
00144         {
00145             return true;
00146         }
00147     }
00148     return false;
00149 }

bool canpayfees ( dbref  ,
dbref  ,
int  ,
int   
)

Definition at line 217 of file predicates.cpp.

References Free_Money, confdata::many_coins, mudconf, notify, Owner, pay_quota(), payfor(), Pennies(), confdata::quotas, tprintf(), and Wizard.

Referenced by create_obj(), do_chown(), and link_exit().

00218 {
00219     if (  !Wizard(who)
00220        && !Wizard(Owner(who))
00221        && !Free_Money(who)
00222        && !Free_Money(Owner(who))
00223        && (Pennies(Owner(who)) < pennies))
00224     {
00225         if (player == who)
00226         {
00227             notify(player, tprintf("Sorry, you don't have enough %s.",
00228                        mudconf.many_coins));
00229         }
00230         else
00231         {
00232             notify(player, tprintf("Sorry, that player doesn't have enough %s.",
00233                 mudconf.many_coins));
00234         }
00235         return false;
00236     }
00237     if (mudconf.quotas)
00238     {
00239         if (!pay_quota(who, quota))
00240         {
00241             if (player == who)
00242             {
00243                 notify(player, "Sorry, your building contract has run out.");
00244             }
00245             else
00246             {
00247                 notify(player,
00248                     "Sorry, that player's building contract has run out.");
00249             }
00250             return false;
00251         }
00252     }
00253     payfor(who, pennies);
00254     return true;
00255 }

void cf_display ( dbref  ,
char *  ,
char *  ,
char **   
)

Definition at line 2174 of file conf.cpp.

References check_access(), conftable, confparm::interpreter, confparm::loc, mux_stricmp(), confparm::pname, confparm::rperms, safe_chr, and safe_ltoa().

Referenced by FUNCTION().

02175 {
02176     CONF *tp;
02177 
02178     for (tp = conftable; tp->pname; tp++)
02179     {
02180         if (!mux_stricmp(tp->pname, param_name))
02181         {
02182             if (check_access(player, tp->rperms))
02183             {
02184                 if (tp->interpreter == cf_int)
02185                 {
02186                     safe_ltoa(*(tp->loc), buff, bufc);
02187                     return;
02188                 }
02189                 else if (tp->interpreter == cf_dbref)
02190                 {
02191                     safe_chr('#', buff, bufc);
02192                     safe_ltoa(*(tp->loc), buff, bufc);
02193                     return;
02194                 }
02195                 else if (tp->interpreter == cf_bool)
02196                 {
02197                     bool *pb = (bool *)tp->loc;
02198                     safe_bool(*pb, buff, bufc);
02199                     return;
02200                 }
02201                 else if (tp->interpreter == cf_string)
02202                 {
02203                     safe_str((char *)tp->loc, buff, bufc);
02204                     return;
02205                 }
02206                 else if (tp->interpreter == cf_string_dyn)
02207                 {
02208                     safe_str(*(char **)tp->loc, buff, bufc);
02209                     return;
02210                 }
02211                 else if (tp->interpreter == cf_int_array)
02212                 {
02213                     IntArray *pia = (IntArray *)(tp->loc);
02214                     ITL itl;
02215                     ItemToList_Init(&itl, buff, bufc);
02216                     for (int i = 0; i < pia->n; i++)
02217                     {
02218                         if (!ItemToList_AddInteger(&itl, pia->pi[i]))
02219                         {
02220                             break;
02221                         }
02222                     }
02223                     ItemToList_Final(&itl);
02224                     return;
02225                 }
02226                 else if (tp->interpreter == cf_seconds)
02227                 {
02228                     CLinearTimeDelta *pltd = (CLinearTimeDelta *)(tp->loc);
02229                     safe_str(pltd->ReturnSecondsString(7), buff, bufc);
02230                     return;
02231                 }
02232             }
02233             safe_noperm(buff, bufc);
02234             return;
02235         }
02236     }
02237     safe_nomatch(buff, bufc);
02238 }

CF_HAND ( cf_art_rule   ) 

Definition at line 3412 of file stringutil.cpp.

References cf_log_syntax(), ArtRuleset::m_bUseAn, ArtRuleset::m_pNextRule, ArtRuleset::m_pRegexp, ArtRuleset::m_pRegexpStudy, MEMALLOC, mux_isspace, mux_tolower, pcre_compile(), pcre_study(), and UNUSED_PARAMETER.

03413 {
03414     UNUSED_PARAMETER(pExtra);
03415     UNUSED_PARAMETER(nExtra);
03416 
03417     char* pCurrent = str;
03418 
03419     while (mux_isspace(*pCurrent))
03420     {
03421         pCurrent++;
03422     }
03423     char* pArticle = pCurrent;
03424     while (  !mux_isspace(*pCurrent)
03425           && *pCurrent != '\0')
03426     {
03427         pCurrent++;
03428     }
03429     if (*pCurrent == '\0')
03430     {
03431         cf_log_syntax(player, cmd, "No article or regexp specified.");
03432         return -1;
03433     }
03434 
03435     bool bUseAn = false;
03436     bool bOkay = false;
03437 
03438     if (pCurrent - pArticle <= 2)
03439     {
03440         if (mux_tolower(pArticle[0]) == 'a')
03441         {
03442             if (mux_tolower(pArticle[1]) == 'n')
03443             {
03444                 bUseAn = true;
03445                 bOkay = true;
03446             }
03447 
03448             if (mux_isspace(pArticle[1]))
03449             {
03450                 bOkay = true;
03451             }
03452         }
03453     }
03454 
03455     if (!bOkay)
03456     {
03457         *pCurrent = '\0';
03458         cf_log_syntax(player, cmd, "Invalid article '%s'.", pArticle);
03459         return -1;
03460     }
03461 
03462     while (mux_isspace(*pCurrent))
03463     {
03464         pCurrent++;
03465     }
03466 
03467     if (*pCurrent == '\0')
03468     {
03469         cf_log_syntax(player, cmd, "No regexp specified.");
03470         return -1;
03471     }
03472 
03473     const char *errptr;
03474     int erroffset;
03475     pcre* reNewRegexp = pcre_compile(pCurrent, 0, &errptr, &erroffset, NULL);
03476     if (!reNewRegexp)
03477     {
03478         cf_log_syntax(player, cmd, "Error processing regexp '%s':.",
03479               pCurrent, errptr);
03480         return -1;
03481     }
03482 
03483     pcre_extra *study = pcre_study(reNewRegexp, 0, &errptr);
03484 
03485     // Push new rule at head of list.
03486     ArtRuleset** arRules = (ArtRuleset **) vp;
03487     ArtRuleset* arNewRule = (ArtRuleset *) MEMALLOC(sizeof(ArtRuleset));
03488 
03489     arNewRule->m_pNextRule = *arRules;
03490     arNewRule->m_bUseAn = bUseAn;
03491     arNewRule->m_pRegexp = reNewRegexp;
03492     arNewRule->m_pRegexpStudy = study;
03493 
03494     *arRules = arNewRule;
03495     return 0;
03496 }

CF_HAND ( cf_flag_name   ) 

Definition at line 1259 of file flags.cpp.

01260 {
01261     UNUSED_PARAMETER(vp);
01262     UNUSED_PARAMETER(pExtra);
01263     UNUSED_PARAMETER(nExtra);
01264     UNUSED_PARAMETER(player);
01265     UNUSED_PARAMETER(cmd);
01266 
01267     MUX_STRTOK_STATE tts;
01268     mux_strtok_src(&tts, str);
01269     mux_strtok_ctl(&tts, " \t=,");
01270     char *flagstr = mux_strtok_parse(&tts);
01271     char *namestr = mux_strtok_parse(&tts);
01272 
01273     if (  !flagstr
01274        || !*flagstr
01275        || !namestr
01276        || !*namestr)
01277     {
01278         return -1;
01279     }
01280 
01281     if (flag_rename(flagstr, namestr))
01282     {
01283         return 0;
01284     }
01285     else
01286     {
01287         return -1;
01288     }
01289 }

CF_HAND ( cf_flag_access   ) 

Definition at line 943 of file flags.cpp.

00944 {
00945     UNUSED_PARAMETER(vp);
00946     UNUSED_PARAMETER(pExtra);
00947     UNUSED_PARAMETER(nExtra);
00948 
00949     MUX_STRTOK_STATE tts;
00950     mux_strtok_src(&tts, str);
00951     mux_strtok_ctl(&tts, " \t=,");
00952     char *fstr = mux_strtok_parse(&tts);
00953     char *permstr = mux_strtok_parse(&tts);
00954 
00955     if (!fstr || !*fstr)
00956     {
00957         return -1;
00958     }
00959 
00960     FLAGNAMEENT *fp;
00961     if ((fp = find_flag(fstr)) == NULL)
00962     {
00963         cf_log_notfound(player, cmd, "No such flag", fstr);
00964         return -1;
00965     }
00966     FLAGBITENT *fbe = fp->fbe;
00967 
00968     // Don't change the handlers on special things.
00969     //
00970     if (  (fbe->handler != fh_any)
00971        && (fbe->handler != fh_wizroy)
00972        && (fbe->handler != fh_wiz)
00973        && (fbe->handler != fh_god)
00974        && (fbe->handler != fh_restrict_player)
00975        && (fbe->handler != fh_privileged))
00976     {
00977         STARTLOG(LOG_CONFIGMODS, "CFG", "PERM");
00978         log_text("Cannot change access for flag: ");
00979         log_text(fp->flagname);
00980         ENDLOG;
00981         return -1;
00982     }
00983 
00984     if (!strcmp(permstr, "any"))
00985     {
00986         fbe->handler = fh_any;
00987     }
00988     else if (!strcmp(permstr, "royalty"))
00989     {
00990         fbe->handler = fh_wizroy;
00991     }
00992     else if (!strcmp(permstr, "wizard"))
00993     {
00994         fbe->handler = fh_wiz;
00995     }
00996     else if (!strcmp(permstr, "god"))
00997     {
00998         fbe->handler = fh_god;
00999     }
01000     else if (!strcmp(permstr, "restrict_player"))
01001     {
01002         fbe->handler = fh_restrict_player;
01003     }
01004     else if (!strcmp(permstr, "privileged"))
01005     {
01006         fbe->handler = fh_privileged;
01007     }
01008     else if (!strcmp(permstr, "staff"))
01009     {
01010         fbe->handler = fh_staff;
01011     }
01012     else
01013     {
01014         cf_log_notfound(player, cmd, "Flag access", permstr);
01015         return -1;
01016     }
01017     return 0;
01018 }

CF_HAND ( cf_func_access   ) 

Definition at line 9125 of file functions.cpp.

09126 {
09127     UNUSED_PARAMETER(vp);
09128 
09129     char *ap;
09130     for (ap = str; *ap && !mux_isspace(*ap); ap++)
09131     {
09132         *ap = mux_tolower(*ap); // Nothing.
09133     }
09134     int nstr = ap - str;
09135 
09136     if (*ap)
09137     {
09138         *ap++ = '\0';
09139     }
09140 
09141     FUN *fp = (FUN *)hashfindLEN(str, nstr, &mudstate.func_htab);
09142     if (fp)
09143     {
09144         return cf_modify_bits(&fp->perms, ap, pExtra, nExtra, player, cmd);
09145     }
09146     UFUN *ufp = (UFUN *)hashfindLEN(str, nstr, &mudstate.ufunc_htab);
09147     if (ufp)
09148     {
09149         return cf_modify_bits(&ufp->perms, ap, pExtra, nExtra, player, cmd);
09150     }
09151     cf_log_notfound(player, cmd, "Function", str);
09152     return -1;
09153 }

CF_HAND ( cf_attr_access   ) 

Definition at line 3029 of file command.cpp.

References atr_str(), cf_log_notfound(), cf_modify_bits(), attr::flags, mux_isspace, descriptor_data::player, and UNUSED_PARAMETER.

03030 {
03031     UNUSED_PARAMETER(vp);
03032 
03033     ATTR *ap;
03034     char *sp;
03035 
03036     for (sp = str; *sp && !mux_isspace(*sp); sp++)
03037     {
03038         ; // Nothing
03039     }
03040     if (*sp)
03041     {
03042         *sp++ = '\0';
03043     }
03044     while (mux_isspace(*sp))
03045     {
03046         sp++;
03047     }
03048 
03049     ap = atr_str(str);
03050     if (ap)
03051     {
03052         return cf_modify_bits(&(ap->flags), sp, pExtra, nExtra, player, cmd);
03053     }
03054     else
03055     {
03056         cf_log_notfound(player, cmd, "Attribute", str);
03057         return -1;
03058     }
03059 }

CF_HAND ( cf_acmd_access   ) 

Definition at line 2994 of file command.cpp.

References cf_modify_bits(), statedata::command_htab, hashfindLEN(), MakeCanonicalAttributeCommand(), mudstate, attr::name, CMDENT::perms, descriptor_data::player, and UNUSED_PARAMETER.

02995 {
02996     UNUSED_PARAMETER(vp);
02997 
02998     ATTR *ap;
02999 
03000     for (ap = attr; ap->name; ap++)
03001     {
03002         int nBuffer;
03003         bool bValid;
03004         char *buff = MakeCanonicalAttributeCommand(ap->name, &nBuffer, &bValid);
03005         if (!bValid)
03006         {
03007             continue;
03008         }
03009 
03010         CMDENT *cmdp = (CMDENT *)hashfindLEN(buff, nBuffer, &mudstate.command_htab);
03011         if (cmdp != NULL)
03012         {
03013             int save = cmdp->perms;
03014             int failure = cf_modify_bits(&(cmdp->perms), str, pExtra, nExtra,
03015                  player, cmd);
03016             if (failure != 0)
03017             {
03018                 cmdp->perms = save;
03019                 return -1;
03020             }
03021         }
03022     }
03023     return 0;
03024 }

CF_HAND ( cf_cmd_alias   ) 

Definition at line 3064 of file command.cpp.

References CMDENT::callseq, cf_log_notfound(), CMDENT::cmdname, CMDENT::extra, find_nametab_ent(), name_table::flag, CMDENT::handler, hashaddLEN(), hashfindLEN(), ISOUTOFMEMORY, MEMALLOC, mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), name_table::perm, CMDENT::perms, descriptor_data::player, StringClone(), SW_GOT_UNIQUE, SW_MULTIPLE, CMDENT::switches, and UNUSED_PARAMETER.

03065 {
03066     UNUSED_PARAMETER(pExtra);
03067     UNUSED_PARAMETER(nExtra);
03068 
03069     char *ap;
03070     CMDENT *cmdp, *cmd2;
03071     NAMETAB *nt;
03072 
03073     MUX_STRTOK_STATE tts;
03074     mux_strtok_src(&tts, str);
03075     mux_strtok_ctl(&tts, " \t=,");
03076     char *alias = mux_strtok_parse(&tts);
03077     char *orig = mux_strtok_parse(&tts);
03078 
03079     if (!orig)
03080     {
03081         // We only got one argument to @alias. Bad.
03082         //
03083         return -1;
03084     }
03085 
03086     for (ap = orig; *ap && (*ap != '/'); ap++) ;
03087     if (*ap == '/')
03088     {
03089         // Switch form of command aliasing: create an alias for
03090         // a command + a switch
03091         //
03092         *ap++ = '\0';
03093 
03094         // Look up the command
03095         //
03096         cmdp = (CMDENT *) hashfindLEN(orig, strlen(orig), (CHashTable *) vp);
03097         if (cmdp == NULL || cmdp->switches == NULL)
03098         {
03099             cf_log_notfound(player, cmd, "Command", orig);
03100             return -1;
03101         }
03102 
03103         // Look up the switch
03104         //
03105         nt = find_nametab_ent(player, (NAMETAB *) cmdp->switches, ap);
03106         if (!nt)
03107         {
03108             cf_log_notfound(player, cmd, "Switch", ap);
03109             return -1;
03110         }
03111 
03112         if (!hashfindLEN(alias, strlen(alias), (CHashTable *)vp))
03113         {
03114             // Create the new command table entry.
03115             //
03116             cmd2 = (CMDENT *)MEMALLOC(sizeof(CMDENT));
03117             ISOUTOFMEMORY(cmd2);
03118             cmd2->cmdname = StringClone(alias);
03119             cmd2->switches = cmdp->switches;
03120             cmd2->perms = cmdp->perms | nt->perm;
03121             cmd2->extra = (cmdp->extra | nt->flag) & ~SW_MULTIPLE;
03122             if (!(nt->flag & SW_MULTIPLE))
03123             {
03124                 cmd2->extra |= SW_GOT_UNIQUE;
03125             }
03126             cmd2->callseq = cmdp->callseq;
03127             cmd2->handler = cmdp->handler;
03128 
03129             hashaddLEN(cmd2->cmdname, strlen(cmd2->cmdname), cmd2, (CHashTable *) vp);
03130         }
03131     }
03132     else
03133     {
03134         // A normal (non-switch) alias
03135         //
03136         void *hp = hashfindLEN(orig, strlen(orig), (CHashTable *) vp);
03137         if (hp == NULL)
03138         {
03139             cf_log_notfound(player, cmd, "Entry", orig);
03140             return -1;
03141         }
03142         hashaddLEN(alias, strlen(alias), hp, (CHashTable *) vp);
03143     }
03144     return 0;
03145 }

CF_HAND ( cf_access   ) 

Definition at line 2938 of file command.cpp.

References cf_log_notfound(), cf_modify_bits(), cf_ntab_access(), statedata::command_htab, hashfindLEN(), mudconf, mudstate, mux_isspace, mux_stricmp(), CMDENT::perms, descriptor_data::player, confdata::restrict_home, CMDENT::switches, and UNUSED_PARAMETER.

02939 {
02940     UNUSED_PARAMETER(vp);
02941 
02942     CMDENT *cmdp;
02943     char *ap;
02944     bool set_switch;
02945 
02946     for (ap = str; *ap && !mux_isspace(*ap) && (*ap != '/'); ap++) ;
02947     if (*ap == '/')
02948     {
02949         set_switch = true;
02950         *ap++ = '\0';
02951     }
02952     else
02953     {
02954         set_switch = false;
02955         if (*ap)
02956         {
02957             *ap++ = '\0';
02958         }
02959         while (mux_isspace(*ap))
02960         {
02961             ap++;
02962         }
02963     }
02964 
02965     cmdp = (CMDENT *)hashfindLEN(str, strlen(str), &mudstate.command_htab);
02966     if (cmdp != NULL)
02967     {
02968         if (set_switch)
02969         {
02970             return cf_ntab_access((int *)cmdp->switches, ap, pExtra, nExtra,
02971                                   player, cmd);
02972         }
02973         else
02974         {
02975             return cf_modify_bits(&(cmdp->perms), ap, pExtra, nExtra, player,
02976                                   cmd);
02977         }
02978     }
02979     else
02980     {
02981         if (!mux_stricmp(str, "home"))
02982         {
02983             return cf_modify_bits(&(mudconf.restrict_home), ap, pExtra,
02984                                   nExtra, player, cmd);
02985         }
02986         cf_log_notfound(player, cmd, "Command", str);
02987         return -1;
02988     }
02989 }

CF_HAND ( cf_cf_access   ) 

Definition at line 1940 of file conf.cpp.

References statedata::bReadingConfiguration, CA_STATIC, cf_modify_bits(), conftable, ENDLOG, confparm::flags, LOG_CONFIGMODS, log_name(), log_text(), mudstate, mux_isspace, NOPERM_MESSAGE, notify, confparm::pname, STARTLOG, and UNUSED_PARAMETER.

01941 {
01942     UNUSED_PARAMETER(vp);
01943 
01944     CONF *tp;
01945     char *ap;
01946 
01947     for (ap = str; *ap && !mux_isspace(*ap); ap++)
01948     {
01949         ; // Nothing
01950     }
01951     if (*ap)
01952     {
01953         *ap++ = '\0';
01954     }
01955 
01956     for (tp = conftable; tp->pname; tp++)
01957     {
01958         if (!strcmp(tp->pname, str))
01959         {
01960             // Cannot modify parameters set CA_STATIC.
01961             //
01962             if (  tp->flags & CA_STATIC
01963                && !mudstate.bReadingConfiguration)
01964             {
01965                 notify(player, NOPERM_MESSAGE);
01966                 STARTLOG(LOG_CONFIGMODS, "CFG", "PERM");
01967                 log_name(player);
01968                 log_text(" tried to change access to static param: ");
01969                 log_text(tp->pname);
01970                 ENDLOG;
01971                 return -1;
01972             }
01973             return cf_modify_bits(&tp->flags, ap, pExtra, nExtra, player, cmd);
01974         }
01975     }
01976     cf_log_notfound(player, cmd, "Config directive", str);
01977     return -1;
01978 }

void cf_init ( void   ) 

Definition at line 39 of file conf.cpp.

References A_USER_START, statedata::access_list, confdata::active_q_chunk, AF_ODARK, statedata::aHelpDesc, confdata::allow_guest_from_registered_site, confdata::art_rules, statedata::attr_next, confdata::autozone, statedata::badname_head, statedata::bCanRestart, statedata::bReadingConfiguration, statedata::bStackLimitReached, confdata::cache_names, confdata::cache_pages, confdata::cache_tick_period, confdata::check_interval, confdata::check_offset, confdata::clone_copy_cost, confdata::cmd_quota_incr, confdata::cmd_quota_max, confdata::compress, confdata::compress_db, confdata::comsys_db, confdata::conn_file, confdata::conn_timeout, confdata::control_flags, confdata::crashdb, confdata::crea_file, confdata::createmax, confdata::createmin, confdata::creg_file, statedata::curr_cmd, statedata::curr_enactor, statedata::curr_executor, confdata::dark_sleepers, alist::data, statedata::db_size, statedata::db_top, statedata::debug_cmd, confdata::default_home, confdata::destroy_going_now, confdata::digcost, statedata::doing_hdr, confdata::down_file, confdata::downmotd_msg, confdata::dump_interval, confdata::dump_msg, confdata::dump_offset, statedata::dumped, statedata::dumper, statedata::dumping, statedata::epoch, confdata::eval_comtitle, confdata::events_daily_hour, statedata::events_flag, confdata::ex_flags, confdata::exam_public, confdata::exit_flags, confdata::exit_quota, confdata::fascist_tport, confdata::fixed_home_msg, confdata::fixed_tel_msg, FLAG_WORD1, FLAG_WORD3, confdata::fork_dump, statedata::freelist, confdata::full_file, confdata::fullmotd_msg, statedata::func_invk_ctr, confdata::func_invk_lim, statedata::func_nest_lev, confdata::func_nest_lim, confdata::game_dir, confdata::game_pag, statedata::generation, statedata::glob_reg_len, confdata::global_error_obj, statedata::global_regs, GOD, confdata::guest_char, confdata::guest_file, confdata::guest_nuker, confdata::guest_prefix, confdata::guests_channel, confdata::guests_channel_alias, confdata::have_comsys, confdata::have_mailer, confdata::have_zones, confdata::hook_obj, confdata::idle_interval, confdata::idle_timeout, confdata::idle_wiz_dark, statedata::in_loop, confdata::indb, confdata::indent_desc, confdata::init_size, statedata::inpipe, ISOUTOFMEMORY, statedata::iter_alist, confdata::killguarantee, confdata::killmax, confdata::killmin, alist::len, confdata::linkcost, statedata::lock_nest_lev, confdata::lock_nest_lim, LOG_ALWAYS, LOG_BUGS, LOG_CONFIGMODS, LOG_DBSAVES, confdata::log_info, LOG_LOGIN, LOG_NET, confdata::log_options, LOG_PCREATES, LOG_PROBLEMS, LOG_SECURITY, LOG_SHOUTS, LOG_STARTUP, LOG_SUSPECTCMDS, LOG_TIMEUSE, LOG_WIZARD, statedata::logging, LOGOPT_LOC, LOGOPT_TIMESTAMP, confdata::machinecost, confdata::mail_db, statedata::mail_db_size, statedata::mail_db_top, confdata::mail_expiration, confdata::mail_per_hour, confdata::many_coins, statedata::markbits, confdata::markdata, confdata::master_room, confdata::match_mine, confdata::match_mine_pl, confdata::max_cache_size, confdata::max_cmdsecs, MAX_GLOBAL_REGS, confdata::max_players, MEMALLOC, statedata::mHelpDesc, confdata::min_guests, statedata::min_size, statedata::mod_al_id, statedata::mod_alist, statedata::mod_alist_len, statedata::mod_size, confdata::motd_file, confdata::motd_msg, statedata::mstat_curr, statedata::mstat_idrss, statedata::mstat_isrss, statedata::mstat_ixrss, statedata::mstat_secs, confdata::mud_name, mudconf, mudstate, tag_int_array::n, confdata::name_spaces, alist::next, statedata::nHearNest, statedata::nHelpDesc, statedata::nObjEvalNest, NOTHING, confdata::nStackLimit, statedata::nStackNest, statedata::ntfy_nest_lev, confdata::ntfy_nest_lim, confdata::number_guests, statedata::olist, confdata::one_coin, confdata::opencost, confdata::outdb, confdata::output_limit, confdata::pagecost, statedata::panicking, confdata::paranoid_alloc, confdata::parent_nest_lim, confdata::paycheck, confdata::payfind, confdata::paylimit, confdata::paystart, confdata::pcreate_per_hour, confdata::pemit_any, confdata::pemit_players, tag_int_array::pi, statedata::pipe_nest_lev, confdata::player_flags, confdata::player_listen, confdata::player_quota, confdata::ports, confdata::postdump_msg, statedata::pout, statedata::poutbufc, statedata::poutnew, statedata::poutobj, confdata::pub_flags, confdata::public_channel, confdata::public_channel_alias, confdata::pueblo_msg, confdata::queue_chunk, confdata::queuemax, confdata::quiet_look, confdata::quiet_whisper, confdata::quit_file, confdata::quotas, confdata::read_rem_desc, confdata::read_rem_name, confdata::regf_file, confdata::reset_players, confdata::restrict_home, confdata::retry_limit, ROBOT, confdata::robot_flags, confdata::robot_speak, confdata::robotcost, confdata::room_flags, confdata::room_quota, confdata::rpt_cmdsecs, confdata::run_startup, SA_DFLT, confdata::sacadjust, confdata::sacfactor, confdata::safe_unowned, confdata::safe_wipe, confdata::safer_passwords, confdata::searchcost, confdata::see_own_dark, CLinearTimeDelta::SetSeconds(), statedata::shutdown_flag, confdata::sig_action, confdata::site_chars, confdata::site_file, confdata::space_compress, confdata::stack_limit, confdata::start_home, confdata::start_quota, confdata::start_room, confdata::status_file, StringClone(), statedata::suspect_list, confdata::sweep_dark, confdata::switch_df_all, confdata::terse_contents, confdata::terse_exits, confdata::terse_look, confdata::terse_movemsg, confdata::thing_flags, confdata::thing_quota, confdata::timeslice, confdata::toad_recipient, confdata::trace_limit, confdata::trace_topdown, statedata::train_nest_lev, confdata::uncompress, confdata::use_hostname, confdata::use_http, confdata::vattr_flags, confdata::vattr_per_hour, confdata::waitcost, statedata::wild_invk_ctr, confdata::wild_invk_lim, confdata::wizmotd_file, confdata::wizmotd_msg, flagset::word, statedata::write_protect, confdata::zone_nest_lim, and statedata::zone_nest_num.

Referenced by dbconvert(), and main().

00040 {
00041     int i;
00042 
00043     mudconf.indb = StringClone("netmux.db");
00044     mudconf.outdb = StringClone("");
00045     mudconf.crashdb = StringClone("");
00046     mudconf.game_dir = StringClone("");
00047     mudconf.game_pag = StringClone("");
00048     mudconf.mail_db   = StringClone("mail.db");
00049     mudconf.comsys_db = StringClone("comsys.db");
00050 
00051     mudconf.compress_db = false;
00052     mudconf.compress = StringClone("gzip");
00053     mudconf.uncompress = StringClone("gzip -d");
00054     mudconf.status_file = StringClone("shutdown.status");
00055     mudconf.max_cache_size = 1*1024*1024;
00056 
00057     mudconf.ports.n = 1;
00058     mudconf.ports.pi = (int *)MEMALLOC(sizeof(int));
00059     ISOUTOFMEMORY(mudconf.ports.pi);
00060     mudconf.ports.pi[0] = 2860;
00061 
00062     mudconf.init_size = 1000;
00063     mudconf.guest_char = -1;
00064     mudconf.guest_nuker = GOD;
00065     mudconf.number_guests = 30;
00066     mudconf.min_guests = 1;
00067     strcpy(mudconf.guest_prefix, "Guest");
00068     mudconf.guest_file     = StringClone("text/guest.txt");
00069     mudconf.conn_file      = StringClone("text/connect.txt");
00070     mudconf.creg_file      = StringClone("text/register.txt");
00071     mudconf.regf_file      = StringClone("text/create_reg.txt");
00072     mudconf.motd_file      = StringClone("text/motd.txt");
00073     mudconf.wizmotd_file   = StringClone("text/wizmotd.txt");
00074     mudconf.quit_file      = StringClone("text/quit.txt");
00075     mudconf.down_file      = StringClone("text/down.txt");
00076     mudconf.full_file      = StringClone("text/full.txt");
00077     mudconf.site_file      = StringClone("text/badsite.txt");
00078     mudconf.crea_file      = StringClone("text/newuser.txt");
00079     mudconf.motd_msg[0] = '\0';
00080     mudconf.wizmotd_msg[0] = '\0';
00081     mudconf.downmotd_msg[0] = '\0';
00082     mudconf.fullmotd_msg[0] = '\0';
00083     mudconf.dump_msg[0] = '\0';
00084     mudconf.postdump_msg[0] = '\0';
00085     mudconf.fixed_home_msg[0] = '\0';
00086     mudconf.fixed_tel_msg[0] = '\0';
00087     strcpy(mudconf.public_channel, "Public");
00088     strcpy(mudconf.public_channel_alias, "pub");
00089     strcpy(mudconf.guests_channel, "Guests");
00090     strcpy(mudconf.guests_channel_alias, "g");
00091     strcpy(mudconf.pueblo_msg, "</xch_mudtext><img xch_mode=html>");
00092     mudconf.art_rules = NULL;
00093     mudconf.indent_desc = false;
00094     mudconf.name_spaces = true;
00095 #ifndef WIN32
00096     mudconf.fork_dump = true;
00097     mudstate.dumping  = false;
00098     mudstate.dumper   = 0;
00099     mudstate.dumped   = 0;
00100     mudstate.write_protect = false;
00101 #endif
00102     mudconf.restrict_home = false;
00103     mudconf.have_comsys = true;
00104     mudconf.have_mailer = true;
00105     mudconf.have_zones = true;
00106     mudconf.paranoid_alloc = false;
00107     mudconf.sig_action = SA_DFLT;
00108     mudconf.max_players = -1;
00109     mudconf.dump_interval = 3600;
00110     mudconf.check_interval = 600;
00111     mudconf.events_daily_hour = 7;
00112     mudconf.dump_offset = 0;
00113     mudconf.check_offset = 300;
00114     mudconf.idle_timeout = 3600;
00115     mudconf.conn_timeout = 120;
00116     mudconf.idle_interval = 60;
00117     mudconf.retry_limit = 3;
00118     mudconf.output_limit = 16384;
00119     mudconf.paycheck = 0;
00120     mudconf.paystart = 0;
00121     mudconf.paylimit = 10000;
00122 #ifdef REALITY_LVLS
00123     mudconf.no_levels = 0;
00124     mudconf.def_room_rx = 1;
00125     mudconf.def_room_tx = ~(RLEVEL)0;
00126     mudconf.def_player_rx = 1;
00127     mudconf.def_player_tx = 1;
00128     mudconf.def_exit_rx = 1;
00129     mudconf.def_exit_tx = 1;
00130     mudconf.def_thing_rx = 1;
00131     mudconf.def_thing_tx = 1;
00132 #endif /* REALITY_LVLS */
00133     mudconf.start_quota = 20;
00134     mudconf.site_chars = 25;
00135     mudconf.payfind = 0;
00136     mudconf.digcost = 10;
00137     mudconf.linkcost = 1;
00138     mudconf.opencost = 1;
00139     mudconf.createmin = 10;
00140     mudconf.createmax = 505;
00141     mudconf.killmin = 10;
00142     mudconf.killmax = 100;
00143     mudconf.killguarantee = 100;
00144     mudconf.robotcost = 1000;
00145     mudconf.pagecost = 10;
00146     mudconf.searchcost = 100;
00147     mudconf.waitcost = 10;
00148     mudconf.machinecost = 64;
00149     mudconf.exit_quota = 1;
00150     mudconf.player_quota = 1;
00151     mudconf.room_quota = 1;
00152     mudconf.thing_quota = 1;
00153     mudconf.mail_expiration = 14;
00154     mudconf.queuemax = 100;
00155     mudconf.queue_chunk = 10;
00156     mudconf.active_q_chunk  = 10;
00157     mudconf.sacfactor       = 5;
00158     mudconf.sacadjust       = -1;
00159     mudconf.trace_limit     = 200;
00160 
00161     mudconf.autozone        = true;
00162     mudconf.use_hostname    = true;
00163     mudconf.clone_copy_cost = false;
00164     mudconf.dark_sleepers   = true;
00165     mudconf.ex_flags        = true;
00166     mudconf.exam_public     = true;
00167     mudconf.fascist_tport   = false;
00168     mudconf.idle_wiz_dark   = false;
00169     mudconf.match_mine      = true;
00170     mudconf.match_mine_pl   = true;
00171     mudconf.pemit_players   = false;
00172     mudconf.pemit_any       = false;
00173     mudconf.player_listen   = false;
00174     mudconf.pub_flags       = true;
00175     mudconf.quiet_look      = true;
00176     mudconf.quiet_whisper   = true;
00177     mudconf.quotas          = false;
00178     mudconf.read_rem_desc   = false;
00179     mudconf.read_rem_name   = false;
00180     mudconf.reset_players   = false;
00181     mudconf.robot_speak     = true;
00182     mudconf.safe_unowned    = false;
00183     mudconf.safer_passwords = false;
00184     mudconf.see_own_dark    = true;
00185     mudconf.sweep_dark      = false;
00186     mudconf.switch_df_all   = true;
00187     mudconf.terse_contents  = true;
00188     mudconf.terse_exits     = true;
00189     mudconf.terse_look      = true;
00190     mudconf.terse_movemsg   = true;
00191     mudconf.trace_topdown   = true;
00192     mudconf.use_http        = false;
00193 
00194     // -- ??? Running SC on a non-SC DB may cause problems.
00195     //
00196     mudconf.space_compress = true;
00197     mudconf.allow_guest_from_registered_site = true;
00198     mudconf.start_room = 0;
00199     mudconf.start_home = NOTHING;
00200     mudconf.default_home = NOTHING;
00201     mudconf.master_room = NOTHING;
00202 
00203     for (i = FLAG_WORD1; i <= FLAG_WORD3; i++)
00204     {
00205         mudconf.player_flags.word[i] = 0;
00206         mudconf.room_flags.word[i] = 0;
00207         mudconf.exit_flags.word[i] = 0;
00208         mudconf.thing_flags.word[i] = 0;
00209         mudconf.robot_flags.word[i] = 0;
00210     }
00211     mudconf.robot_flags.word[FLAG_WORD1] |= ROBOT;
00212 
00213     mudconf.vattr_flags = AF_ODARK;
00214     strcpy(mudconf.mud_name, "MUX");
00215     strcpy(mudconf.one_coin, "penny");
00216     strcpy(mudconf.many_coins, "pennies");
00217     mudconf.timeslice.SetSeconds(1);
00218     mudconf.cmd_quota_max = 100;
00219     mudconf.cmd_quota_incr = 1;
00220     mudconf.rpt_cmdsecs.SetSeconds(120);
00221     mudconf.max_cmdsecs.SetSeconds(60);
00222     mudconf.cache_tick_period.SetSeconds(30);
00223     mudconf.control_flags = 0xffffffff; // Everything for now...
00224     mudconf.log_options = LOG_ALWAYS | LOG_BUGS | LOG_SECURITY |
00225         LOG_NET | LOG_LOGIN | LOG_DBSAVES | LOG_CONFIGMODS |
00226         LOG_SHOUTS | LOG_STARTUP | LOG_WIZARD | LOG_SUSPECTCMDS |
00227         LOG_PROBLEMS | LOG_PCREATES | LOG_TIMEUSE;
00228     mudconf.log_info = LOGOPT_TIMESTAMP | LOGOPT_LOC;
00229     mudconf.markdata[0] = 0x01;
00230     mudconf.markdata[1] = 0x02;
00231     mudconf.markdata[2] = 0x04;
00232     mudconf.markdata[3] = 0x08;
00233     mudconf.markdata[4] = 0x10;
00234     mudconf.markdata[5] = 0x20;
00235     mudconf.markdata[6] = 0x40;
00236     mudconf.markdata[7] = 0x80;
00237     mudconf.func_nest_lim = 50;
00238     mudconf.func_invk_lim = 2500;
00239     mudconf.wild_invk_lim = 100000;
00240     mudconf.ntfy_nest_lim = 20;
00241     mudconf.lock_nest_lim = 20;
00242     mudconf.parent_nest_lim = 10;
00243     mudconf.zone_nest_lim = 20;
00244     mudconf.stack_limit = 50;
00245     mudconf.cache_names = true;
00246     mudconf.toad_recipient = -1;
00247     mudconf.eval_comtitle = true;
00248     mudconf.run_startup = true;
00249     mudconf.safe_wipe = false;
00250     mudconf.destroy_going_now = false;
00251     mudconf.nStackLimit = 10000;
00252     mudconf.hook_obj = NOTHING;
00253     mudconf.global_error_obj = NOTHING;
00254     mudconf.cache_pages = 40;
00255     mudconf.mail_per_hour = 50;
00256     mudconf.vattr_per_hour = 5000;
00257     mudconf.pcreate_per_hour = 100;
00258 
00259     mudstate.events_flag = 0;
00260     mudstate.bReadingConfiguration = false;
00261     mudstate.bCanRestart = false;
00262     mudstate.panicking = false;
00263     mudstate.logging = 0;
00264     mudstate.epoch = 0;
00265     mudstate.generation = 0;
00266     mudstate.curr_executor = NOTHING;
00267     mudstate.curr_enactor = NOTHING;
00268     mudstate.shutdown_flag  = false;
00269     mudstate.attr_next = A_USER_START;
00270     mudstate.debug_cmd = "< init >";
00271     mudstate.curr_cmd  = "< none >";
00272     strcpy(mudstate.doing_hdr, "Doing");
00273     mudstate.access_list = NULL;
00274     mudstate.suspect_list = NULL;
00275     mudstate.badname_head = NULL;
00276     mudstate.mstat_ixrss[0] = 0;
00277     mudstate.mstat_ixrss[1] = 0;
00278     mudstate.mstat_idrss[0] = 0;
00279     mudstate.mstat_idrss[1] = 0;
00280     mudstate.mstat_isrss[0] = 0;
00281     mudstate.mstat_isrss[1] = 0;
00282     mudstate.mstat_secs[0] = 0;
00283     mudstate.mstat_secs[1] = 0;
00284     mudstate.mstat_curr = 0;
00285     mudstate.iter_alist.data = NULL;
00286     mudstate.iter_alist.len = 0;
00287     mudstate.iter_alist.next = NULL;
00288     mudstate.mod_alist = NULL;
00289     mudstate.mod_alist_len = 0;
00290     mudstate.mod_size = 0;
00291     mudstate.mod_al_id = NOTHING;
00292     mudstate.olist = NULL;
00293     mudstate.min_size = 0;
00294     mudstate.db_top = 0;
00295     mudstate.db_size = 0;
00296     mudstate.mail_db_top = 0;
00297     mudstate.mail_db_size = 0;
00298     mudstate.freelist = NOTHING;
00299     mudstate.markbits = NULL;
00300     mudstate.func_nest_lev = 0;
00301     mudstate.func_invk_ctr = 0;
00302     mudstate.wild_invk_ctr = 0;
00303     mudstate.ntfy_nest_lev = 0;
00304     mudstate.train_nest_lev = 0;
00305     mudstate.lock_nest_lev = 0;
00306     mudstate.zone_nest_num = 0;
00307     mudstate.pipe_nest_lev = 0;
00308     mudstate.inpipe = false;
00309     mudstate.pout = NULL;
00310     mudstate.poutnew = NULL;
00311     mudstate.poutbufc = NULL;
00312     mudstate.poutobj = NOTHING;
00313     for (i = 0; i < MAX_GLOBAL_REGS; i++)
00314     {
00315         mudstate.global_regs[i] = NULL;
00316         mudstate.glob_reg_len[i] = 0;
00317     }
00318     mudstate.nObjEvalNest = 0;
00319     mudstate.in_loop = 0;
00320     mudstate.bStackLimitReached = false;
00321     mudstate.nStackNest = 0;
00322     mudstate.nHearNest  = 0;
00323     mudstate.aHelpDesc = NULL;
00324     mudstate.mHelpDesc = 0;
00325     mudstate.nHelpDesc = 0;
00326 }

void cf_list ( dbref  ,
char *  ,
char **   
)

Definition at line 2243 of file conf.cpp.

References check_access(), conftable, ItemToList_AddString(), ItemToList_Init(), confparm::pname, and confparm::rperms.

Referenced by FUNCTION().

02244 {
02245     CONF *tp;
02246     ITL itl;
02247     ItemToList_Init(&itl, buff, bufc);
02248 
02249     for (tp = conftable; tp->pname; tp++)
02250     {
02251         if (check_access(player, tp->rperms))
02252         {
02253             if (!ItemToList_AddString(&itl, tp->pname))
02254             {
02255                 break;
02256             }
02257         }
02258     }
02259     ItemToList_Final(&itl);
02260     return;
02261 }

void cf_log_notfound ( dbref  ,
char *  ,
const char *  ,
char *   
)

Definition at line 331 of file conf.cpp.

References statedata::bReadingConfiguration, ENDLOG, Log, LOG_STARTUP, mudstate, notify, STARTLOG, CLogFile::tinyprintf(), and tprintf().

Referenced by CF_HAND().

00332 {
00333     if (mudstate.bReadingConfiguration)
00334     {
00335         STARTLOG(LOG_STARTUP, "CNF", "NFND");
00336         Log.tinyprintf("%s: %s %s not found", cmd, thingname, thing);
00337         ENDLOG;
00338     }
00339     else
00340     {
00341         notify(player, tprintf("%s %s not found", thingname, thing));
00342     }
00343 }

void DCL_CDECL cf_log_syntax ( dbref  player,
char *  cmd,
const char *  fmt,
  ... 
)

Definition at line 348 of file conf.cpp.

References alloc_lbuf, statedata::bReadingConfiguration, ENDLOG, free_lbuf, LBUF_SIZE, LOG_STARTUP, log_text(), mudstate, mux_vsnprintf(), notify, and STARTLOG.

Referenced by add_helpfile(), and CF_HAND().

00349 {
00350     va_list ap;
00351     va_start(ap, fmt);
00352 
00353     char *buf = alloc_lbuf("cf_log_syntax");
00354     mux_vsnprintf(buf, LBUF_SIZE, fmt, ap);
00355     if (mudstate.bReadingConfiguration)
00356     {
00357         STARTLOG(LOG_STARTUP, "CNF", "SYNTX")
00358         log_text(cmd);
00359         log_text(": ");
00360         log_text(buf);
00361         ENDLOG;
00362     }
00363     else
00364     {
00365         notify(player, buf);
00366     }
00367     free_lbuf(buf);
00368     va_end(ap);
00369 }

int cf_modify_bits ( int *  ,
char *  ,
void *  ,
UINT32  ,
dbref  ,
char *   
)

Referenced by CF_HAND().

int cf_ntab_access ( int *  ,
char *  ,
void *  ,
UINT32  ,
dbref  ,
char *   
)

Referenced by CF_HAND().

int cf_read ( void   ) 

Definition at line 2118 of file conf.cpp.

References statedata::bReadingConfiguration, confdata::config_file, DefaultSuffixes, confdata::indb, ISOUTOFMEMORY, MEMALLOC, MEMFREE, mudconf, mudstate, pFilename, and pSuffix.

Referenced by main().

02119 {
02120     int retval;
02121 
02122     mudstate.bReadingConfiguration = true;
02123     retval = cf_include(NULL, mudconf.config_file, (void *)0, 0, 0, "init");
02124     mudstate.bReadingConfiguration = false;
02125 
02126     // Fill in missing DB file names.
02127     //
02128     unsigned int nInDB = strlen(mudconf.indb);
02129     for (int i = 0; DefaultSuffixes[i].pFilename; i++)
02130     {
02131         char **p = DefaultSuffixes[i].pFilename;
02132         if (**p == '\0')
02133         {
02134             // The filename is an empty string so we should construct
02135             // a default filename.
02136             //
02137             char *pSuffix = DefaultSuffixes[i].pSuffix;
02138             int nSuffix = strlen(pSuffix);
02139             char *buff = (char *)MEMALLOC(nInDB + nSuffix + 1);
02140             ISOUTOFMEMORY(buff);
02141             memcpy(buff, mudconf.indb, nInDB);
02142             memcpy(buff + nInDB, pSuffix, nSuffix+1);
02143             MEMFREE(*p);
02144             *p = buff;
02145         }
02146     }
02147     return retval;
02148 }

int cf_set ( char *  ,
char *  ,
dbref   
)

Definition at line 1983 of file conf.cpp.

References alloc_lbuf, statedata::bReadingConfiguration, check_access(), conftable, confparm::flags, mudstate, NOPERM_MESSAGE, notify, and confparm::pname.

Referenced by CF_HAND(), and do_admin().

01984 {
01985     CONF *tp;
01986     int i;
01987     char *buff = 0;
01988 
01989     // Search the config parameter table for the command. If we find
01990     // it, call the handler to parse the argument.
01991     //
01992     for (tp = conftable; tp->pname; tp++)
01993     {
01994         if (!strcmp(tp->pname, cp))
01995         {
01996             if (  !mudstate.bReadingConfiguration
01997                && !check_access(player, tp->flags))
01998             {
01999                 notify(player, NOPERM_MESSAGE);
02000                 return -1;
02001             }
02002             if (!mudstate.bReadingConfiguration)
02003             {
02004                 buff = alloc_lbuf("cf_set");
02005                 strcpy(buff, ap);
02006             }
02007             i = tp->interpreter(tp->loc, ap, tp->pExtra, tp->nExtra, player, cp);
02008             if (!mudstate.bReadingConfiguration)
02009             {
02010                 STARTLOG(LOG_CONFIGMODS, "CFG", "UPDAT");
02011                 log_name(player);
02012                 log_text(" entered config directive: ");
02013                 log_text(cp);
02014                 log_text(" with args '");
02015                 log_text(buff);
02016                 log_text("'.  Status: ");
02017                 switch (i)
02018                 {
02019                 case 0:
02020                     log_text("Success.");
02021                     break;
02022 
02023                 case 1:
02024                     log_text("Partial success.");
02025                     break;
02026 
02027                 case -1:
02028                     log_text("Failure.");
02029                     break;
02030 
02031                 default:
02032                     log_text("Strange.");
02033                 }
02034                 ENDLOG;
02035                 free_lbuf(buff);
02036             }
02037             return i;
02038         }
02039     }
02040 
02041     // Config directive not found.  Complain about it.
02042     //
02043     cf_log_notfound(player, "Set", "Config directive", cp);
02044     return -1;
02045 }

void ChangePassword ( dbref  player,
const char *  szPassword 
)

Definition at line 282 of file player.cpp.

References GenerateSalt(), mux_crypt(), and s_Pass().

Referenced by check_pass(), CGuests::Create(), create_player(), do_newpassword(), and do_password().

00283 {
00284     int iType;
00285     s_Pass(player, mux_crypt(szPassword, GenerateSalt(), &iType));
00286 }

bool check_access ( dbref  player,
int  mask 
)

Definition at line 935 of file command.cpp.

References Announce, statedata::bReadingConfiguration, Builder, CA_ADMIN, CA_ANNOUNCE, CA_BUILDER, CA_CANTBE_MASK, CA_DISABLED, CA_GOD, CA_HEAD, CA_IMMORTAL, CA_MUSTBE_MASK, CA_NO_GUEST, CA_NO_HAVEN, CA_NO_ROBOT, CA_NO_SLAVE, CA_NO_SUSPECT, CA_NO_UNINS, CA_ROBOT, CA_STAFF, CA_STATIC, CA_UNINS, CA_WIZARD, God, Guest, Head, Immortal, mudstate, Player_haven, Robot, Slave, Staff, Suspect, Uninspected, Wizard, and WizRoy.

Referenced by cf_display(), cf_list(), cf_set(), check_command(), decompile_flags(), display_nametab(), do_decomp(), find_nametab_ent(), interp_nametab(), list_cf_access(), list_cmdaccess(), list_cmdswitches(), list_cmdtable(), list_functable(), listset_nametab(), mux_exec(), process_cmdent(), process_command(), and search_nametab().

00936 {
00937     if (mask & (CA_DISABLED|CA_STATIC))
00938     {
00939         return false;
00940     }
00941     if (  God(player)
00942        || mudstate.bReadingConfiguration)
00943     {
00944         return true;
00945     }
00946 
00947     if (mask & CA_MUSTBE_MASK)
00948     {
00949         // Since CA_GOD by itself is a frequent case, for the sake of
00950         // performance, we test CA_GOD specifically. If CA_GOD were ever
00951         // combined with anything, it would be passed through to the general
00952         // case.
00953         //
00954         if ((mask & CA_MUSTBE_MASK) == CA_GOD)
00955         {
00956             return false;
00957         }
00958 
00959         // Since God(player) is always false here, CA_GOD is still handled by
00960         // the following code even though it doesn't appear in any of the
00961         // cases explicitly.  CA_WIZARD by itself is also a common case, but
00962         // since we have have a bit (mask & CA_MUSTBE_MASK), and since that
00963         // bit is not a lone CA_GOD bit (handled above), and since CA_WIZARD
00964         // it tested first below, it doesn't make sense to test CA_WIZARD
00965         // as a special case.
00966         //
00967         if (!(  ((mask & CA_WIZARD)   && Wizard(player))
00968              || ((mask & CA_ADMIN)    && WizRoy(player))
00969              || ((mask & CA_BUILDER)  && Builder(player))
00970              || ((mask & CA_STAFF)    && Staff(player))
00971              || ((mask & CA_HEAD)     && Head(player))
00972              || ((mask & CA_ANNOUNCE) && Announce(player))
00973              || ((mask & CA_IMMORTAL) && Immortal(player))
00974              || ((mask & CA_UNINS)    && Uninspected(player))
00975              || ((mask & CA_ROBOT)    && Robot(player))))
00976         {
00977             return false;
00978         }
00979     }
00980 
00981     // Check for forbidden flags.
00982     //
00983     if (  (mask & CA_CANTBE_MASK)
00984        && !Wizard(player))
00985     {
00986         if (  ((mask & CA_NO_HAVEN)   && Player_haven(player))
00987            || ((mask & CA_NO_ROBOT)   && Robot(player))
00988            || ((mask & CA_NO_SLAVE)   && Slave(player))
00989            || ((mask & CA_NO_SUSPECT) && Suspect(player))
00990            || ((mask & CA_NO_GUEST)   && Guest(player))
00991            || ((mask & CA_NO_UNINS)   && Uninspected(player)))
00992         {
00993             return false;
00994         }
00995     }
00996     return true;
00997 }

void check_events ( void   ) 

Definition at line 1364 of file netcommon.cpp.

References A_DAILY, did_it(), DO_WHOLE_DB, ET_DAILY, confdata::events_daily_hour, statedata::events_flag, Flags2, CLinearTimeAbsolute::GetLocal(), Going, HAS_DAILY, FIELDEDTIME::iHour, ITER_PARENTS, mudconf, mudstate, Owner, and CLinearTimeAbsolute::ReturnFields().

Referenced by dispatch_CheckEvents().

01365 {
01366     dbref thing, parent;
01367     int lev;
01368 
01369     CLinearTimeAbsolute ltaNow;
01370     ltaNow.GetLocal();
01371 
01372     FIELDEDTIME ft;
01373     if (!ltaNow.ReturnFields(&ft))
01374     {
01375         return;
01376     }
01377 
01378     // Resetting every midnight.
01379     //
01380     static int iLastHourChecked = 25;
01381     if (  iLastHourChecked == 23
01382        && ft.iHour < iLastHourChecked)
01383     {
01384         mudstate.events_flag &= ~ET_DAILY;
01385     }
01386     iLastHourChecked = ft.iHour;
01387 
01388     if (  ft.iHour == mudconf.events_daily_hour
01389        && !(mudstate.events_flag & ET_DAILY))
01390     {
01391         mudstate.events_flag |= ET_DAILY;
01392         DO_WHOLE_DB(thing)
01393         {
01394             if (Going(thing))
01395             {
01396                 continue;
01397             }
01398 
01399             ITER_PARENTS(thing, parent, lev)
01400             {
01401                 if (Flags2(thing) & HAS_DAILY)
01402                 {
01403                     did_it(Owner(thing), thing, 0, NULL, 0, NULL, A_DAILY, (char **)NULL, 0);
01404                     break;
01405                 }
01406             }
01407         }
01408     }
01409 
01410 }

void check_mail ( dbref  player,
int  folder,
bool  silent 
)

Definition at line 3070 of file mail.cpp.

References count_mail(), get_folder_name(), notify, tprintf(), and urgent_mail().

Referenced by announce_connect(), and do_mail_change_folder().

03071 {
03072     // Check for new @mail
03073     //
03074     int rc;     // Read messages.
03075     int uc;     // Unread messages.
03076     int cc;     // Cleared messages.
03077     int gc;     // urgent messages.
03078 
03079     // Just count messages
03080     //
03081     count_mail(player, folder, &rc, &uc, &cc);
03082     urgent_mail(player, folder, &gc);
03083 #ifdef MAIL_ALL_FOLDERS
03084     notify(player,
03085            tprintf("MAIL: %d messages in folder %d [%s] (%d unread, %d cleared).\r\n",
03086                rc + uc, folder, get_folder_name(player, folder), uc, cc));
03087 #else // MAIL_ALL_FOLDERS
03088     if (rc + uc > 0)
03089     {
03090         notify(player, tprintf("MAIL: %d messages in folder %d [%s] (%d unread, %d cleared).", rc + uc, folder, get_folder_name(player, folder), uc, cc));
03091     }
03092     else if (!silent)
03093     {
03094         notify(player, tprintf("\r\nMAIL: You have no mail.\r\n"));
03095     }
03096     if (gc > 0)
03097     {
03098         notify(player, tprintf("URGENT MAIL: You have %d urgent messages in folder %d [%s].", gc, folder, get_folder_name(player, folder)));
03099     }
03100 #endif // MAIL_ALL_FOLDERS
03101 }

void check_mail_expiration ( void   ) 

Definition at line 3024 of file mail.cpp.

References DO_WHOLE_DB, MailList::FirstItem(), CLinearTimeAbsolute::GetLocal(), MailList::IsEnd(), M_Safe, confdata::mail_expiration, mudconf, MailList::NextItem(), MailList::RemoveItem(), CLinearTimeDelta::ReturnSeconds(), and CLinearTimeAbsolute::SetString().

Referenced by fork_and_dump().

03025 {
03026     // Negative values for expirations never expire.
03027     //
03028     if (0 > mudconf.mail_expiration)
03029     {
03030         return;
03031     }
03032 
03033     dbref thing;
03034     int expire_secs = mudconf.mail_expiration * 86400;
03035 
03036     CLinearTimeAbsolute ltaNow;
03037     ltaNow.GetLocal();
03038 
03039     CLinearTimeAbsolute ltaMail;
03040     DO_WHOLE_DB(thing)
03041     {
03042         MailList ml(thing);
03043         struct mail *mp;
03044         for (mp = ml.FirstItem(); !ml.IsEnd(); mp = ml.NextItem())
03045         {
03046             if (M_Safe(mp))
03047             {
03048                 continue;
03049             }
03050 
03051             const char *pMailTimeStr = mp->time;
03052             if (!ltaMail.SetString(pMailTimeStr))
03053             {
03054                 continue;
03055             }
03056 
03057             CLinearTimeDelta ltd(ltaMail, ltaNow);
03058             if (ltd.ReturnSeconds() <= expire_secs)
03059             {
03060                 continue;
03061             }
03062 
03063             // Delete this one.
03064             //
03065             ml.RemoveItem();
03066         }
03067     }
03068 }

bool check_zone_handler ( dbref  player,
dbref  thing,
bool  bPlayerCheck 
)

Definition at line 3112 of file db.cpp.

References A_LENTER, atr_get_raw(), check_zone_handler(), could_doit(), Good_obj, confdata::have_zones, isPlayer, mudconf, mudstate, Zone, confdata::zone_nest_lim, and statedata::zone_nest_num.

Referenced by check_zone_handler(), and do_chzone().

03113 {
03114     mudstate.zone_nest_num++;
03115 
03116     if (  !mudconf.have_zones
03117        || !Good_obj(Zone(thing))
03118        || mudstate.zone_nest_num >= mudconf.zone_nest_lim
03119        || isPlayer(thing) != bPlayerCheck)
03120     {
03121         mudstate.zone_nest_num = 0;
03122         return false;
03123     }
03124 
03125     // If the zone doesn't have an enterlock, DON'T allow control.
03126     //
03127     if (  atr_get_raw(Zone(thing), A_LENTER)
03128        && could_doit(player, Zone(thing), A_LENTER))
03129     {
03130         mudstate.zone_nest_num = 0;
03131         return true;
03132     }
03133     else if (thing == Zone(thing))
03134     {
03135         return false;
03136     }
03137     return check_zone_handler(player, Zone(thing), false);
03138 }

int chown_all ( dbref  from_player,
dbref  to_player,
dbref  acting_player,
int  key 
)

Definition at line 244 of file walkdb.cpp.

References add_quota(), CHOWN_NOZONE, CHOWN_OK, DO_WHOLE_DB, confdata::exit_quota, FLAG_WORD1, Flags, God, HALT, INHERIT, isPlayer, mudconf, NOTHING, notify, Owner, confdata::player_quota, confdata::room_quota, s_Flags, s_Owner, s_Zone, confdata::thing_quota, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.

Referenced by destroy_player(), do_chownall(), and do_toad().

00245 {
00246     if (!isPlayer(from_player))
00247     {
00248         from_player = Owner(from_player);
00249     }
00250     if (!isPlayer(to_player))
00251     {
00252         to_player = Owner(to_player);
00253     }
00254     int count     = 0;
00255     if (  God(from_player)
00256        && !God(acting_player))
00257     {
00258         notify(acting_player, "Permission denied.");
00259     }
00260     else
00261     {
00262         int i;
00263         int quota_out = 0;
00264         int quota_in  = 0;
00265         DO_WHOLE_DB(i)
00266         {
00267             if (  Owner(i) == from_player
00268                && Owner(i) != i)
00269             {
00270                 switch (Typeof(i))
00271                 {
00272                 case TYPE_PLAYER:
00273 
00274                     s_Owner(i, i);
00275                     quota_out += mudconf.player_quota;
00276                     break;
00277 
00278                 case TYPE_THING:
00279 
00280                     s_Owner(i, to_player);
00281                     quota_out += mudconf.thing_quota;
00282                     quota_in -= mudconf.thing_quota;
00283                     break;
00284 
00285                 case TYPE_ROOM:
00286 
00287                     s_Owner(i, to_player);
00288                     quota_out += mudconf.room_quota;
00289                     quota_in -= mudconf.room_quota;
00290                     break;
00291 
00292                 case TYPE_EXIT:
00293 
00294                     s_Owner(i, to_player);
00295                     quota_out += mudconf.exit_quota;
00296                     quota_in -= mudconf.exit_quota;
00297                     break;
00298 
00299                 default:
00300 
00301                     s_Owner(i, to_player);
00302                 }
00303                 s_Flags(i, FLAG_WORD1,
00304                     (Flags(i) & ~(CHOWN_OK | INHERIT)) | HALT);
00305 
00306                 if (key & CHOWN_NOZONE)
00307                 {
00308                     s_Zone(i, NOTHING);
00309                 }
00310                 count++;
00311             }
00312         }
00313         add_quota(from_player, quota_out);
00314         add_quota(to_player, quota_in);
00315     }
00316     return count;
00317 }

void CleanUpSlaveProcess ( void   ) 

Definition at line 478 of file bsd.cpp.

References slave_pid.

Referenced by boot_slave(), do_restart(), get_slave_result(), main(), new_connection(), and sighandler().

00479 {
00480     if (slave_pid > 0)
00481     {
00482         kill(slave_pid, SIGKILL);
00483         waitpid(slave_pid, NULL, 0);
00484     }
00485     slave_pid = 0;
00486 }

void CleanUpSlaveSocket ( void   ) 

Definition at line 465 of file bsd.cpp.

References DebugTotalSockets, INVALID_SOCKET, IS_INVALID_SOCKET, SD_BOTH, and slave_socket.

Referenced by boot_slave(), do_restart(), get_slave_result(), main(), new_connection(), and sighandler().

00466 {
00467     if (!IS_INVALID_SOCKET(slave_socket))
00468     {
00469         shutdown(slave_socket, SD_BOTH);
00470         if (close(slave_socket) == 0)
00471         {
00472             DebugTotalSockets--;
00473         }
00474         slave_socket = INVALID_SOCKET;
00475     }
00476 }

dbref clone_home ( dbref  ,
dbref   
)

Definition at line 166 of file object.cpp.

References can_set_home(), Home, new_home(), and Owner.

Referenced by do_clone().

00167 {
00168     dbref loc = Home(thing);
00169     if (can_set_home(Owner(player), player, loc))
00170     {
00171         return loc;
00172     }
00173     return new_home(player);
00174 }

void close_sockets ( bool  emergency,
char *  message 
)

Definition at line 3336 of file bsd.cpp.

References aMainGamePorts, DebugTotalSockets, DESC_SAFEITER_ALL, descriptor_data::descriptor, INVALID_SOCKET, IS_SOCKET_ERROR, log_perror(), nMainGamePorts, queue_string(), queue_write_LEN(), R_GOING_DOWN, SD_BOTH, shutdownsock(), PortInfo::socket, SOCKET_CLOSE, and SOCKET_WRITE.

Referenced by emergency_shutdown(), and main().

03337 {
03338     DESC *d, *dnext;
03339 
03340     DESC_SAFEITER_ALL(d, dnext)
03341     {
03342         if (emergency)
03343         {
03344             SOCKET_WRITE(d->descriptor, message, strlen(message), 0);
03345             if (IS_SOCKET_ERROR(shutdown(d->descriptor, SD_BOTH)))
03346             {
03347                 log_perror("NET", "FAIL", NULL, "shutdown");
03348             }
03349             if (SOCKET_CLOSE(d->descriptor) == 0)
03350             {
03351                 DebugTotalSockets--;
03352             }
03353         }
03354         else
03355         {
03356             queue_string(d, message);
03357             queue_write_LEN(d, "\r\n", 2);
03358             shutdownsock(d, R_GOING_DOWN);
03359         }
03360     }
03361     for (int i = 0; i < nMainGamePorts; i++)
03362     {
03363         if (SOCKET_CLOSE(aMainGamePorts[i].socket) == 0)
03364         {
03365             DebugTotalSockets--;
03366         }
03367         aMainGamePorts[i].socket = INVALID_SOCKET;
03368     }
03369 }

bool Commer ( dbref   ) 

Definition at line 1356 of file db.cpp.

References AF_NOPROG, alloc_lbuf, 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(), free_lbuf, CBitField::IsSet(), mudstate, and CBitField::Set().

Referenced by check_loc_contents(), and sweep_check().

01357 {
01358     if (mudstate.bfNoCommands.IsSet(thing))
01359     {
01360         // We already know that there are no commands on this thing.
01361         //
01362         return false;
01363     }
01364     else if (mudstate.bfCommands.IsSet(thing))
01365     {
01366         // We already know that there are definitely commands on this thing.
01367         //
01368         return true;
01369     }
01370 
01371     bool bFoundListens = false;
01372 
01373     char *as;
01374     atr_push();
01375     char *buff = alloc_lbuf("Commer");
01376     for (int atr = atr_head(thing, &as); atr; atr = atr_next(&as))
01377     {
01378         ATTR *ap = atr_num(atr);
01379         if (  !ap
01380            || (ap->flags & AF_NOPROG))
01381         {
01382             continue;
01383         }
01384 
01385         int   aflags;
01386         dbref aowner;
01387 
01388         atr_get_str(buff, thing, atr, &aowner, &aflags);
01389 
01390         if (aflags & AF_NOPROG)
01391         {
01392             continue;
01393         }
01394 
01395         if (  AMATCH_CMD != buff[0]
01396            && AMATCH_LISTEN != buff[0])
01397         {
01398             continue;
01399         }
01400 
01401         // Search for unescaped ':'
01402         //
01403         char *s = strchr(buff+1, ':');
01404         if (!s)
01405         {
01406             continue;
01407         }
01408 
01409         if (AMATCH_CMD == buff[0])
01410         {
01411             free_lbuf(buff);
01412             atr_pop();
01413             mudstate.bfCommands.Set(thing);
01414             if (bFoundListens)
01415             {
01416                 mudstate.bfListens.Set(thing);
01417                 mudstate.bfNoListens.Clear(thing);
01418             }
01419             return true;
01420         }
01421         else // AMATCH_LISTEN == buff[0]
01422         {
01423             bFoundListens = true;
01424         }
01425     }
01426     free_lbuf(buff);
01427     atr_pop();
01428     mudstate.bfNoCommands.Set(thing);
01429     if (bFoundListens)
01430     {
01431         mudstate.bfListens.Set(thing);
01432         mudstate.bfNoListens.Clear(thing);
01433     }
01434     else
01435     {
01436         mudstate.bfNoListens.Set(thing);
01437         mudstate.bfListens.Clear(thing);
01438     }
01439     return false;
01440 }

bool could_doit ( dbref  ,
dbref  ,
int   
)

Definition at line 107 of file predicates.cpp.

References atr_get, eval_boolexp_atr(), free_lbuf, HOME, isPlayer, Key, and Pass_Locks.

Referenced by atr_match1(), check_zone_handler(), do_drop(), do_enter_internal(), do_get(), do_leave(), do_link(), do_teleport_single(), do_use(), fwdlist_load(), give_money(), give_thing(), link_exit(), look_in(), mail_check(), move_exit(), move_via_teleport(), notify_check(), open_exit(), page_check(), promote_match(), sp_ok(), test_join_access(), test_receive_access(), and test_transmit_access().

00108 {
00109     if (thing == HOME)
00110     {
00111         return true;
00112     }
00113 
00114     // If nonplayer tries to get key, then no.
00115     //
00116     if (  !isPlayer(player)
00117        && Key(thing))
00118     {
00119         return false;
00120     }
00121     if (Pass_Locks(player))
00122     {
00123         return true;
00124     }
00125 
00126     dbref aowner;
00127     int   aflags;
00128     char *key = atr_get(thing, locknum, &aowner, &aflags);
00129     bool doit = eval_boolexp_atr(player, thing, thing, key);
00130     free_lbuf(key);
00131     return doit;
00132 }

void count_mail ( dbref  player,
int  folder,
int *  rcount,
int *  ucount,
int *  ccount 
)

Definition at line 2017 of file mail.cpp.

References Cleared, MailList::FirstItem(), Folder, MailList::IsEnd(), MailList::NextItem(), and Read.

Referenced by check_mail(), and FUNCTION().

02018 {
02019     int rc = 0;
02020     int uc = 0;
02021     int cc = 0;
02022 
02023     MailList ml(player);
02024     struct mail *mp;
02025     for (mp = ml.FirstItem(); !ml.IsEnd(); mp = ml.NextItem())
02026     {
02027         if (Folder(mp) == folder)
02028         {
02029             if (Read(mp))
02030             {
02031                 rc++;
02032             }
02033             else
02034             {
02035                 uc++;
02036             }
02037 
02038             if (Cleared(mp))
02039             {
02040                 cc++;
02041             }
02042         }
02043     }
02044     *rcount = rc;
02045     *ucount = uc;
02046     *ccount = cc;
02047 }

dbref create_obj ( dbref  ,
int  ,
const char *  ,
int   
)

Definition at line 182 of file object.cpp.

References A_CREATED, A_LAST, A_MODIFIED, A_QUOTA, A_RQUOTA, add_player_name(), alloc_sbuf, atr_add_raw(), atr_free(), confdata::autozone, badname_check(), canpayfees(), object::cpu_time_used, confdata::createmax, confdata::createmin, db, db_grow(), statedata::db_top, confdata::digcost, confdata::exit_flags, confdata::exit_quota, FLAG_WORD1, free_lbuf, free_sbuf, statedata::freelist, object::fs, CLinearTimeAbsolute::GetLocal(), Good_obj, Inherits, IS_CLEAN, Link, LOG_BUGS, LOG_PROBLEMS, LOG_SIMPLE, lookup_player(), MakeCanonicalExitName(), MakeCanonicalObjectName(), mudconf, mudstate, munge_space(), mux_ltoa(), Name, NOPERM_MESSAGE, NOTHING, notify, OBJECT_ENDOWMENT, confdata::opencost, Owner, confdata::paystart, confdata::player_flags, confdata::player_quota, CLinearTimeAbsolute::ReturnDateString(), confdata::robot_flags, confdata::robotcost, confdata::room_flags, confdata::room_quota, s_Contents, s_Exits, s_Link, s_Location, s_Name(), s_Next, s_Owner, s_Parent, s_Pennies(), s_ThAttrib, s_ThMail, s_Zone, CLinearTimeDelta::Set100ns(), CLinearTimeAbsolute::Set100ns(), confdata::start_quota, confdata::thing_flags, confdata::thing_quota, tprintf(), object::tThrottleExpired, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Unmark, ValidatePlayerName(), flagset::word, and Zone.

Referenced by create_player(), do_clone(), do_create(), do_dig(), FUNCTION(), and open_exit().

00183 {
00184     dbref obj, owner;
00185     int quota = 0, value = 0, nValidName;
00186     FLAGSET f;
00187     char *buff;
00188     const char *pValidName;
00189     const char *tname;
00190     bool okname = false, self_owned = false, require_inherit = false;
00191 
00192     switch (objtype)
00193     {
00194     case TYPE_ROOM:
00195 
00196         cost = mudconf.digcost;
00197         quota = mudconf.room_quota;
00198         f = mudconf.room_flags;
00199         pValidName = MakeCanonicalObjectName(name, &nValidName, &okname);
00200         tname = "a room";
00201         break;
00202 
00203     case TYPE_THING:
00204 
00205         if (cost < mudconf.createmin)
00206             cost = mudconf.createmin;
00207         if (cost > mudconf.createmax)
00208             cost = mudconf.createmax;
00209         quota = mudconf.thing_quota;
00210         f = mudconf.thing_flags;
00211         value = OBJECT_ENDOWMENT(cost);
00212         pValidName = MakeCanonicalObjectName(name, &nValidName, &okname);
00213         tname = "a thing";
00214         break;
00215 
00216     case TYPE_EXIT:
00217 
00218         cost = mudconf.opencost;
00219         quota = mudconf.exit_quota;
00220         f = mudconf.exit_flags;
00221         pValidName = MakeCanonicalExitName(name, &nValidName, &okname);
00222         tname = "an exit";
00223         break;
00224 
00225     case TYPE_PLAYER:
00226 
00227         if (cost)
00228         {
00229             cost = mudconf.robotcost;
00230             quota = mudconf.player_quota;
00231             f = mudconf.robot_flags;
00232             value = 0;
00233             tname = "a robot";
00234             require_inherit = true;
00235         }
00236         else
00237         {
00238             cost = 0;
00239             quota = 0;
00240             f = mudconf.player_flags;
00241             value = mudconf.paystart;
00242             quota = mudconf.start_quota;
00243             self_owned = true;
00244             tname = "a player";
00245         }
00246         buff = munge_space(name);
00247         pValidName = name;
00248         if (!badname_check(buff))
00249         {
00250             notify(player, "That name is not allowed.");
00251             free_lbuf(buff);
00252             return NOTHING;
00253         }
00254         if (*buff)
00255         {
00256             okname = ValidatePlayerName(buff);
00257             if (!okname)
00258             {
00259                 notify(player, "That's a silly name for a player.");
00260                 free_lbuf(buff);
00261                 return NOTHING;
00262             }
00263         }
00264         if (okname)
00265         {
00266             okname = (lookup_player(NOTHING, buff, false) == NOTHING);
00267             if (!okname)
00268             {
00269                 notify(player, tprintf("The name %s is already taken.", name));
00270                 free_lbuf(buff);
00271                 return NOTHING;
00272             }
00273         }
00274         free_lbuf(buff);
00275         break;
00276 
00277     default:
00278         LOG_SIMPLE(LOG_BUGS, "BUG", "OTYPE", tprintf("Bad object type in create_obj: %d.", objtype));
00279         return NOTHING;
00280     }
00281 
00282     if (!okname)
00283     {
00284         notify(player, tprintf("That's a silly name for %s!", tname));
00285         return NOTHING;
00286     }
00287 
00288     if (!self_owned)
00289     {
00290         if (!Good_obj(player))
00291         {
00292             return NOTHING;
00293         }
00294         owner = Owner(player);
00295         if (!Good_obj(owner))
00296         {
00297             return NOTHING;
00298         }
00299     }
00300     else
00301     {
00302         owner = NOTHING;
00303     }
00304 
00305     if (require_inherit)
00306     {
00307         if (!Inherits(player))
00308         {
00309             notify(player, NOPERM_MESSAGE);
00310             return NOTHING;
00311         }
00312     }
00313 
00314     // Make sure the creator can pay for the object.
00315     //
00316     if ((player != NOTHING) && !canpayfees(player, player, cost, quota))
00317     {
00318         return NOTHING;
00319     }
00320 
00321     // Get the first object from the freelist.  If the object is not clean,
00322     // discard the remainder of the freelist and go get a completely new object.
00323     //
00324     obj = NOTHING;
00325     if (mudstate.freelist != NOTHING)
00326     {
00327         obj = mudstate.freelist;
00328         if (IS_CLEAN(obj))
00329         {
00330             mudstate.freelist = Link(obj);
00331         }
00332         else
00333         {
00334             LOG_SIMPLE(LOG_PROBLEMS, "FRL", "DAMAG", tprintf("Freelist damaged, bad object #%d.", obj));
00335             obj = NOTHING;
00336             mudstate.freelist = NOTHING;
00337         }
00338     }
00339     if (obj == NOTHING)
00340     {
00341         obj = mudstate.db_top;
00342         db_grow(mudstate.db_top + 1);
00343     }
00344     atr_free(obj);  // just in case.
00345 
00346     // Set things up according to the object type.
00347     //
00348     s_Location(obj, NOTHING);
00349     s_Contents(obj, NOTHING);
00350     s_Exits(obj, NOTHING);
00351     s_Next(obj, NOTHING);
00352     s_Link(obj, NOTHING);
00353     s_Parent(obj, NOTHING);
00354 
00355     if (mudconf.autozone && player != NOTHING)
00356     {
00357         s_Zone(obj, Zone(player));
00358     }
00359     else
00360     {
00361         s_Zone(obj, NOTHING);
00362     }
00363     f.word[FLAG_WORD1] |= objtype;
00364     db[obj].fs = f;
00365     s_Owner(obj, (self_owned ? obj : owner));
00366     s_Pennies(obj, value);
00367     Unmark(obj);
00368     pValidName = munge_space(pValidName);
00369     s_Name(obj, pValidName);
00370     free_lbuf(pValidName);
00371     db[obj].cpu_time_used.Set100ns(0);
00372 
00373     db[obj].tThrottleExpired.Set100ns(0);
00374     s_ThAttrib(obj, 0);
00375     s_ThMail(obj, 0);
00376 
00377     CLinearTimeAbsolute ltaNow;
00378     ltaNow.GetLocal();
00379     buff = ltaNow.ReturnDateString(7);
00380     atr_add_raw(obj, A_CREATED, buff);
00381     atr_add_raw(obj, A_MODIFIED, buff);
00382 
00383     if (objtype == TYPE_PLAYER)
00384     {
00385         atr_add_raw(obj, A_LAST, buff);
00386 
00387         buff = alloc_sbuf("create_obj.quota");
00388         mux_ltoa(quota, buff);
00389         atr_add_raw(obj, A_QUOTA, buff);
00390         atr_add_raw(obj, A_RQUOTA, buff);
00391         add_player_name(obj, Name(obj));
00392         free_sbuf(buff);
00393         s_Zone(obj, NOTHING);
00394     }
00395     return obj;
00396 }

dbref create_player ( char *  name,
char *  pass,
dbref  executor,
bool  isrobot,
const char **  pmsg 
)

Definition at line 545 of file player.cpp.

References ChangePassword(), create_obj(), free_lbuf, local_data_create(), NOTHING, ok_password(), s_Home, start_home(), ThrottlePlayerCreate(), trim_spaces(), and TYPE_PLAYER.

Referenced by check_connect(), db_make_minimal(), do_pcreate(), and CGuests::MakeGuestChar().

00552 {
00553     *pmsg = NULL;
00554 
00555     // Potentially throttle the rate of player creation.
00556     //
00557     if (ThrottlePlayerCreate())
00558     {
00559         *pmsg = "The limit of new players for this hour has been reached. Please try again later.";
00560         return NOTHING;
00561     }
00562 
00563     // Make sure the password is OK.  Name is checked in create_obj.
00564     //
00565     char *pbuf = trim_spaces(password);
00566     if (!ok_password(pbuf, pmsg))
00567     {
00568         free_lbuf(pbuf);
00569         return NOTHING;
00570     }
00571 
00572     // If so, go create him.
00573     //
00574     dbref player = create_obj(creator, TYPE_PLAYER, name, isrobot);
00575     if (player == NOTHING)
00576     {
00577         *pmsg = "Either there is already a player with that name, or that name is illegal.";
00578         free_lbuf(pbuf);
00579         return NOTHING;
00580     }
00581 
00582     // Initialize everything.
00583     //
00584     ChangePassword(player, pbuf);
00585     s_Home(player, start_home());
00586     free_lbuf(pbuf);
00587     local_data_create(player);
00588     return player;
00589 }

char* crypt ( const char *  inptr,
const char *  inkey 
)

Definition at line 118 of file crypt-entry.cpp.

References __md5_crypt(), _ufc_foobar, crypt_r(), and md5_salt_prefix.

00119 {
00120 #ifdef _LIBC
00121   /* Try to find out whether we have to use MD5 encryption replacement.  */
00122   if (strncmp (md5_salt_prefix, salt, sizeof (md5_salt_prefix) - 1) == 0)
00123     return __md5_crypt (key, salt);
00124 #endif
00125 
00126   return crypt_r (key, salt, &_ufc_foobar);
00127 }

size_t decode_attr_flags ( int  aflags,
char *  buff 
)

Definition at line 774 of file look.cpp.

References attr_decode_table, ATTR_DECODE_ENTRY::letter, and ATTR_DECODE_ENTRY::mask.

Referenced by FUNCTION(), and view_atr().

00775 {
00776     char *p = buff;
00777     PATTR_DECODE_ENTRY pEntry;
00778     for (pEntry = attr_decode_table; pEntry->mask; pEntry++)
00779     {
00780         if (aflags & pEntry->mask)
00781         {
00782             *p++ = pEntry->letter;
00783         }
00784     }
00785     *p = '\0';
00786     return p - buff;
00787 }

dbref default_home ( void   ) 

Definition at line 111 of file object.cpp.

References confdata::default_home, mudconf, NOTHING, confdata::start_home, and confdata::start_room.

Referenced by check_dead_refs(), and new_home().

00112 {
00113     if (mudconf.default_home != NOTHING)
00114     {
00115         return mudconf.default_home;
00116     }
00117     if (mudconf.start_home != NOTHING)
00118     {
00119         return mudconf.start_home;
00120     }
00121     return mudconf.start_room;
00122 }

bool delete_player_name ( dbref  ,
const char *   
)

Definition at line 755 of file player.cpp.

References alloc_lbuf, free_lbuf, hashdeleteLEN(), hashfindLEN(), MEMFREE, mudstate, mux_strlwr(), NOTHING, statedata::player_htab, and safe_str.

Referenced by CGuests::Create(), destroy_player(), do_alias(), do_fixdb(), do_name(), and do_toad().

00756 {
00757     char *temp, *tp;
00758 
00759     tp = temp = alloc_lbuf("delete_player_name");
00760     safe_str(name, temp, &tp);
00761     *tp = '\0';
00762     mux_strlwr(temp);
00763 
00764     dbref *p = (int *)hashfindLEN(temp, strlen(temp), &mudstate.player_htab);
00765     if (  !p
00766        || *p == NOTHING
00767        || (  player != NOTHING
00768           && *p != player))
00769     {
00770         free_lbuf(temp);
00771         return false;
00772     }
00773     MEMFREE(p);
00774     p = NULL;
00775     hashdeleteLEN(temp, strlen(temp), &mudstate.player_htab);
00776     free_lbuf(temp);
00777     return true;
00778 }

void desc_reload ( dbref   ) 

Definition at line 1130 of file netcommon.cpp.

References A_TIMEOUT, atr_pget, DESC_ITER_PLAYER, free_lbuf, confdata::idle_timeout, mudconf, mux_atol(), and descriptor_data::timeout.

Referenced by atr_add_raw_LEN(), and atr_clr().

01131 {
01132     DESC *d;
01133     char *buf;
01134     dbref aowner;
01135     FLAG aflags;
01136 
01137     DESC_ITER_PLAYER(player, d)
01138     {
01139         buf = atr_pget(player, A_TIMEOUT, &aowner, &aflags);
01140         if (buf)
01141         {
01142             d->timeout = mux_atol(buf);
01143             if (d->timeout <= 0)
01144             {
01145                 d->timeout = mudconf.idle_timeout;
01146             }
01147         }
01148         free_lbuf(buf);
01149     }
01150 }

void destroy_obj ( dbref   ) 

Definition at line 432 of file object.cpp.

References A_SEMAPHORE, add_quota(), atr_free(), statedata::bStandAlone, statedata::db_top, destroy_bad_obj(), confdata::digcost, confdata::exit_quota, FLAG_WORD1, FLAG_WORD2, FLAG_WORD3, fwdlist_clr(), giveto(), GOD, GOING, Good_obj, Good_owner, halt_que(), confdata::linkcost, local_data_free(), Location, mudconf, mudstate, Name, NFY_DRAIN, nfy_que(), NOTHING, notify, OBJECT_DEPOSIT, confdata::one_coin, confdata::opencost, Owner, Pennies(), confdata::player_quota, Quiet, confdata::quotas, ReleaseAllResources(), Robot, confdata::robotcost, confdata::room_quota, s_Contents, s_Exits, s_Flags, s_Link, s_Location, s_Name(), s_Next, s_Owner, s_Parent, s_Pennies(), s_Powers, s_Powers2, s_Zone, stack_clr(), confdata::thing_quota, tprintf(), TYPE_EXIT, TYPE_GARBAGE, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.

Referenced by check_dead_refs(), check_exit_chains(), check_loc_exits(), destroy_exit(), destroy_player(), destroy_thing(), do_destroy(), empty_obj(), and purge_going().

00433 {
00434     if (!Good_obj(obj))
00435     {
00436         if (  (obj >= 0)
00437            && (obj < mudstate.db_top))
00438         {
00439             destroy_bad_obj(obj);
00440         }
00441         return;
00442     }
00443 
00444     // Validate the owner.
00445     //
00446     dbref owner = Owner(obj);
00447     bool good_owner = Good_owner(owner);
00448 
00449     // Halt any pending commands (waiting or semaphore).
00450     //
00451     if (!mudstate.bStandAlone)
00452     {
00453         if (  halt_que(NOTHING, obj) > 0
00454            && good_owner
00455            && !Quiet(obj)
00456            && !Quiet(owner))
00457         {
00458             notify(owner, "Halted.");
00459         }
00460         nfy_que(obj, A_SEMAPHORE, NFY_DRAIN, 0);
00461 
00462         // Remove forwardlists and stacks.
00463         //
00464         fwdlist_clr(obj);
00465         stack_clr(obj);
00466     }
00467 
00468     // Compensate the owner for the object.
00469     //
00470     if (  good_owner
00471        && owner != obj)
00472     {
00473         int val = 0;
00474         int quota = 0;
00475         switch (Typeof(obj))
00476         {
00477         case TYPE_ROOM:
00478             val = mudconf.digcost;
00479             quota = mudconf.room_quota;
00480             break;
00481 
00482         case TYPE_THING:
00483             val = OBJECT_DEPOSIT(Pennies(obj));
00484             quota = mudconf.thing_quota;
00485             break;
00486 
00487         case TYPE_EXIT:
00488             if (Location(obj) == NOTHING)
00489             {
00490                 val = mudconf.opencost;
00491             }
00492             else
00493             {
00494                 val = mudconf.opencost + mudconf.linkcost;
00495             }
00496             quota = mudconf.exit_quota;
00497             break;
00498 
00499         case TYPE_PLAYER:
00500             if (Robot(obj))
00501             {
00502                 val = mudconf.robotcost;
00503             }
00504             else
00505             {
00506                 val = 0;
00507             }
00508             quota = mudconf.player_quota;
00509             break;
00510         }
00511         if (val)
00512         {
00513             giveto(owner, val);
00514             if (  !Quiet(owner)
00515                && !Quiet(obj))
00516             {
00517                 notify(owner, tprintf(
00518                        "You get back your %d %s deposit for %s(#%d).",
00519                         val, mudconf.one_coin, Name(obj), obj));
00520             }
00521         }
00522         if (  mudconf.quotas
00523            && quota)
00524         {
00525             add_quota(owner, quota);
00526         }
00527     }
00528     if (!mudstate.bStandAlone)
00529     {
00530         ReleaseAllResources(obj);
00531     }
00532     atr_free(obj);
00533     s_Name(obj, NULL);
00534     s_Flags(obj, FLAG_WORD1, (TYPE_GARBAGE | GOING));
00535     s_Flags(obj, FLAG_WORD2, 0);
00536     s_Flags(obj, FLAG_WORD3, 0);
00537     s_Powers(obj, 0);
00538     s_Powers2(obj, 0);
00539     s_Location(obj, NOTHING);
00540     s_Contents(obj, NOTHING);
00541     s_Exits(obj, NOTHING);
00542     s_Next(obj, NOTHING);
00543     s_Link(obj, NOTHING);
00544     s_Owner(obj, GOD);
00545     s_Pennies(obj, 0);
00546     s_Parent(obj, NOTHING);
00547     s_Zone(obj, NOTHING);
00548 
00549     local_data_free(obj);
00550 }

void destroy_player ( dbref  agent,
dbref  victim 
)

Definition at line 679 of file object.cpp.

References A_ALIAS, atr_pget, boot_off(), chown_all(), CHOWN_NOZONE, delete_player_name(), destroy_obj(), free_lbuf, halt_que(), move_via_generic(), Name, NOTHING, notify_quiet, and tprintf().

Referenced by CGuests::DestroyGuestChar(), do_destroy(), and purge_going().

00680 {
00681     // Bye bye...
00682     //
00683     boot_off(victim, "You have been destroyed!");
00684     halt_que(victim, NOTHING);
00685     int count = chown_all(victim, player, player, CHOWN_NOZONE);
00686 
00687     // Remove the name from the name hash table.
00688     //
00689     delete_player_name(victim, Name(victim));
00690     dbref aowner;
00691     int aflags;
00692     char *buf = atr_pget(victim, A_ALIAS, &aowner, &aflags);
00693     delete_player_name(victim, buf);
00694     free_lbuf(buf);
00695 
00696     move_via_generic(victim, NOTHING, player, 0);
00697     destroy_obj(victim);
00698     notify_quiet(player, tprintf("(%d objects @chowned to you)", count));
00699 }

void did_it ( dbref  ,
dbref  ,
int  ,
const char *  ,
int  ,
const char *  ,
int  ,
char *  [],
int   
)

Definition at line 2261 of file predicates.cpp.

References A_CHARGES, A_RUNOUT, AF_HTML, alloc_lbuf, alloc_sbuf, atr_add_raw(), atr_pget, CMuxAlarm::bAlarmed, EV_EVAL, EV_FCHECK, EV_FIGNORE, EV_TOP, free_lbuf, free_sbuf, statedata::global_regs, Good_obj, Has_location, Html, IsReal, Location, MAX_GLOBAL_REGS, mudstate, mux_atol(), mux_exec(), mux_ltoa(), MuxAlarm, Name, NOTHING, notify, notify_except2(), notify_except2_rlevel(), notify_html, PopIntegers(), PopPointers(), PushIntegers(), PushPointers(), restore_global_regs(), safe_str, save_global_regs(), tprintf(), and wait_que().

Referenced by check_events(), do_clone(), do_drop(), do_enter_internal(), do_get(), do_kill(), do_leave(), do_teleport_single(), do_trigger(), do_use(), do_verb(), give_money(), give_thing(), look_in(), look_simple(), move_exit(), move_via_exit(), move_via_generic(), move_via_teleport(), notify_check(), process_enter_loc(), process_leave_loc(), process_preload(), send_mail(), show_a_desc(), and show_desc().

02263 {
02264     if (MuxAlarm.bAlarmed)
02265     {
02266         return;
02267     }
02268 
02269     char *d, *buff, *act, *charges, *bp, *str;
02270     dbref loc, aowner;
02271     int num, aflags;
02272 
02273     // If we need to call exec() from within this function, we first save
02274     // the state of the global registers, in order to avoid munging them
02275     // inappropriately. Do note that the restoration to their original
02276     // values occurs BEFORE the execution of the @a-attribute. Therefore,
02277     // any changing of setq() values done in the @-attribute and @o-attribute
02278     // will NOT be passed on. This prevents odd behaviors that result from
02279     // odd @verbs and so forth (the idea is to preserve the caller's control
02280     // of the global register values).
02281     //
02282 
02283     bool need_pres = false;
02284     char **preserve = NULL;
02285     int *preserve_len = NULL;
02286 
02287     // message to player.
02288     //
02289     if (what > 0)
02290     {
02291         d = atr_pget(thing, what, &aowner, &aflags);
02292         if (*d)
02293         {
02294             need_pres = true;
02295             preserve = PushPointers(MAX_GLOBAL_REGS);
02296             preserve_len = PushIntegers(MAX_GLOBAL_REGS);
02297             save_global_regs("did_it_save", preserve, preserve_len);
02298             buff = bp = alloc_lbuf("did_it.1");
02299             str = d;
02300             mux_exec(buff, &bp, thing, player, player,
02301                 EV_EVAL | EV_FIGNORE | EV_FCHECK | EV_TOP, &str, args, nargs);
02302             *bp = '\0';
02303             if (  (aflags & AF_HTML)
02304                && Html(player))
02305             {
02306                 safe_str("\r\n", buff, &bp);
02307                 *bp = '\0';
02308                 notify_html(player, buff);
02309             }
02310             else
02311             {
02312                 notify(player, buff);
02313             }
02314             free_lbuf(buff);
02315         }
02316         else if (def)
02317         {
02318             notify(player, def);
02319         }
02320         free_lbuf(d);
02321     }
02322     if (what < 0 && def)
02323     {
02324         notify(player, def);
02325     }
02326 
02327     // message to neighbors.
02328     //
02329     if (  owhat > 0
02330        && Has_location(player)
02331        && Good_obj(loc = Location(player)))
02332     {
02333         d = atr_pget(thing, owhat, &aowner, &aflags);
02334         if (*d)
02335         {
02336             if (!need_pres)
02337             {
02338                 need_pres = true;
02339                 preserve = PushPointers(MAX_GLOBAL_REGS);
02340                 preserve_len = PushIntegers(MAX_GLOBAL_REGS);
02341                 save_global_regs("did_it_save", preserve, preserve_len);
02342             }
02343             buff = bp = alloc_lbuf("did_it.2");
02344             str = d;
02345             mux_exec(buff, &bp, thing, player, player,
02346                      EV_EVAL | EV_FIGNORE | EV_FCHECK | EV_TOP, &str, args, nargs);
02347             *bp = '\0';
02348             if (*buff)
02349             {
02350 #ifdef REALITY_LVLS
02351                 notify_except2_rlevel(loc, player, player, thing, tprintf("%s %s", Name(player), buff));
02352 #else
02353                 notify_except2(loc, player, player, thing, tprintf("%s %s", Name(player), buff));
02354 #endif /* REALITY_LVLS */
02355             }
02356             free_lbuf(buff);
02357         }
02358         else if (odef)
02359         {
02360 #ifdef REALITY_LVLS
02361             notify_except2_rlevel(loc, player, player, thing, tprintf("%s %s", Name(player), odef));
02362 #else
02363             notify_except2(loc, player, player, thing, tprintf("%s %s", Name(player), odef));
02364 #endif /* REALITY_LVLS */
02365         }
02366         free_lbuf(d);
02367     }
02368     if (  owhat < 0
02369        && odef
02370        && Has_location(player)
02371        && Good_obj(loc = Location(player)))
02372     {
02373 #ifdef REALITY_LVLS
02374         notify_except2_rlevel(loc, player, player, thing, tprintf("%s %s", Name(player), odef));
02375 #else
02376         notify_except2(loc, player, player, thing, tprintf("%s %s", Name(player), odef));
02377 #endif /* REALITY_LVLS */
02378     }
02379 
02380     // If we preserved the state of the global registers, restore them.
02381     //
02382     if (need_pres)
02383     {
02384         restore_global_regs("did_it_restore", preserve, preserve_len);
02385         PopIntegers(preserve_len, MAX_GLOBAL_REGS);
02386         PopPointers(preserve, MAX_GLOBAL_REGS);
02387     }
02388 
02389     // do the action attribute.
02390     //
02391 #ifdef REALITY_LVLS
02392     if (awhat > 0 && IsReal(thing, player))
02393 #else
02394     if (awhat > 0)
02395 #endif /* REALITY_LVLS */
02396     {
02397         if (*(act = atr_pget(thing, awhat, &aowner, &aflags)))
02398         {
02399             charges = atr_pget(thing, A_CHARGES, &aowner, &aflags);
02400             if (*charges)
02401             {
02402                 num = mux_atol(charges);
02403                 if (num > 0)
02404                 {
02405                     buff = alloc_sbuf("did_it.charges");
02406                     mux_ltoa(num-1, buff);
02407                     atr_add_raw(thing, A_CHARGES, buff);
02408                     free_sbuf(buff);
02409                 }
02410                 else if (*(buff = atr_pget(thing, A_RUNOUT, &aowner, &aflags)))
02411                 {
02412                     free_lbuf(act);
02413                     act = buff;
02414                 }
02415                 else
02416                 {
02417                     free_lbuf(act);
02418                     free_lbuf(buff);
02419                     free_lbuf(charges);
02420                     return;
02421                 }
02422             }
02423             free_lbuf(charges);
02424             CLinearTimeAbsolute lta;
02425             wait_que(thing, player, player, false, lta, NOTHING, 0, act,
02426                 args, nargs, mudstate.global_regs);
02427         }
02428         free_lbuf(act);
02429     }
02430 }

void dispatch_CacheTick ( void *  pUnused,
int  iUnused 
)

Definition at line 141 of file timer.cpp.

References cache_tick(), confdata::cache_tick_period, statedata::debug_cmd, CScheduler::DeferTask(), dispatch_CacheTick(), CLinearTimeAbsolute::GetUTC(), mudconf, mudstate, PRIORITY_SYSTEM, scheduler, CLinearTimeDelta::SetSeconds(), and UNUSED_PARAMETER.

Referenced by CallBack_ShowDispatches(), dispatch_CacheTick(), and init_timer().

00142 {
00143     UNUSED_PARAMETER(pUnused);
00144     UNUSED_PARAMETER(iUnused);
00145 
00146     char *cmdsave = mudstate.debug_cmd;
00147     mudstate.debug_cmd = (char *)"< cachetick >";
00148 
00149     CLinearTimeDelta ltd = 0;
00150     if (mudconf.cache_tick_period <= ltd)
00151     {
00152         mudconf.cache_tick_period.SetSeconds(1);
00153     }
00154 
00155     cache_tick();
00156 
00157     // Schedule ourselves again.
00158     //
00159     CLinearTimeAbsolute ltaNextTime;
00160     ltaNextTime.GetUTC();
00161     ltaNextTime += mudconf.cache_tick_period;
00162     scheduler.DeferTask(ltaNextTime, PRIORITY_SYSTEM, dispatch_CacheTick, 0, 0);
00163     mudstate.debug_cmd = cmdsave;
00164 }

void dispatch_CheckEvents ( void *  pUnused,
int  iUnused 
)

Definition at line 118 of file timer.cpp.

References CF_EVENTCHECK, check_events(), confdata::control_flags, statedata::debug_cmd, CScheduler::DeferTask(), dispatch_CheckEvents(), statedata::events_counter, CLinearTimeAbsolute::GetUTC(), mudconf, mudstate, PRIORITY_SYSTEM, scheduler, time_15m, and UNUSED_PARAMETER.

Referenced by CallBack_ShowDispatches(), dispatch_CheckEvents(), do_timewarp(), and init_timer().

00119 {
00120     UNUSED_PARAMETER(pUnused);
00121     UNUSED_PARAMETER(iUnused);
00122 
00123     if (mudconf.control_flags & CF_EVENTCHECK)
00124     {
00125         char *cmdsave = mudstate.debug_cmd;
00126         mudstate.debug_cmd = (char *)"< eventcheck >";
00127         check_events();
00128         mudstate.debug_cmd = cmdsave;
00129     }
00130 
00131     // Schedule ourselves again.
00132     //
00133     CLinearTimeAbsolute ltaNow;
00134     ltaNow.GetUTC();
00135     CLinearTimeDelta ltd = time_15m;
00136     mudstate.events_counter = ltaNow + ltd;
00137     scheduler.DeferTask(mudstate.events_counter, PRIORITY_SYSTEM, dispatch_CheckEvents, 0, 0);
00138 }

void dispatch_DatabaseDump ( void *  pUnused,
int  iUnused 
)

Definition at line 52 of file timer.cpp.

References CF_CHECKPOINT, confdata::control_flags, statedata::debug_cmd, CScheduler::DeferTask(), dispatch_DatabaseDump(), statedata::dump_counter, confdata::dump_interval, statedata::dumping, fork_and_dump(), CLinearTimeAbsolute::GetUTC(), mudconf, mudstate, PRIORITY_SYSTEM, scheduler, CLinearTimeDelta::SetSeconds(), and UNUSED_PARAMETER.

Referenced by CallBack_ShowDispatches(), dispatch_DatabaseDump(), do_timewarp(), init_timer(), and sighandler().

00053 {
00054     UNUSED_PARAMETER(pUnused);
00055     UNUSED_PARAMETER(iUnused);
00056 
00057     int nNextTimeInSeconds = mudconf.dump_interval;
00058 
00059     if (mudconf.control_flags & CF_CHECKPOINT)
00060     {
00061         char *cmdsave = mudstate.debug_cmd;
00062         mudstate.debug_cmd = (char *)"< dump >";
00063 #ifndef WIN32
00064         if (mudstate.dumping)
00065         {
00066             // There is a dump in progress. These usually happen very quickly.
00067             // We will reschedule ourselves to try again in 20 seconds.
00068             // Ordinarily, you would think "...a dump is a dump...", but some
00069             // dumps might not be the type of dump we're going to do.
00070             //
00071             nNextTimeInSeconds = 20;
00072         }
00073         else
00074 #endif // !WIN32
00075         {
00076             fork_and_dump(0);
00077         }
00078         mudstate.debug_cmd = cmdsave;
00079     }
00080 
00081     // Schedule ourselves again.
00082     //
00083     CLinearTimeAbsolute ltaNow;
00084     ltaNow.GetUTC();
00085     CLinearTimeDelta ltd;
00086     ltd.SetSeconds(nNextTimeInSeconds);
00087     mudstate.dump_counter = ltaNow + ltd;
00088     scheduler.DeferTask(mudstate.dump_counter, PRIORITY_SYSTEM, dispatch_DatabaseDump, 0, 0);
00089 }

void dispatch_FreeListReconstruction ( void *  pUnused,
int  iUnused 
)

Definition at line 23 of file timer.cpp.

References CF_DBCHECK, statedata::check_counter, confdata::check_interval, confdata::control_flags, statedata::debug_cmd, CScheduler::DeferTask(), dispatch_FreeListReconstruction(), do_dbck(), CLinearTimeAbsolute::GetUTC(), Guest, mudconf, mudstate, NOTHING, pcache_trim(), pool_reset(), PRIORITY_SYSTEM, scheduler, CLinearTimeDelta::SetSeconds(), and UNUSED_PARAMETER.

Referenced by CallBack_ShowDispatches(), dispatch_FreeListReconstruction(), do_timewarp(), and init_timer().

00024 {
00025     UNUSED_PARAMETER(pUnused);
00026     UNUSED_PARAMETER(iUnused);
00027 
00028     if (mudconf.control_flags & CF_DBCHECK)
00029     {
00030         char *cmdsave = mudstate.debug_cmd;
00031         mudstate.debug_cmd = (char *)"< dbck >";
00032         do_dbck(NOTHING, NOTHING, NOTHING, 0);
00033         Guest.CleanUp();
00034         pcache_trim();
00035         pool_reset();
00036         mudstate.debug_cmd = cmdsave;
00037     }
00038 
00039     // Schedule ourselves again.
00040     //
00041     CLinearTimeAbsolute ltaNow;
00042     ltaNow.GetUTC();
00043     CLinearTimeDelta ltd;
00044     ltd.SetSeconds(mudconf.check_interval);
00045     mudstate.check_counter = ltaNow + ltd;
00046     scheduler.DeferTask(mudstate.check_counter, PRIORITY_SYSTEM,
00047         dispatch_FreeListReconstruction, 0, 0);
00048 }

void dispatch_IdleCheck ( void *  pUnused,
int  iUnused 
)

Definition at line 93 of file timer.cpp.

References CF_IDLECHECK, check_idle(), confdata::control_flags, statedata::debug_cmd, CScheduler::DeferTask(), dispatch_IdleCheck(), CLinearTimeAbsolute::GetUTC(), statedata::idle_counter, confdata::idle_interval, mudconf, mudstate, PRIORITY_SYSTEM, scheduler, CLinearTimeDelta::SetSeconds(), and UNUSED_PARAMETER.

Referenced by CallBack_ShowDispatches(), dispatch_IdleCheck(), do_timewarp(), and init_timer().

00094 {
00095     UNUSED_PARAMETER(pUnused);
00096     UNUSED_PARAMETER(iUnused);
00097 
00098     if (mudconf.control_flags & CF_IDLECHECK)
00099     {
00100         char *cmdsave = mudstate.debug_cmd;
00101         mudstate.debug_cmd = (char *)"< idlecheck >";
00102         check_idle();
00103         mudstate.debug_cmd = cmdsave;
00104     }
00105 
00106     // Schedule ourselves again.
00107     //
00108     CLinearTimeAbsolute ltaNow;
00109     ltaNow.GetUTC();
00110     CLinearTimeDelta ltd;
00111     ltd.SetSeconds(mudconf.idle_interval);
00112     mudstate.idle_counter = ltaNow + ltd;
00113     scheduler.DeferTask(mudstate.idle_counter, PRIORITY_SYSTEM, dispatch_IdleCheck, 0, 0);
00114 }

void divest_object ( dbref   ) 

Definition at line 577 of file object.cpp.

References Contents, Controls, Going, Good_obj, Has_location, Home, HOME, Key, move_via_generic(), new_home(), NOTHING, s_Home, and SAFE_DOLIST.

Referenced by do_enter_internal(), do_kill(), do_move(), empty_obj(), give_thing(), move_exit(), move_via_teleport(), process_dropped_dropto(), and send_dropto().

00578 {
00579     dbref curr, temp;
00580 
00581     SAFE_DOLIST(curr, temp, Contents(thing))
00582     {
00583         if (  !Controls(thing, curr)
00584            && Has_location(curr)
00585            && Key(curr))
00586         {
00587             if (  !Good_obj(Home(curr))
00588                || Going(Home(curr)))
00589             {
00590                 s_Home(curr, new_home(curr));
00591             }
00592             move_via_generic(curr, HOME, NOTHING, 0);
00593         }
00594     }
00595 }

void do_enter_internal ( dbref  ,
dbref  ,
bool   
)

Definition at line 898 of file move.cpp.

References A_AEFAIL, A_EFAIL, A_LENTER, A_OEFAIL, Controls, could_doit(), did_it(), divest_object(), Enter_ok, HUSH_ENTER, Location, move_via_generic(), NOPERM_MESSAGE, NOTHING, notify, and process_sticky_dropto().

Referenced by do_enter(), and process_command().

00899 {
00900     int oattr, aattr;
00901 
00902     if (!Enter_ok(thing) && !Controls(player, thing))
00903     {
00904         oattr = quiet ? 0 : A_OEFAIL;
00905         aattr = quiet ? 0 : A_AEFAIL;
00906         did_it(player, thing, A_EFAIL, NOPERM_MESSAGE,
00907                oattr, NULL, aattr, (char **)NULL, 0);
00908     }
00909     else if (player == thing)
00910     {
00911         notify(player, "You can't enter yourself!");
00912     }
00913     else if (could_doit(player, thing, A_LENTER))
00914     {
00915         dbref loc = Location(player);
00916         oattr = quiet ? HUSH_ENTER : 0;
00917         move_via_generic(player, thing, NOTHING, oattr);
00918         divest_object(player);
00919         process_sticky_dropto(loc, player);
00920     }
00921     else
00922     {
00923         oattr = quiet ? 0 : A_OEFAIL;
00924         aattr = quiet ? 0 : A_AEFAIL;
00925         did_it(player, thing, A_EFAIL, "You can't enter that.",
00926                oattr, NULL, aattr, (char **)NULL, 0);
00927     }
00928 }

void do_lock ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
int  nargs,
char *  name,
char *  keytext 
)

Definition at line 435 of file set.cpp.

References A_LOCK, AF_LOCK, AMBIGUOUS, atr_add_raw(), atr_get_info(), atr_set_flags(), bCanLockAttr(), Controls, free_boolexp(), init_match(), MAT_EXIT_PARENTS, match_everything(), match_result(), NOPERM_MESSAGE, NOTHING, notify_quiet, NOTYPE, attr::number, parse_attrib(), parse_boolexp(), Quiet, RemoveSetOfCharacters(), TRUE_BOOLEXP, unparse_boolexp_quiet(), and UNUSED_PARAMETER.

Referenced by CGuests::MakeGuestChar().

00444 {
00445     UNUSED_PARAMETER(caller);
00446     UNUSED_PARAMETER(enactor);
00447     UNUSED_PARAMETER(nargs);
00448 
00449     dbref thing;
00450     ATTR *ap;
00451 
00452     if (  parse_attrib(executor, name, &thing, &ap)
00453        && ap)
00454     {
00455         dbref aowner;
00456         int aflags;
00457         if (!atr_get_info(thing, ap->number, &aowner, &aflags))
00458         {
00459             notify_quiet(executor, "Attribute not present on object.");
00460             return;
00461         }
00462 
00463         if (bCanLockAttr(executor, thing, ap))
00464         {
00465             aflags |= AF_LOCK;
00466             atr_set_flags(thing, ap->number, aflags);
00467             if (  !Quiet(executor)
00468                && !Quiet(thing))
00469             {
00470                 notify_quiet(executor, "Attribute locked.");
00471             }
00472         }
00473         else
00474         {
00475             notify_quiet(executor, NOPERM_MESSAGE);
00476         }
00477         return;
00478     }
00479     init_match(executor, name, NOTYPE);
00480     match_everything(MAT_EXIT_PARENTS);
00481     thing = match_result();
00482 
00483     switch (thing)
00484     {
00485     case NOTHING:
00486         notify_quiet(executor, "I don't see what you want to lock!");
00487         return;
00488 
00489     case AMBIGUOUS:
00490         notify_quiet(executor, "I don't know which one you want to lock!");
00491         return;
00492 
00493     default:
00494         if (!Controls(executor, thing))
00495         {
00496             notify_quiet(executor, "You can't lock that!");
00497             return;
00498         }
00499     }
00500 
00501     char *pRestrictedKeyText = RemoveSetOfCharacters(keytext, "\r\n\t");
00502     struct boolexp *okey = parse_boolexp(executor, pRestrictedKeyText, false);
00503     if (okey == TRUE_BOOLEXP)
00504     {
00505         notify_quiet(executor, "I don't understand that key.");
00506     }
00507     else
00508     {
00509         // Everything ok, do it.
00510         //
00511         if (!key)
00512         {
00513             key = A_LOCK;
00514         }
00515         atr_add_raw(thing, key, unparse_boolexp_quiet(executor, okey));
00516         if (  !Quiet(executor)
00517            && !Quiet(thing))
00518         {
00519             notify_quiet(executor, "Locked.");
00520         }
00521     }
00522     free_boolexp(okey);
00523 }

void do_mail_clear ( dbref  player,
char *  msglist 
)

Definition at line 1095 of file mail.cpp.

References do_mail_flags(), and M_CLEARED.

Referenced by do_mail(), do_mail_debug(), do_mail_stub(), and ReleaseAllResources().

01096 {
01097     do_mail_flags(player, msglist, M_CLEARED, false);
01098 }

void do_mail_purge ( dbref  player  ) 

Definition at line 1638 of file mail.cpp.

References Cleared, MailList::FirstItem(), MailList::IsEnd(), MailList::NextItem(), notify, and MailList::RemoveItem().

Referenced by announce_disconnect(), do_mail(), do_mail_debug(), do_mail_stub(), and ReleaseAllResources().

01639 {
01640     // Go through player's mail, and remove anything marked cleared.
01641     //
01642     MailList ml(player);
01643     struct mail *mp;
01644     for (mp = ml.FirstItem(); !ml.IsEnd(); mp = ml.NextItem())
01645     {
01646         if (Cleared(mp))
01647         {
01648             ml.RemoveItem();
01649         }
01650     }
01651     notify(player, "MAIL: Mailbox purged.");
01652 }

void do_pemit_list ( dbref  player,
int  key,
bool  bDoContents,
int  pemit_flags,
char *  list,
int  chPoseType,
char *  message 
)

Definition at line 1333 of file speech.cpp.

References do_pemit_single(), mux_strtok_ctl(), mux_strtok_parse(), and mux_strtok_src().

Referenced by do_pemit(), and FUNCTION().

01342 {
01343     // Send a message to a list of dbrefs. The list is destructively
01344     // modified.
01345     //
01346     if (  message[0] == '\0'
01347        || list[0] == '\0')
01348     {
01349         return;
01350     }
01351 
01352     char *p;
01353     MUX_STRTOK_STATE tts;
01354     mux_strtok_src(&tts, list);
01355     mux_strtok_ctl(&tts, " ");
01356     for (p = mux_strtok_parse(&tts); p; p = mux_strtok_parse(&tts))
01357     {
01358         do_pemit_single(player, key, bDoContents, pemit_flags, p, chPoseType,
01359             message);
01360     }
01361 }

void do_pemit_single ( dbref  player,
int  key,
bool  bDoContents,
int  pemit_flags,
char *  recipient,
int  chPoseType,
char *  message 
)

Definition at line 1050 of file speech.cpp.

References A_AWAY, alloc_lbuf, AMBIGUOUS, Connected, Controls, free_lbuf, Has_contents, init_match(), isPlayer, isRoom, Location, Long_Fingers, match_controlled, match_everything(), match_result(), modSpeech(), Moniker(), mudconf, nearby(), NOPERM_MESSAGE, NOTHING, notify, notify_all_from_inside, notify_except(), notify_except2(), notify_with_cause, notify_with_cause_html, page_check(), page_return(), confdata::pemit_any, PEMIT_FEMIT, PEMIT_FPOSE, PEMIT_FPOSE_NS, PEMIT_FSAY, PEMIT_HERE, PEMIT_HTML, PEMIT_OEMIT, PEMIT_PEMIT, confdata::pemit_players, PEMIT_ROOM, PEMIT_WHISPER, confdata::quiet_whisper, safe_str, tprintf(), TYPE_PLAYER, where_is(), whisper_pose(), and Wizard.

Referenced by do_pemit(), do_pemit_list(), and FUNCTION().

01059 {
01060     dbref target, loc;
01061     char *buf2, *bp;
01062     int depth;
01063     bool ok_to_do = false;
01064 
01065     switch (key)
01066     {
01067     case PEMIT_FSAY:
01068     case PEMIT_FPOSE:
01069     case PEMIT_FPOSE_NS:
01070     case PEMIT_FEMIT:
01071         target = match_controlled(player, recipient);
01072         if (target == NOTHING)
01073         {
01074             return;
01075         }
01076         ok_to_do = true;
01077         break;
01078 
01079     default:
01080         init_match(player, recipient, TYPE_PLAYER);
01081         match_everything(0);
01082         target = match_result();
01083     }
01084 
01085     char *newMessage = NULL;
01086     char *saystring = NULL;
01087 
01088     char *p;
01089     switch (target)
01090     {
01091     case NOTHING:
01092         switch (key)
01093         {
01094         case PEMIT_WHISPER:
01095             notify(player, "Whisper to whom?");
01096             break;
01097 
01098         case PEMIT_PEMIT:
01099             notify(player, "Emit to whom?");
01100             break;
01101 
01102         case PEMIT_OEMIT:
01103             notify(player, "Emit except to whom?");
01104             break;
01105 
01106         default:
01107             notify(player, "Sorry.");
01108             break;
01109         }
01110         break;
01111 
01112     case AMBIGUOUS:
01113         notify(player, "I don't know who you mean!");
01114         break;
01115 
01116     default:
01117 
01118         // Enforce locality constraints.
01119         //
01120         if (  !ok_to_do
01121            && (  nearby(player, target)
01122               || Long_Fingers(player)
01123               || Controls(player, target)))
01124         {
01125             ok_to_do = true;
01126         }
01127         if (  !ok_to_do
01128            && key == PEMIT_PEMIT
01129            && isPlayer(target)
01130            && mudconf.pemit_players)
01131         {
01132             if (!page_check(player, target))
01133             {
01134                 return;
01135             }
01136             ok_to_do = true;
01137         }
01138         if (  !ok_to_do
01139            && (  !mudconf.pemit_any
01140               || key != PEMIT_PEMIT))
01141         {
01142             notify(player, "You are too far away to do that.");
01143             return;
01144         }
01145         if (  bDoContents
01146            && !Controls(player, target)
01147            && !mudconf.pemit_any)
01148         {
01149             notify(player, NOPERM_MESSAGE);
01150             return;
01151         }
01152         loc = where_is(target);
01153 
01154         switch (key)
01155         {
01156         case PEMIT_PEMIT:
01157             if (bDoContents)
01158             {
01159                 if (Has_contents(target))
01160                 {
01161                     notify_all_from_inside(target, player, message);
01162                 }
01163             }
01164             else
01165             {
01166                 if (pemit_flags & PEMIT_HTML)
01167                 {
01168                     notify_with_cause_html(target, player, message);
01169                 }
01170                 else
01171                 {
01172                     notify_with_cause(target, player, message);
01173                 }
01174             }
01175             break;
01176 
01177         case PEMIT_OEMIT:
01178             notify_except(Location(target), player, target, message, 0);
01179             break;
01180 
01181         case PEMIT_WHISPER:
01182             if (  isPlayer(target)
01183                && !Connected(target))
01184             {
01185                 page_return(player, target, "Away", A_AWAY,
01186                     tprintf("Sorry, %s is not connected.", Moniker(target)));
01187                 return;
01188             }
01189             switch (chPoseType)
01190             {
01191             case ':':
01192                 message++;
01193                 whisper_pose(player, target, message, true);
01194                 break;
01195 
01196             case ';':
01197                 message++;
01198                 whisper_pose(player, target, message, false);
01199                 break;
01200 
01201             case '"':
01202                 message++;
01203 
01204             default:
01205                 newMessage = modSpeech(player, message, true, "whisper");
01206                 if (newMessage)
01207                 {
01208                     message = newMessage;
01209                 }
01210                 notify(player, tprintf("You whisper \"%s\" to %s.", message,
01211                     Moniker(target)));
01212                 notify_with_cause(target, player,
01213                     tprintf("%s whispers \"%s\"", Moniker(player), message));
01214                 if (newMessage)
01215                 {
01216                     free_lbuf(newMessage);
01217                 }
01218             }
01219             if (  !mudconf.quiet_whisper
01220                && !Wizard(player))
01221             {
01222                 loc = where_is(player);
01223                 if (loc != NOTHING)
01224                 {
01225                     buf2 = alloc_lbuf("do_pemit.whisper.buzz");
01226                     bp = buf2;
01227                     safe_str(Moniker(player), buf2, &bp);
01228                     safe_str(" whispers something to ", buf2, &bp);
01229                     safe_str(Moniker(target), buf2, &bp);
01230                     *bp = '\0';
01231                     notify_except2(loc, player, player, target, buf2);
01232                     free_lbuf(buf2);
01233                 }
01234             }
01235             break;
01236 
01237         case PEMIT_FSAY:
01238             newMessage = modSpeech(target, message, true, "@fsay");
01239             if (newMessage)
01240             {
01241                 message = newMessage;
01242             }
01243             notify(target, tprintf("You say, \"%s\"", message));
01244             if (loc != NOTHING)
01245             {
01246                 saystring = modSpeech(target, message, false, "@fsay");
01247                 if (saystring)
01248                 {
01249                     p = tprintf("%s %s \"%s\"", Moniker(target),
01250                         saystring, message);
01251                     notify_except(loc, player, target, p, 0);
01252                 }
01253                 else
01254                 {
01255                     p = tprintf("%s says, \"%s\"", Moniker(target),
01256                         message);
01257                     notify_except(loc, player, target, p, 0);
01258                 }
01259             }
01260             if (saystring)
01261             {
01262                 free_lbuf(saystring);
01263             }
01264             if (newMessage)
01265             {
01266                 free_lbuf(newMessage);
01267             }
01268             break;
01269 
01270         case PEMIT_FPOSE:
01271             newMessage = modSpeech(target, message, true, "@fpose");
01272             if (newMessage)
01273             {
01274                 message = newMessage;
01275             }
01276             p = tprintf("%s %s", Moniker(target), message);
01277             notify_all_from_inside(loc, player, p);
01278             if (newMessage)
01279             {
01280                 free_lbuf(newMessage);
01281             }
01282             break;
01283 
01284         case PEMIT_FPOSE_NS:
01285             newMessage = modSpeech(target, message, true, "@fpose");
01286             if (newMessage)
01287             {
01288                 message = newMessage;
01289             }
01290             p = tprintf("%s%s", Moniker(target), message);
01291             notify_all_from_inside(loc, player, p);
01292             if (newMessage)
01293             {
01294                 free_lbuf(newMessage);
01295             }
01296             break;
01297 
01298         case PEMIT_FEMIT:
01299             if (  (pemit_flags & PEMIT_HERE)
01300                || !pemit_flags)
01301             {
01302                 notify_all_from_inside(loc, player, message);
01303             }
01304             if (pemit_flags & PEMIT_ROOM)
01305             {
01306                 if (  isRoom(loc)
01307                    && (pemit_flags & PEMIT_HERE))
01308                 {
01309                     return;
01310                 }
01311                 depth = 0;
01312                 while (  !isRoom(loc)
01313                       && depth++ < 20)
01314                 {
01315                     loc = Location(loc);
01316                     if (  loc == NOTHING
01317                        || loc == Location(loc))
01318                     {
01319                         return;
01320                     }
01321                 }
01322                 if (isRoom(loc))
01323                 {
01324                     notify_all_from_inside(loc, player, message);
01325                 }
01326             }
01327             break;
01328         }
01329     }
01330 }

void do_say ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  message 
)

Definition at line 153 of file speech.cpp.

References free_lbuf, Good_obj, isRoom, Location, modSpeech(), Moniker(), MSG_SAYPOSE, notify_all_from_inside, notify_all_from_inside_html, notify_all_from_inside_saypose, notify_except(), notify_except_rlevel(), notify_saypose, SAY_EMIT, SAY_HERE, SAY_HTML, SAY_NOEVAL, SAY_NOTAG, SAY_POSE, SAY_POSE_NOSPC, SAY_PREFIX, SAY_ROOM, SAY_SAY, sp_ok(), tprintf(), UNUSED_PARAMETER, and where_is().

Referenced by FUNCTION().

00154 {
00155     UNUSED_PARAMETER(caller);
00156     UNUSED_PARAMETER(enactor);
00157 
00158     // Make sure speaker is somewhere if speaking in a place
00159     //
00160     dbref loc = where_is(executor);
00161     if ( !(  Good_obj(loc)
00162           && sp_ok(executor)))
00163     {
00164         return;
00165     }
00166 
00167     int say_flags, depth;
00168 
00169     // Convert prefix-coded messages into the normal type
00170     //
00171     say_flags = key & (SAY_NOEVAL | SAY_NOTAG | SAY_HERE | SAY_ROOM | SAY_HTML);
00172     key &= ~(SAY_NOEVAL | SAY_NOTAG | SAY_HERE | SAY_ROOM | SAY_HTML);
00173 
00174     if (key == SAY_PREFIX)
00175     {
00176         switch (*message)
00177         {
00178         case '"':
00179             message++;
00180             key = SAY_SAY;
00181             break;
00182 
00183         case ':':
00184             message++;
00185             if (*message == ' ')
00186             {
00187                 message++;
00188                 key = SAY_POSE_NOSPC;
00189             }
00190             else
00191             {
00192                 key = SAY_POSE;
00193             }
00194             break;
00195 
00196         case ';':
00197             message++;
00198             key = SAY_POSE_NOSPC;
00199             break;
00200 
00201         case '\\':
00202             message++;
00203 
00204             // FALLTHROUGH
00205             //
00206 
00207         default:
00208             key = SAY_EMIT;
00209             break;
00210         }
00211     }
00212 
00213     char *command = "";
00214     if (SAY_SAY == key)
00215     {
00216         command = "say";
00217     }
00218     else if (SAY_POSE == key || SAY_POSE_NOSPC == key)
00219     {
00220         command = "pose";
00221     }
00222     else if (SAY_EMIT == key)
00223     {
00224         command = "@emit";
00225     }
00226 
00227     // Parse speechmod if present.
00228     //
00229     char *messageOrig = message;
00230     char *messageNew = NULL;
00231     if (!(say_flags & SAY_NOEVAL))
00232     {
00233         messageNew = modSpeech(executor, message, true, command);
00234         if (messageNew)
00235         {
00236             message = messageNew;
00237         }
00238     }
00239 
00240     // Send the message on its way
00241     //
00242     char *saystring;
00243     switch (key)
00244     {
00245     case SAY_SAY:
00246         saystring = modSpeech(executor, messageOrig, false, command);
00247         if (saystring)
00248         {
00249             notify_saypose(executor, tprintf("%s %s \"%s\"",
00250                 Moniker(executor), saystring, message));
00251 #ifdef REALITY_LVLS
00252             notify_except_rlevel(loc, executor, executor, tprintf("%s %s \"%s\"", Moniker(executor), saystring, message), MSG_SAYPOSE);
00253 #else
00254             notify_except(loc, executor, executor, tprintf("%s %s \"%s\"", Moniker(executor), saystring, message), MSG_SAYPOSE);
00255 #endif
00256             free_lbuf(saystring);
00257         }
00258         else
00259         {
00260             notify_saypose(executor, tprintf("You say, \"%s\"", message));
00261 #ifdef REALITY_LVLS
00262             notify_except_rlevel(loc, executor, executor, tprintf("%s says, \"%s\"", Moniker(executor), message), MSG_SAYPOSE);
00263 #else
00264             notify_except(loc, executor, executor, tprintf("%s says, \"%s\"", Moniker(executor), message), MSG_SAYPOSE);
00265 #endif
00266         }
00267         break;
00268 
00269     case SAY_POSE:
00270 #ifdef REALITY_LVLS
00271         notify_except_rlevel(loc, executor, -1, tprintf("%s %s", Moniker(executor), message), MSG_SAYPOSE);
00272 #else
00273         notify_all_from_inside_saypose(loc, executor, tprintf("%s %s", Moniker(executor), message));
00274 #endif
00275         break;
00276 
00277     case SAY_POSE_NOSPC:
00278 #ifdef REALITY_LVLS
00279         notify_except_rlevel(loc, executor, -1, tprintf("%s%s", Moniker(executor), message), MSG_SAYPOSE);
00280 #else
00281         notify_all_from_inside_saypose(loc, executor, tprintf("%s%s", Moniker(executor), message));
00282 #endif
00283         break;
00284 
00285     case SAY_EMIT:
00286         if (  (say_flags & SAY_HERE)
00287            || (say_flags & SAY_HTML)
00288            || !say_flags)
00289         {
00290             if (say_flags & SAY_HTML)
00291             {
00292                 notify_all_from_inside_html(loc, executor, message);
00293             }
00294             else
00295             {
00296 
00297 #ifdef REALITY_LVLS
00298                 notify_except_rlevel(loc, executor, -1, message, SAY_EMIT);
00299 #else
00300                 notify_all_from_inside(loc, executor, message);
00301 #endif
00302             }
00303         }
00304         if (say_flags & SAY_ROOM)
00305         {
00306             if (  isRoom(loc)
00307                && (say_flags & SAY_HERE))
00308             {
00309                 if (messageNew)
00310                 {
00311                     free_lbuf(messageNew);
00312                 }
00313                 return;
00314             }
00315             for (depth = 0; !isRoom(loc) && (depth < 20); depth++)
00316             {
00317                 loc = Location(loc);
00318                 if (  !Good_obj(loc)
00319                    || (loc == Location(loc)))
00320                 {
00321                     if (messageNew)
00322                     {
00323                         free_lbuf(messageNew);
00324                     }
00325                     return;
00326                 }
00327             }
00328             if (isRoom(loc))
00329             {
00330 #ifdef REALITY_LVLS
00331                 notify_except_rlevel(loc, executor, -1, message, -1);
00332 #else
00333                 notify_all_from_inside(loc, executor, message);
00334 #endif
00335             }
00336         }
00337         break;
00338     }
00339     if (messageNew)
00340     {
00341         free_lbuf(messageNew);
00342     }
00343 }

void dump_database_internal ( int   ) 

Definition at line 1294 of file game.cpp.

References DUMP_PROCEDURE::bUseTemporary, confdata::compress, confdata::compress_db, confdata::comsys_db, db_write(), DebugTotalFiles, DUMP_I_PANIC, DUMP_I_SIGNAL, dump_mail(), statedata::dumping, DumpProcedures, statedata::epoch, F_MUX, DUMP_PROCEDURE::fType, confdata::have_comsys, confdata::have_mailer, local_dump_database(), log_perror(), confdata::mail_db, mudconf, mudstate, NUM_DUMP_TYPES, confdata::outdb, OUTPUT_FLAGS, OUTPUT_VERSION, POPEN_WRITE_OP, DUMP_PROCEDURE::ppszOutputBase, DUMP_PROCEDURE::pszErrorMessage, RemoveFile(), ReplaceFile(), save_comsys(), SIZEOF_PATHNAME, DUMP_PROCEDURE::szOutputSuffix, and tprintf().

Referenced by do_backup(), do_restart(), do_shutdown(), dump_database(), fork_and_dump(), and sighandler().

01295 {
01296     char tmpfile[SIZEOF_PATHNAME+32];
01297     char outfn[SIZEOF_PATHNAME+32];
01298     char prevfile[SIZEOF_PATHNAME+32];
01299     FILE *f;
01300 
01301     if (  dump_type < 0
01302        || NUM_DUMP_TYPES <= dump_type)
01303     {
01304         return;
01305     }
01306 
01307     bool bPotentialConflicts = false;
01308 #ifndef WIN32
01309     // If we are already dumping for some reason, and suddenly get a type 1 or
01310     // type 4 dump, basically don't touch mail and comsys files. The other
01311     // dump will take care of them as well as can be expected for now, and if
01312     // we try to, we'll just step on them.
01313     //
01314     if (  mudstate.dumping
01315        && (  dump_type == DUMP_I_PANIC
01316           || dump_type == DUMP_I_SIGNAL))
01317     {
01318         bPotentialConflicts = true;
01319     }
01320 #endif
01321 
01322     // Call the local dump function only if another dump is not already
01323     // in progress.
01324     //
01325     local_dump_database(dump_type);
01326 
01327     if (0 < dump_type)
01328     {
01329         DUMP_PROCEDURE *dp = &DumpProcedures[dump_type];
01330 
01331         sprintf(outfn, "%s%s", *(dp->ppszOutputBase), dp->szOutputSuffix);
01332         if (dp->bUseTemporary)
01333         {
01334             sprintf(tmpfile, "%s.#%d#", outfn, mudstate.epoch);
01335             RemoveFile(tmpfile);
01336             f = fopen(tmpfile, "wb");
01337         }
01338         else
01339         {
01340             RemoveFile(outfn);
01341             f = fopen(outfn, "wb");
01342         }
01343 
01344         if (f)
01345         {
01346             DebugTotalFiles++;
01347             setvbuf(f, NULL, _IOFBF, 16384);
01348             db_write(f, F_MUX, dp->fType);
01349             if (fclose(f) == 0)
01350             {
01351                 DebugTotalFiles--;
01352             }
01353 
01354             if (dp->bUseTemporary)
01355             {
01356                 ReplaceFile(tmpfile, outfn);
01357             }
01358         }
01359         else
01360         {
01361             log_perror("DMP", "FAIL", dp->pszErrorMessage, outfn);
01362         }
01363 
01364         if (!bPotentialConflicts)
01365         {
01366             if (mudconf.have_mailer)
01367             {
01368                 f = fopen(mudconf.mail_db, "wb");
01369                 if (f)
01370                 {
01371                     DebugTotalFiles++;
01372                     dump_mail(f);
01373                     if (fclose(f) == 0)
01374                     {
01375                         DebugTotalFiles--;
01376                     }
01377                 }
01378             }
01379             if (mudconf.have_comsys)
01380             {
01381                 save_comsys(mudconf.comsys_db);
01382             }
01383         }
01384         return;
01385     }
01386 
01387     // Nuke our predecessor
01388     //
01389     if (mudconf.compress_db)
01390     {
01391         sprintf(prevfile, "%s.prev.gz", mudconf.outdb);
01392         sprintf(tmpfile, "%s.#%d#.gz", mudconf.outdb, mudstate.epoch - 1);
01393         RemoveFile(tmpfile);
01394         sprintf(tmpfile, "%s.#%d#.gz", mudconf.outdb, mudstate.epoch);
01395         strcpy(outfn, mudconf.outdb);
01396         strcat(outfn, ".gz");
01397 
01398         f = popen(tprintf("%s > %s", mudconf.compress, tmpfile), POPEN_WRITE_OP);
01399         if (f)
01400         {
01401             DebugTotalFiles++;
01402             setvbuf(f, NULL, _IOFBF, 16384);
01403             db_write(f, F_MUX, OUTPUT_VERSION | OUTPUT_FLAGS);
01404             if (pclose(f) != -1)
01405             {
01406                 DebugTotalFiles--;
01407             }
01408             ReplaceFile(outfn, prevfile);
01409             if (ReplaceFile(tmpfile, outfn) < 0)
01410             {
01411                 log_perror("SAV", "FAIL", "Renaming output file to DB file", tmpfile);
01412             }
01413         }
01414         else
01415         {
01416             log_perror("SAV", "FAIL", "Opening", tmpfile);
01417         }
01418     }
01419     else
01420     {
01421         sprintf(prevfile, "%s.prev", mudconf.outdb);
01422         sprintf(tmpfile, "%s.#%d#", mudconf.outdb, mudstate.epoch - 1);
01423         RemoveFile(tmpfile);
01424         sprintf(tmpfile, "%s.#%d#", mudconf.outdb, mudstate.epoch);
01425 
01426         f = fopen(tmpfile, "wb");
01427         if (f)
01428         {
01429             DebugTotalFiles++;
01430             setvbuf(f, NULL, _IOFBF, 16384);
01431             db_write(f, F_MUX, OUTPUT_VERSION | OUTPUT_FLAGS);
01432             if (fclose(f) == 0)
01433             {
01434                 DebugTotalFiles--;
01435             }
01436             ReplaceFile(mudconf.outdb, prevfile);
01437             if (ReplaceFile(tmpfile, mudconf.outdb) < 0)
01438             {
01439                 log_perror("SAV", "FAIL", "Renaming output file to DB file", tmpfile);
01440             }
01441         }
01442         else
01443         {
01444             log_perror("SAV", "FAIL", "Opening", tmpfile);
01445         }
01446     }
01447 
01448     if (mudconf.have_mailer)
01449     {
01450         f = fopen(mudconf.mail_db, "wb");
01451         if (f)
01452         {
01453             DebugTotalFiles++;
01454             dump_mail(f);
01455             if (fclose(f) == 0)
01456             {
01457                 DebugTotalFiles--;
01458             }
01459         }
01460     }
01461 
01462     if (mudconf.have_comsys)
01463     {
01464         save_comsys(mudconf.comsys_db);
01465     }
01466 }

int dump_mail ( FILE *   ) 

Definition at line 2764 of file mail.cpp.

References DO_WHOLE_DB, MailList::FirstItem(), mail::from, MailList::IsEnd(), isPlayer, statedata::mail_db_top, mail_list, MessageFetch(), mudstate, MailList::NextItem(), mail::number, putref(), putstring(), mail::read, save_malias(), mail::subject, mail::time, mail::to, and mail::tolist.

Referenced by dump_database_internal().

02765 {
02766     dbref thing;
02767     int count = 0, i;
02768 
02769     // Write out version number
02770     //
02771     fprintf(fp, "+V5\n");
02772     putref(fp, mudstate.mail_db_top);
02773     DO_WHOLE_DB(thing)
02774     {
02775         if (isPlayer(thing))
02776         {
02777             MailList ml(thing);
02778             struct mail *mp;
02779             for (mp = ml.FirstItem(); !ml.IsEnd(); mp = ml.NextItem())
02780             {
02781                 putref(fp, mp->to);
02782                 putref(fp, mp->from);
02783                 putref(fp, mp->number);
02784                 putstring(fp, mp->tolist);
02785                 putstring(fp, mp->time);
02786                 putstring(fp, mp->subject);
02787                 putref(fp, mp->read);
02788                 count++;
02789             }
02790         }
02791     }
02792 
02793     fprintf(fp, "*** END OF DUMP ***\n");
02794 
02795     // Add the db of mail messages
02796     //
02797     for (i = 0; i < mudstate.mail_db_top; i++)
02798     {
02799         if (0 < mail_list[i].m_nRefs)
02800         {
02801             putref(fp, i);
02802             putstring(fp, MessageFetch(i));
02803         }
02804     }
02805     fprintf(fp, "+++ END OF DUMP +++\n");
02806     save_malias(fp);
02807 
02808     return count;
02809 }

void edit_string ( char *  ,
char **  ,
char *  ,
char *   
)

Definition at line 1529 of file set.cpp.

References alloc_lbuf, replace_string(), and safe_str.

Referenced by FUNCTION().

01530 {
01531     char *cp;
01532 
01533     // Do the substitution.  Idea for prefix/suffix from R'nice@TinyTIM.
01534     //
01535     if (!strcmp(from, "^"))
01536     {
01537         // Prepend 'to' to string.
01538         //
01539         *dst = alloc_lbuf("edit_string.^");
01540         cp = *dst;
01541         safe_str(to, *dst, &cp);
01542         safe_str(src, *dst, &cp);
01543         *cp = '\0';
01544     }
01545     else if (!strcmp(from, "$"))
01546     {
01547         // Append 'to' to string.
01548         //
01549         *dst = alloc_lbuf("edit_string.$");
01550         cp = *dst;
01551         safe_str(src, *dst, &cp);
01552         safe_str(to, *dst, &cp);
01553         *cp = '\0';
01554     }
01555     else
01556     {
01557         // Replace all occurances of 'from' with 'to'. Handle the special
01558         // cases of from = \$ and \^.
01559         //
01560         if (  (  from[0] == '\\'
01561               || from[0] == '%')
01562            && (  from[1] == '$'
01563               || from[1] == '^')
01564            && from[2] == '\0')
01565         {
01566             from++;
01567         }
01568         *dst = replace_string(from, to, src);
01569     }
01570 }

void empty_obj ( dbref   ) 

Definition at line 602 of file object.cpp.

References Contents, destroy_obj(), divest_object(), Exits, Going, Good_obj, Has_location, Home, HOME, isExit, isGarbage, Location, Log_header_err(), Log_simple_err(), move_via_generic(), new_home(), next, NOTHING, s_Home, s_Location, s_Next, and SAFE_DOLIST.

Referenced by destroy_thing(), do_destroy(), and purge_going().

00603 {
00604     dbref targ, next;
00605 
00606     // Send the contents home
00607     //
00608     SAFE_DOLIST(targ, next, Contents(obj))
00609     {
00610         if (!Has_location(targ))
00611         {
00612             Log_simple_err(targ, obj,
00613                    "Funny object type in contents list of GOING location. Flush terminated.");
00614             break;
00615         }
00616         else if (Location(targ) != obj)
00617         {
00618             Log_header_err(targ, obj, Location(targ), true,
00619                    "Location",
00620                    "indicates object really in another location during cleanup of GOING location.  Flush terminated.");
00621             break;
00622         }
00623         else
00624         {
00625             s_Location(targ, NOTHING);
00626             s_Next(targ, NOTHING);
00627             if (  !Good_obj(Home(targ))
00628                || Going(Home(targ))
00629                || Home(targ) == obj)
00630             {
00631                 s_Home(targ, new_home(targ));
00632             }
00633             move_via_generic(targ, HOME, NOTHING, 0);
00634             divest_object(targ);
00635         }
00636     }
00637 
00638     // Destroy the exits.
00639     //
00640     SAFE_DOLIST(targ, next, Exits(obj))
00641     {
00642         if (!isExit(targ) && !isGarbage(targ))
00643         {
00644             Log_simple_err(targ, obj, "Funny object type in exit list of GOING location. Flush terminated.");
00645             break;
00646         }
00647         else if (Exits(targ) != obj)
00648         {
00649             Log_header_err(targ, obj, Exits(targ), true, "Location",
00650                    "indicates exit really in another location during cleanup of GOING location.  Flush terminated.");
00651             break;
00652         }
00653         else
00654         {
00655             destroy_obj(targ);
00656         }
00657     }
00658 }

void end_log ( void   ) 

Definition at line 106 of file log.cpp.

References ENDLINE, CLogFile::Flush(), Log, statedata::logging, mudstate, and CLogFile::WriteString().

Referenced by pool_alloc(), pool_alloc_lbuf(), pool_free(), pool_free_lbuf(), and report_timecheck().

00107 {
00108     Log.WriteString(ENDLINE);
00109     Log.Flush();
00110     mudstate.logging--;
00111 }

bool eval_boolexp ( dbref  ,
dbref  ,
dbref  ,
BOOLEXP  
)

Definition at line 51 of file boolexp.cpp.

References A_LENTER, A_LOCK, A_NAME, alloc_lbuf, alloc_mbuf, atr_get, atr_num(), atr_pget, CMuxAlarm::bAlarmed, bCanReadAttr(), BOOLEXP_AND, BOOLEXP_ATR, BOOLEXP_CARRY, BOOLEXP_CONST, BOOLEXP_EVAL, BOOLEXP_INDIR, BOOLEXP_IS, BOOLEXP_NOT, BOOLEXP_OR, BOOLEXP_OWNER, statedata::bStandAlone, check_attr(), Contents, DOLIST, ENDLINE, ENDLOG, EV_EVAL, EV_FCHECK, EV_FIGNORE, EV_TOP, eval_boolexp(), eval_boolexp_atr(), free_lbuf, free_mbuf, INDIR_TOKEN, statedata::lock_nest_lev, confdata::lock_nest_lim, Log, LOG_BUGS, log_name_and_loc(), log_text(), MAX_GLOBAL_REGS, member(), mudconf, mudstate, mux_assert, mux_exec(), MuxAlarm, notify, attr::number, Owner, PopIntegers(), PopPointers(), PushIntegers(), PushPointers(), restore_global_regs(), save_global_regs(), STARTLOG, string_compare(), boolexp::sub1, boolexp::sub2, boolexp::thing, TRUE_BOOLEXP, boolexp::type, and CLogFile::WriteString().

Referenced by eval_boolexp(), eval_boolexp_atr(), and FUNCTION().

00052 {
00053     if (b == TRUE_BOOLEXP)
00054     {
00055         return true;
00056     }
00057 
00058     dbref aowner, obj, source;
00059     int aflags;
00060     char *key, *buff, *buff2, *bp, *str;
00061     ATTR *a;
00062     bool bCheck, c;
00063 
00064     switch (b->type)
00065     {
00066     case BOOLEXP_AND:
00067         return   eval_boolexp(player, thing, from, b->sub1)
00068               && eval_boolexp(player, thing, from, b->sub2);
00069 
00070     case BOOLEXP_OR:
00071         return   eval_boolexp(player, thing, from, b->sub1)
00072               || eval_boolexp(player, thing, from, b->sub2);
00073 
00074     case BOOLEXP_NOT:
00075         return !eval_boolexp(player, thing, from, b->sub1);
00076 
00077     case BOOLEXP_INDIR:
00078 
00079         // BOOLEXP_INDIR (i.e. @) is a unary operation which is replaced at
00080         // evaluation time by the lock of the object whose number is the
00081         // argument of the operation.
00082         //
00083         mudstate.lock_nest_lev++;
00084         if (mudstate.lock_nest_lev >= mudconf.lock_nest_lim)
00085         {
00086             if (mudstate.bStandAlone)
00087             {
00088                 Log.WriteString("Lock exceeded recursion limit." ENDLINE);
00089             }
00090             else
00091             {
00092                 STARTLOG(LOG_BUGS, "BUG", "LOCK");
00093                 log_name_and_loc(player);
00094                 log_text(": Lock exceeded recursion limit.");
00095                 ENDLOG;
00096                 notify(player, "Sorry, broken lock!");
00097             }
00098             mudstate.lock_nest_lev--;
00099             return false;
00100         }
00101         if (  b->sub1->type != BOOLEXP_CONST
00102            || b->sub1->thing < 0)
00103         {
00104             if (mudstate.bStandAlone)
00105             {
00106                 Log.WriteString("Broken lock." ENDLINE);
00107             }
00108             else
00109             {
00110                 STARTLOG(LOG_BUGS, "BUG", "LOCK");
00111                 log_name_and_loc(player);
00112                 buff = alloc_mbuf("eval_boolexp.LOG.indir");
00113                 sprintf(buff, ": Lock had bad indirection (%c, type %d)",
00114                     INDIR_TOKEN, b->sub1->type);
00115                 log_text(buff);
00116                 free_mbuf(buff);
00117                 ENDLOG;
00118                 notify(player, "Sorry, broken lock!");
00119             }
00120             mudstate.lock_nest_lev--;
00121             return false;
00122         }
00123         key = atr_get(b->sub1->thing, A_LOCK, &aowner, &aflags);
00124         c = eval_boolexp_atr(player, b->sub1->thing, from, key);
00125         free_lbuf(key);
00126         mudstate.lock_nest_lev--;
00127         return c;
00128 
00129     case BOOLEXP_CONST:
00130         return   b->thing == player
00131               || member(b->thing, Contents(player));
00132 
00133     case BOOLEXP_ATR:
00134         a = atr_num(b->thing);
00135         if (!a)
00136         {
00137             // No such attribute.
00138             //
00139             return false;
00140         }
00141 
00142         // First check the object itself, then its contents.
00143         //
00144         if (check_attr(player, from, a, (char *)b->sub1))
00145         {
00146             return true;
00147         }
00148         DOLIST(obj, Contents(player))
00149         {
00150             if (check_attr(obj, from, a, (char *)b->sub1))
00151             {
00152                 return true;
00153             }
00154         }
00155         return false;
00156 
00157     case BOOLEXP_EVAL:
00158 
00159         a = atr_num(b->thing);
00160         if (  !a
00161            || MuxAlarm.bAlarmed)
00162         {
00163             // No such attribute.
00164             //
00165             return false;
00166         }
00167         source = from;
00168         buff = atr_pget(from, a->number, &aowner, &aflags);
00169         if (!buff || !*buff)
00170         {
00171             free_lbuf(buff);
00172             buff = atr_pget(thing, a->number, &aowner, &aflags);
00173             source = thing;
00174         }
00175         bCheck = false;
00176 
00177         if (  a->number == A_NAME
00178            || a->number == A_LENTER)
00179         {
00180             bCheck = true;
00181         }
00182         else if (bCanReadAttr(source, source, a, false))
00183         {
00184             bCheck = true;
00185         }
00186         if (bCheck)
00187         {
00188             char **preserve = NULL;
00189             int *preserve_len = NULL;
00190             preserve = PushPointers(MAX_GLOBAL_REGS);
00191             preserve_len = PushIntegers(MAX_GLOBAL_REGS);
00192             save_global_regs("eval_boolexp_save", preserve, preserve_len);
00193 
00194             buff2 = bp = alloc_lbuf("eval_boolexp");
00195             str = buff;
00196             mux_exec(buff2, &bp, source, player, player,
00197                 EV_FIGNORE | EV_EVAL | EV_FCHECK | EV_TOP, &str,
00198                 (char **)NULL, 0);
00199             *bp = '\0';
00200 
00201             restore_global_regs("eval_boolexp_save", preserve, preserve_len);
00202             PopIntegers(preserve_len, MAX_GLOBAL_REGS);
00203             PopPointers(preserve, MAX_GLOBAL_REGS);
00204 
00205             bCheck = !string_compare(buff2, (char *)b->sub1);
00206             free_lbuf(buff2);
00207         }
00208         free_lbuf(buff);
00209         return bCheck;
00210 
00211     case BOOLEXP_IS:
00212 
00213         // If an object check, do that.
00214         //
00215         if (b->sub1->type == BOOLEXP_CONST)
00216         {
00217             return (b->sub1->thing == player);
00218         }
00219 
00220         // Nope, do an attribute check
00221         //
00222         a = atr_num(b->sub1->thing);
00223         if (!a)
00224         {
00225             return false;
00226         }
00227         return check_attr(player, from, a, (char *)(b->sub1)->sub1);
00228 
00229     case BOOLEXP_CARRY:
00230 
00231         // If an object check, do that
00232         //
00233         if (b->sub1->type == BOOLEXP_CONST)
00234         {
00235             return member(b->sub1->thing, Contents(player));
00236         }
00237 
00238         // Nope, do an attribute check
00239         //
00240         a = atr_num(b->sub1->thing);
00241         if (!a)
00242         {
00243             return false;
00244         }
00245         DOLIST(obj, Contents(player))
00246         {
00247             if (check_attr(obj, from, a, (char *)(b->sub1)->sub1))
00248             {
00249                 return true;
00250             }
00251         }
00252         return false;
00253 
00254     case BOOLEXP_OWNER:
00255 
00256         return (Owner(b->sub1->thing) == Owner(player));
00257 
00258     default:
00259 
00260         // Bad type
00261         //
00262         mux_assert(0);
00263         return false;
00264     }
00265 }

bool eval_boolexp_atr ( dbref  ,
dbref  ,
dbref  ,
char *   
)

Definition at line 267 of file boolexp.cpp.

References eval_boolexp(), free_boolexp(), and parse_boolexp().

Referenced by could_doit(), and eval_boolexp().

00268 {
00269     bool ret_value;
00270 
00271     BOOLEXP *b = parse_boolexp(player, key, true);
00272     if (b == NULL)
00273     {
00274         ret_value = true;
00275     }
00276     else
00277     {
00278         ret_value = eval_boolexp(player, thing, from, b);
00279         free_boolexp(b);
00280     }
00281     return ret_value;
00282 }

bool exit_displayable ( dbref  ,
dbref  ,
int   
)

Definition at line 2217 of file predicates.cpp.

References statedata::bStandAlone, Dark, Light, mudstate, VE_BASE_DARK, and VE_LOC_DARK.

Referenced by look_exits().

02218 {
02219     // Dark exit
02220     //
02221     if (Dark(exit))
02222     {
02223         return false;
02224     }
02225 
02226 #ifdef WOD_REALMS
02227     if (!mudstate.bStandAlone)
02228     {
02229         int iRealmDirective = DoThingToThingVisibility(player, exit,
02230             ACTION_IS_STATIONARY);
02231         if (REALM_DO_HIDDEN_FROM_YOU == iRealmDirective)
02232         {
02233             return false;
02234         }
02235     }
02236 #endif // WOD_REALMS
02237 
02238     // Light exit
02239     //
02240     if (Light(exit))
02241     {
02242         return true;
02243     }
02244 
02245     // Dark location or base.
02246     //
02247     if (key & (VE_LOC_DARK | VE_BASE_DARK))
02248     {
02249         return false;
02250     }
02251 
02252     // Default
02253     //
02254     return true;
02255 }

bool exit_visible ( dbref  ,
dbref  ,
int   
)

Definition at line 2171 of file predicates.cpp.

References statedata::bStandAlone, Dark, Examinable, IsReal, Light, mudstate, VE_BASE_DARK, VE_LOC_DARK, and VE_LOC_XAM.

Referenced by FUNCTION(), match_exit_internal(), and room_list().

02172 {
02173 #ifdef WOD_REALMS
02174     if (!mudstate.bStandAlone)
02175     {
02176         int iRealmDirective = DoThingToThingVisibility(player, exit,
02177             ACTION_IS_STATIONARY);
02178         if (REALM_DO_HIDDEN_FROM_YOU == iRealmDirective)
02179         {
02180             return false;
02181         }
02182     }
02183 #endif // WOD_REALMS
02184 
02185 #ifdef REALITY_LVLS
02186     if (!mudstate.bStandAlone)
02187     {
02188     if (!IsReal(player, exit))
02189        return 0;
02190     }
02191 #endif /* REALITY_LVLS */
02192 
02193     // Exam exit's location
02194     //
02195     if (  (key & VE_LOC_XAM)
02196        || Examinable(player, exit)
02197        || Light(exit))
02198     {
02199         return true;
02200     }
02201 
02202     // Dark location or base
02203     //
02204     if (  (key & (VE_LOC_DARK | VE_BASE_DARK))
02205        || Dark(exit))
02206     {
02207         return false;
02208     }
02209 
02210     // Default
02211     //
02212     return true;
02213 }

int fetch_cmds ( dbref  target  ) 

Definition at line 2891 of file netcommon.cpp.

References descriptor_data::command_count, and DESC_ITER_PLAYER.

Referenced by FUNCTION().

02892 {
02893     int sum = 0;
02894     bool bFound = false;
02895 
02896     DESC *d;
02897     DESC_ITER_PLAYER(target, d)
02898     {
02899         sum += d->command_count;
02900         bFound = true;
02901     }
02902 
02903     if (bFound)
02904     {
02905         return sum;
02906     }
02907     else
02908     {
02909         return -1;
02910     }
02911 }

long fetch_ConnectionInfoField ( dbref  target,
int  iField 
)

Definition at line 2966 of file netcommon.cpp.

References A_CONNINFO, atr_get, free_lbuf, mux_atol(), and ParseConnectionInfoString().

02967 {
02968     dbref aowner;
02969     int   aflags;
02970     char *pConnInfo = atr_get(target, A_CONNINFO, &aowner, &aflags);
02971     char *aFields[5];
02972     ParseConnectionInfoString(pConnInfo, aFields);
02973 
02974     long result;
02975     if (  !aFields[iField]
02976        || (result = mux_atol(aFields[iField])) < 0)
02977     {
02978         result = 0;
02979     }
02980     free_lbuf(pConnInfo);
02981     return result;
02982 }

void fetch_ConnectionInfoFields ( dbref  target,
long  anFields[4] 
)

Definition at line 2924 of file netcommon.cpp.

References A_CONNINFO, atr_get, free_lbuf, mux_atol(), and ParseConnectionInfoString().

Referenced by shutdownsock().

02925 {
02926     dbref aowner;
02927     int   aflags;
02928     char *pConnInfo = atr_get(target, A_CONNINFO, &aowner, &aflags);
02929     char *aFields[5];
02930     ParseConnectionInfoString(pConnInfo, aFields);
02931 
02932     for (int i = 0; i < 4; i++)
02933     {
02934         long result;
02935         if (  !aFields[i]
02936            || (result = mux_atol(aFields[i])) < 0)
02937         {
02938             result = 0;
02939         }
02940         anFields[i] = result;
02941     }
02942     free_lbuf(pConnInfo);
02943 }

CLinearTimeAbsolute fetch_logouttime ( dbref  target  ) 

Definition at line 2986 of file netcommon.cpp.

References A_CONNINFO, atr_get, CIF_LOGOUTTIME, free_lbuf, ParseConnectionInfoString(), CLinearTimeAbsolute::SetSeconds(), and CLinearTimeAbsolute::SetSecondsString().

Referenced by FUNCTION().

02987 {
02988     dbref aowner;
02989     int   aflags;
02990     char *pConnInfo = atr_get(target, A_CONNINFO, &aowner, &aflags);
02991     char *aFields[5];
02992     ParseConnectionInfoString(pConnInfo, aFields);
02993 
02994     CLinearTimeAbsolute lta;
02995     if (aFields[CIF_LOGOUTTIME])
02996     {
02997         lta.SetSecondsString(aFields[CIF_LOGOUTTIME]);
02998     }
02999     else
03000     {
03001         lta.SetSeconds(0);
03002     }
03003     free_lbuf(pConnInfo);
03004     return lta;
03005 }

void FLOAT_Initialize ( void   ) 

Definition at line 3603 of file strtod.cpp.

References mux_FPInit(), and mux_FPSet().

Referenced by main().

03604 {
03605     mux_FPInit();
03606     mux_FPSet();
03607 }

void fork_and_dump ( int  key  ) 

Definition at line 1528 of file game.cpp.

References al_store(), alloc_lbuf, check_mail_expiration(), CMuxAlarm::Clear(), dump_database_internal(), DUMP_FLATFILE, DUMP_I_FLAT, DUMP_I_NORMAL, confdata::dump_msg, DUMP_STRUCT, DUMP_TEXT, statedata::dumped, statedata::dumper, statedata::dumping, ENDLOG, statedata::epoch, confdata::fork_dump, free_lbuf, local_dump_complete_signal(), local_presync_database(), LOG_DBSAVES, log_perror(), log_text(), mudconf, mudstate, MuxAlarm, confdata::outdb, pcache_sync(), confdata::postdump_msg, raw_broadcast(), STARTLOG, SYNC, and statedata::write_protect.

Referenced by dispatch_DatabaseDump(), and do_dump().

01529 {
01530 #ifndef WIN32
01531     static volatile bool bRequestAccepted = false;
01532 
01533     // fork_and_dump is never called with mudstate.dumping true, but we'll
01534     // ensure that assertion now.
01535     //
01536     if (  bRequestAccepted
01537        || mudstate.dumping)
01538     {
01539         return;
01540     }
01541     bRequestAccepted = true;
01542 #endif
01543 
01544     // If no options were given, then it means DUMP_TEXT+DUMP_STRUCT.
01545     //
01546     if (key == 0)
01547     {
01548         key = DUMP_TEXT+DUMP_STRUCT;
01549     }
01550 
01551     if (*mudconf.dump_msg)
01552     {
01553         raw_broadcast(0, "%s", mudconf.dump_msg);
01554     }
01555     check_mail_expiration();
01556     char *buff = alloc_lbuf("fork_and_dump");
01557     if (key & (DUMP_TEXT|DUMP_STRUCT))
01558     {
01559         STARTLOG(LOG_DBSAVES, "DMP", "CHKPT");
01560         if (key & DUMP_TEXT)
01561         {
01562             log_text("SYNCing");
01563             if (key & DUMP_STRUCT)
01564             {
01565                 log_text(" and ");
01566             }
01567         }
01568         if (key & DUMP_STRUCT)
01569         {
01570             mudstate.epoch++;
01571             sprintf(buff, "%s.#%d#", mudconf.outdb, mudstate.epoch);
01572             log_text("Checkpointing: ");
01573             log_text(buff);
01574         }
01575         ENDLOG;
01576     }
01577     if (key & DUMP_FLATFILE)
01578     {
01579         STARTLOG(LOG_DBSAVES, "DMP", "FLAT");
01580         log_text("Creating flatfile: ");
01581         sprintf(buff, "%s.FLAT", mudconf.outdb);
01582         log_text(buff);
01583         ENDLOG;
01584     }
01585     free_lbuf(buff);
01586 
01587     local_presync_database();
01588 
01589 #ifndef MEMORY_BASED
01590     // Save cached modified attribute list
01591     //
01592     al_store();
01593 #endif // MEMORY_BASED
01594 
01595     pcache_sync();
01596     SYNC;
01597 
01598 #ifndef WIN32
01599     mudstate.write_protect = true;
01600     int child = 0;
01601     bool bChildExists = false;
01602     mudstate.dumping = true;
01603     mudstate.dumped  = 0;
01604     bool bAttemptFork = mudconf.fork_dump;
01605 #if !defined(HAVE_PREAD) \
01606  || !defined(HAVE_PWRITE)
01607     if (key & DUMP_FLATFILE)
01608     {
01609         // Don't attempt a fork()'ed @dump/flat without pread()/pwrite()
01610         // support.
01611         //
01612         bAttemptFork = false;
01613     }
01614 #endif // !HAVE_PREAD !HAVE_PWRITE
01615 #endif // WIN32
01616     if (key & (DUMP_STRUCT|DUMP_FLATFILE))
01617     {
01618 #ifndef WIN32
01619         if (bAttemptFork)
01620         {
01621             child = fork();
01622         }
01623         if (child == 0)
01624         {
01625             // If we don't clear this alarm, the child will eventually receive a
01626             // SIG_PROF.
01627             //
01628             MuxAlarm.Clear();
01629 #endif
01630             if (key & DUMP_STRUCT)
01631             {
01632                 dump_database_internal(DUMP_I_NORMAL);
01633             }
01634             if (key & DUMP_FLATFILE)
01635             {
01636                 dump_database_internal(DUMP_I_FLAT);
01637             }
01638 #ifndef WIN32
01639             if (mudconf.fork_dump)
01640             {
01641                 _exit(0);
01642             }
01643         }
01644         else if (child < 0)
01645         {
01646             log_perror("DMP", "FORK", NULL, "fork()");
01647         }
01648         else
01649         {
01650             mudstate.dumper = child;
01651             if (mudstate.dumper == mudstate.dumped)
01652             {
01653                 // The child process executed and exited before fork() returned
01654                 // to the parent process.  Without a process id, the parent's
01655                 // SIGCHLD handler could not be certain that the pid of the
01656                 // exiting process would match the pid of this child.
01657                 //
01658                 // At the this point, we can be sure, however, there's
01659                 // nothing much left to do.
01660                 //
01661                 // See SIGCHLD handler in bsd.cpp.
01662                 //
01663                 mudstate.dumper = 0;
01664                 mudstate.dumped = 0;
01665             }
01666             else
01667             {
01668                 bChildExists = true;
01669             }
01670         }
01671 #endif
01672     }
01673 
01674 #ifndef WIN32
01675     mudstate.write_protect = false;
01676     if (!bChildExists)
01677     {
01678         // We have the ability to fork children, but we are not configured to
01679         // use it; or, we tried to fork a child and failed; or, we didn't
01680         // need to dump the structure or a flatfile; or, the child has finished
01681         // dumping already.
01682         //
01683         mudstate.dumper = 0;
01684         mudstate.dumping = false;
01685         local_dump_complete_signal();
01686     }
01687     bRequestAccepted = false;
01688 #endif
01689 
01690     if (*mudconf.postdump_msg)
01691     {
01692         raw_broadcast(0, "%s", mudconf.postdump_msg);
01693     }
01694 }

bool fwdlist_ck ( dbref  player,
dbref  thing,
int  anum,
char *  atext 
)

Definition at line 390 of file db.cpp.

References alloc_lbuf, statedata::bStandAlone, free_lbuf, fwdlist_load(), fwdlist_rewrite(), fwdlist_set(), mudstate, and UNUSED_PARAMETER.

Referenced by do_forwardlist().

00391 {
00392     UNUSED_PARAMETER(anum);
00393 
00394     if (mudstate.bStandAlone)
00395     {
00396         return true;
00397     }
00398 
00399     FWDLIST *fp;
00400     int count = 0;
00401 
00402     if (atext && *atext)
00403     {
00404         fp = (FWDLIST *) alloc_lbuf("fwdlist_ck.fp");
00405         fwdlist_load(fp, player, atext);
00406     }
00407     else
00408     {
00409         fp = NULL;
00410     }
00411 
00412     // Set the cached forwardlist.
00413     //
00414     fwdlist_set(thing, fp);
00415     count = fwdlist_rewrite(fp, atext);
00416     if (fp)
00417     {
00418         free_lbuf(fp);
00419     }
00420     return ((count > 0) || !atext || !*atext);
00421 }

void fwdlist_clr ( dbref   ) 

Definition at line 270 of file db.cpp.

References fwdlist_get(), statedata::fwdlist_htab, hashdeleteLEN(), MEMFREE, and mudstate.

Referenced by atr_clr(), destroy_bad_obj(), destroy_obj(), and fwdlist_set().

00271 {
00272     // If a forwardlist exists, delete it
00273     //
00274     FWDLIST *xfp = fwdlist_get(thing);
00275     if (xfp)
00276     {
00277         MEMFREE(xfp);
00278         xfp = NULL;
00279         hashdeleteLEN(&thing, sizeof(thing), &mudstate.fwdlist_htab);
00280     }
00281 }

FWDLIST* fwdlist_get ( dbref   ) 

Definition at line 423 of file db.cpp.

References A_FORWARDLIST, alloc_lbuf, atr_get, statedata::bStandAlone, free_lbuf, statedata::fwdlist_htab, fwdlist_load(), GOD, hashfindLEN(), and mudstate.

Referenced by check_dead_refs(), do_entrances(), fwdlist_clr(), fwdlist_set(), and notify_check().

00424 {
00425     static FWDLIST *fp = NULL;
00426     if (mudstate.bStandAlone)
00427     {
00428         if (!fp)
00429         {
00430             fp = (FWDLIST *) alloc_lbuf("fwdlist_get");
00431         }
00432         dbref aowner;
00433         int   aflags;
00434         char *tp = atr_get(thing, A_FORWARDLIST, &aowner, &aflags);
00435         fwdlist_load(fp, GOD, tp);
00436         free_lbuf(tp);
00437     }
00438     else
00439     {
00440         fp = (FWDLIST *) hashfindLEN(&thing, sizeof(thing),
00441             &mudstate.fwdlist_htab);
00442     }
00443     return fp;
00444 }

int fwdlist_load ( FWDLIST ,
dbref  ,
char *   
)

Definition at line 287 of file db.cpp.

References A_LLINK, alloc_lbuf, statedata::bStandAlone, Controls, could_doit(), forward_list::count, forward_list::data, free_lbuf, God, Good_obj, Link_ok, mudstate, mux_atol(), mux_isdigit, mux_isspace, notify, and tprintf().

Referenced by fwdlist_ck(), fwdlist_get(), and process_preload().

00288 {
00289     dbref target;
00290     char *tp, *bp, *dp;
00291     bool fail;
00292 
00293     int count = 0;
00294     int errors = 0;
00295     bp = tp = alloc_lbuf("fwdlist_load.str");
00296     strcpy(tp, atext);
00297     do
00298     {
00299         // Skip spaces.
00300         //
00301         for (; mux_isspace(*bp); bp++)
00302         {
00303             ; // Nothing.
00304         }
00305 
00306         // Remember string.
00307         //
00308         for (dp = bp; *bp && !mux_isspace(*bp); bp++)
00309         {
00310             ; // Nothing.
00311         }
00312 
00313         // Terminate string.
00314         //
00315         if (*bp)
00316         {
00317             *bp++ = '\0';
00318         }
00319 
00320         if (  *dp++ == '#'
00321            && mux_isdigit(*dp))
00322         {
00323             target = mux_atol(dp);
00324             if (mudstate.bStandAlone)
00325             {
00326                 fail = !Good_obj(target);
00327             }
00328             else
00329             {
00330                 fail = (  !Good_obj(target)
00331                        || (  !God(player)
00332                           && !Controls(player, target)
00333                           && (  !Link_ok(target)
00334                              || !could_doit(player, target, A_LLINK))));
00335             }
00336             if (fail)
00337             {
00338                 if (!mudstate.bStandAlone)
00339                 {
00340                     notify(player,
00341                         tprintf("Cannot forward to #%d: Permission denied.",
00342                         target));
00343                 }
00344                 errors++;
00345             }
00346             else
00347             {
00348                 if (count < 1000)
00349                 {
00350                     fp->data[count++] = target;
00351                 }
00352             }
00353         }
00354     } while (*bp);
00355     free_lbuf(tp);
00356     fp->count = count;
00357     return errors;
00358 }

int fwdlist_rewrite ( FWDLIST ,
char *   
)

Definition at line 364 of file db.cpp.

References forward_list::count, forward_list::data, Good_obj, ItemToList_AddInteger(), ItemToList_Final(), and ItemToList_Init().

Referenced by check_dead_refs(), and fwdlist_ck().

00365 {
00366     int count = 0;
00367     atext[0] = '\0';
00368 
00369     if (fp && fp->count)
00370     {
00371         char *bp = atext;
00372         ITL pContext;
00373         ItemToList_Init(&pContext, atext, &bp, '#');
00374         for (int i = 0; i < fp->count; i++)
00375         {
00376             if (  Good_obj(fp->data[i])
00377                && ItemToList_AddInteger(&pContext, fp->data[i]))
00378             {
00379                 count++;
00380             }
00381         }
00382         ItemToList_Final(&pContext);
00383     }
00384     return count;
00385 }

void fwdlist_set ( dbref  ,
FWDLIST  
)

Definition at line 231 of file db.cpp.

References forward_list::count, forward_list::data, fwdlist_clr(), fwdlist_get(), statedata::fwdlist_htab, hashaddLEN(), hashreplLEN(), ISOUTOFMEMORY, MEMALLOC, MEMFREE, and mudstate.

Referenced by fwdlist_ck(), and process_preload().

00232 {
00233     FWDLIST *fp, *xfp;
00234     int i;
00235 
00236     // If fwdlist is null, clear.
00237     //
00238     if (!ifp || (ifp->count <= 0))
00239     {
00240         fwdlist_clr(thing);
00241         return;
00242     }
00243 
00244     // Copy input forwardlist to a correctly-sized buffer.
00245     //
00246     fp = (FWDLIST *)MEMALLOC(sizeof(int) * ((ifp->count) + 1));
00247     ISOUTOFMEMORY(fp);
00248 
00249     for (i = 0; i < ifp->count; i++)
00250     {
00251         fp->data[i] = ifp->data[i];
00252     }
00253     fp->count = ifp->count;
00254 
00255     // Replace an existing forwardlist, or add a new one.
00256     //
00257     xfp = fwdlist_get(thing);
00258     if (xfp)
00259     {
00260         MEMFREE(xfp);
00261         xfp = NULL;
00262         hashreplLEN(&thing, sizeof(thing), fp, &mudstate.fwdlist_htab);
00263     }
00264     else
00265     {
00266         hashaddLEN(&thing, sizeof(thing), fp, &mudstate.fwdlist_htab);
00267     }
00268 }

int get_gender ( dbref   ) 

Definition at line 837 of file eval.cpp.

References A_SEX, atr_pget, free_lbuf, and mux_tolower.

Referenced by handle_ears(), and mux_exec().

00838 {
00839     dbref aowner;
00840     int aflags;
00841     char *atr_gotten = atr_pget(player, A_SEX, &aowner, &aflags);
00842     char first = atr_gotten[0];
00843     free_lbuf(atr_gotten);
00844     switch (mux_tolower(first))
00845     {
00846     case 'p':
00847         return 4;
00848 
00849     case 'm':
00850         return 3;
00851 
00852     case 'f':
00853     case 'w':
00854         return 2;
00855     }
00856     return 1;
00857 }

bool get_obj_and_lock ( dbref  ,
char *  ,
dbref ,
ATTR **  ,
char *  ,
char **   
)

Definition at line 1823 of file predicates.cpp.

References A_LOCK, alloc_lbuf, atr_num(), attr, free_lbuf, Good_obj, lock_sw, match_thing_quiet(), parse_thing_slash(), safe_match_result(), safe_str, and search_nametab().

Referenced by FUNCTION().

01824 {
01825     char *str, *tbuf;
01826     int anum;
01827 
01828     tbuf = alloc_lbuf("get_obj_and_lock");
01829     strcpy(tbuf, what);
01830     if (parse_thing_slash(player, tbuf, &str, it))
01831     {
01832         // <obj>/<lock> syntax, use the named lock.
01833         //
01834         if (!search_nametab(player, lock_sw, str, &anum))
01835         {
01836             free_lbuf(tbuf);
01837             safe_str("#-1 LOCK NOT FOUND", errmsg, bufc);
01838             return false;
01839         }
01840     }
01841     else
01842     {
01843         // Not <obj>/<lock>, do a normal get of the default lock.
01844         //
01845         *it = match_thing_quiet(player, what);
01846         if (!Good_obj(*it))
01847         {
01848             free_lbuf(tbuf);
01849             safe_match_result(*it, errmsg, bufc);
01850             return false;
01851         }
01852         anum = A_LOCK;
01853     }
01854 
01855     // Get the attribute definition, fail if not found.
01856     //
01857     free_lbuf(tbuf);
01858     *attr = atr_num(anum);
01859     if (!(*attr))
01860     {
01861         safe_str("#-1 LOCK NOT FOUND", errmsg, bufc);
01862         return false;
01863     }
01864     return true;
01865 }

void giveto ( dbref  ,
int   
)

Definition at line 288 of file predicates.cpp.

References Free_Money, Owner, Pennies(), s_Pennies(), and Wizard.

Referenced by CallBack_HaltQueue(), CallBack_NotifySemaphoreDrainOrAll(), connect_player(), destroy_obj(), do_chown(), do_kill(), do_processcom(), do_unlink(), give_money(), halt_que(), link_exit(), move_object(), and Task_RunQueueEntry().

00289 {
00290     if (  Wizard(who)
00291        || Wizard(Owner(who))
00292        || Free_Money(who)
00293        || Free_Money(Owner(who)))
00294     {
00295         return;
00296     }
00297     who = Owner(who);
00298     s_Pennies(who, Pennies(who) + pennies);
00299 }

int halt_que ( dbref  ,
dbref   
)

Definition at line 334 of file cque.cpp.

References a_Queue(), CallBack_HaltQueue(), giveto(), Halt_Entries, Halt_Entries_Run, Halt_Object_Target, Halt_Player_Run, Halt_Player_Target, mudconf, NOTHING, scheduler, CScheduler::TraverseUnordered(), and confdata::waitcost.

Referenced by announce_disconnect(), check_dead_refs(), destroy_bad_obj(), destroy_obj(), destroy_player(), do_chown(), do_command(), do_halt(), do_kill(), setup_que(), and Task_RunQueueEntry().

00335 {
00336     Halt_Player_Target = executor;
00337     Halt_Object_Target = object;
00338     Halt_Entries       = 0;
00339     Halt_Player_Run    = NOTHING;
00340     Halt_Entries_Run   = 0;
00341 
00342     // Process @wait, timed semaphores, and untimed semaphores.
00343     //
00344     scheduler.TraverseUnordered(CallBack_HaltQueue);
00345 
00346     if (Halt_Player_Run != NOTHING)
00347     {
00348         giveto(Halt_Player_Run, mudconf.waitcost * Halt_Entries_Run);
00349         a_Queue(Halt_Player_Run, -Halt_Entries_Run);
00350         Halt_Player_Run = NOTHING;
00351     }
00352     return Halt_Entries;
00353 }

void handle_ears ( dbref  ,
bool  ,
bool   
)

Definition at line 608 of file predicates.cpp.

References alloc_lbuf, free_lbuf, get_gender(), isExit, MSG_INV, MSG_LOC, MSG_ME, MSG_NBR, Name, notify_check(), and tprintf().

Referenced by do_edit(), do_set(), do_wipe(), fh_hear_bit(), and set_attr_internal().

00609 {
00610     char *buff, *bp;
00611     int gender;
00612     static const char *poss[5] =
00613     {"", "its", "her", "his", "their"};
00614 
00615     if (could_hear != can_hear)
00616     {
00617         buff = alloc_lbuf("handle_ears");
00618         strcpy(buff, Name(thing));
00619         if (isExit(thing))
00620         {
00621             for (bp = buff; *bp && *bp != ';'; bp++)
00622             {
00623                 ; // Nothing.
00624             }
00625             *bp = '\0';
00626         }
00627         gender = get_gender(thing);
00628 
00629         if (can_hear)
00630         {
00631             notify_check(thing, thing,
00632                          tprintf("%s grow%s ears and can now hear.",
00633                                  buff, (gender == 4) ? "" : "s"),
00634                          (MSG_ME | MSG_NBR | MSG_LOC | MSG_INV));
00635         }
00636         else
00637         {
00638             notify_check(thing, thing,
00639                          tprintf("%s lose%s %s ears and become%s deaf.",
00640                                  buff, (gender == 4) ? "" : "s",
00641                                  poss[gender], (gender == 4) ? "" : "s"),
00642                          (MSG_ME | MSG_NBR | MSG_LOC | MSG_INV));
00643         }
00644         free_lbuf(buff);
00645     }
00646 }

bool Hearer ( dbref   ) 

Definition at line 1903 of file game.cpp.

References AF_NOPROG, alloc_lbuf, 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(), Connected, free_lbuf, H_Listen, statedata::inpipe, CBitField::IsSet(), Monitor, mudstate, statedata::poutobj, Puppet, and CBitField::Set().

Referenced by do_edit(), do_examine(), do_set(), do_wipe(), fh_hear_bit(), look_in(), look_simple(), move_via_exit(), move_via_generic(), move_via_teleport(), process_sticky_dropto(), and set_attr_internal().

01904 {
01905     if (  mudstate.inpipe
01906        && thing == mudstate.poutobj)
01907     {
01908         return true;
01909     }
01910 
01911     if (  Connected(thing)
01912        || Puppet(thing)
01913        || H_Listen(thing))
01914     {
01915         return true;
01916     }
01917 
01918     if (Monitor(thing))
01919     {
01920         if (mudstate.bfListens.IsSet(thing))
01921         {
01922             return true;
01923         }
01924         else if (mudstate.bfNoListens.IsSet(thing))
01925         {
01926             return false;
01927         }
01928         else
01929         {
01930             bool bFoundCommands = false;
01931 
01932             char *buff = alloc_lbuf("Hearer");
01933             char *as;
01934             atr_push();
01935             for (int atr = atr_head(thing, &as); atr; atr = atr_next(&as))
01936             {
01937                 ATTR *ap = atr_num(atr);
01938                 if (  !ap
01939                    || (ap->flags & AF_NOPROG))
01940                 {
01941                     continue;
01942                 }
01943 
01944                 int   aflags;
01945                 dbref aowner;
01946                 atr_get_str(buff, thing, atr, &aowner, &aflags);
01947 
01948                 if (aflags & AF_NOPROG)
01949                 {
01950                     continue;
01951                 }
01952 
01953                 char *s = NULL;
01954                 if (  AMATCH_CMD    == buff[0]
01955                    || AMATCH_LISTEN == buff[0])
01956                 {
01957                     s = strchr(buff+1, ':');
01958                     if (s)
01959                     {
01960                         if (AMATCH_CMD == buff[0])
01961                         {
01962                             bFoundCommands = true;
01963                         }
01964                         else
01965                         {
01966                             free_lbuf(buff);
01967                             atr_pop();
01968                             mudstate.bfListens.Set(thing);
01969                             return true;
01970                         }
01971                     }
01972                 }
01973             }
01974             free_lbuf(buff);
01975             atr_pop();
01976 
01977             mudstate.bfNoListens.Set(thing);
01978 
01979             if (bFoundCommands)
01980             {
01981                 mudstate.bfNoCommands.Clear(thing);
01982                 mudstate.bfCommands.Set(thing);
01983             }
01984             else
01985             {
01986                 mudstate.bfCommands.Clear(thing);
01987                 mudstate.bfNoCommands.Set(thing);
01988             }
01989         }
01990     }
01991     return false;
01992 }

void help_helper ( dbref  executor,
int  iHelpfile,
char *  topic_arg,
char *  buff,
char **  bufc 
)

Definition at line 416 of file help.cpp.

References statedata::aHelpDesc, alloc_lbuf, free_lbuf, hashfindLEN(), HELP_DESC::ht, MakeCanonicalTopicName(), mudstate, ReportTopic(), safe_str, and ValidateHelpFileIndex().

Referenced by FUNCTION().

00418 {
00419     if (!ValidateHelpFileIndex(iHelpfile))
00420     {
00421         return;
00422     }
00423 
00424     const char *topic = MakeCanonicalTopicName(topic_arg);
00425 
00426     CHashTable *htab = mudstate.aHelpDesc[iHelpfile].ht;
00427     struct help_entry *htab_entry =
00428         (struct help_entry *)hashfindLEN(topic, strlen(topic), htab);
00429     if (htab_entry)
00430     {
00431         char *result = alloc_lbuf("help_helper");
00432         if (ReportTopic(executor, htab_entry, iHelpfile, result))
00433         {
00434             safe_str(result, buff, bufc);
00435         }
00436         else
00437         {
00438             safe_str("#-1 ERROR", buff, bufc);
00439         }
00440         free_lbuf(result);
00441     }
00442     else
00443     {
00444         safe_str("#-1 TOPIC DOES NOT EXIST", buff, bufc);
00445     }
00446 }

void helpindex_clean ( int   ) 

Definition at line 26 of file help.cpp.

References statedata::aHelpDesc, hash_firstentry(), hash_nextentry(), HELP_DESC::ht, help_entry::key, MEMFREE, and mudstate.

Referenced by helpindex_read(), and main().

00027 {
00028     CHashTable *htab = mudstate.aHelpDesc[iHelpfile].ht;
00029     if (htab == NULL)
00030     {
00031         return;
00032     }
00033     struct help_entry *htab_entry;
00034     for (htab_entry = (struct help_entry *)hash_firstentry(htab);
00035          htab_entry;
00036          htab_entry = (struct help_entry *)hash_nextentry(htab))
00037     {
00038         MEMFREE(htab_entry->key);
00039         htab_entry->key = NULL;
00040         MEMFREE(htab_entry);
00041         htab_entry = NULL;
00042     }
00043     delete mudstate.aHelpDesc[iHelpfile].ht;
00044     mudstate.aHelpDesc[iHelpfile].ht = NULL;
00045 }

void helpindex_init ( void   ) 

Definition at line 230 of file help.cpp.

References helpindex_load(), and NOTHING.

Referenced by main().

00231 {
00232     helpindex_load(NOTHING);
00233 }

void helpindex_load ( dbref   ) 

Definition at line 217 of file help.cpp.

References helpindex_read(), mudstate, statedata::nHelpDesc, NOTHING, notify, and Quiet.

Referenced by do_readcache(), and helpindex_init().

00218 {
00219     for (int i = 0; i < mudstate.nHelpDesc; i++)
00220     {
00221         helpindex_read(i);
00222     }
00223     if (  player != NOTHING
00224        && !Quiet(player))
00225     {
00226         notify(player, "Cache for help indexes refreshed.");
00227     }
00228 }

bool html_escape ( const char *  src,
char *  dest,
char **  destp 
)

Definition at line 538 of file game.cpp.

References safe_chr, and safe_str.

Referenced by look_contents(), look_exits(), and notify_check().

00539 {
00540     const char *msg_orig;
00541     bool ret = false;
00542 
00543     if (destp == 0)
00544     {
00545         char *temp = dest;
00546         destp = &temp;
00547     }
00548 
00549     for (msg_orig = src; msg_orig && *msg_orig && !ret; msg_orig++)
00550     {
00551         char *p = *destp;
00552         switch (*msg_orig)
00553         {
00554         case '<':
00555             safe_str("&lt;", dest, destp);
00556             break;
00557 
00558         case '>':
00559             safe_str("&gt;", dest, destp);
00560             break;
00561 
00562         case '&':
00563             safe_str("&amp;", dest, destp);
00564             break;
00565 
00566         case '\"':
00567             safe_str("&quot;", dest, destp);
00568             break;
00569 
00570         default:
00571             safe_chr(*msg_orig, dest, destp);
00572             break;
00573         }
00574 
00575         // For <>&\, this may cause an extra loop around before it figures out that we are
00576         // out of buffer, but no harm is done in this, and the common case is a single character.
00577         //
00578         if (p == *destp)
00579         {
00580             ret = true;
00581         }
00582     }
00583     **destp = 0;
00584     return ret;
00585 }

int init_dbfile ( char *  game_dir_file,
char *  game_pag_file,
int  nCachePages 
)

Definition at line 3083 of file db.cpp.

References statedata::bStandAlone, cache_init(), db_free(), ENDLINE, ENDLOG, HF_OPEN_STATUS_ERROR, Log, LOG_ALWAYS, mudstate, STARTLOG, and CLogFile::tinyprintf().

Referenced by dbconvert(), and main().

03084 {
03085     if (mudstate.bStandAlone)
03086     {
03087         Log.tinyprintf("Opening (%s,%s)" ENDLINE, game_dir_file, game_pag_file);
03088     }
03089     int cc = cache_init(game_dir_file, game_pag_file, nCachePages);
03090     if (cc != HF_OPEN_STATUS_ERROR)
03091     {
03092         if (mudstate.bStandAlone)
03093         {
03094             Log.tinyprintf("Done opening (%s,%s)." ENDLINE, game_dir_file,
03095                 game_pag_file);
03096         }
03097         else
03098         {
03099             STARTLOG(LOG_ALWAYS, "INI", "LOAD");
03100             Log.tinyprintf("Using game db files: (%s,%s).", game_dir_file,
03101                 game_pag_file);
03102             ENDLOG;
03103         }
03104         db_free();
03105     }
03106     return cc;
03107 }

void init_logout_cmdtab ( void   ) 

Definition at line 1903 of file netcommon.cpp.

References name_table::flag, hashaddLEN(), statedata::logout_cmd_htab, logout_cmdtable, mudstate, and name_table::name.

Referenced by main().

01904 {
01905     NAMETAB *cp;
01906 
01907     // Make the htab bigger than the number of entries so that we find things
01908     // on the first check.  Remember that the admin can add aliases.
01909     //
01910     for (cp = logout_cmdtable; cp->flag; cp++)
01911     {
01912         hashaddLEN(cp->name, strlen(cp->name), cp, &mudstate.logout_cmd_htab);
01913     }
01914 }

void init_timer ( void   ) 

Definition at line 211 of file timer.cpp.

References confdata::cache_tick_period, statedata::check_counter, confdata::check_interval, confdata::check_offset, CScheduler::DeferTask(), dispatch_CacheTick(), dispatch_CanRestart(), dispatch_CheckEvents(), dispatch_DatabaseDump(), dispatch_FreeListReconstruction(), dispatch_IdleCheck(), statedata::dump_counter, confdata::dump_interval, confdata::dump_offset, statedata::events_counter, CLinearTimeAbsolute::GetUTC(), statedata::idle_counter, confdata::idle_interval, mudconf, mudstate, PRIORITY_OBJECT, PRIORITY_SYSTEM, scheduler, CLinearTimeDelta::SetSeconds(), time_15s, time_30s, and time_45s.

Referenced by main().

00212 {
00213     CLinearTimeAbsolute ltaNow;
00214     ltaNow.GetUTC();
00215 
00216     // Setup re-occuring Free List Reconstruction task.
00217     //
00218     CLinearTimeDelta ltd;
00219     ltd.SetSeconds((mudconf.check_offset == 0) ? mudconf.check_interval : mudconf.check_offset);
00220     mudstate.check_counter  = ltaNow + ltd;
00221     scheduler.DeferTask(mudstate.check_counter, PRIORITY_SYSTEM,
00222         dispatch_FreeListReconstruction, 0, 0);
00223 
00224     // Setup re-occuring Database Dump task.
00225     //
00226     ltd.SetSeconds((mudconf.dump_offset == 0) ? mudconf.dump_interval : mudconf.dump_offset);
00227     mudstate.dump_counter  = ltaNow + ltd;
00228     scheduler.DeferTask(mudstate.dump_counter, PRIORITY_SYSTEM,
00229         dispatch_DatabaseDump, 0, 0);
00230 
00231     // Setup re-occuring Idle Check task.
00232     //
00233     ltd.SetSeconds(mudconf.idle_interval);
00234     mudstate.idle_counter   = ltaNow + ltd;
00235     scheduler.DeferTask(mudstate.idle_counter, PRIORITY_SYSTEM,
00236         dispatch_IdleCheck, 0, 0);
00237 
00238     // Setup re-occuring Check Events task.
00239     //
00240     mudstate.events_counter = ltaNow + time_15s;
00241     scheduler.DeferTask(mudstate.events_counter, PRIORITY_SYSTEM,
00242         dispatch_CheckEvents, 0, 0);
00243 
00244 #ifndef MEMORY_BASED
00245     // Setup re-occuring cache_tick task.
00246     //
00247     ltd.SetSeconds(0);
00248     if (mudconf.cache_tick_period <= ltd)
00249     {
00250         mudconf.cache_tick_period.SetSeconds(1);
00251     }
00252     scheduler.DeferTask(ltaNow+mudconf.cache_tick_period, PRIORITY_SYSTEM,
00253         dispatch_CacheTick, 0, 0);
00254 #endif // !MEMORY_BASED
00255 
00256 #if 0
00257     // Setup comsys channel scrubbing.
00258     //
00259     scheduler.DeferTask(ltaNow+time_45s, PRIORITY_SYSTEM, dispatch_CleanChannels, 0, 0);
00260 #endif // 0
00261 
00262     // Setup one-shot task to enable restarting 10 seconds after startmux.
00263     //
00264     scheduler.DeferTask(ltaNow+time_15s, PRIORITY_OBJECT, dispatch_CanRestart, 0, 0);
00265 
00266 #ifdef WIN32
00267     // Setup Periodic QueryPerformance Calibration.
00268     //
00269     scheduler.DeferTask(ltaNow+time_30s, PRIORITY_SYSTEM,
00270         dispatch_CalibrateQueryPerformance, 0, 0);
00271 
00272 #endif // WIN32
00273 }

void init_version ( void   ) 

Definition at line 60 of file version.cpp.

References ENDLOG, LOG_ALWAYS, log_text(), mudstate, MUX_BUILD_DATE, STARTLOG, and statedata::version.

Referenced by main().

00061 {
00062     STARTLOG(LOG_ALWAYS, "INI", "START");
00063     log_text("Starting: ");
00064     log_text(mudstate.version);
00065     ENDLOG;
00066     STARTLOG(LOG_ALWAYS, "INI", "START");
00067     log_text("Build date: ");
00068     log_text(MUX_BUILD_DATE);
00069     ENDLOG;
00070 }

dbref insert_first ( dbref  ,
dbref   
)

Definition at line 46 of file predicates.cpp.

References s_Next.

Referenced by do_clone(), do_drop(), do_get(), move_object(), and move_the_exit().

00047 {
00048     s_Next(thing, head);
00049     return thing;
00050 }

void list_cf_access ( dbref   ) 

Definition at line 2153 of file conf.cpp.

References access_nametab, alloc_mbuf, check_access(), conftable, confparm::flags, God, listset_nametab(), and confparm::pname.

Referenced by do_list().

02154 {
02155     CONF *tp;
02156     char *buff;
02157 
02158     buff = alloc_mbuf("list_cf_access");
02159     for (tp = conftable; tp->pname; tp++)
02160     {
02161         if (God(player) || check_access(player, tp->flags))
02162         {
02163             sprintf(buff, "%s:", tp->pname);
02164             listset_nametab(player, access_nametab, tp->flags, buff, true);
02165         }
02166     }
02167     free_mbuf(buff);
02168 }

bool list_check ( dbref  thing,
dbref  player,
char  type,
char *  str,
char *  raw_str,
bool  check_parent 
)

Definition at line 1863 of file game.cpp.

References atr_match(), CMuxAlarm::bAlarmed, statedata::db_top, IsReal, mudstate, MuxAlarm, next, Next, No_Command, and NOTHING.

Referenced by process_command().

01871 {
01872     bool bMatch = false;
01873 
01874     int limit = mudstate.db_top;
01875     while (NOTHING != thing)
01876     {
01877 #ifdef REALITY_LVLS
01878         if ((thing != player)
01879            && (!(No_Command(thing)))
01880            && IsReal(thing, player))
01881 #else
01882         if (  thing != player
01883            && !No_Command(thing))
01884 #endif /* REALITY_LVLS */
01885         {
01886             bMatch |= atr_match(thing, player, type, str, raw_str, check_parent);
01887         }
01888 
01889         // Non-authoritative test of circular reference.
01890         //
01891         dbref next;
01892         if (  thing == (next = Next(thing))
01893            || --limit < 0
01894            || MuxAlarm.bAlarmed)
01895         {
01896             break;
01897         }
01898         thing = next;
01899     }
01900     return bMatch;
01901 }

void list_siteinfo ( dbref   ) 

Definition at line 2670 of file netcommon.cpp.

References statedata::access_list, list_sites(), mudstate, S_ACCESS, S_SUSPECT, and statedata::suspect_list.

Referenced by do_list().

02671 {
02672     list_sites(player, mudstate.access_list, "Site Access", S_ACCESS);
02673     list_sites(player, mudstate.suspect_list, "Suspected Sites", S_SUSPECT);
02674 }

void list_system_resources ( dbref  player  ) 

Definition at line 4070 of file bsd.cpp.

References DebugTotalFiles, DebugTotalSockets, and notify.

Referenced by do_list().

04071 {
04072     char buffer[80];
04073 
04074     int nTotal = 0;
04075     notify(player, "System Resources");
04076 
04077     sprintf(buffer, "Total Open Files: %ld", DebugTotalFiles);
04078     notify(player, buffer);
04079     nTotal += DebugTotalFiles;
04080 
04081     sprintf(buffer, "Total Sockets: %ld", DebugTotalSockets);
04082     notify(player, buffer);
04083     nTotal += DebugTotalSockets;
04084 
04085 #ifdef WIN32
04086     sprintf(buffer, "Total Threads: %ld", DebugTotalThreads);
04087     notify(player, buffer);
04088     nTotal += DebugTotalThreads;
04089 
04090     sprintf(buffer, "Total Semaphores: %ld", DebugTotalSemaphores);
04091     notify(player, buffer);
04092     nTotal += DebugTotalSemaphores;
04093 #endif // WIN32
04094 
04095     sprintf(buffer, "Total Handles (sum of above): %d", nTotal);
04096     notify(player, buffer);
04097 
04098 #ifdef WIN32
04099     for (int i = 0; i < NUM_SLAVE_THREADS; i++)
04100     {
04101         sprintf(buffer, "Thread %d at line %u", i+1, SlaveThreadInfo[i].iDoing);
04102         notify(player, buffer);
04103     }
04104 #endif // WIN32
04105 }

void load_mail ( FILE *   ) 

Definition at line 3003 of file mail.cpp.

References load_mail_V5(), and load_malias().

Referenced by load_game().

03004 {
03005     char nbuf1[8];
03006 
03007     // Read the version number.
03008     //
03009     if (!fgets(nbuf1, sizeof(nbuf1), fp))
03010     {
03011         return;
03012     }
03013     if (strncmp(nbuf1, "+V5", 3) == 0)
03014     {
03015         load_mail_V5(fp);
03016     }
03017     else
03018     {
03019         return;
03020     }
03021     load_malias(fp);
03022 }

void load_player_names ( void   ) 

Definition at line 845 of file player.cpp.

References A_ALIAS, add_player_name(), alloc_lbuf, atr_pget_str(), DO_WHOLE_DB, free_lbuf, isPlayer, and Name.

Referenced by db_make_minimal(), and db_read().

00846 {
00847     dbref i;
00848     DO_WHOLE_DB(i)
00849     {
00850         if (isPlayer(i))
00851         {
00852             add_player_name(i, Name(i));
00853         }
00854     }
00855     char *alias = alloc_lbuf("load_player_names");
00856     DO_WHOLE_DB(i)
00857     {
00858         if (isPlayer(i))
00859         {
00860             dbref aowner;
00861             int aflags;
00862             alias = atr_pget_str(alias, i, A_ALIAS, &aowner, &aflags);
00863             if (*alias)
00864             {
00865                 add_player_name(i, alias);
00866             }
00867         }
00868     }
00869     free_lbuf(alias);
00870 }

void local_connect ( dbref  ,
int  ,
int   
)

Definition at line 152 of file local.cpp.

References UNUSED_PARAMETER.

Referenced by check_connect().

00153 {
00154     UNUSED_PARAMETER(player);
00155     UNUSED_PARAMETER(isnew);
00156     UNUSED_PARAMETER(num);
00157 }

void local_data_clone ( dbref  ,
dbref   
)

Definition at line 179 of file local.cpp.

References UNUSED_PARAMETER.

Referenced by do_clone().

00180 {
00181     UNUSED_PARAMETER(clone);
00182     UNUSED_PARAMETER(source);
00183 }

void local_data_create ( dbref   ) 

Definition at line 171 of file local.cpp.

References UNUSED_PARAMETER.

Referenced by create_player(), do_create(), do_dig(), FUNCTION(), and open_exit().

00172 {
00173     UNUSED_PARAMETER(object);
00174 }

void local_data_free ( dbref   ) 

Definition at line 187 of file local.cpp.

References UNUSED_PARAMETER.

Referenced by destroy_obj().

00188 {
00189     UNUSED_PARAMETER(object);
00190 }

void local_dbck ( void   ) 

Definition at line 144 of file local.cpp.

Referenced by do_dbck().

00145 {
00146 }

void local_disconnect ( dbref  ,
int   
)

Definition at line 163 of file local.cpp.

References UNUSED_PARAMETER.

Referenced by announce_disconnect().

00164 {
00165     UNUSED_PARAMETER(player);
00166     UNUSED_PARAMETER(num);
00167 }

void local_dump_complete_signal ( void   ) 

Definition at line 130 of file local.cpp.

Referenced by dump_database(), fork_and_dump(), and sighandler().

00131 {
00132 }

void local_dump_database ( int   ) 

Definition at line 118 of file local.cpp.

References UNUSED_PARAMETER.

Referenced by dump_database_internal().

00119 {
00120     UNUSED_PARAMETER(dump_type);
00121 }

void local_presync_database ( void   ) 

Definition at line 90 of file local.cpp.

Referenced by do_restart(), do_shutdown(), dump_database(), and fork_and_dump().

00091 {
00092 }

void local_presync_database_sigsegv ( void   ) 

Definition at line 98 of file local.cpp.

Referenced by sighandler().

00099 {
00100 }

void local_shutdown ( void   ) 

Definition at line 137 of file local.cpp.

Referenced by main().

00138 {
00139 }

void local_startup ( void   ) 

Definition at line 67 of file local.cpp.

References commands_no_arg_add(), commands_one_arg_add(), commands_one_arg_cmdarg_add(), commands_two_arg_add(), commands_two_arg_argv_add(), commands_two_arg_argv_cmdarg_add(), commands_two_arg_cmdarg_add(), functions_add(), local_command_table_no_arg, local_command_table_one_arg, local_command_table_one_arg_cmdarg, local_command_table_two_arg, local_command_table_two_arg_argv, local_command_table_two_arg_cmdarg, local_command_table_two_argv_cmdarg, and local_funlist.

Referenced by main().

bool locatable ( dbref  ,
dbref  ,
dbref   
)

Definition at line 2080 of file predicates.cpp.

References Examinable, Find_Unfindable, Findable, Good_obj, NOTHING, where_is(), where_room(), and Wizard.

Referenced by FUNCTION().

02081 {
02082     // No sense if trying to locate a bad object
02083     //
02084     if (!Good_obj(it))
02085     {
02086         return false;
02087     }
02088 
02089     dbref loc_it = where_is(it);
02090 
02091     // Succeed if we can examine the target, if we are the target, if we can
02092     // examine the location, if a wizard caused the lookup, or if the target
02093     // caused the lookup.
02094     //
02095     if (  Examinable(player, it)
02096        || Find_Unfindable(player)
02097        || loc_it == player
02098        || (  loc_it != NOTHING
02099           && (  Examinable(player, loc_it)
02100              || loc_it == where_is(player)))
02101        || Wizard(enactor)
02102        || it == enactor)
02103     {
02104         return true;
02105     }
02106 
02107     dbref room_it = where_room(it);
02108     bool findable_room;
02109     if (Good_obj(room_it))
02110     {
02111         findable_room = Findable(room_it);
02112     }
02113     else
02114     {
02115         findable_room = true;
02116     }
02117 
02118     // Succeed if we control the containing room or if the target is findable
02119     // and the containing room is not unfindable.
02120     //
02121     if (  (  room_it != NOTHING
02122           && Examinable(player, room_it))
02123        || Find_Unfindable(player)
02124        || (  Findable(it)
02125           && findable_room))
02126     {
02127         return true;
02128     }
02129 
02130     // We can't do it.
02131     //
02132     return false;
02133 }

void log_name ( dbref   ) 

Definition at line 169 of file log.cpp.

References statedata::bStandAlone, free_lbuf, GOD, Log, confdata::log_info, LOGOPT_FLAGS, LOGOPT_OWNER, mudconf, mudstate, Name, Owner, strip_ansi(), CLogFile::tinyprintf(), unparse_object(), unparse_object_numonly(), and CLogFile::WriteString().

Referenced by CF_HAND(), check_connect(), do_backup(), do_boot(), do_fixdb(), do_global(), do_name(), do_newpassword(), do_pcreate(), do_quota(), do_restart(), do_shout(), do_shutdown(), do_toad(), failconn(), log_name_and_loc(), queue_write_LEN(), report_timecheck(), and shutdownsock().

00170 {
00171     if (mudstate.bStandAlone)
00172     {
00173         Log.tinyprintf("%s(#%d)", Name(target), target);
00174     }
00175     else
00176     {
00177         char *tp;
00178 
00179         if (mudconf.log_info & LOGOPT_FLAGS)
00180         {
00181             tp = unparse_object(GOD, target, false);
00182         }
00183         else
00184         {
00185             tp = unparse_object_numonly(target);
00186         }
00187         Log.WriteString(strip_ansi(tp));
00188         free_lbuf(tp);
00189         if (  (mudconf.log_info & LOGOPT_OWNER)
00190            && target != Owner(target))
00191         {
00192             if (mudconf.log_info & LOGOPT_FLAGS)
00193             {
00194                 tp = unparse_object(GOD, Owner(target), false);
00195             }
00196             else
00197             {
00198                 tp = unparse_object_numonly(Owner(target));
00199             }
00200             Log.tinyprintf("[%s]", strip_ansi(tp));
00201             free_lbuf(tp);
00202         }
00203     }
00204 }

void log_name_and_loc ( dbref   ) 

Definition at line 210 of file log.cpp.

References Has_location, Location, confdata::log_info, log_name(), log_text(), LOGOPT_LOC, and mudconf.

Referenced by check_connect(), do_boot(), do_command(), do_toad(), eval_boolexp(), process_command(), report(), and Task_RunQueueEntry().

00211 {
00212     log_name(player);
00213     if (  (mudconf.log_info & LOGOPT_LOC)
00214        && Has_location(player))
00215     {
00216         log_text(" in ");
00217         log_name(Location(player));
00218     }
00219     return;
00220 }

void log_number ( int   ) 

Definition at line 148 of file log.cpp.

References Log, and CLogFile::WriteInteger().

Referenced by boot_slave(), Log_header_err(), report_timecheck(), and shovechars().

00149 {
00150     Log.WriteInteger(num);
00151 }

void log_perror ( const char *  ,
const char *  ,
const char *  ,
const char *   
)

Definition at line 117 of file log.cpp.

References ENDLINE, CLogFile::Flush(), Log, log_text(), statedata::logging, mudstate, start_log(), and CLogFile::WriteString().

Referenced by close_sockets(), dump_database_internal(), fork_and_dump(), make_nolinger(), make_nonblocking(), make_socket(), and shovechars().

00118 {
00119     start_log(primary, secondary);
00120     if (extra && *extra)
00121     {
00122         log_text("(");
00123         log_text(extra);
00124         log_text(") ");
00125     }
00126 
00127     // <Failing_object text>: <strerror() text>
00128     //
00129     Log.WriteString(failing_object);
00130     Log.WriteString(": ");
00131     Log.WriteString(strerror(errno));
00132 #ifndef WIN32
00133     Log.WriteString(ENDLINE);
00134 #endif // !WIN32
00135     Log.Flush();
00136     mudstate.logging--;
00137 }

void DCL_CDECL log_printf ( const char *  fmt,
  ... 
)

Definition at line 153 of file log.cpp.

References Log, mux_vsnprintf(), SIZEOF_LOG_BUFFER, and CLogFile::WriteBuffer().

00154 {
00155     va_list ap;
00156     va_start(ap, fmt);
00157     char aTempBuffer[SIZEOF_LOG_BUFFER];
00158     int nString = mux_vsnprintf(aTempBuffer, SIZEOF_LOG_BUFFER, fmt, ap);
00159     va_end(ap);
00160     Log.WriteBuffer(nString, aTempBuffer);
00161 }

void log_text ( const char *   ) 

Definition at line 143 of file log.cpp.

References Log, strip_ansi(), and CLogFile::WriteString().

Referenced by announce_connect(), announce_disconnect(), boot_slave(), CF_HAND(), cf_log_syntax(), cf_status_from_succfail(), check_connect(), do_backup(), do_boot(), do_command(), do_fixdb(), do_global(), do_link(), do_logged_out_internal(), do_mail_nuke(), do_mail_read(), do_name(), do_newpassword(), do_pcreate(), do_quota(), do_restart(), do_shout(), do_shutdown(), do_toad(), dump_database(), eval_boolexp(), failconn(), fcache_read(), fork_and_dump(), get_slave_result(), helpindex_read(), init_version(), CHashFile::Insert(), load_game(), Log_header_err(), log_name_and_loc(), log_perror(), Log_pointer_err(), log_signal(), log_signal_ignore(), Log_simple_err(), log_type_and_name(), LogStatBuf(), main(), CGuests::MakeGuestChar(), new_connection(), new_mail_message(), pool_free(), pool_free_lbuf(), process_command(), purge_going(), queue_write_LEN(), report(), report_timecheck(), ReportTopic(), shovechars(), shutdownsock(), Task_RunQueueEntry(), and ValidateHelpFileIndex().

00144 {
00145     Log.WriteString(strip_ansi(text));
00146 }

void log_type_and_name ( dbref   ) 

Definition at line 245 of file log.cpp.

References Good_obj, log_text(), Name, and OBJTYP().

Referenced by Log_header_err(), Log_pointer_err(), Log_simple_err(), and purge_going().

00246 {
00247     char nbuf[16];
00248 
00249     log_text(OBJTYP(thing));
00250     sprintf(nbuf, " #%d(", thing);
00251     log_text(nbuf);
00252     if (Good_obj(thing))
00253     {
00254         log_text(Name(thing));
00255     }
00256     log_text(")");
00257     return;
00258 }

void logged_out0 ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key 
)

Definition at line 2512 of file netcommon.cpp.

References logged_out1().

02513 {
02514     logged_out1(executor, caller, enactor, key, "");
02515 }

void logged_out1 ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  arg 
)

Definition at line 2473 of file netcommon.cpp.

References DESC_ITER_PLAYER, do_logged_out_internal(), descriptor_data::last_time, s_Html, and UNUSED_PARAMETER.

Referenced by logged_out0().

02474 {
02475     UNUSED_PARAMETER(caller);
02476     UNUSED_PARAMETER(enactor);
02477 
02478     // PUEBLOCLIENT affects all the player's connections.
02479     //
02480     if (key == CMD_PUEBLOCLIENT)
02481     {
02482         DESC *d;
02483         DESC_ITER_PLAYER(executor, d)
02484         {
02485             do_logged_out_internal(d, key, arg);
02486         }
02487         // Set the player's flag.
02488         //
02489         s_Html(executor);
02490         return;
02491     }
02492 
02493     // Other logged-out commands affect only the player's most recently
02494     // used connection.
02495     //
02496     DESC *d;
02497     DESC *dLatest = NULL;
02498     DESC_ITER_PLAYER(executor, d)
02499     {
02500         if (  dLatest == NULL
02501            || dLatest->last_time < d->last_time)
02502         {
02503             dLatest = d;
02504         }
02505     }
02506     if (dLatest != NULL)
02507     {
02508         do_logged_out_internal(dLatest, key, arg);
02509     }
02510 }

void look_in ( dbref  ,
dbref  ,
int   
)

Definition at line 1201 of file look.cpp.

References A_AFAIL, A_ASUCC, A_FAIL, A_LOCK, A_NAMEFORMAT, A_OFAIL, A_OSUCC, A_SUCC, alloc_lbuf, atr_pget, CONTENTS_LOCAL, could_doit(), did_it(), EV_EVAL, EV_FCHECK, EV_TOP, free_lbuf, Good_obj, Hearer(), Html, isRoom, LK_IDESC, LK_OBEYTERSE, LK_SHOWATTR, LK_SHOWEXIT, LK_SHOWVRML, Location, look_atrs(), look_contents(), look_exits(), MAX_GLOBAL_REGS, mudconf, mux_exec(), notify, notify_html, confdata::quiet_look, restore_global_regs(), save_and_clear_global_regs(), show_desc(), show_vrml_url(), Terse, confdata::terse_contents, confdata::terse_exits, and unparse_object().

Referenced by announce_connect(), do_look(), and move_object().

01202 {
01203     // Only makes sense for things that can hear.
01204     //
01205     if (!Hearer(player))
01206     {
01207         return;
01208     }
01209 
01210     // If he needs the VMRL URL, send it:
01211     //
01212     if (key & LK_SHOWVRML)
01213     {
01214         show_vrml_url(player, loc);
01215     }
01216 
01217     // Use @nameformat (by Marlek) if it's present, otherwise, use the
01218     // name and if the player can link to it, it's dbref as well.
01219     //
01220     dbref aowner;
01221     int aflags;
01222     char *NameFormatBuffer = atr_pget(loc, A_NAMEFORMAT, &aowner, &aflags);
01223     char *NameFormat = NameFormatBuffer;
01224 
01225     if (*NameFormat)
01226     {
01227         char *FormatOutput = alloc_lbuf("look_name.FO");
01228         char *tPtr = FormatOutput;
01229 
01230         char *preserve[MAX_GLOBAL_REGS];
01231         int preserve_len[MAX_GLOBAL_REGS];
01232         save_and_clear_global_regs("look_in_save", preserve, preserve_len);
01233 
01234         mux_exec(FormatOutput, &tPtr, loc, player, player,
01235                 EV_FCHECK | EV_EVAL | EV_TOP,
01236                 &NameFormat, 0, 0);
01237         *tPtr = '\0';
01238 
01239         restore_global_regs("look_in_restore", preserve, preserve_len);
01240         notify(player, FormatOutput);
01241 
01242         free_lbuf(FormatOutput);
01243     }
01244     else
01245     {
01246         // Okay, no @NameFormat.  Show the normal name.
01247         //
01248         char *buff = unparse_object(player, loc, true);
01249         if (Html(player))
01250         {
01251             notify_html(player, "<center><h3>");
01252             notify(player, buff);
01253             notify_html(player, "</h3></center>");
01254         }
01255         else
01256         {
01257             notify(player, buff);
01258         }
01259         free_lbuf(buff);
01260     }
01261     free_lbuf(NameFormatBuffer);
01262 
01263     if (!Good_obj(loc))
01264     {
01265         // If we went to NOTHING et al, then skip the rest.
01266         //
01267         return;
01268     }
01269 
01270     // Tell him the description.
01271     //
01272     int showkey = 0;
01273     if (loc == Location(player))
01274     {
01275         showkey |= LK_IDESC;
01276     }
01277     if (key & LK_OBEYTERSE)
01278     {
01279         showkey |= LK_OBEYTERSE;
01280     }
01281     show_desc(player, loc, showkey);
01282 
01283     bool is_terse = (key & LK_OBEYTERSE) ? Terse(player) : false;
01284 
01285     // Tell him the appropriate messages if he has the key.
01286     //
01287     if (isRoom(loc))
01288     {
01289         int pattr, oattr, aattr;
01290         if (could_doit(player, loc, A_LOCK))
01291         {
01292             pattr = A_SUCC;
01293             oattr = A_OSUCC;
01294             aattr = A_ASUCC;
01295         }
01296         else
01297         {
01298             pattr = A_FAIL;
01299             oattr = A_OFAIL;
01300             aattr = A_AFAIL;
01301         }
01302         if (is_terse)
01303         {
01304             pattr = 0;
01305         }
01306         did_it(player, loc, pattr, NULL, oattr, NULL, aattr, (char **)NULL, 0);
01307     }
01308 
01309     // Tell him the attributes, contents and exits.
01310     //
01311     if (  (key & LK_SHOWATTR)
01312        && !mudconf.quiet_look
01313        && !is_terse)
01314     {
01315         look_atrs(player, loc, false);
01316     }
01317     if (  !is_terse
01318        || mudconf.terse_contents)
01319     {
01320         look_contents(player, loc, "Contents:", CONTENTS_LOCAL);
01321     }
01322     if (  (key & LK_SHOWEXIT)
01323        && (  !is_terse
01324           || mudconf.terse_exits))
01325     {
01326         look_exits(player, loc, "Obvious exits:");
01327     }
01328 }

dbref lookup_player ( dbref  ,
char *  ,
bool   
)

Definition at line 780 of file player.cpp.

References alloc_lbuf, find_connected_name(), free_lbuf, God, Good_obj, hashfindLEN(), Hidden, is_integer(), isPlayer, LOOKUP_TOKEN, mudstate, mux_atol(), mux_strlwr(), NOTHING, NUMBER_TOKEN, statedata::player_htab, safe_str, and string_compare().

Referenced by connect_player(), CGuests::Create(), create_obj(), do_alias(), do_chown(), do_editchannel(), do_fixdb(), do_icmd(), do_last(), do_mail_debug(), do_mail_retract1(), do_mail_review(), do_mail_stats(), do_malias_add(), do_malias_chown(), do_malias_create(), do_malias_remove(), do_name(), do_newpassword(), do_page(), do_quota(), do_stats(), FUNCTION(), internalPlayerFind(), make_numlist(), CGuests::MakeGuestChar(), match_player(), parse_msglist(), and search_setup().

00781 {
00782     if (string_compare(name, "me") == 0)
00783     {
00784         return doer;
00785     }
00786 
00787     while (*name == LOOKUP_TOKEN)
00788     {
00789         name++;
00790     }
00791     dbref thing;
00792     if (*name == NUMBER_TOKEN)
00793     {
00794         name++;
00795         if (!is_integer(name, NULL))
00796         {
00797             return NOTHING;
00798         }
00799         thing = mux_atol(name);
00800         if (!Good_obj(thing))
00801         {
00802             return NOTHING;
00803         }
00804         if ( !(  isPlayer(thing)
00805               || God(doer)))
00806         {
00807             thing = NOTHING;
00808         }
00809         return thing;
00810     }
00811     char *temp, *tp;
00812     tp = temp = alloc_lbuf("lookup_player");
00813     safe_str(name, temp, &tp);
00814     *tp = '\0';
00815     mux_strlwr(temp);
00816     dbref *p = (int *)hashfindLEN(temp, strlen(temp), &mudstate.player_htab);
00817     free_lbuf(temp);
00818     if (!p)
00819     {
00820         if (check_who)
00821         {
00822             thing = find_connected_name(doer, name);
00823             if (Hidden(thing))
00824             {
00825                 thing = NOTHING;
00826             }
00827         }
00828         else
00829         {
00830             thing = NOTHING;
00831         }
00832     }
00833     else if (!Good_obj(*p))
00834     {
00835         thing = NOTHING;
00836     }
00837     else
00838     {
00839         thing = *p;
00840     }
00841 
00842     return thing;
00843 }

struct mail* mail_fetch ( dbref  ,
int   
)

Definition at line 1976 of file mail.cpp.

References MailList::FirstItem(), Folder, MailList::IsEnd(), MailList::NextItem(), and player_folder().

Referenced by do_mail_fwd(), do_mail_reply(), mail_fetch_from(), and mail_fetch_message().

01977 {
01978     int i = 0;
01979     MailList ml(player);
01980     struct mail *mp;
01981     for (mp = ml.FirstItem(); !ml.IsEnd(); mp = ml.NextItem())
01982     {
01983         if (Folder(mp) == player_folder(player))
01984         {
01985             i++;
01986             if (i == num)
01987             {
01988                 return mp;
01989             }
01990         }
01991     }
01992     return NULL;
01993 }

int mail_fetch_from ( dbref  player,
int  num 
)

Definition at line 2005 of file mail.cpp.

References mail::from, mail_fetch(), and NOTHING.

Referenced by FUNCTION().

02006 {
02007     struct mail *mp = mail_fetch(player, num);
02008     if (mp)
02009     {
02010         return mp->from;
02011     }
02012     return NOTHING;
02013 }

const char* mail_fetch_message ( dbref  player,
int  num 
)

Definition at line 1995 of file mail.cpp.

References mail_fetch(), MessageFetch(), and mail::number.

Referenced by FUNCTION().

01996 {
01997     struct mail *mp = mail_fetch(player, num);
01998     if (mp)
01999     {
02000         return MessageFetch(mp->number);
02001     }
02002     return NULL;
02003 }

void make_portlist ( dbref  ,
dbref  ,
char *  ,
char **   
)

Definition at line 35 of file netcommon.cpp.

References DESC_ITER_CONN, descriptor_data::descriptor, ItemToList_AddInteger(), ItemToList_Final(), ItemToList_Init(), descriptor_data::player, and UNUSED_PARAMETER.

Referenced by FUNCTION().

00036 {
00037     UNUSED_PARAMETER(player);
00038 
00039     ITL itl;
00040     ItemToList_Init(&itl, buff, bufc);
00041 
00042     DESC *d;
00043     DESC_ITER_CONN(d)
00044     {
00045         if (  d->player == target
00046            && !ItemToList_AddInteger(&itl, d->descriptor))
00047         {
00048             break;
00049         }
00050     }
00051     ItemToList_Final(&itl);
00052 }

char* MakeCanonicalExitName ( const char *  pName,
int *  pnName,
bool *  pbValid 
)

Definition at line 374 of file predicates.cpp.

References ANSI_ENDGOAL_NORMAL, ANSI_TruncateToField(), MakeCanonicalObjectName(), MBUF_SIZE, safe_mb_chr, safe_mb_str, and strip_ansi().

Referenced by create_obj(), and do_name().

00375 {
00376     static char Buf[MBUF_SIZE];
00377     static char Out[MBUF_SIZE];
00378 
00379     *pnName = 0;
00380     *pbValid = false;
00381 
00382     if (!pName)
00383     {
00384         return NULL;
00385     }
00386 
00387     // Build the non-ANSI version so that we can parse for semicolons
00388     // safely.
00389     //
00390     char *pStripped = strip_ansi(pName);
00391     char *pBuf = Buf;
00392     safe_mb_str(pStripped, Buf, &pBuf);
00393     *pBuf = '\0';
00394 
00395     size_t nBuf = pBuf - Buf;
00396     pBuf = Buf;
00397 
00398     bool bHaveDisplay = false;
00399 
00400     char *pOut = Out;
00401 
00402     for (; nBuf;)
00403     {
00404         // Build (q,n) as the next segment.  Leave the the remaining segments as
00405         // (pBuf,nBuf).
00406         //
00407         char *q = strchr(pBuf, ';');
00408         size_t n;
00409         if (q)
00410         {
00411             *q = '\0';
00412             n = q - pBuf;
00413             q = pBuf;
00414             pBuf += n + 1;
00415             nBuf -= n + 1;
00416         }
00417         else
00418         {
00419             n = nBuf;
00420             q = pBuf;
00421             pBuf += nBuf;
00422             nBuf = 0;
00423         }
00424 
00425         if (bHaveDisplay)
00426         {
00427             // We already have the displayable name. We don't allow ANSI in
00428             // any segment but the first, so we can pull them directly from
00429             // the stripped buffer.
00430             //
00431             int  nN;
00432             bool bN;
00433             char *pN = MakeCanonicalObjectName(q, &nN, &bN);
00434             if (  bN
00435                && nN < MBUF_SIZE - (pOut - Out) - 1)
00436             {
00437                 safe_mb_chr(';', Out, &pOut);
00438                 safe_mb_str(pN, Out, &pOut);
00439             }
00440         }
00441         else
00442         {
00443             // We don't have the displayable name, yet. We know where the next
00444             // semicolon occurs, so we limit the visible width of the
00445             // truncation to that.  We should be picking up all the visible
00446             // characters leading up to the semicolon, but not including the
00447             // semi-colon.
00448             //
00449             int vw;
00450             ANSI_TruncateToField(pName, sizeof(Out), Out, n, &vw,
00451                 ANSI_ENDGOAL_NORMAL);
00452 
00453             // vw should always be equal to n, but we'll just make sure.
00454             //
00455             if ((size_t)vw == n)
00456             {
00457                 int  nN;
00458                 bool bN;
00459                 char *pN = MakeCanonicalObjectName(Out, &nN, &bN);
00460                 if (  bN
00461                    && nN <= MBUF_SIZE - 1)
00462                 {
00463                     safe_mb_str(pN, Out, &pOut);
00464                     bHaveDisplay = true;
00465                 }
00466             }
00467         }
00468     }
00469     if (bHaveDisplay)
00470     {
00471         *pnName = pOut - Out;
00472         *pbValid = true;
00473         *pOut = '\0';
00474         return Out;
00475     }
00476     else
00477     {
00478         return NULL;
00479     }
00480 }

char* MakeCanonicalObjectName ( const char *  pName,
int *  pnName,
bool *  pbValid 
)

Definition at line 305 of file predicates.cpp.

References ANSI_ENDGOAL_NORMAL, ANSI_TruncateToField(), MBUF_SIZE, mux_isspace, mux_ObjectNameSet, and strip_ansi().

Referenced by create_obj(), do_clone(), do_fixdb(), do_name(), FUNCTION(), and MakeCanonicalExitName().

00306 {
00307     static char Buf[MBUF_SIZE];
00308 
00309     *pnName = 0;
00310     *pbValid = false;
00311 
00312     if (!pName)
00313     {
00314         return NULL;
00315     }
00316 
00317     // Build up what the real name would be. If we pass all the
00318     // checks, this is what we will return as a result.
00319     //
00320     int nVisualWidth;
00321     int nBuf = ANSI_TruncateToField(pName, sizeof(Buf), Buf, MBUF_SIZE,
00322         &nVisualWidth, ANSI_ENDGOAL_NORMAL);
00323 
00324     // Disallow pure ANSI names. There must be at least -something-
00325     // visible.
00326     //
00327     if (nVisualWidth <= 0)
00328     {
00329         return NULL;
00330     }
00331 
00332     // Get the stripped version (Visible parts without color info).
00333     //
00334     size_t nStripped;
00335     char *pStripped = strip_ansi(Buf, &nStripped);
00336 
00337     // Do not allow LOOKUP_TOKEN, NUMBER_TOKEN, NOT_TOKEN, or SPACE
00338     // as the first character, or SPACE as the last character
00339     //
00340     if (  strchr("*!#", *pStripped)
00341        || mux_isspace(pStripped[0])
00342        || mux_isspace(pStripped[nStripped-1]))
00343     {
00344         return NULL;
00345     }
00346 
00347     // Only printable characters besides ARG_DELIMITER, AND_TOKEN,
00348     // and OR_TOKEN are allowed.
00349     //
00350     for (unsigned int i = 0; i < nStripped; i++)
00351     {
00352         if (!mux_ObjectNameSet(pStripped[i]))
00353         {
00354             return NULL;
00355         }
00356     }
00357 
00358     // Special names are specifically dis-allowed.
00359     //
00360     if (  (nStripped == 2 && memcmp("me", pStripped, 2) == 0)
00361        || (nStripped == 4 && (  memcmp("home", pStripped, 4) == 0
00362                              || memcmp("here", pStripped, 4) == 0)))
00363     {
00364         return NULL;
00365     }
00366 
00367     *pnName = nBuf;
00368     *pbValid = true;
00369     return Buf;
00370 }

double MakeSpecialFloat ( int  iWhich  ) 

Definition at line 82 of file funmath.cpp.

References SpecialFloatUnion::d, and SpecialFloatTable.

Referenced by mux_atof().

00083 {
00084     return SpecialFloatTable[iWhich].d;
00085 }

void malias_cleanup ( dbref  player  ) 

Definition at line 4210 of file mail.cpp.

References ma_top, malias, and malias_cleanup1().

Referenced by ReleaseAllResources().

04211 {
04212     for (int i = 0; i < ma_top; i++)
04213     {
04214         malias_cleanup1(malias[i], player);
04215     }
04216 }

dbref match_controlled_handler ( dbref  player,
const char *  name,
bool  bQuiet 
)

Definition at line 22 of file set.cpp.

References Controls, Good_obj, init_match(), MAT_EXIT_PARENTS, match_everything(), match_result(), noisy_match_result(), NOPERM_MESSAGE, NOTHING, notify_quiet, and NOTYPE.

00023 {
00024     dbref mat;
00025     init_match(executor, name, NOTYPE);
00026     match_everything(MAT_EXIT_PARENTS);
00027     if (bQuiet)
00028     {
00029         mat = match_result();
00030     }
00031     else
00032     {
00033         mat = noisy_match_result();
00034     }
00035     if (!Good_obj(mat))
00036     {
00037         return mat;
00038     }
00039 
00040     if (Controls(executor, mat))
00041     {
00042         return mat;
00043     }
00044     if (!bQuiet)
00045     {
00046         notify_quiet(executor, NOPERM_MESSAGE);
00047     }
00048     return NOTHING;
00049 }

dbref match_possessed ( dbref  ,
dbref  ,
char *  ,
dbref  ,
bool   
)

Definition at line 1599 of file predicates.cpp.

References alloc_lbuf, Controls, d1, Dark, Enter_ok, free_lbuf, Good_obj, init_match(), match_neighbor(), match_possessed(), match_possession(), match_result(), NOPERM, NOTHING, NOTYPE, Opaque, and promote_dflt().

Referenced by do_get(), do_look(), and match_possessed().

01600 {
01601     // First, check normally.
01602     //
01603     if (Good_obj(dflt))
01604     {
01605         return dflt;
01606     }
01607 
01608     // Didn't find it directly.  Recursively do a contents check.
01609     //
01610     dbref result, result1;
01611     char *buff, *place, *s1, *d1, *temp;
01612     char *start = target;
01613     while (*target)
01614     {
01615         // Fail if no ' characters.
01616         //
01617         place = target;
01618         target = strchr(place, '\'');
01619         if (  target == NULL
01620            || !*target)
01621         {
01622             return dflt;
01623         }
01624 
01625         // If string started with a ', skip past it
01626         //
01627         if (place == target)
01628         {
01629             target++;
01630             continue;
01631         }
01632 
01633         // If next character is not an s or a space, skip past
01634         //
01635         temp = target++;
01636         if (!*target)
01637         {
01638             return dflt;
01639         }
01640         if (  *target != 's'
01641            && *target != 'S'
01642            && *target != ' ')
01643         {
01644             continue;
01645         }
01646 
01647         // If character was not a space make sure the following character is
01648         // a space.
01649         //
01650         if (*target != ' ')
01651         {
01652             target++;
01653             if (!*target)
01654             {
01655                 return dflt;
01656             }
01657             if (*target != ' ')
01658             {
01659                 continue;
01660             }
01661         }
01662 
01663         // Copy the container name to a new buffer so we can terminate it.
01664         //
01665         buff = alloc_lbuf("is_posess");
01666         for (s1 = start, d1 = buff; *s1 && (s1 < temp); *d1++ = (*s1++))
01667         {
01668             ; // Nothing.
01669         }
01670         *d1 = '\0';
01671 
01672         // Look for the container here and in our inventory.  Skip past if we
01673         // can't find it.
01674         //
01675         init_match(thing, buff, NOTYPE);
01676         if (player == thing)
01677         {
01678             match_neighbor();
01679             match_possession();
01680         }
01681         else
01682         {
01683             match_possession();
01684         }
01685         result1 = match_result();
01686 
01687         free_lbuf(buff);
01688         if (!Good_obj(result1))
01689         {
01690             dflt = promote_dflt(dflt, result1);
01691             continue;
01692         }
01693 
01694         // If we don't control it and it is either dark or opaque, skip past.
01695         //
01696         bool control = Controls(player, result1);
01697         if (  (  Dark(result1)
01698               || Opaque(result1))
01699            && !control)
01700         {
01701             dflt = promote_dflt(dflt, NOTHING);
01702             continue;
01703         }
01704 
01705         // Validate object has the ENTER bit set, if requested.
01706         //
01707         if (  check_enter
01708            && !Enter_ok(result1)
01709            && !control)
01710         {
01711             dflt = promote_dflt(dflt, NOPERM);
01712             continue;
01713         }
01714 
01715         // Look for the object in the container.
01716         //
01717         init_match(result1, target, NOTYPE);
01718         match_possession();
01719         result = match_result();
01720         result = match_possessed(player, result1, target, result, check_enter);
01721         if (Good_obj(result))
01722         {
01723             return result;
01724         }
01725         dflt = promote_dflt(dflt, result);
01726     }
01727     return dflt;
01728 }

bool member ( dbref  ,
dbref   
)

Definition at line 95 of file predicates.cpp.

References DOLIST.

Referenced by eval_boolexp().

00096 {
00097     DOLIST(list, list)
00098     {
00099         if (list == thing)
00100         {
00101             return true;
00102         }
00103     }
00104     return false;
00105 }

char* modSpeech ( dbref  player,
char *  message,
bool  bWhich,
char *  command 
)

Definition at line 19 of file speech.cpp.

References A_SAYSTRING, A_SPEECHMOD, alloc_lbuf, atr_get, CMuxAlarm::bAlarmed, EV_EVAL, EV_FCHECK, EV_TOP, free_lbuf, mux_exec(), and MuxAlarm.

Referenced by BuildChannelMessage(), do_page(), do_pemit_single(), do_say(), do_shout(), and whisper_pose().

00020 {
00021     dbref aowner;
00022     int aflags;
00023     char *mod = atr_get(player, bWhich ? A_SPEECHMOD : A_SAYSTRING,
00024         &aowner, &aflags);
00025 
00026     if (  mod[0] == '\0'
00027        || MuxAlarm.bAlarmed)
00028     {
00029         free_lbuf(mod);
00030         return NULL;
00031     }
00032 
00033     char *mod_orig = mod;
00034     char *new_message = alloc_lbuf("modspeech");
00035     char *t_ptr = new_message;
00036     char *args[2];
00037     args[0] = message;
00038     args[1] = command;
00039     mux_exec(new_message, &t_ptr, player, player, player,
00040         EV_FCHECK | EV_EVAL | EV_TOP, &mod, args, 2);
00041     *t_ptr = '\0';
00042     free_lbuf(mod_orig);
00043     return new_message;
00044 }

const char* Moniker ( dbref  thing  ) 

Definition at line 528 of file db.cpp.

References A_MONIKER, aszSpecialDBRefNames, atr_get_LEN(), confdata::cache_names, db, free_lbuf, LBUF_SIZE, MEMFREE, object::moniker, mudconf, object::name, Name, PureName(), StringClone(), StringCloneLen(), strip_accents(), and strip_ansi().

Referenced by announce_connect(), announce_disconnect(), BuildChannelMessage(), do_chanlist(), do_chboot(), do_destroy(), do_page(), do_pemit_single(), do_say(), do_shout(), do_train(), FUNCTION(), mail_check(), mail_return(), page_check(), page_return(), say_shout(), trimmed_name(), unparse_object(), and whisper_pose().

00529 {
00530     if (thing < 0)
00531     {
00532         return aszSpecialDBRefNames[-thing];
00533     }
00534     if (db[thing].moniker)
00535     {
00536         return db[thing].moniker;
00537     }
00538 
00539     // Compare accent-stripped, ansi-stripped version of @moniker against
00540     // accent-stripped, ansi-stripped version of @name.
00541     //
00542     const char *pPureName = strip_accents(PureName(thing));
00543     char *pPureNameCopy = StringClone(pPureName);
00544 
00545     size_t nMoniker;
00546     dbref  aowner;
00547     int    aflags;
00548     char *pMoniker = atr_get_LEN(thing, A_MONIKER, &aowner, &aflags,
00549         &nMoniker);
00550     char *pPureMoniker = strip_accents(strip_ansi(pMoniker));
00551 
00552     const char *pReturn = NULL;
00553     static char tbuff[LBUF_SIZE];
00554     if (strcmp(pPureNameCopy, pPureMoniker) == 0)
00555     {
00556         // The stripped version of @moniker is the same as the stripped
00557         // version of @name, so (possibly cache and) use the unstripped
00558         // version of @moniker.
00559         //
00560         if (mudconf.cache_names)
00561         {
00562 #ifdef MEMORY_BASED
00563             db[thing].moniker = StringCloneLen(pMoniker, nMoniker);
00564 #else // MEMORY_BASED
00565             if (strcmp(pMoniker, Name(thing)) == 0)
00566             {
00567                 db[thing].moniker = db[thing].name;
00568             }
00569             else
00570             {
00571                 db[thing].moniker = StringCloneLen(pMoniker, nMoniker);
00572             }
00573 #endif // MEMORY_BASED
00574             pReturn = db[thing].moniker;
00575         }
00576         else
00577         {
00578             memcpy(tbuff, pMoniker, nMoniker+1);
00579             pReturn = tbuff;
00580         }
00581     }
00582     else
00583     {
00584         // @moniker can't be used, so instead reflect @name (whether it
00585         // contains ANSI color and accents or not).
00586         //
00587 #ifdef MEMORY_BASED
00588         if (mudconf.cache_names)
00589         {
00590             db[thing].moniker = StringClone(Name(thing));
00591             pReturn = db[thing].moniker;
00592         }
00593         else
00594         {
00595             pReturn = Name(thing);
00596         }
00597 #else // MEMORY_BASED
00598         if (mudconf.cache_names)
00599         {
00600             db[thing].moniker = db[thing].name;
00601             pReturn = db[thing].moniker;
00602         }
00603         else
00604         {
00605             pReturn = Name(thing);
00606         }
00607 #endif // MEMORY_BASED
00608     }
00609     free_lbuf(pMoniker);
00610     MEMFREE(pPureNameCopy);
00611 
00612     return pReturn;
00613 }

void move_exit ( dbref  ,
dbref  ,
bool  ,
const char *  ,
int   
)

Definition at line 468 of file move.cpp.

References A_AFAIL, A_EXITVARDEST, A_FAIL, A_LOCK, A_OFAIL, atr_get_raw(), atr_pget, could_doit(), Dark, did_it(), divest_object(), free_lbuf, get_atr(), get_exit_dest(), Going, Good_obj, HOME, Home, HUSH_EXIT, Location, move_via_exit(), NOTHING, notify, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, and Wizard.

Referenced by do_move(), do_teleport_single(), and process_command().

00469 {
00470     int oattr, aattr;
00471     bool bDoit = false;
00472 
00473     dbref loc = Location(exit);
00474     if (atr_get_raw(exit, A_EXITVARDEST) != NULL)
00475     {
00476         loc = get_exit_dest(player, exit);
00477     }
00478 
00479     if (loc == HOME)
00480     {
00481         loc = Home(player);
00482     }
00483 
00484 #ifdef WOD_REALMS
00485     if (Good_obj(loc) && (REALM_DO_HIDDEN_FROM_YOU != DoThingToThingVisibility(player, exit, ACTION_IS_MOVING)))
00486     {
00487         if (isShroud(player))
00488         {
00489             bDoit = true;
00490             int iShroudWarded = get_atr("SHROUD_WARDED");
00491             if (iShroudWarded > 0)
00492             {
00493                 int owner, flags;
00494                 char *buff = atr_pget(exit, iShroudWarded, &owner, &flags);
00495                 if (buff)
00496                 {
00497                     if (*buff)
00498                     {
00499                         bDoit = false;
00500                     }
00501                     free_lbuf(buff);
00502                 }
00503             }
00504         }
00505 
00506         if (!bDoit && isUmbra(player))
00507         {
00508             bDoit = true;
00509             int iUmbraWarded = get_atr("UMBRA_WARDED");
00510             if (iUmbraWarded > 0)
00511             {
00512                 int owner, flags;
00513                 char *buff = atr_pget(exit, iUmbraWarded, &owner, &flags);
00514                 if (buff)
00515                 {
00516                     if (*buff)
00517                     {
00518                         bDoit = false;
00519                     }
00520                     free_lbuf(buff);
00521                 }
00522             }
00523         }
00524 
00525         if (!bDoit && could_doit(player, exit, A_LOCK))
00526         {
00527             bDoit = true;
00528         }
00529     }
00530 #else
00531     if (Good_obj(loc) && could_doit(player, exit, A_LOCK))
00532     {
00533         bDoit = true;
00534     }
00535 #endif
00536     if (bDoit)
00537     {
00538         switch (Typeof(loc))
00539         {
00540         case TYPE_ROOM:
00541             move_via_exit(player, loc, NOTHING, exit, hush);
00542             if (divest)
00543                 divest_object(player);
00544             break;
00545         case TYPE_PLAYER:
00546         case TYPE_THING:
00547             if (Going(loc))
00548             {
00549                 notify(player, "You can't go that way.");
00550                 return;
00551             }
00552             move_via_exit(player, loc, NOTHING, exit, hush);
00553             divest_object(player);
00554             break;
00555         case TYPE_EXIT:
00556             notify(player, "You can't go that way.");
00557             return;
00558         }
00559     }
00560     else
00561     {
00562         if ((Wizard(player) && Dark(player)) || (hush & HUSH_EXIT))
00563         {
00564             oattr = 0;
00565             aattr = 0;
00566         }
00567         else
00568         {
00569             oattr = A_OFAIL;
00570             aattr = A_AFAIL;
00571         }
00572         did_it(player, exit, A_FAIL, failmsg, oattr, NULL, aattr, (char **)NULL, 0);
00573     }
00574 }

void move_object ( dbref  ,
dbref   
)

Definition at line 180 of file move.cpp.

References Contents, Controls, giveto(), HOME, Home, insert_first(), isPlayer, LK_OBEYTERSE, LK_SHOWEXIT, Location, look_in(), mudconf, NOTHING, notify, confdata::one_coin, confdata::payfind, confdata::paylimit, Pennies(), RandomINT32(), remove_first(), s_Contents, s_Location, s_Next, and tprintf().

Referenced by check_connect(), check_dead_refs(), CGuests::Create(), do_pcreate(), CGuests::MakeGuestChar(), move_via_exit(), move_via_generic(), and move_via_teleport().

00181 {
00182     dbref src = Location(thing);
00183 
00184     // Remove from the source location
00185     //
00186     if (src != NOTHING)
00187     {
00188         s_Contents(src, remove_first(Contents(src), thing));
00189     }
00190 
00191     // Special check for HOME
00192     //
00193     if (dest == HOME)
00194     {
00195         dest = Home(thing);
00196     }
00197 
00198     // Add to destination location
00199     //
00200     if (dest != NOTHING)
00201     {
00202         s_Contents(dest, insert_first(Contents(dest), thing));
00203     }
00204     else
00205     {
00206         s_Next(thing, NOTHING);
00207     }
00208     s_Location(thing, dest);
00209 
00210     // Look around and do the penny check
00211     //
00212     look_in(thing, dest, (LK_SHOWEXIT | LK_OBEYTERSE));
00213     if (  isPlayer(thing)
00214        && mudconf.payfind > 0
00215        && Pennies(thing) < mudconf.paylimit
00216        && !Controls(thing, dest)
00217        && RandomINT32(0, mudconf.payfind-1) == 0)
00218     {
00219         giveto(thing, 1);
00220         notify(thing, tprintf("You found a %s!", mudconf.one_coin));
00221     }
00222 }

void move_via_generic ( dbref  ,
dbref  ,
dbref  ,
int   
)

Definition at line 314 of file move.cpp.

References A_AMOVE, A_MOVE, A_OMOVE, did_it(), Hearer(), HOME, Home, Location, move_object(), process_enter_loc(), and process_leave_loc().

Referenced by check_contents_chains(), destroy_player(), destroy_thing(), divest_object(), do_clone(), do_create(), do_drop(), do_enter_internal(), do_get(), do_kill(), do_leave(), do_move(), empty_obj(), FUNCTION(), give_thing(), process_dropped_dropto(), and send_dropto().

00315 {
00316     if (dest == HOME)
00317     {
00318         dest = Home(thing);
00319     }
00320 
00321     dbref src = Location(thing);
00322     bool canhear = Hearer(thing);
00323     process_leave_loc(thing, dest, cause, canhear, hush);
00324     move_object(thing, dest);
00325     did_it(thing, thing, A_MOVE, NULL, A_OMOVE, NULL, A_AMOVE,
00326            (char **)NULL, 0);
00327     process_enter_loc(thing, src, cause, canhear, hush);
00328 }

bool move_via_teleport ( dbref  ,
dbref  ,
dbref  ,
int   
)

Definition at line 372 of file move.cpp.

References A_AMOVE, A_ATOFAIL, A_ATPORT, A_LTELOUT, A_MOVE, A_OMOVE, A_OTOFAIL, A_OTPORT, A_OXTPORT, A_TOFAIL, A_TPORT, could_doit(), did_it(), divest_object(), Good_obj, Hearer(), HOME, Home, HUSH_ENTER, HUSH_LEAVE, isExit, isRoom, Location, move_object(), move_the_exit(), mudconf, NOTHING, notify_quiet, confdata::ntfy_nest_lim, process_enter_loc(), process_leave_loc(), and process_sticky_dropto().

Referenced by do_dig(), and do_teleport_single().

00373 {
00374     dbref curr;
00375     int count;
00376     char *failmsg;
00377 
00378     dbref src = Location(thing);
00379     if ((dest != HOME) && Good_obj(src))
00380     {
00381         curr = src;
00382         for (count = mudconf.ntfy_nest_lim; count > 0; count--)
00383         {
00384             if (!could_doit(thing, curr, A_LTELOUT))
00385             {
00386                 if ((thing == cause) || (cause == NOTHING))
00387                 {
00388                     failmsg = "You can't teleport out!";
00389                 }
00390                 else
00391                 {
00392                     failmsg = "You can't be teleported out!";
00393                     notify_quiet(cause, "You can't teleport that out!");
00394                 }
00395                 did_it(thing, src,
00396                        A_TOFAIL, failmsg, A_OTOFAIL, NULL,
00397                        A_ATOFAIL, (char **)NULL, 0);
00398                 return false;
00399             }
00400             if (isRoom(curr))
00401             {
00402                 break;
00403             }
00404             curr = Location(curr);
00405         }
00406     }
00407 
00408     if (isExit(thing))
00409     {
00410         move_the_exit(thing, dest);
00411         return true;
00412     }
00413     if (dest == HOME)
00414     {
00415         dest = Home(thing);
00416     }
00417     bool canhear = Hearer(thing);
00418     if (!(hush & HUSH_LEAVE))
00419     {
00420         did_it(thing, thing, 0, NULL, A_OXTPORT, NULL, 0,
00421             (char **)NULL, 0);
00422     }
00423     process_leave_loc(thing, dest, NOTHING, canhear, hush);
00424 
00425     move_object(thing, dest);
00426 
00427     if (!(hush & HUSH_ENTER))
00428     {
00429         did_it(thing, thing, A_TPORT, NULL, A_OTPORT, NULL, A_ATPORT,
00430             (char **)NULL, 0);
00431     }
00432     did_it(thing, thing, A_MOVE, NULL, A_OMOVE, NULL, A_AMOVE,
00433         (char **)NULL, 0);
00434     process_enter_loc(thing, src, NOTHING, canhear, hush);
00435     divest_object(thing);
00436     process_sticky_dropto(src, thing);
00437     return true;
00438 }

const char* mux_crypt ( const char *  szPassword,
const char *  szSalt,
int *  piType 
)

Definition at line 307 of file player.cpp.

References BLOWFISH_PREFIX_LENGTH, crypt(), CRYPT_BLOWFISH, CRYPT_CLEARTEXT, CRYPT_DES, CRYPT_DES_EXT, CRYPT_FAIL, CRYPT_MD5, CRYPT_OTHER, CRYPT_SHA1, EncodeBase64(), ENCODED_HASH_LENGTH, ENCODED_SALT_LENGTH, SHA1_CONTEXT::H, MD5_PREFIX_LENGTH, SHA1_Compute(), SHA1_Final(), SHA1_Init(), and SHA1_PREFIX_LENGTH.

Referenced by ChangePassword(), and check_pass().

00308 {
00309     const char *pSaltField = NULL;
00310     size_t nSaltField = 0;
00311 
00312     *piType = CRYPT_FAIL;
00313 
00314     if (szSetting[0] == '$')
00315     {
00316         const char *p = strchr(szSetting+1, '$');
00317         if (p)
00318         {
00319             p++;
00320             size_t nAlgo = p - szSetting;
00321             if (  nAlgo == SHA1_PREFIX_LENGTH
00322                && memcmp(szSetting, szSHA1Prefix, SHA1_PREFIX_LENGTH) == 0)
00323             {
00324                 // SHA-1
00325                 //
00326                 pSaltField = p;
00327                 p = strchr(pSaltField, '$');
00328                 if (p)
00329                 {
00330                     nSaltField = p - pSaltField;
00331                 }
00332                 else
00333                 {
00334                     nSaltField = strlen(pSaltField);
00335                 }
00336                 if (nSaltField <= ENCODED_SALT_LENGTH)
00337                 {
00338                     *piType = CRYPT_SHA1;
00339                 }
00340             }
00341             else if (  nAlgo == MD5_PREFIX_LENGTH
00342                     && memcmp(szSetting, szMD5Prefix, MD5_PREFIX_LENGTH) == 0)
00343             {
00344                 *piType = CRYPT_MD5;
00345             }
00346             else if (  nAlgo == BLOWFISH_PREFIX_LENGTH
00347                     && memcmp(szSetting, szBlowfishPrefix, BLOWFISH_PREFIX_LENGTH) == 0)
00348             {
00349                 *piType = CRYPT_BLOWFISH;
00350             }
00351             else
00352             {
00353                 *piType = CRYPT_OTHER;
00354             }
00355         }
00356     }
00357     else if (szSetting[0] == '_')
00358     {
00359         *piType = CRYPT_DES_EXT;
00360     }
00361     else
00362     {
00363 #if 0
00364         // Strictly speaking, we can say the algorithm is DES.
00365         //
00366         *piType = CRYPT_DES;
00367 #else
00368         // However, in order to support clear-text passwords, we restrict
00369         // ourselves to only verifying an existing DES-encrypted password and
00370         // we assume a fixed salt of 'XX'.  If you have been using a different
00371         // salt, or if you need to generate a DES-encrypted password, the
00372         // following code won't work.
00373         //
00374         size_t nSetting = strlen(szSetting);
00375         if (  nSetting == 13
00376            && memcmp(szSetting, "XX", 2) == 0)
00377         {
00378             *piType = CRYPT_DES;
00379         }
00380         else
00381         {
00382             *piType = CRYPT_CLEARTEXT;
00383         }
00384 #endif
00385     }
00386 
00387     switch (*piType)
00388     {
00389     case CRYPT_FAIL:
00390         return szFail;
00391 
00392     case CRYPT_CLEARTEXT:
00393         return szPassword;
00394 
00395     case CRYPT_MD5:
00396     case CRYPT_BLOWFISH:
00397     case CRYPT_OTHER:
00398     case CRYPT_DES_EXT:
00399 #ifdef WIN32
00400         // The WIN32 release only supports SHA1, DES, and clear-text.
00401         //
00402         return szFail;
00403 #endif // WIN32
00404 
00405     case CRYPT_DES:
00406 #if defined(HAVE_LIBCRYPT) \
00407  || defined(HAVE_CRYPT)
00408         return crypt(szPassword, szSetting);
00409 #else
00410         return szFail;
00411 #endif
00412     }
00413 
00414     // Calculate SHA-1 Hash.
00415     //
00416     SHA1_CONTEXT shac;
00417 
00418     SHA1_Init(&shac);
00419     SHA1_Compute(&shac, nSaltField, pSaltField);
00420     SHA1_Compute(&shac, strlen(szPassword), szPassword);
00421     SHA1_Final(&shac);
00422 
00423     // Serialize 5 UINT32 words into big-endian.
00424     //
00425     char szHashRaw[21];
00426     char *p = szHashRaw;
00427 
00428     int i;
00429     for (i = 0; i <= 4; i++)
00430     {
00431         *p++ = (UINT8)(shac.H[i] >> 24);
00432         *p++ = (UINT8)(shac.H[i] >> 16);
00433         *p++ = (UINT8)(shac.H[i] >>  8);
00434         *p++ = (UINT8)(shac.H[i]      );
00435     }
00436     *p = '\0';
00437 
00438     //          1         2         3         4
00439     // 12345678901234567890123456789012345678901234567
00440     // $SHA1$ssssssssssss$hhhhhhhhhhhhhhhhhhhhhhhhhhhh
00441     //
00442     static char buf[SHA1_PREFIX_LENGTH + ENCODED_SALT_LENGTH + 1 + ENCODED_HASH_LENGTH + 1 + 16];
00443     strcpy(buf, szSHA1Prefix);
00444     memcpy(buf + SHA1_PREFIX_LENGTH, pSaltField, nSaltField);
00445     buf[SHA1_PREFIX_LENGTH + nSaltField] = '$';
00446     EncodeBase64(20, szHashRaw, buf + SHA1_PREFIX_LENGTH + nSaltField + 1);
00447     return buf;
00448 }

char* mux_dtoa ( double  d,
int  mode,
int  ndigits,
int *  decpt,
int *  sign,
char **  rve 
)

Definition at line 2626 of file strtod.cpp.

References Balloc(), Bcopy, Bfree(), Bias, bigtens, Bletch, Bndry_mask, cmp(), d2b(), diff(), dtoa_result, dval, Exp_11, Exp_mask, Exp_msk1, Exp_shift1, Flt_Rounds, Frac_mask, Frac_mask1, freedtoa(), hi0bits(), i2b(), Int_max, Bigint::k, Log2P, Long, lshift(), mult(), multadd(), n_bigtens, nrv_alloc(), P, pow5mult(), Quick_max, quorem(), Rounding, rv_alloc(), Sign_bit, Ten_pmax, tens, Bigint::wds, word0, word1, and Bigint::x.

Referenced by mux_ftoa(), and NearestPretty().

02628 {
02629  /* Arguments ndigits, decpt, sign are similar to those
02630     of ecvt and fcvt; trailing zeros are suppressed from
02631     the returned string.  If not null, *rve is set to point
02632     to the end of the return value.  If d is +-Infinity or NaN,
02633     then *decpt is set to 9999.
02634 
02635     mode:
02636         0 ==> shortest string that yields d when read in
02637             and rounded to nearest.
02638         1 ==> like 0, but with Steele & White stopping rule;
02639             e.g. with IEEE P754 arithmetic , mode 0 gives
02640             1e23 whereas mode 1 gives 9.999999999999999e22.
02641         2 ==> max(1,ndigits) significant digits.  This gives a
02642             return value similar to that of ecvt, except
02643             that trailing zeros are suppressed.
02644         3 ==> through ndigits past the decimal point.  This
02645             gives a return value similar to that from fcvt,
02646             except that trailing zeros are suppressed, and
02647             ndigits can be negative.
02648         4,5 ==> similar to 2 and 3, respectively, but (in
02649             round-nearest mode) with the tests of mode 0 to
02650             possibly return a shorter string that rounds to d.
02651             With IEEE arithmetic and compilation with
02652             -DHonor_FLT_ROUNDS, modes 4 and 5 behave the same
02653             as modes 2 and 3 when FLT_ROUNDS != 1.
02654         6-9 ==> Debugging modes similar to mode - 4:  don't try
02655             fast floating-point estimate (if applicable).
02656 
02657         Values of mode other than 0-9 are treated as mode 0.
02658 
02659         Sufficient space is allocated to the return value
02660         to hold the suppressed trailing zeros.
02661     */
02662 
02663     int bbits, b2, b5, be, dig, i, ieps, ilim = 0, ilim0 = 0, ilim1 = 0,
02664         j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
02665         spec_case, try_quick;
02666     Long L;
02667 #ifndef Sudden_Underflow
02668     int denorm;
02669     ULong x;
02670 #endif
02671     Bigint *b = NULL, *b1 = NULL, *delta = NULL, *mlo = NULL, *mhi = NULL, *S = NULL;
02672     double d2, ds, eps;
02673     char *s, *s0;
02674 #ifdef Honor_FLT_ROUNDS
02675     int rounding;
02676 #endif
02677 #ifdef SET_INEXACT
02678     int inexact, oldinexact;
02679 #endif
02680 
02681     if (dtoa_result)
02682     {
02683         freedtoa(dtoa_result);
02684         dtoa_result = 0;
02685     }
02686 
02687     if (word0(d) & Sign_bit)
02688     {
02689         /* set sign for everything, including 0's and NaNs */
02690         *sign = 1;
02691         word0(d) &= ~Sign_bit;  /* clear sign bit */
02692     }
02693     else
02694     {
02695         *sign = 0;
02696     }
02697 
02698 #if defined(IEEE_Arith) + defined(VAX)
02699 #ifdef IEEE_Arith
02700     if ((word0(d) & Exp_mask) == Exp_mask)
02701 #else
02702     if (word0(d)  == 0x8000)
02703 #endif
02704     {
02705         /* Infinity or NaN */
02706         *decpt = 9999;
02707 #ifdef IEEE_Arith
02708         if (!word1(d) && !(word0(d) & 0xfffff))
02709         {
02710             return nrv_alloc("Inf", rve, 8);
02711         }
02712 #endif
02713         return nrv_alloc("NaN", rve, 3);
02714     }
02715 #endif
02716 #ifdef IBM
02717     dval(d) += 0; /* normalize */
02718 #endif
02719     if (!dval(d))
02720     {
02721         *decpt = 1;
02722         return nrv_alloc("0", rve, 1);
02723     }
02724 
02725 #ifdef SET_INEXACT
02726     try_quick = oldinexact = get_inexact();
02727     inexact = 1;
02728 #endif
02729 #ifdef Honor_FLT_ROUNDS
02730     if ((rounding = Flt_Rounds) >= 2)
02731     {
02732         if (*sign)
02733         {
02734             rounding = rounding == 2 ? 0 : 2;
02735         }
02736         else
02737         {
02738             if (rounding != 2)
02739             {
02740                 rounding = 0;
02741             }
02742         }
02743     }
02744 #endif
02745 
02746     b = d2b(dval(d), &be, &bbits);
02747 #ifdef Sudden_Underflow
02748     i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
02749 #else
02750     if ((i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))))
02751     {
02752 #endif
02753         dval(d2) = dval(d);
02754         word0(d2) &= Frac_mask1;
02755         word0(d2) |= Exp_11;
02756 #ifdef IBM
02757         if (j = 11 - hi0bits(word0(d2) & Frac_mask))
02758         {
02759             dval(d2) /= 1 << j;
02760         }
02761 #endif
02762 
02763         /* log(x)   ~=~ log(1.5) + (x-1.5)/1.5
02764          * log10(x)  =  log(x) / log(10)
02765          *      ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10))
02766          * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2)
02767          *
02768          * This suggests computing an approximation k to log10(d) by
02769          *
02770          * k = (i - Bias)*0.301029995663981
02771          *  + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 );
02772          *
02773          * We want k to be too large rather than too small.
02774          * The error in the first-order Taylor series approximation
02775          * is in our favor, so we just round up the constant enough
02776          * to compensate for any error in the multiplication of
02777          * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077,
02778          * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14,
02779          * adding 1e-13 to the constant term more than suffices.
02780          * Hence we adjust the constant term to 0.1760912590558.
02781          * (We could get a more accurate k by invoking log10,
02782          *  but this is probably not worthwhile.)
02783          */
02784 
02785         i -= Bias;
02786 #ifdef IBM
02787         i <<= 2;
02788         i += j;
02789 #endif
02790 #ifndef Sudden_Underflow
02791         denorm = 0;
02792     }
02793     else
02794     {
02795         /* d is denormalized */
02796 
02797         i = bbits + be + (Bias + (P-1) - 1);
02798         x = i > 32  ? word0(d) << (64 - i) | word1(d) >> (i - 32)
02799                 : word1(d) << (32 - i);
02800         dval(d2) = x;
02801         word0(d2) -= 31*Exp_msk1; /* adjust exponent */
02802         i -= (Bias + (P-1) - 1) + 1;
02803         denorm = 1;
02804     }
02805 #endif
02806     ds = (dval(d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981;
02807     k = (int)ds;
02808     if (ds < 0. && ds != k)
02809     {
02810         k--;    /* want k = floor(ds) */
02811     }
02812     k_check = 1;
02813     if (k >= 0 && k <= Ten_pmax)
02814     {
02815         if (dval(d) < tens[k])
02816         {
02817             k--;
02818         }
02819         k_check = 0;
02820     }
02821     j = bbits - i - 1;
02822     if (j >= 0)
02823     {
02824         b2 = 0;
02825         s2 = j;
02826     }
02827     else
02828     {
02829         b2 = -j;
02830         s2 = 0;
02831     }
02832     if (k >= 0)
02833     {
02834         b5 = 0;
02835         s5 = k;
02836         s2 += k;
02837     }
02838     else
02839     {
02840         b2 -= k;
02841         b5 = -k;
02842         s5 = 0;
02843     }
02844     if (mode < 0 || mode > 9)
02845     {
02846         mode = 0;
02847     }
02848 
02849 #ifndef SET_INEXACT
02850 #ifdef Check_FLT_ROUNDS
02851     try_quick = Rounding == 1;
02852 #else
02853     try_quick = 1;
02854 #endif
02855 #endif /*SET_INEXACT*/
02856 
02857     if (mode > 5)
02858     {
02859         mode -= 4;
02860         try_quick = 0;
02861     }
02862     leftright = 1;
02863     switch (mode)
02864     {
02865     case 0:
02866     case 1:
02867         ilim = ilim1 = -1;
02868         i = 18;
02869         ndigits = 0;
02870         break;
02871     case 2:
02872         leftright = 0;
02873         /* no break */
02874     case 4:
02875         if (ndigits <= 0)
02876         {
02877             ndigits = 1;
02878         }
02879         ilim = ilim1 = i = ndigits;
02880         break;
02881     case 3:
02882         leftright = 0;
02883         /* no break */
02884     case 5:
02885         i = ndigits + k + 1;
02886         ilim = i;
02887         ilim1 = i - 1;
02888         if (i <= 0)
02889         {
02890             i = 1;
02891         }
02892     }
02893     s = s0 = rv_alloc(i);
02894 
02895 #ifdef Honor_FLT_ROUNDS
02896     if (mode > 1 && rounding != 1)
02897     {
02898         leftright = 0;
02899     }
02900 #endif
02901 
02902     if (ilim >= 0 && ilim <= Quick_max && try_quick)
02903     {
02904         /* Try to get by with floating-point arithmetic. */
02905 
02906         i = 0;
02907         dval(d2) = dval(d);
02908         k0 = k;
02909         ilim0 = ilim;
02910         ieps = 2; /* conservative */
02911         if (k > 0)
02912         {
02913             ds = tens[k&0xf];
02914             j = k >> 4;
02915             if (j & Bletch)
02916             {
02917                 /* prevent overflows */
02918                 j &= Bletch - 1;
02919                 dval(d) /= bigtens[n_bigtens-1];
02920                 ieps++;
02921             }
02922             for (; j; j >>= 1, i++)
02923             {
02924                 if (j & 1)
02925                 {
02926                     ieps++;
02927                     ds *= bigtens[i];
02928                 }
02929             }
02930             dval(d) /= ds;
02931         }
02932         else if ((j1 = -k))
02933         {
02934             dval(d) *= tens[j1 & 0xf];
02935             for (j = j1 >> 4; j; j >>= 1, i++)
02936             {
02937                 if (j & 1)
02938                 {
02939                     ieps++;
02940                     dval(d) *= bigtens[i];
02941                 }
02942             }
02943         }
02944         if (k_check && dval(d) < 1. && ilim > 0)
02945         {
02946             if (ilim1 <= 0)
02947             {
02948                 goto fast_failed;
02949             }
02950             ilim = ilim1;
02951             k--;
02952             dval(d) *= 10.;
02953             ieps++;
02954         }
02955         dval(eps) = ieps*dval(d) + 7.;
02956         word0(eps) -= (P-1)*Exp_msk1;
02957         if (ilim == 0)
02958         {
02959             S = mhi = 0;
02960             dval(d) -= 5.;
02961             if (dval(d) > dval(eps))
02962             {
02963                 goto one_digit;
02964             }
02965             if (dval(d) < -dval(eps))
02966             {
02967                 goto no_digits;
02968             }
02969             goto fast_failed;
02970         }
02971 #ifndef No_leftright
02972         if (leftright)
02973         {
02974             /* Use Steele & White method of only
02975              * generating digits needed.
02976              */
02977             dval(eps) = 0.5/tens[ilim-1] - dval(eps);
02978             for (i = 0;;)
02979             {
02980                 L = (Long)dval(d);
02981                 dval(d) -= L;
02982                 *s++ = '0' + (int)L;
02983                 if (dval(d) < dval(eps))
02984                 {
02985                     goto ret1;
02986                 }
02987                 if (1. - dval(d) < dval(eps))
02988                 {
02989                     goto bump_up;
02990                 }
02991                 if (++i >= ilim)
02992                 {
02993                     break;
02994                 }
02995                 dval(eps) *= 10.;
02996                 dval(d) *= 10.;
02997             }
02998         }
02999         else
03000         {
03001 #endif
03002             /* Generate ilim digits, then fix them up. */
03003             dval(eps) *= tens[ilim-1];
03004             for (i = 1;; i++, dval(d) *= 10.)
03005             {
03006                 L = (Long)(dval(d));
03007                 if (!(dval(d) -= L))
03008                 {
03009                     ilim = i;
03010                 }
03011                 *s++ = '0' + (int)L;
03012                 if (i == ilim)
03013                 {
03014                     if (dval(d) > 0.5 + dval(eps))
03015                     {
03016                         goto bump_up;
03017                     }
03018                     else if (dval(d) < 0.5 - dval(eps))
03019                     {
03020                         while (*--s == '0')
03021                         {
03022                             ; // Nothing.
03023                         }
03024                         s++;
03025                         goto ret1;
03026                     }
03027                     break;
03028                 }
03029             }
03030 #ifndef No_leftright
03031         }
03032 #endif
03033 fast_failed:
03034         s = s0;
03035         dval(d) = dval(d2);
03036         k = k0;
03037         ilim = ilim0;
03038     }
03039 
03040     /* Do we have a "small" integer? */
03041 
03042     if (be >= 0 && k <= Int_max)
03043     {
03044         /* Yes. */
03045         ds = tens[k];
03046         if (ndigits < 0 && ilim <= 0)
03047         {
03048             S = mhi = 0;
03049             if (ilim < 0 || dval(d) <= 5*ds)
03050             {
03051                 goto no_digits;
03052             }
03053             goto one_digit;
03054         }
03055         for (i = 1; ; i++, dval(d) *= 10.0)
03056         {
03057             L = (Long)(dval(d) / ds);
03058             dval(d) -= L*ds;
03059 #ifdef Check_FLT_ROUNDS
03060             /* If FLT_ROUNDS == 2, L will usually be high by 1 */
03061             if (dval(d) < 0)
03062             {
03063                 L--;
03064                 dval(d) += ds;
03065             }
03066 #endif
03067             if (ds <= dval(d))
03068             {
03069                 L++;
03070                 dval(d) -= ds;
03071             }
03072             *s++ = '0' + (int)L;
03073             if (!dval(d))
03074             {
03075 #ifdef SET_INEXACT
03076                 inexact = 0;
03077 #endif
03078                 break;
03079             }
03080             if (i == ilim)
03081             {
03082 #ifdef Honor_FLT_ROUNDS
03083                 if (mode > 1)
03084                 {
03085                     switch (rounding)
03086                     {
03087                     case 0: goto ret1;
03088                     case 2: goto bump_up;
03089                     }
03090                 }
03091 #endif
03092                 dval(d) += dval(d);
03093                 if (dval(d) > ds || dval(d) == ds && L & 1)
03094                 {
03095 bump_up:
03096                     while (*--s == '9')
03097                     {
03098                         if (s == s0)
03099                         {
03100                             k++;
03101                             *s = '0';
03102                             break;
03103                         }
03104                     }
03105                     ++*s++;
03106                 }
03107                 break;
03108             }
03109         }
03110         goto ret1;
03111     }
03112 
03113     m2 = b2;
03114     m5 = b5;
03115     mhi = mlo = 0;
03116     if (leftright)
03117     {
03118         i =
03119 #ifndef Sudden_Underflow
03120             denorm ? be + (Bias + (P-1) - 1 + 1) :
03121 #endif
03122 #ifdef IBM
03123             1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3);
03124 #else
03125             1 + P - bbits;
03126 #endif
03127         b2 += i;
03128         s2 += i;
03129         mhi = i2b(1);
03130     }
03131     if (m2 > 0 && s2 > 0)
03132     {
03133         i = m2 < s2 ? m2 : s2;
03134         b2 -= i;
03135         m2 -= i;
03136         s2 -= i;
03137     }
03138     if (b5 > 0)
03139     {
03140         if (leftright)
03141         {
03142             if (m5 > 0)
03143             {
03144                 mhi = pow5mult(mhi, m5);
03145                 b1 = mult(mhi, b);
03146                 Bfree(b);
03147                 b = b1;
03148             }
03149             if ((j = b5 - m5))
03150             {
03151                 b = pow5mult(b, j);
03152             }
03153         }
03154         else
03155         {
03156             b = pow5mult(b, b5);
03157         }
03158     }
03159     S = i2b(1);
03160     if (s5 > 0)
03161     {
03162         S = pow5mult(S, s5);
03163     }
03164 
03165     /* Check for special case that d is a normalized power of 2. */
03166 
03167     spec_case = 0;
03168     if ((mode < 2 || leftright)
03169 #ifdef Honor_FLT_ROUNDS
03170             && rounding == 1
03171 #endif
03172                 )
03173     {
03174         if (!word1(d) && !(word0(d) & Bndry_mask)
03175 #ifndef Sudden_Underflow
03176          && word0(d) & (Exp_mask & ~Exp_msk1)
03177 #endif
03178                 )
03179         {
03180             /* The special case */
03181             b2 += Log2P;
03182             s2 += Log2P;
03183             spec_case = 1;
03184         }
03185     }
03186 
03187     /* Arrange for convenient computation of quotients:
03188      * shift left if necessary so divisor has 4 leading 0 bits.
03189      *
03190      * Perhaps we should just compute leading 28 bits of S once
03191      * and for all and pass them and a shift to quorem, so it
03192      * can do shifts and ors to compute the numerator for q.
03193      */
03194 #ifdef Pack_32
03195     if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
03196     {
03197         i = 32 - i;
03198     }
03199 #else
03200     if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf))
03201     {
03202         i = 16 - i;
03203     }
03204 #endif
03205     if (i > 4)
03206     {
03207         i -= 4;
03208         b2 += i;
03209         m2 += i;
03210         s2 += i;
03211     }
03212     else if (i < 4)
03213     {
03214         i += 28;
03215         b2 += i;
03216         m2 += i;
03217         s2 += i;
03218     }
03219     if (b2 > 0)
03220     {
03221         b = lshift(b, b2);
03222     }
03223     if (s2 > 0)
03224     {
03225         S = lshift(S, s2);
03226     }
03227     if (k_check)
03228     {
03229         if (cmp(b,S) < 0)
03230         {
03231             k--;
03232             b = multadd(b, 10, 0);  /* we botched the k estimate */
03233             if (leftright)
03234             {
03235                 mhi = multadd(mhi, 10, 0);
03236             }
03237             ilim = ilim1;
03238         }
03239     }
03240     if (ilim <= 0 && (mode == 3 || mode == 5))
03241     {
03242         if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0)
03243         {
03244             /* no digits, fcvt style */
03245 no_digits:
03246             k = -1 - ndigits;
03247             goto ret;
03248         }
03249 one_digit:
03250         *s++ = '1';
03251         k++;
03252         goto ret;
03253     }
03254     if (leftright)
03255     {
03256         if (m2 > 0)
03257         {
03258             mhi = lshift(mhi, m2);
03259         }
03260 
03261         /* Compute mlo -- check for special case
03262          * that d is a normalized power of 2.
03263          */
03264 
03265         mlo = mhi;
03266         if (spec_case)
03267         {
03268             mhi = Balloc(mhi->k);
03269             Bcopy(mhi, mlo);
03270             mhi = lshift(mhi, Log2P);
03271         }
03272 
03273         for (i = 1;;i++)
03274         {
03275             dig = quorem(b,S) + '0';
03276             /* Do we yet have the shortest decimal string
03277              * that will round to d?
03278              */
03279             j = cmp(b, mlo);
03280             delta = diff(S, mhi);
03281             j1 = delta->sign ? 1 : cmp(b, delta);
03282             Bfree(delta);
03283 #ifndef ROUND_BIASED
03284             if (j1 == 0 && mode != 1 && !(word1(d) & 1)
03285 #ifdef Honor_FLT_ROUNDS
03286                 && rounding >= 1
03287 #endif
03288                                    )
03289             {
03290                 if (dig == '9')
03291                 {
03292                     goto round_9_up;
03293                 }
03294                 if (j > 0)
03295                 {
03296                     dig++;
03297                 }
03298 #ifdef SET_INEXACT
03299                 else if (!b->x[0] && b->wds <= 1)
03300                 {
03301                     inexact = 0;
03302                 }
03303 #endif
03304                 *s++ = dig;
03305                 goto ret;
03306             }
03307 #endif
03308             if (j < 0 || j == 0 && mode != 1
03309 #ifndef ROUND_BIASED
03310                             && !(word1(d) & 1)
03311 #endif
03312                     )
03313             {
03314                 if (!b->x[0] && b->wds <= 1)
03315                 {
03316 #ifdef SET_INEXACT
03317                     inexact = 0;
03318 #endif
03319                     goto accept_dig;
03320                 }
03321 #ifdef Honor_FLT_ROUNDS
03322                 if (mode > 1)
03323                 {
03324                     switch (rounding)
03325                     {
03326                     case 0: goto accept_dig;
03327                     case 2: goto keep_dig;
03328                     }
03329                 }
03330 #endif /*Honor_FLT_ROUNDS*/
03331                 if (j1 > 0)
03332                 {
03333                     b = lshift(b, 1);
03334                     j1 = cmp(b, S);
03335                     if (  (j1 > 0 || j1 == 0 && dig & 1)
03336                        && dig++ == '9')
03337                     {
03338                         goto round_9_up;
03339                     }
03340                 }
03341 accept_dig:
03342                 *s++ = dig;
03343                 goto ret;
03344             }
03345             if (j1 > 0)
03346             {
03347 #ifdef Honor_FLT_ROUNDS
03348                 if (!rounding)
03349                 {
03350                     goto accept_dig;
03351                 }
03352 #endif
03353                 if (dig == '9')
03354                 {
03355                     /* possible if i == 1 */
03356 round_9_up:
03357                     *s++ = '9';
03358                     goto roundoff;
03359                 }
03360                 *s++ = dig + 1;
03361                 goto ret;
03362             }
03363 #ifdef Honor_FLT_ROUNDS
03364 keep_dig:
03365 #endif
03366             *s++ = dig;
03367             if (i == ilim)
03368             {
03369                 break;
03370             }
03371             b = multadd(b, 10, 0);
03372             if (mlo == mhi)
03373             {
03374                 mlo = mhi = multadd(mhi, 10, 0);
03375             }
03376             else
03377             {
03378                 mlo = multadd(mlo, 10, 0);
03379                 mhi = multadd(mhi, 10, 0);
03380             }
03381         }
03382     }
03383     else
03384     {
03385         for (i = 1;; i++)
03386         {
03387             *s++ = dig = quorem(b,S) + '0';
03388             if (!b->x[0] && b->wds <= 1)
03389             {
03390 #ifdef SET_INEXACT
03391                 inexact = 0;
03392 #endif
03393                 goto ret;
03394             }
03395             if (i >= ilim)
03396             {
03397                 break;
03398             }
03399             b = multadd(b, 10, 0);
03400         }
03401     }
03402 
03403     /* Round off last digit */
03404 
03405 #ifdef Honor_FLT_ROUNDS
03406     switch (rounding)
03407     {
03408     case 0: goto trimzeros;
03409     case 2: goto roundoff;
03410     }
03411 #endif
03412     b = lshift(b, 1);
03413     j = cmp(b, S);
03414     if (j > 0 || j == 0 && dig & 1)
03415     {
03416 roundoff:
03417         while (*--s == '9')
03418         {
03419             if (s == s0)
03420             {
03421                 k++;
03422                 *s++ = '1';
03423                 goto ret;
03424             }
03425         }
03426         ++*s++;
03427     }
03428     else
03429     {
03430 #ifdef Honor_FLT_ROUNDS
03431 trimzeros:
03432 #endif
03433         while (*--s == '0')
03434         {
03435             ; // Nothing.
03436         }
03437         s++;
03438     }
03439 ret:
03440     Bfree(S);
03441     if (mhi)
03442     {
03443         if (mlo && mlo != mhi)
03444         {
03445             Bfree(mlo);
03446         }
03447         Bfree(mhi);
03448     }
03449 ret1:
03450 #ifdef SET_INEXACT
03451     if (inexact)
03452     {
03453         if (!oldinexact)
03454         {
03455             word0(d) = Exp_1 + (70 << Exp_shift);
03456             word1(d) = 0;
03457             dval(d) += 1.;
03458         }
03459     }
03460     else if (!oldinexact)
03461     {
03462         clear_inexact();
03463     }
03464 #endif
03465     Bfree(b);
03466     *s = 0;
03467     *decpt = k + 1;
03468     if (rve)
03469     {
03470         *rve = s;
03471     }
03472     return s0;
03473 }

void mux_exec ( char *  buff,
char **  bufc,
dbref  executor,
dbref  caller,
dbref  enactor,
int  eval,
char **  dstr,
char *  cargs[],
int  ncargs 
)

Definition at line 1087 of file eval.cpp.

References A_VA, alloc_lbuf, alloc_mbuf, ANSI_ENDGOAL_NORMAL, ANSI_String_Copy(), ANSI_String_Finalize(), ANSI_String_In_Init(), ANSI_String_Out_Init(), ufun::atr, atr_get, atr_pget_str_LEN(), CMuxAlarm::bAlarmed, statedata::bStackLimitReached, check_access(), statedata::curr_cmd, EV_EVAL, EV_FCHECK, EV_FMAND, EV_NO_LOCATION, EV_NOFCHECK, EV_NOTRACE, EV_STRIP_CURLY, EV_TOP, ufun::flags, tagFun::flags, FN_NOEVAL, FN_PRES, FN_PRIV, free_lbuf, free_mbuf, tagFun::fun, statedata::func_htab, statedata::func_invk_ctr, confdata::func_invk_lim, statedata::func_nest_lev, confdata::func_nest_lim, get_gender(), statedata::glob_reg_len, statedata::global_regs, Going, hashfindLEN(), ISOUTOFMEMORY, isSpecial, LBUF_SIZE, MAX_ARG, MAX_GLOBAL_REGS, tagFun::maxArgs, tagFun::maxArgsParsed, MEMALLOC, MEMFREE, tagFun::minArgs, mudconf, mudstate, mux_exec(), mux_isazAZ, mux_isspace, mux_ltoa(), mux_RegisterSet, mux_tolower, mux_toupper, MuxAlarm, Name, tagFun::name, notify, confdata::nStackLimit, statedata::nStackNest, ufun::obj, parse_arglist_lite(), parse_to_lite(), tagFun::perms, ufun::perms, PopIntegers(), PopPointers(), statedata::pout, PushIntegers(), PushPointers(), restore_global_regs(), safe_copy_buf(), safe_noperm, safe_str, save_global_regs(), SBUF_SIZE, confdata::space_compress, tcache_add(), tcache_empty(), tcache_finish(), Trace, confdata::trace_limit, confdata::trace_topdown, statedata::ufunc_htab, and where_is().

Referenced by add_mail_message(), add_prefix(), BuildChannelMessage(), check_filter(), default_handler(), delim_check(), did_it(), do_if(), do_postpend(), do_prepend(), do_switch(), do_think(), do_ufun(), eval_boolexp(), filter_handler(), FUNCTION(), get_exit_dest(), get_handler(), look_contents(), look_exits(), look_in(), mail_return(), modSpeech(), mux_exec(), page_return(), parse_arglist(), parse_arglist_lite(), process_cmdent(), process_command(), process_hook(), process_sex(), ReportTopic(), search_perform(), show_a_desc(), switch_handler(), and u_comp().

01089 {
01090     if (  *dstr == NULL
01091        || **dstr == '\0'
01092        || MuxAlarm.bAlarmed)
01093     {
01094         return;
01095     }
01096 
01097     // Stack Limit checking with thanks to RhostMUSH.
01098     //
01099     if (mudconf.nStackLimit < mudstate.nStackNest)
01100     {
01101         mudstate.bStackLimitReached = true;
01102         return;
01103     }
01104 
01105     char *TempPtr;
01106     char *tstr, *tbuf, *start, *oldp, *savestr;
01107     const char *constbuf;
01108     int ch;
01109     char *realbuff = NULL, *realbp = NULL;
01110     dbref aowner;
01111     int nfargs, aflags, feval, i;
01112     bool ansi = false;
01113     FUN *fp;
01114     UFUN *ufp;
01115 
01116     static const char *subj[5] = {"", "it", "she", "he", "they"};
01117     static const char *poss[5] = {"", "its", "her", "his", "their"};
01118     static const char *obj[5] =  {"", "it", "her", "him", "them"};
01119     static const char *absp[5] = {"", "its", "hers", "his", "theirs"};
01120 
01121     // This is scratch buffer is used potentially on every invocation of
01122     // mux_exec. Do not assume that its contents are valid after you
01123     // execute any function that could re-enter mux_exec.
01124     //
01125     static char mux_scratch[LBUF_SIZE];
01126 
01127     char *pdstr = *dstr;
01128 
01129     int at_space = 1;
01130     int gender = -1;
01131 
01132     bool is_trace = Trace(executor) && !(eval & EV_NOTRACE);
01133     bool is_top = false;
01134 
01135     // Extend the buffer if we need to.
01136     //
01137     if (LBUF_SIZE - SBUF_SIZE < (*bufc) - buff)
01138     {
01139         realbuff = buff;
01140         realbp = *bufc;
01141         buff = (char *)MEMALLOC(LBUF_SIZE);
01142         ISOUTOFMEMORY(buff);
01143         *bufc = buff;
01144     }
01145 
01146     oldp = start = *bufc;
01147 
01148     // If we are tracing, save a copy of the starting buffer.
01149     //
01150     savestr = NULL;
01151     if (is_trace)
01152     {
01153         is_top = tcache_empty();
01154         savestr = alloc_lbuf("exec.save");
01155         strcpy(savestr, pdstr);
01156     }
01157 
01158     // Save Parser Mode.
01159     //
01160     bool bSpaceIsSpecialSave = isSpecial(L1, ' ');
01161     bool bParenthesisIsSpecialSave = isSpecial(L1, '(');
01162     bool bBracketIsSpecialSave = isSpecial(L1, '[');
01163 
01164     // Setup New Parser Mode.
01165     //
01166     bool bSpaceIsSpecial = mudconf.space_compress && !(eval & EV_NO_COMPRESS);
01167     isSpecial(L1, ' ') = bSpaceIsSpecial;
01168     isSpecial(L1, '(') = (eval & EV_FCHECK) != 0;
01169     isSpecial(L1, '[') = (eval & EV_NOFCHECK) == 0;
01170 
01171     size_t nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01172     for (;;)
01173     {
01174         // Handle mundane characters specially. There are usually a lot of them.
01175         // Just copy them.
01176         //
01177         if (!isSpecial(L1, *pdstr))
01178         {
01179             char *p = pdstr + 1;
01180             while (!isSpecial(L1, *p++))
01181             {
01182                 ; // Nothing.
01183             }
01184             size_t n = p - pdstr - 1;
01185             if (nBufferAvailable < n)
01186             {
01187                 n = nBufferAvailable;
01188             }
01189             memcpy(*bufc, pdstr, n);
01190             nBufferAvailable -= n;
01191             *bufc += n;
01192             at_space = 0;
01193             pdstr = p - 1;
01194         }
01195 
01196 
01197         // At this point, **dstr must be one of the following characters:
01198         //
01199         // 0x00 0x20 0x25 0x28 0x5B 0x5C 0x7B
01200         // NULL  SP   %    (     [    \   {
01201         //
01202         // Test softcode shows the following distribution:
01203         //
01204         // NULL occurs 116948 times
01205         //   (  occurs  49567 times
01206         //   %  occurs  24553 times
01207         //   [  occurs   7618 times
01208         //  SP  occurs   1323 times
01209         //
01210         if (*pdstr == '\0')
01211         {
01212             break;
01213         }
01214         else if (*pdstr == '(')
01215         {
01216             // *pdstr == '('
01217             //
01218             // Arglist start.  See if what precedes is a function. If so,
01219             // execute it if we should.
01220             //
01221             at_space = 0;
01222 
01223             // Load an sbuf with an lowercase version of the func name, and
01224             // see if the func exists. Trim trailing spaces from the name if
01225             // configured.
01226             //
01227             char *pEnd = *bufc - 1;
01228             if (mudconf.space_compress && (eval & EV_FMAND))
01229             {
01230                 while (  oldp <= pEnd
01231                       && mux_isspace(*pEnd))
01232                 {
01233                     pEnd--;
01234                 }
01235             }
01236 
01237             // _strlwr(tbuf);
01238             //
01239             char *p2 = mux_scratch;
01240             for (char *p = oldp; p <= pEnd; p++)
01241             {
01242                 *p2++ = mux_tolower(*p);
01243             }
01244             *p2 = '\0';
01245 
01246             int ntbuf = p2 - mux_scratch;
01247             fp = (FUN *)hashfindLEN(mux_scratch, ntbuf, &mudstate.func_htab);
01248 
01249             // If not a builtin func, check for global func.
01250             //
01251             ufp = NULL;
01252             if (fp == NULL)
01253             {
01254                 ufp = (UFUN *)hashfindLEN(mux_scratch, ntbuf, &mudstate.ufunc_htab);
01255             }
01256 
01257             // Do the right thing if it doesn't exist.
01258             //
01259             if (!fp && !ufp)
01260             {
01261                 if (eval & EV_FMAND)
01262                 {
01263                     *bufc = oldp;
01264                     safe_str("#-1 FUNCTION (", buff, bufc);
01265                     safe_str(mux_scratch, buff, bufc);
01266                     safe_str(") NOT FOUND", buff, bufc);
01267                     nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01268                     break;
01269                 }
01270                 else if (nBufferAvailable)
01271                 {
01272                     *(*bufc)++ = '(';
01273                     nBufferAvailable--;
01274                 }
01275             }
01276             else
01277             {
01278                 // Get the arglist and count the number of args. Neg # of args
01279                 // means catenate subsequent args.
01280                 //
01281                 if (ufp)
01282                 {
01283                     nfargs = MAX_ARG;
01284                 }
01285                 else
01286                 {
01287                     nfargs = fp->maxArgsParsed;
01288                 }
01289 
01290                 tstr = pdstr;
01291                 if (  fp
01292                    && (fp->flags & FN_NOEVAL))
01293                 {
01294                     feval = eval & ~(EV_EVAL|EV_TOP|EV_STRIP_CURLY);
01295                 }
01296                 else
01297                 {
01298                     feval = eval & ~EV_TOP;
01299                 }
01300 
01301                 char **fargs = PushPointers(MAX_ARG);
01302                 pdstr = parse_arglist_lite(executor, caller, enactor,
01303                       pdstr + 1, ')', feval, fargs, nfargs, cargs, ncargs,
01304                       &nfargs);
01305 
01306 
01307                 // If no closing delim, just insert the '(' and continue normally.
01308                 //
01309                 if (!pdstr)
01310                 {
01311                     pdstr = tstr;
01312                     if (nBufferAvailable)
01313                     {
01314                         *(*bufc)++ = *pdstr;
01315                         nBufferAvailable--;
01316                     }
01317                 }
01318                 else
01319                 {
01320                     pdstr--;
01321 
01322                     // If it's a user-defined function, perform it now.
01323                     //
01324                     mudstate.func_nest_lev++;
01325                     mudstate.func_invk_ctr++;
01326                     if (mudconf.func_nest_lim <= mudstate.func_nest_lev)
01327                     {
01328                          safe_str("#-1 FUNCTION RECURSION LIMIT EXCEEDED", buff, &oldp);
01329                     }
01330                     else if (mudconf.func_invk_lim <= mudstate.func_invk_ctr)
01331                     {
01332                         safe_str("#-1 FUNCTION INVOCATION LIMIT EXCEEDED", buff, &oldp);
01333                     }
01334                     else if (Going(executor))
01335                     {
01336                         safe_str("#-1 BAD EXECUTOR", buff, &oldp);
01337                     }
01338                     else if (!check_access(executor, ufp ? ufp->perms : fp->perms))
01339                     {
01340                         safe_noperm(buff, &oldp);
01341                     }
01342                     else if (MuxAlarm.bAlarmed)
01343                     {
01344                         safe_str("#-1 CPU LIMITED", buff, &oldp);
01345                     }
01346                     else if (ufp)
01347                     {
01348                         tstr = atr_get(ufp->obj, ufp->atr, &aowner, &aflags);
01349                         if (ufp->flags & FN_PRIV)
01350                         {
01351                             i = ufp->obj;
01352                         }
01353                         else
01354                         {
01355                             i = executor;
01356                         }
01357                         TempPtr = tstr;
01358 
01359                         char **preserve = NULL;
01360                         int *preserve_len = NULL;
01361 
01362                         if (ufp->flags & FN_PRES)
01363                         {
01364                             preserve = PushPointers(MAX_GLOBAL_REGS);
01365                             preserve_len = PushIntegers(MAX_GLOBAL_REGS);
01366                             save_global_regs("eval_save", preserve, preserve_len);
01367                         }
01368 
01369                         mux_exec(buff, &oldp, i, executor, enactor, feval,
01370                                  &TempPtr, fargs, nfargs);
01371 
01372                         if (ufp->flags & FN_PRES)
01373                         {
01374                             restore_global_regs("eval_restore", preserve, preserve_len);
01375                             PopIntegers(preserve_len, MAX_GLOBAL_REGS);
01376                             PopPointers(preserve, MAX_GLOBAL_REGS);
01377                             preserve = NULL;
01378                             preserve_len = NULL;
01379                         }
01380                         free_lbuf(tstr);
01381                     }
01382                     else
01383                     {
01384                         // If the number of args is right, perform the func.
01385                         // Otherwise, return an error message.
01386                         //
01387                         if (  fp->minArgs <= nfargs
01388                            && nfargs <= fp->maxArgs
01389                            && !MuxAlarm.bAlarmed)
01390                         {
01391                             fp->fun(buff, &oldp, executor, caller, enactor,
01392                                     fargs, nfargs, cargs, ncargs);
01393                         }
01394                         else
01395                         {
01396                             if (fp->minArgs == fp->maxArgs)
01397                             {
01398                                 sprintf(mux_scratch,
01399                                     "#-1 FUNCTION (%s) EXPECTS %d ARGUMENTS",
01400                                     fp->name, fp->minArgs);
01401                             }
01402                             else if (fp->minArgs + 1 == fp->maxArgs)
01403                             {
01404                                 sprintf(mux_scratch,
01405                                     "#-1 FUNCTION (%s) EXPECTS %d OR %d ARGUMENTS",
01406                                     fp->name, fp->minArgs, fp->maxArgs);
01407                             }
01408                             else if (MuxAlarm.bAlarmed)
01409                             {
01410                                 sprintf(mux_scratch, "#-1 CPU LIMITED");
01411                             }
01412                             else
01413                             {
01414                                 sprintf(mux_scratch,
01415                                     "#-1 FUNCTION (%s) EXPECTS BETWEEN %d AND %d ARGUMENTS",
01416                                     fp->name, fp->minArgs, fp->maxArgs);
01417                             }
01418                             safe_str(mux_scratch, buff, &oldp);
01419                         }
01420                     }
01421                     *bufc = oldp;
01422                     nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01423                     mudstate.func_nest_lev--;
01424                 }
01425 
01426                 // Return the space allocated for the arguments.
01427                 //
01428                 for (i = 0; i < nfargs; i++)
01429                 {
01430                     free_lbuf(fargs[i]);
01431                 }
01432                 PopPointers(fargs, MAX_ARG);
01433                 fargs = NULL;
01434             }
01435             eval &= ~EV_FCHECK;
01436             isSpecial(L1, '(') = false;
01437         }
01438         else if (*pdstr == '%')
01439         {
01440             // Percent-replace start.  Evaluate the chars following and
01441             // perform the appropriate substitution.
01442             //
01443             at_space = 0;
01444             if (!(eval & EV_EVAL))
01445             {
01446                 if (nBufferAvailable)
01447                 {
01448                     *(*bufc)++ = '%';
01449                     nBufferAvailable--;
01450                 }
01451                 pdstr++;
01452                 if (nBufferAvailable)
01453                 {
01454                     *(*bufc)++ = *pdstr;
01455                     nBufferAvailable--;
01456                 }
01457             }
01458             else
01459             {
01460                 pdstr++;
01461                 ch = *pdstr;
01462                 unsigned char cType_L2 = isSpecial(L2, ch);
01463                 TempPtr = *bufc;
01464                 int iCode = cType_L2 & 0x7F;
01465                 if (iCode == 1)
01466                 {
01467                     // 30 31 32 33 34 35 36 37 38 39
01468                     // 0  1  2  3  4  5  6  7  8  9
01469                     //
01470                     // Command argument number N.
01471                     //
01472                     i = ch - '0';
01473                     if (  i < ncargs
01474                        && cargs[i])
01475                     {
01476                         safe_str(cargs[i], buff, bufc);
01477                         nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01478                     }
01479                 }
01480                 else if (iCode == 2)
01481                 {
01482                     // 51
01483                     // Q
01484                     //
01485                     pdstr++;
01486                     i = mux_RegisterSet[(unsigned char)*pdstr];
01487                     if (  0 <= i
01488                        && i < MAX_GLOBAL_REGS)
01489                     {
01490                         if (  mudstate.glob_reg_len[i] > 0
01491                            && mudstate.global_regs[i])
01492                         {
01493                             safe_copy_buf(mudstate.global_regs[i],
01494                                 mudstate.glob_reg_len[i], buff, bufc);
01495                             nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01496                         }
01497                     }
01498                     else if (*pdstr == '\0')
01499                     {
01500                         pdstr--;
01501                     }
01502                 }
01503                 else if (iCode <= 4)
01504                 {
01505                     if (iCode == 3)
01506                     {
01507                         // 23
01508                         // #
01509                         //
01510                         // Enactor DB number.
01511                         //
01512                         mux_scratch[0] = '#';
01513                         i = mux_ltoa(enactor, mux_scratch+1);
01514                         safe_copy_buf(mux_scratch, i+1, buff, bufc);
01515                         nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01516                     }
01517                     else if (iCode == 4)
01518                     {
01519                         // 21
01520                         // !
01521                         //
01522                         // iCode == '!'
01523                         // Executor DB number.
01524                         //
01525                         mux_scratch[0] = '#';
01526                         i = mux_ltoa(executor, mux_scratch+1);
01527                         safe_copy_buf(mux_scratch, i+1, buff, bufc);
01528                         nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01529                     }
01530                     else
01531                     {
01532                         // iCode == 0
01533                         //
01534                         // Just copy
01535                         //
01536                         if (nBufferAvailable)
01537                         {
01538                             *(*bufc)++ = ch;
01539                             nBufferAvailable--;
01540                         }
01541                     }
01542                 }
01543                 else if (iCode <= 6)
01544                 {
01545                     if (iCode == 6)
01546                     {
01547                         // 43 58
01548                         // C  X
01549                         //
01550                         // Color
01551                         //
01552                         const char *pColor = ColorTable[(unsigned char)pdstr[1]];
01553                         if (pColor)
01554                         {
01555                             pdstr++;
01556                             ansi = true;
01557                             safe_str(pColor, buff, bufc);
01558                             nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01559                         }
01560                         else if (pdstr[1] && nBufferAvailable)
01561                         {
01562                             *(*bufc)++ = *pdstr;
01563                             nBufferAvailable--;
01564                         }
01565                     }
01566                     else
01567                     {
01568                         // 52
01569                         // R
01570                         //
01571                         // Carriage return.
01572                         //
01573                         safe_copy_buf("\r\n", 2, buff, bufc);
01574                         nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01575                     }
01576                 }
01577                 else if (iCode <= 8)
01578                 {
01579                     if (iCode == 7)
01580                     {
01581                         // 42
01582                         // B
01583                         //
01584                         // Blank.
01585                         //
01586                         if (nBufferAvailable)
01587                         {
01588                             *(*bufc)++ = ' ';
01589                             nBufferAvailable--;
01590                         }
01591                     }
01592                     else
01593                     {
01594                         // 54
01595                         // T
01596                         //
01597                         // Tab.
01598                         //
01599                         if (nBufferAvailable)
01600                         {
01601                             *(*bufc)++ = '\t';
01602                             nBufferAvailable--;
01603                         }
01604                     }
01605                 }
01606                 else if (iCode <= 10)
01607                 {
01608                     if (iCode == 9)
01609                     {
01610                         // 4C
01611                         // L
01612                         //
01613                         // Enactor Location DB Ref
01614                         //
01615                         if (!(eval & EV_NO_LOCATION))
01616                         {
01617                             mux_scratch[0] = '#';
01618                             i = mux_ltoa(where_is(enactor), mux_scratch+1);
01619                             safe_copy_buf(mux_scratch, i+1, buff, bufc);
01620                             nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01621                         }
01622                     }
01623                     else
01624                     {
01625                         // 56
01626                         // V
01627                         //
01628                         // Variable attribute.
01629                         //
01630                         pdstr++;
01631                         if (mux_isazAZ(*pdstr))
01632                         {
01633                             i = A_VA + mux_toupper(*pdstr) - 'A';
01634                             size_t nAttrGotten;
01635                             atr_pget_str_LEN(mux_scratch, executor, i,
01636                                 &aowner, &aflags, &nAttrGotten);
01637                             if (0 < nAttrGotten)
01638                             {
01639                                 if (nAttrGotten > nBufferAvailable)
01640                                 {
01641                                     nAttrGotten = nBufferAvailable;
01642                                 }
01643                                 memcpy(*bufc, mux_scratch, nAttrGotten);
01644                                 *bufc += nAttrGotten;
01645                                 nBufferAvailable -= nAttrGotten;
01646                             }
01647                         }
01648                         else if (*pdstr == '\0')
01649                         {
01650                             pdstr--;
01651                         }
01652                     }
01653                 }
01654                 else if (iCode <= 14)
01655                 {
01656                     if (iCode <= 12)
01657                     {
01658                         if (iCode == 11)
01659                         {
01660                             // 25
01661                             // %
01662                             //
01663                             // Percent - a literal %
01664                             //
01665                             if (nBufferAvailable)
01666                             {
01667                                 *(*bufc)++ = '%';
01668                                 nBufferAvailable--;
01669                             }
01670                         }
01671                         else
01672                         {
01673                             // 4E
01674                             // N
01675                             //
01676                             // Enactor name
01677                             //
01678                             safe_str(Name(enactor), buff, bufc);
01679                             nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01680                         }
01681                     }
01682                     else
01683                     {
01684                         if (iCode == 13)
01685                         {
01686                             // 7C
01687                             // |
01688                             //
01689                             // piped command output.
01690                             //
01691                             safe_str(mudstate.pout, buff, bufc);
01692                             nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01693                         }
01694                         else
01695                         {
01696                             // 53
01697                             // S
01698                             //
01699                             // Subjective pronoun.
01700                             //
01701                             if (gender < 0)
01702                             {
01703                                 gender = get_gender(enactor);
01704                             }
01705                             if (!gender)
01706                             {
01707                                 constbuf  = Name(enactor);
01708                             }
01709                             else
01710                             {
01711                                 constbuf  = subj[gender];
01712                             }
01713                             safe_str(constbuf, buff, bufc);
01714                             nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01715                         }
01716                     }
01717                 }
01718                 else
01719                 {
01720                     if (iCode <= 16)
01721                     {
01722                         if (iCode == 15)
01723                         {
01724                             // 50
01725                             // P
01726                             //
01727                             // Personal pronoun.
01728                             //
01729                             if (gender < 0)
01730                             {
01731                                 gender = get_gender(enactor);
01732                             }
01733 
01734                             if (!gender)
01735                             {
01736                                 safe_str(Name(enactor), buff, bufc);
01737                                 nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01738                                 if (nBufferAvailable)
01739                                 {
01740                                     *(*bufc)++ = 's';
01741                                     nBufferAvailable--;
01742                                 }
01743                             }
01744                             else
01745                             {
01746                                 safe_str((char *)poss[gender], buff, bufc);
01747                                 nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01748                             }
01749                         }
01750                         else
01751                         {
01752                             // 4F
01753                             // O
01754                             //
01755                             // Objective pronoun.
01756                             //
01757                             if (gender < 0)
01758                             {
01759                                 gender = get_gender(enactor);
01760                             }
01761                             if (!gender)
01762                             {
01763                                 constbuf = Name(enactor);
01764                             }
01765                             else
01766                             {
01767                                 constbuf = obj[gender];
01768                             }
01769                             safe_str(constbuf, buff, bufc);
01770                             nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01771                         }
01772                     }
01773                     else
01774                     {
01775                         if (iCode == 17)
01776                         {
01777                             // 41
01778                             // A
01779                             //
01780                             // Absolute posessive.
01781                             // Idea from Empedocles.
01782                             //
01783                             if (gender < 0)
01784                             {
01785                                 gender = get_gender(enactor);
01786                             }
01787 
01788                             if (!gender)
01789                             {
01790                                 safe_str(Name(enactor), buff, bufc);
01791                                 nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01792                                 if (nBufferAvailable)
01793                                 {
01794                                     *(*bufc)++ = 's';
01795                                     nBufferAvailable--;
01796                                 }
01797                             }
01798                             else
01799                             {
01800                                 safe_str(absp[gender], buff, bufc);
01801                                 nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01802                             }
01803                         }
01804                         else if (iCode == 18)
01805                         {
01806                             // 00
01807                             // \0
01808                             //
01809                             // All done.
01810                             //
01811                             pdstr--;
01812                         }
01813                         else if (iCode == 19)
01814                         {
01815                             // 4D
01816                             // M
01817                             //
01818                             // Last command
01819                             //
01820                             safe_str(mudstate.curr_cmd, buff, bufc);
01821                             nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01822                         }
01823                         else
01824                         {
01825                             // 40
01826                             // @
01827                             //
01828                             // iCode == '@'
01829                             // Caller DB number.
01830                             //
01831                             mux_scratch[0] = '#';
01832                             i = mux_ltoa(caller, mux_scratch+1);
01833                             safe_copy_buf(mux_scratch, i+1, buff, bufc);
01834                             nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01835                         }
01836                     }
01837                 }
01838 
01839                 // For some escape letters, if the escape letter
01840                 // was upper-case, then upper-case the first
01841                 // letter of the value.
01842                 //
01843                 if (cType_L2 & 0x80)
01844                 {
01845                     *TempPtr = mux_toupper(*TempPtr);
01846                 }
01847             }
01848         }
01849         else if (*pdstr == '[')
01850         {
01851             // Function start.  Evaluate the contents of the square brackets
01852             // as a function. If no closing bracket, insert the '[' and
01853             // continue.
01854             //
01855             tstr = pdstr++;
01856             mudstate.nStackNest++;
01857             tbuf = parse_to_lite(&pdstr, ']', '\0', &at_space, &at_space);
01858             at_space = 0;
01859             if (pdstr == NULL)
01860             {
01861                 if (nBufferAvailable)
01862                 {
01863                     *(*bufc)++ = '[';
01864                     nBufferAvailable--;
01865                 }
01866                 pdstr = tstr;
01867             }
01868             else
01869             {
01870                 mudstate.nStackNest--;
01871                 TempPtr = tbuf;
01872                 mux_exec(buff, bufc, executor, caller, enactor,
01873                     (eval | EV_FCHECK | EV_FMAND) & ~EV_TOP, &TempPtr, cargs,
01874                     ncargs);
01875                 nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01876                 pdstr--;
01877             }
01878         }
01879 
01880         // At this point, *pdstr must be one of the following characters:
01881         //
01882         // 0x20 0x5C 0x7B
01883         // SP    \    {
01884         //
01885         else if (*pdstr == ' ')
01886         {
01887             // A space. Add a space if not compressing or if previous char was
01888             // not a space.
01889             //
01890             if (bSpaceIsSpecial && !at_space)
01891             {
01892                 if (nBufferAvailable)
01893                 {
01894                     *(*bufc)++ = ' ';
01895                     nBufferAvailable--;
01896                 }
01897                 at_space = 1;
01898             }
01899         }
01900         else if (*pdstr == '{')
01901         {
01902             // *pdstr == '{'
01903             //
01904             // Literal start.  Insert everything up to the terminating '}'
01905             // without parsing. If no closing brace, insert the '{' and
01906             // continue.
01907             //
01908             tstr = pdstr++;
01909             mudstate.nStackNest++;
01910             tbuf = parse_to_lite(&pdstr, '}', '\0', &at_space, &at_space);
01911             at_space = 0;
01912             if (pdstr == NULL)
01913             {
01914                 if (nBufferAvailable)
01915                 {
01916                     *(*bufc)++ = '{';
01917                     nBufferAvailable--;
01918                 }
01919                 pdstr = tstr;
01920             }
01921             else
01922             {
01923                 mudstate.nStackNest--;
01924                 if (!(eval & EV_STRIP_CURLY))
01925                 {
01926                     if (nBufferAvailable)
01927                     {
01928                         *(*bufc)++ = '{';
01929                         nBufferAvailable--;
01930                     }
01931                 }
01932 
01933                 if (eval & EV_EVAL)
01934                 {
01935                     // Preserve leading spaces (Felan)
01936                     //
01937                     if (*tbuf == ' ')
01938                     {
01939                         if (nBufferAvailable)
01940                         {
01941                             *(*bufc)++ = ' ';
01942                             nBufferAvailable--;
01943                         }
01944                         tbuf++;
01945                     }
01946 
01947                     TempPtr = tbuf;
01948                     mux_exec(buff, bufc, executor, caller, enactor,
01949                         (eval & ~(EV_STRIP_CURLY | EV_FCHECK | EV_TOP)),
01950                         &TempPtr, cargs, ncargs);
01951                 }
01952                 else
01953                 {
01954                     TempPtr = tbuf;
01955                     mux_exec(buff, bufc, executor, caller, enactor,
01956                         eval & ~EV_TOP, &TempPtr, cargs, ncargs);
01957                 }
01958                 nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01959 
01960                 if (!(eval & EV_STRIP_CURLY))
01961                 {
01962                     if (nBufferAvailable)
01963                     {
01964                         *(*bufc)++ = '}';
01965                         nBufferAvailable--;
01966                     }
01967                 }
01968                 pdstr--;
01969             }
01970         }
01971         else if (*pdstr == '\\')
01972         {
01973             // *pdstr must be \.
01974             //
01975             // General escape. Add the following char without special
01976             // processing.
01977             //
01978             at_space = 0;
01979             pdstr++;
01980             if (*pdstr)
01981             {
01982                 if (nBufferAvailable)
01983                 {
01984                     *(*bufc)++ = *pdstr;
01985                     nBufferAvailable--;
01986                 }
01987             }
01988             else
01989             {
01990                 pdstr--;
01991             }
01992         }
01993         else
01994         {
01995             // *pdstr must be ESC.
01996             //
01997             at_space = 0;
01998             if (nBufferAvailable)
01999             {
02000                 *(*bufc)++ = *pdstr;
02001                 nBufferAvailable--;
02002             }
02003             pdstr++;
02004             if (*pdstr)
02005             {
02006                 if (nBufferAvailable)
02007                 {
02008                     *(*bufc)++ = *pdstr;
02009                     nBufferAvailable--;
02010                 }
02011             }
02012             else
02013             {
02014                 pdstr--;
02015             }
02016         }
02017         pdstr++;
02018     }
02019 
02020     // If we're eating spaces, and the last thing was a space, eat it up.
02021     // Complicated by the fact that at_space is initially true. So check to
02022     // see if we actually put something in the buffer, too.
02023     //
02024     if (  bSpaceIsSpecial
02025        && at_space
02026        && start != *bufc)
02027     {
02028         (*bufc)--;
02029     }
02030 
02031     **bufc = '\0';
02032 
02033     // Collect and report trace information.
02034     //
02035     if (is_trace)
02036     {
02037         tcache_add(executor, savestr, start);
02038         if (  is_top
02039            || !mudconf.trace_topdown)
02040         {
02041             tcache_finish();
02042         }
02043         if (  is_top
02044            && 0 < tcache_count - mudconf.trace_limit)
02045         {
02046             tbuf = alloc_mbuf("exec.trace_diag");
02047             sprintf(tbuf, "%d lines of trace output discarded.", tcache_count
02048                 - mudconf.trace_limit);
02049             notify(executor, tbuf);
02050             free_mbuf(tbuf);
02051         }
02052     }
02053 
02054     if (  realbuff
02055        || ansi
02056        || (eval & EV_TOP))
02057     {
02058         // We need to transfer and/or ANSI optimize the result.
02059         //
02060         static struct ANSI_In_Context aic;
02061         static struct ANSI_Out_Context aoc;
02062 
02063         ANSI_String_Out_Init(&aoc, mux_scratch, sizeof(mux_scratch),
02064             sizeof(mux_scratch), ANSI_ENDGOAL_NORMAL);
02065         if (realbuff)
02066         {
02067             *realbp = '\0';
02068             ANSI_String_In_Init(&aic, realbuff, ANSI_ENDGOAL_NORMAL);
02069             ANSI_String_Copy(&aoc, &aic, sizeof(mux_scratch));
02070         }
02071         ANSI_String_In_Init(&aic, buff, ANSI_ENDGOAL_NORMAL);
02072         ANSI_String_Copy(&aoc, &aic, sizeof(mux_scratch));
02073         if (realbuff)
02074         {
02075             MEMFREE(buff);
02076             buff = realbuff;
02077         }
02078 
02079         int nVisualWidth;
02080         int nLen = ANSI_String_Finalize(&aoc, &nVisualWidth);
02081         memcpy(buff, mux_scratch, nLen+1);
02082         *bufc = buff + nLen;
02083     }
02084 
02085     *dstr = pdstr;
02086 
02087     // Restore Parser Mode.
02088     //
02089     isSpecial(L1, ' ') = bSpaceIsSpecialSave;
02090     isSpecial(L1, '(') = bParenthesisIsSpecialSave;
02091     isSpecial(L1, '[') = bBracketIsSpecialSave;
02092 }

void mux_FPInit (  ) 

Definition at line 3589 of file strtod.cpp.

Referenced by FLOAT_Initialize().

03590 {
03591 }

void mux_FPRestore (  ) 

Definition at line 3597 of file strtod.cpp.

Referenced by FUNCTION().

03598 {
03599 }

void mux_FPSet (  ) 

Definition at line 3593 of file strtod.cpp.

Referenced by FLOAT_Initialize(), and FUNCTION().

03594 {
03595 }

double mux_strtod ( const char *  s00,
char **  se 
)

Referenced by mux_atof().

const char* Name ( dbref  thing  ) 

Definition at line 450 of file db.cpp.

References A_NAME, aszSpecialDBRefNames, atr_get_LEN(), atr_get_str(), db, free_lbuf, LBUF_SIZE, object::name, and StringCloneLen().

00451 {
00452     if (thing < 0)
00453     {
00454         return aszSpecialDBRefNames[-thing];
00455     }
00456 
00457     dbref aowner;
00458     int aflags;
00459 #ifdef MEMORY_BASED
00460     static char tbuff[LBUF_SIZE];
00461     atr_get_str(tbuff, thing, A_NAME, &aowner, &aflags);
00462     return tbuff;
00463 #else // MEMORY_BASED
00464     if (!db[thing].name)
00465     {
00466         size_t len;
00467         char *pName = atr_get_LEN(thing, A_NAME, &aowner, &aflags, &len);
00468         db[thing].name = StringCloneLen(pName, len);
00469         free_lbuf(pName);
00470     }
00471     return db[thing].name;
00472 #endif // MEMORY_BASED
00473 }

bool nearby ( dbref  ,
dbref   
)

Definition at line 2140 of file predicates.cpp.

References Can_Hide, Good_obj, Hidden, See_Hidden, and where_is().

Referenced by bCanReadAttr(), do_examine(), do_pemit_single(), do_verb(), exam_wildattrs(), FUNCTION(), and nearby_or_control().

02141 {
02142     if (  !Good_obj(player)
02143        || !Good_obj(thing))
02144     {
02145         return false;
02146     }
02147     if (  Can_Hide(thing)
02148        && Hidden(thing)
02149        && !See_Hidden(player))
02150     {
02151         return false;
02152     }
02153     dbref thing_loc = where_is(thing);
02154     if (thing_loc == player)
02155     {
02156         return true;
02157     }
02158     dbref player_loc = where_is(player);
02159     if (  thing_loc == player_loc
02160        || thing == player_loc)
02161     {
02162         return true;
02163     }
02164     return false;
02165 }

dbref new_home ( dbref   ) 

Definition at line 151 of file object.cpp.

References can_set_home(), default_home(), Home, Location, and Owner.

Referenced by check_contents_chains(), check_dead_refs(), clone_home(), divest_object(), do_create(), empty_obj(), and FUNCTION().

00152 {
00153     dbref loc = Location(player);
00154     if (can_set_home(Owner(player), player, loc))
00155     {
00156         return loc;
00157     }
00158     loc = Home(Owner(player));
00159     if (can_set_home(Owner(player), player, loc))
00160     {
00161         return loc;
00162     }
00163     return default_home();
00164 }

int nfy_que ( dbref  ,
int  ,
int  ,
int   
)

Definition at line 525 of file cque.cpp.

References add_to(), atr_clr(), atr_get, CallBack_NotifySemaphoreDrainOrAll(), CallBack_NotifySemaphoreFirstOrQuiet(), free_lbuf, mux_atol(), NFY_NFY, NFY_QUIET, Notify_Attr, Notify_Key, Notify_Num_Done, Notify_Num_Max, Notify_Sem, scheduler, CScheduler::TraverseOrdered(), and CScheduler::TraverseUnordered().

Referenced by destroy_bad_obj(), destroy_obj(), and do_notify().

00526 {
00527     int cSemaphore = 1;
00528     if (attr)
00529     {
00530         int   aflags;
00531         dbref aowner;
00532         char *str = atr_get(sem, attr, &aowner, &aflags);
00533         cSemaphore = mux_atol(str);
00534         free_lbuf(str);
00535     }
00536 
00537     Notify_Num_Done = 0;
00538     if (cSemaphore > 0)
00539     {
00540         Notify_Key     = key;
00541         Notify_Sem     = sem;
00542         Notify_Attr    = attr;
00543         Notify_Num_Max = count;
00544         if (  key == NFY_NFY
00545            || key == NFY_QUIET)
00546         {
00547             scheduler.TraverseOrdered(CallBack_NotifySemaphoreFirstOrQuiet);
00548         }
00549         else
00550         {
00551             scheduler.TraverseUnordered(CallBack_NotifySemaphoreDrainOrAll);
00552         }
00553     }
00554 
00555     // Update the sem waiters count.
00556     //
00557     if (key == NFY_NFY)
00558     {
00559         add_to(sem, -count, attr);
00560     }
00561     else
00562     {
00563         atr_clr(sem, attr);
00564     }
00565 
00566     return Notify_Num_Done;
00567 }

void notify_check ( dbref  ,
dbref  ,
const char *  ,
int   
)

Definition at line 587 of file game.cpp.

References A_AAHEAR, A_AHEAR, A_AMHEAR, A_FILTER, A_INFILTER, A_INPREFIX, A_LISTEN, A_LUSE, A_PREFIX, add_prefix(), alloc_lbuf, alloc_sbuf, AMATCH_LISTEN, atr_get, atr_match(), Audible, check_filter(), Contents, could_doit(), forward_list::count, statedata::curr_enactor, statedata::curr_executor, forward_list::data, dflt_from_msg(), did_it(), DOLIST, Exits, free_lbuf, free_sbuf, fwdlist_get(), Good_obj, H_Listen, Halted, Has_location, Html, html_escape(), statedata::inpipe, isPlayer, Location, Monitor, MSG_F_CONTENTS, MSG_F_DOWN, MSG_F_UP, MSG_FWDLIST, MSG_HTML, MSG_INV, MSG_INV_EXITS, MSG_INV_L, MSG_LOC, MSG_LOC_A, MSG_ME, MSG_NBR, MSG_NBR_A, MSG_NBR_EXITS, MSG_NBR_EXITS_A, MSG_OOC, MSG_PUP_ALWAYS, MSG_S_INSIDE, MSG_S_OUTSIDE, MSG_SAYPOSE, mudconf, mudstate, Name, statedata::nHearNest, Nospoof, notify_check(), statedata::ntfy_nest_lev, confdata::ntfy_nest_lim, NUM_ENV_VARS, Owner, confdata::player_listen, Puppet, raw_notify(), raw_notify_html(), safe_chr, safe_str, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, where_is(), and wild().

Referenced by announce_connect(), announce_disconnect(), handle_ears(), notify_check(), notify_except(), and notify_except2().

00588 {
00589     // If speaker is invalid or message is empty, just exit.
00590     //
00591     if (  !Good_obj(target)
00592        || !msg
00593        || !*msg)
00594     {
00595         return;
00596     }
00597 
00598 #ifdef WOD_REALMS
00599     if ((key & MSG_OOC) == 0)
00600     {
00601         if ((key & MSG_SAYPOSE) != 0)
00602         {
00603             if (REALM_DO_HIDDEN_FROM_YOU == DoThingToThingVisibility(target, sender, ACTION_IS_TALKING))
00604             {
00605                 return;
00606             }
00607         }
00608         else
00609         {
00610             if (REALM_DO_HIDDEN_FROM_YOU == DoThingToThingVisibility(target, sender, ACTION_IS_MOVING))
00611             {
00612                 return;
00613             }
00614         }
00615     }
00616 #endif // WOD_REALMS
00617 
00618     // Enforce a recursion limit
00619     //
00620     mudstate.ntfy_nest_lev++;
00621     if (mudconf.ntfy_nest_lim <= mudstate.ntfy_nest_lev)
00622     {
00623         mudstate.ntfy_nest_lev--;
00624         return;
00625     }
00626 
00627     char *msg_ns, *mp, *tbuff, *tp, *buff;
00628     char *args[NUM_ENV_VARS];
00629     dbref aowner,  recip, obj;
00630     int i, nargs, aflags;
00631     FWDLIST *fp;
00632 
00633     // If we want NOSPOOF output, generate it.  It is only needed if we are
00634     // sending the message to the target object.
00635     //
00636     if (key & MSG_ME)
00637     {
00638         mp = msg_ns = alloc_lbuf("notify_check");
00639         if (  Nospoof(target)
00640            && target != sender
00641            && target != mudstate.curr_enactor
00642            && target != mudstate.curr_executor)
00643         {
00644             // I'd really like to use tprintf here but I can't because the
00645             // caller may have.  notify(target, tprintf(...)) is quite common
00646             // in the code.
00647             //
00648             tbuff = alloc_sbuf("notify_check.nospoof");
00649             safe_chr('[', msg_ns, &mp);
00650             safe_str(Name(sender), msg_ns, &mp);
00651             sprintf(tbuff, "(#%d)", sender);
00652             safe_str(tbuff, msg_ns, &mp);
00653 
00654             if (sender != Owner(sender))
00655             {
00656                 safe_chr('{', msg_ns, &mp);
00657                 safe_str(Name(Owner(sender)), msg_ns, &mp);
00658                 safe_chr('}', msg_ns, &mp);
00659             }
00660             if (sender != mudstate.curr_enactor)
00661             {
00662                 sprintf(tbuff, "<-(#%d)", mudstate.curr_enactor);
00663                 safe_str(tbuff, msg_ns, &mp);
00664             }
00665             safe_str("] ", msg_ns, &mp);
00666             free_sbuf(tbuff);
00667         }
00668         safe_str(msg, msg_ns, &mp);
00669         *mp = '\0';
00670     }
00671     else
00672     {
00673         msg_ns = NULL;
00674     }
00675 
00676     // msg contains the raw message, msg_ns contains the NOSPOOFed msg.
00677     //
00678     bool check_listens = !Halted(target);
00679     switch (Typeof(target))
00680     {
00681     case TYPE_PLAYER:
00682         if (key & MSG_ME)
00683         {
00684             if (key & MSG_HTML)
00685             {
00686                 raw_notify_html(target, msg_ns);
00687             }
00688             else
00689             {
00690                 if (Html(target))
00691                 {
00692                     char *msg_ns_escaped;
00693 
00694                     msg_ns_escaped = alloc_lbuf("notify_check_escape");
00695                     html_escape(msg_ns, msg_ns_escaped, 0);
00696                     raw_notify(target, msg_ns_escaped);
00697                     free_lbuf(msg_ns_escaped);
00698                 }
00699                 else
00700                 {
00701                     raw_notify(target, msg_ns);
00702                 }
00703             }
00704         }
00705         if (!mudconf.player_listen)
00706         {
00707             check_listens = false;
00708         }
00709 
00710         // FALLTHROUGH
00711 
00712     case TYPE_THING:
00713     case TYPE_ROOM:
00714 
00715         // If we're in a pipe, objects can receive raw_notify if
00716         // they're not a player. (players were already notified
00717         // above.
00718         //
00719         if (  mudstate.inpipe
00720            && !isPlayer(target))
00721         {
00722             raw_notify(target, msg_ns);
00723         }
00724 
00725         // Forward puppet message if it is for me.
00726         //
00727         bool has_neighbors = Has_location(target);
00728         dbref targetloc = where_is(target);
00729         bool is_audible = Audible(target);
00730 
00731         if ( (key & MSG_ME)
00732            && Puppet(target)
00733            && (target != Owner(target))
00734            && (  (key & MSG_PUP_ALWAYS)
00735               || (  targetloc != Location(Owner(target))
00736                  && targetloc != Owner(target))))
00737         {
00738             tp = tbuff = alloc_lbuf("notify_check.puppet");
00739             safe_str(Name(target), tbuff, &tp);
00740             safe_str("> ", tbuff, &tp);
00741             safe_str(msg_ns, tbuff, &tp);
00742             *tp = '\0';
00743             raw_notify(Owner(target), tbuff);
00744             free_lbuf(tbuff);
00745         }
00746 
00747         // Check for @Listen match if it will be useful.
00748         //
00749         bool pass_listen = false;
00750         nargs = 0;
00751         if (  check_listens
00752            && (key & (MSG_ME | MSG_INV_L))
00753            && H_Listen(target))
00754         {
00755             tp = atr_get(target, A_LISTEN, &aowner, &aflags);
00756             if (*tp && wild(tp, (char *)msg, args, NUM_ENV_VARS))
00757             {
00758                 for (nargs = NUM_ENV_VARS; nargs && (!args[nargs - 1] || !(*args[nargs - 1])); nargs--)
00759                 {
00760                     ; // Nothing
00761                 }
00762                 pass_listen = true;
00763             }
00764             free_lbuf(tp);
00765         }
00766 
00767         // If we matched the @listen or are monitoring, check the
00768         // USE lock.
00769         //
00770         bool pass_uselock = false;
00771         if (  (key & MSG_ME)
00772            && check_listens
00773            && (  pass_listen
00774               || Monitor(target)))
00775         {
00776             pass_uselock = could_doit(sender, target, A_LUSE);
00777         }
00778 
00779         // Process AxHEAR if we pass LISTEN, USElock and it's for me.
00780         //
00781         if (  (key & MSG_ME)
00782            && pass_listen
00783            && pass_uselock
00784            && mudstate.nHearNest <= 2)
00785         {
00786             mudstate.nHearNest++;
00787             if (sender != target)
00788             {
00789                 did_it(sender, target, 0, NULL, 0, NULL, A_AHEAR, args, nargs);
00790             }
00791             else
00792             {
00793                 did_it(sender, target, 0, NULL, 0, NULL, A_AMHEAR, args,
00794                     nargs);
00795             }
00796             did_it(sender, target, 0, NULL, 0, NULL, A_AAHEAR, args, nargs);
00797             mudstate.nHearNest--;
00798         }
00799 
00800         // Get rid of match arguments. We don't need them anymore.
00801         //
00802         if (pass_listen)
00803         {
00804             for (i = 0; i < nargs; i++)
00805             {
00806                 if (args[i] != NULL)
00807                 {
00808                     free_lbuf(args[i]);
00809                 }
00810             }
00811         }
00812 
00813         // Process ^-listens if for me, MONITOR, and we pass USElock.
00814         //
00815         if (  (key & MSG_ME)
00816            && pass_uselock
00817            && sender != target
00818            && Monitor(target))
00819         {
00820             atr_match(target, sender, AMATCH_LISTEN, (char *)msg, (char *)msg,
00821                 false);
00822         }
00823 
00824         // Deliver message to forwardlist members.
00825         //
00826         if ( (key & MSG_FWDLIST)
00827            && is_audible
00828            && check_filter(target, sender, A_FILTER, msg))
00829         {
00830             tbuff = dflt_from_msg(sender, target);
00831             buff = add_prefix(target, sender, A_PREFIX, msg, tbuff);
00832             free_lbuf(tbuff);
00833 
00834             fp = fwdlist_get(target);
00835             if (fp)
00836             {
00837                 for (i = 0; i < fp->count; i++)
00838                 {
00839                     recip = fp->data[i];
00840                     if (  !Good_obj(recip)
00841                        || recip == target)
00842                     {
00843                         continue;
00844                     }
00845                     notify_check(recip, sender, buff,
00846                              MSG_ME | MSG_F_UP | MSG_F_CONTENTS | MSG_S_INSIDE);
00847                 }
00848             }
00849             free_lbuf(buff);
00850         }
00851 
00852         // Deliver message through audible exits.
00853         //
00854         if (key & MSG_INV_EXITS)
00855         {
00856             DOLIST(obj, Exits(target))
00857             {
00858                 recip = Location(obj);
00859                 if (  Audible(obj)
00860                    && (  recip != target
00861                       && check_filter(obj, sender, A_FILTER, msg)))
00862                 {
00863                     buff = add_prefix(obj, target, A_PREFIX, msg,
00864                         "From a distance,");
00865                     notify_check(recip, sender, buff,
00866                         MSG_ME | MSG_F_UP | MSG_F_CONTENTS | MSG_S_INSIDE);
00867                     free_lbuf(buff);
00868                 }
00869             }
00870         }
00871 
00872         // Deliver message through neighboring audible exits.
00873         //
00874         if (  has_neighbors
00875            && (  (key & MSG_NBR_EXITS)
00876               || (  (key & MSG_NBR_EXITS_A)
00877                  && is_audible)))
00878         {
00879             // If from inside, we have to add the prefix string of
00880             // the container.
00881             //
00882             if (key & MSG_S_INSIDE)
00883             {
00884                 tbuff = dflt_from_msg(sender, target);
00885                 buff = add_prefix(target, sender, A_PREFIX, msg, tbuff);
00886                 free_lbuf(tbuff);
00887             }
00888             else
00889             {
00890                 buff = (char *)msg;
00891             }
00892 
00893             DOLIST(obj, Exits(Location(target)))
00894             {
00895                 recip = Location(obj);
00896                 if (  Good_obj(recip)
00897                    && Audible(obj)
00898                    && recip != targetloc
00899                    && recip != target
00900                    && check_filter(obj, sender, A_FILTER, msg))
00901                 {
00902                     tbuff = add_prefix(obj, target, A_PREFIX, buff,
00903                         "From a distance,");
00904                     notify_check(recip, sender, tbuff,
00905                         MSG_ME | MSG_F_UP | MSG_F_CONTENTS | MSG_S_INSIDE);
00906                     free_lbuf(tbuff);
00907                 }
00908             }
00909             if (key & MSG_S_INSIDE)
00910             {
00911                 free_lbuf(buff);
00912             }
00913         }
00914 
00915         // Deliver message to contents.
00916         //
00917         if (  (  (key & MSG_INV)
00918               || (  (key & MSG_INV_L)
00919                  && pass_listen))
00920            && check_filter(target, sender, A_INFILTER, msg))
00921         {
00922             // Don't prefix the message if we were given the MSG_NOPREFIX key.
00923             //
00924             if (key & MSG_S_OUTSIDE)
00925             {
00926                 buff = add_prefix(target, sender, A_INPREFIX, msg, "");
00927             }
00928             else
00929             {
00930                 buff = (char *)msg;
00931             }
00932             DOLIST(obj, Contents(target))
00933             {
00934                 if (obj != target)
00935                 {
00936                     notify_check(obj, sender, buff,
00937                         MSG_ME | MSG_F_DOWN | MSG_S_OUTSIDE | key & MSG_HTML);
00938                 }
00939             }
00940             if (key & MSG_S_OUTSIDE)
00941             {
00942                 free_lbuf(buff);
00943             }
00944         }
00945 
00946         // Deliver message to neighbors.
00947         //
00948         if (  has_neighbors
00949            && (  (key & MSG_NBR)
00950               || (  (key & MSG_NBR_A)
00951                  && is_audible
00952                  && check_filter(target, sender, A_FILTER, msg))))
00953         {
00954             if (key & MSG_S_INSIDE)
00955             {
00956                 tbuff = dflt_from_msg(sender, target);
00957                 buff = add_prefix(target, sender, A_PREFIX, msg, "");
00958                 free_lbuf(tbuff);
00959             }
00960             else
00961             {
00962                 buff = (char *)msg;
00963             }
00964             DOLIST(obj, Contents(targetloc))
00965             {
00966                 if (  obj != target
00967                    && obj != targetloc)
00968                 {
00969                     notify_check(obj, sender, buff,
00970                     MSG_ME | MSG_F_DOWN | MSG_S_OUTSIDE);
00971                 }
00972             }
00973             if (key & MSG_S_INSIDE)
00974             {
00975                 free_lbuf(buff);
00976             }
00977         }
00978 
00979         // Deliver message to container.
00980         //
00981         if (  has_neighbors
00982            && (  (key & MSG_LOC)
00983               || ( (key & MSG_LOC_A)
00984                  && is_audible
00985                  && check_filter(target, sender, A_FILTER, msg))))
00986         {
00987             if (key & MSG_S_INSIDE)
00988             {
00989                 tbuff = dflt_from_msg(sender, target);
00990                 buff = add_prefix(target, sender, A_PREFIX, msg, tbuff);
00991                 free_lbuf(tbuff);
00992             }
00993             else
00994             {
00995                 buff = (char *)msg;
00996             }
00997             notify_check(targetloc, sender, buff,
00998                 MSG_ME | MSG_F_UP | MSG_S_INSIDE);
00999             if (key & MSG_S_INSIDE)
01000             {
01001                 free_lbuf(buff);
01002             }
01003         }
01004     }
01005     if (msg_ns)
01006     {
01007         free_lbuf(msg_ns);
01008     }
01009     mudstate.ntfy_nest_lev--;
01010 }

void notify_except ( dbref  ,
dbref  ,
dbref  ,
const char *  ,
int  key 
)

Definition at line 1012 of file game.cpp.

References Contents, DOLIST, MSG_F_DOWN, MSG_F_UP, MSG_ME, MSG_ME_ALL, MSG_NBR_EXITS_A, MSG_S_INSIDE, MSG_S_OUTSIDE, and notify_check().

Referenced by do_move(), do_pemit_single(), and do_say().

01013 {
01014     dbref first;
01015 
01016     if (loc != exception)
01017     {
01018         notify_check(loc, player, msg, (MSG_ME_ALL | MSG_F_UP | MSG_S_INSIDE | MSG_NBR_EXITS_A | key));
01019     }
01020     DOLIST(first, Contents(loc))
01021     {
01022         if (first != exception)
01023         {
01024             notify_check(first, player, msg, (MSG_ME | MSG_F_DOWN | MSG_S_OUTSIDE | key));
01025         }
01026     }
01027 }

void notify_except2 ( dbref  ,
dbref  ,
dbref  ,
dbref  ,
const char *   
)

Definition at line 1029 of file game.cpp.

References Contents, DOLIST, MSG_F_DOWN, MSG_F_UP, MSG_ME, MSG_ME_ALL, MSG_NBR_EXITS_A, MSG_S_INSIDE, MSG_S_OUTSIDE, and notify_check().

Referenced by did_it(), do_pemit_single(), do_toad(), process_enter_loc(), and process_leave_loc().

01030 {
01031     dbref first;
01032 
01033     if (  loc != exc1
01034        && loc != exc2)
01035     {
01036         notify_check(loc, player, msg, (MSG_ME_ALL | MSG_F_UP | MSG_S_INSIDE | MSG_NBR_EXITS_A));
01037     }
01038     DOLIST(first, Contents(loc))
01039     {
01040         if (  first != exc1
01041            && first != exc2)
01042         {
01043             notify_check(first, player, msg, (MSG_ME | MSG_F_DOWN | MSG_S_OUTSIDE));
01044         }
01045     }
01046 }

bool ok_password ( const char *  szPassword,
const char **  pmsg 
)

Definition at line 544 of file predicates.cpp.

References statedata::bStandAlone, mudconf, mudstate, mux_islower, mux_isprint, mux_isspace, mux_isupper, and confdata::safer_passwords.

Referenced by create_player(), do_newpassword(), and do_password().

00545 {
00546     *pmsg = NULL;
00547 
00548     if (*password == '\0')
00549     {
00550         *pmsg = "Null passwords are not allowed.";
00551         return false;
00552     }
00553 
00554     const char *scan;
00555     int num_upper = 0;
00556     int num_special = 0;
00557     int num_lower = 0;
00558 
00559     for (scan = password; *scan; scan++)
00560     {
00561         if (  !mux_isprint(*scan)
00562            || mux_isspace(*scan))
00563         {
00564             *pmsg = "Illegal character in password.";
00565             return false;
00566         }
00567         if (mux_isupper(*scan))
00568         {
00569             num_upper++;
00570         }
00571         else if (mux_islower(*scan))
00572         {
00573             num_lower++;
00574         }
00575         else if (  *scan != '\''
00576                 && *scan != '-')
00577         {
00578             num_special++;
00579         }
00580     }
00581 
00582     if (  !mudstate.bStandAlone
00583        && mudconf.safer_passwords)
00584     {
00585         if (num_upper < 1)
00586         {
00587             *pmsg = "The password must contain at least one capital letter.";
00588             return false;
00589         }
00590         if (num_lower < 1)
00591         {
00592             *pmsg = "The password must contain at least one lowercase letter.";
00593             return false;
00594         }
00595         if (num_special < 1)
00596         {
00597             *pmsg = "The password must contain at least one number or a symbol other than the apostrophe or dash.";
00598             return false;
00599         }
00600     }
00601     return true;
00602 }

void olist_add ( dbref   ) 

Definition at line 1189 of file walkdb.cpp.

References alloc_lbuf, objlist_stack::count, objlist_block::data, objlist_stack::head, mudstate, objlist_block::next, OBLOCK_SIZE, statedata::olist, and objlist_stack::tail.

Referenced by find_wild_attrs(), and search_perform().

01190 {
01191     OBLOCK *op;
01192 
01193     if (!mudstate.olist->head)
01194     {
01195         op = (OBLOCK *) alloc_lbuf("olist_add.first");
01196         mudstate.olist->head = mudstate.olist->tail = op;
01197         mudstate.olist->count = 0;
01198         op->next = NULL;
01199     }
01200     else if (mudstate.olist->count >= OBLOCK_SIZE)
01201     {
01202         op = (OBLOCK *) alloc_lbuf("olist_add.next");
01203         mudstate.olist->tail->next = op;
01204         mudstate.olist->tail = op;
01205         mudstate.olist->count = 0;
01206         op->next = NULL;
01207     }
01208     else
01209     {
01210         op = mudstate.olist->tail;
01211     }
01212     op->data[mudstate.olist->count++] = item;
01213 }

dbref olist_first ( void   ) 

Definition at line 1217 of file walkdb.cpp.

References objlist_stack::cblock, objlist_stack::citm, objlist_stack::count, objlist_block::data, objlist_stack::head, mudstate, NOTHING, statedata::olist, and objlist_stack::tail.

Referenced by do_decomp(), do_edit(), do_search(), do_wipe(), exam_wildattrs(), FUNCTION(), grep_util(), lattr_handler(), and search_mark().

01218 {
01219     if (!mudstate.olist->head)
01220     {
01221         return NOTHING;
01222     }
01223     if (  (mudstate.olist->head == mudstate.olist->tail)
01224        && (mudstate.olist->count == 0))
01225     {
01226         return NOTHING;
01227     }
01228     mudstate.olist->cblock = mudstate.olist->head;
01229     mudstate.olist->citm = 0;
01230     return mudstate.olist->cblock->data[mudstate.olist->citm++];
01231 }

dbref olist_next ( void   ) 

Definition at line 1233 of file walkdb.cpp.

References objlist_stack::cblock, objlist_stack::citm, objlist_stack::count, objlist_block::data, mudstate, objlist_block::next, NOTHING, OBLOCK_SIZE, statedata::olist, and objlist_stack::tail.

Referenced by do_decomp(), do_edit(), do_search(), do_wipe(), exam_wildattrs(), FUNCTION(), grep_util(), lattr_handler(), and search_mark().

01234 {
01235     if (!mudstate.olist->cblock)
01236     {
01237         return NOTHING;
01238     }
01239     if (  (mudstate.olist->cblock == mudstate.olist->tail)
01240        && (mudstate.olist->citm >= mudstate.olist->count))
01241     {
01242         return NOTHING;
01243     }
01244     dbref thing = mudstate.olist->cblock->data[mudstate.olist->citm++];
01245     if (mudstate.olist->citm >= OBLOCK_SIZE)
01246     {
01247         mudstate.olist->cblock = mudstate.olist->cblock->next;
01248         mudstate.olist->citm = 0;
01249     }
01250     return thing;
01251 }

void olist_pop ( void   ) 

Definition at line 1174 of file walkdb.cpp.

References free_lbuf, objlist_stack::head, MEMFREE, mudstate, objlist_stack::next, objlist_block::next, and statedata::olist.

Referenced by do_decomp(), do_edit(), do_examine(), do_search(), do_wipe(), FUNCTION(), grep_util(), lattr_handler(), and CGuests::WipeAttrs().

01175 {
01176     OLSTK *ol = mudstate.olist->next;
01177     OBLOCK *op, *onext;
01178     for (op = mudstate.olist->head; op != NULL; op = onext)
01179     {
01180         onext = op->next;
01181         free_lbuf(op);
01182     }
01183     MEMFREE(mudstate.olist);
01184     mudstate.olist = ol;
01185 }

void olist_push ( void   ) 

Definition at line 1158 of file walkdb.cpp.

References objlist_stack::cblock, objlist_stack::citm, objlist_stack::count, objlist_stack::head, ISOUTOFMEMORY, MEMALLOC, mudstate, objlist_stack::next, statedata::olist, and objlist_stack::tail.

Referenced by do_decomp(), do_edit(), do_examine(), do_search(), do_wipe(), FUNCTION(), grep_util(), lattr_handler(), and CGuests::WipeAttrs().

01159 {
01160     OLSTK *ol = (OLSTK *)MEMALLOC(sizeof(OLSTK));
01161     ISOUTOFMEMORY(ol);
01162     ol->next = mudstate.olist;
01163     mudstate.olist = ol;
01164 
01165     ol->head = NULL;
01166     ol->tail = NULL;
01167     ol->cblock = NULL;
01168     ol->count = 0;
01169     ol->citm = 0;
01170 }

bool parse_and_get_attrib ( dbref  ,
char *  [],
char **  ,
dbref ,
char *  ,
char **   
)

Definition at line 32 of file funceval.cpp.

References atr_pget, atr_str(), free_lbuf, attr::number, parse_attrib(), safe_noperm, and See_attr.

Referenced by do_ufun(), filter_handler(), and FUNCTION().

00033 {
00034     ATTR *ap;
00035 
00036     // Two possibilities for the first arg: <obj>/<attr> and <attr>.
00037     //
00038     if (!parse_attrib(executor, fargs[0], thing, &ap))
00039     {
00040         *thing = executor;
00041         ap = atr_str(fargs[0]);
00042     }
00043 
00044     // Make sure we got a good attribute.
00045     //
00046     if (!ap)
00047     {
00048         return false;
00049     }
00050 
00051     // Use it if we can access it, otherwise return an error.
00052     //
00053     if (!See_attr(executor, *thing, ap))
00054     {
00055         safe_noperm(buff, bufc);
00056         return false;
00057     }
00058 
00059     dbref aowner;
00060     int aflags;
00061     *atext = atr_pget(*thing, ap->number, &aowner, &aflags);
00062     if (!*atext)
00063     {
00064         return false;
00065     }
00066     else if (!**atext)
00067     {
00068         free_lbuf(*atext);
00069         return false;
00070     }
00071     return true;
00072 }

char* parse_arglist ( dbref  executor,
dbref  caller,
dbref  enactor,
char *  ,
char  ,
int  ,
char *  [],
int  ,
char *  [],
int  ,
int *   
)

Definition at line 726 of file eval.cpp.

References alloc_lbuf, EV_EVAL, EV_FCHECK, mux_exec(), parse_to(), and parse_to_lite().

Referenced by do_verb(), and process_cmdent().

00729 {
00730     char *rstr, *tstr, *bp, *str;
00731     int arg, peval;
00732 
00733     if (dstr == NULL)
00734     {
00735         *nArgsParsed = 0;
00736         return NULL;
00737     }
00738 
00739     int nLen;
00740     int iWhichDelim;
00741     rstr = parse_to_lite(&dstr, delim, '\0', &nLen, &iWhichDelim);
00742     arg = 0;
00743 
00744     peval = (eval & ~EV_EVAL);
00745 
00746     while (  arg < nfargs
00747           && rstr)
00748     {
00749         if (arg < nfargs - 1)
00750         {
00751             tstr = parse_to(&rstr, ',', peval);
00752         }
00753         else
00754         {
00755             tstr = parse_to(&rstr, '\0', peval);
00756         }
00757 
00758         bp = fargs[arg] = alloc_lbuf("parse_arglist");
00759         if (eval & EV_EVAL)
00760         {
00761             str = tstr;
00762             mux_exec(fargs[arg], &bp, executor, caller, enactor,
00763                      eval | EV_FCHECK, &str, cargs, ncargs);
00764             *bp = '\0';
00765         }
00766         else
00767         {
00768             strcpy(fargs[arg], tstr);
00769         }
00770         arg++;
00771     }
00772     *nArgsParsed = arg;
00773     return dstr;
00774 }

bool parse_attrib ( dbref  ,
char *  ,
dbref ,
ATTR **   
)

Definition at line 1368 of file set.cpp.

References alloc_lbuf, atr_str(), attr, free_lbuf, NOTHING, and parse_thing_slash().

Referenced by default_handler(), do_addcommand(), do_chown(), do_delcommand(), do_function(), do_lock(), do_prog(), do_set(), do_trigger(), do_unlock(), FUNCTION(), get_handler(), and parse_and_get_attrib().

01369 {
01370     ATTR *tattr = NULL;
01371     *thing = NOTHING;
01372 
01373     if (!str)
01374     {
01375         *attr = tattr;
01376         return false;
01377     }
01378 
01379     // Break apart string into obj and attr.
01380     //
01381     char *buff = alloc_lbuf("parse_attrib");
01382     strcpy(buff, str);
01383     char *AttrName;
01384     bool retval = parse_thing_slash(player, buff, &AttrName, thing);
01385 
01386     // Get the named attribute from the object if we can.
01387     //
01388     if (retval)
01389     {
01390         tattr = atr_str(AttrName);
01391     }
01392 
01393     free_lbuf(buff);
01394     *attr = tattr;
01395     return retval;
01396 }

bool parse_attrib_wild ( dbref  ,
char *  ,
dbref ,
bool  ,
bool  ,
bool   
)

Definition at line 1459 of file set.cpp.

References alloc_lbuf, find_wild_attrs(), free_lbuf, Good_obj, hashflush(), init_match(), ITER_PARENTS, MAT_EXIT_PARENTS, match_everything(), match_result(), mudstate, NOTYPE, Parent, statedata::parent_htab, and parse_thing_slash().

Referenced by do_decomp(), do_edit(), do_examine(), do_wipe(), FUNCTION(), grep_util(), and lattr_handler().

01461 {
01462     if (!str)
01463     {
01464         return false;
01465     }
01466 
01467     dbref parent;
01468     int lev;
01469     bool check_exclude, hash_insert;
01470     char *buff = alloc_lbuf("parse_attrib_wild");
01471     strcpy(buff, str);
01472 
01473     // Separate name and attr portions at the first /.
01474     //
01475     if (!parse_thing_slash(player, buff, &str, thing))
01476     {
01477         // Not in obj/attr format, return if not defaulting to.
01478         //
01479         if (!df_star)
01480         {
01481             free_lbuf(buff);
01482             return false;
01483         }
01484 
01485         // Look for the object, return failure if not found.
01486         //
01487         init_match(player, buff, NOTYPE);
01488         match_everything(MAT_EXIT_PARENTS);
01489         *thing = match_result();
01490 
01491         if (!Good_obj(*thing))
01492         {
01493             free_lbuf(buff);
01494             return false;
01495         }
01496         str = (char *)"*";
01497     }
01498 
01499     // Check the object (and optionally all parents) for attributes.
01500     //
01501     if (check_parents)
01502     {
01503         check_exclude = false;
01504         hash_insert = check_parents;
01505         hashflush(&mudstate.parent_htab);
01506         ITER_PARENTS(*thing, parent, lev)
01507         {
01508             if (!Good_obj(Parent(parent)))
01509             {
01510                 hash_insert = false;
01511             }
01512             find_wild_attrs(player, parent, str, check_exclude, hash_insert, get_locks);
01513             check_exclude = true;
01514         }
01515     }
01516     else
01517     {
01518         find_wild_attrs(player, *thing, str, false, false, get_locks);
01519     }
01520     free_lbuf(buff);
01521     return true;
01522 }

BOOLEXP* parse_boolexp ( dbref  ,
const char *  ,
bool   
)

Definition at line 692 of file boolexp.cpp.

References statedata::bStandAlone, mudstate, parse_boolexp_E(), parse_player, parsebuf, parsestore, parsing_internal, and TRUE_BOOLEXP.

Referenced by db_write_object(), debug_examine(), do_decomp(), do_examine(), do_lock(), eval_boolexp_atr(), FUNCTION(), and view_atr().

00693 {
00694     size_t n = strlen(buf);
00695     if (n > sizeof(parsestore)-1)
00696     {
00697         n = sizeof(parsestore)-1;
00698     }
00699     memcpy(parsestore, buf, n+1);
00700     parsebuf = parsestore;
00701     parse_player = player;
00702     if (  buf == NULL
00703        || *buf == '\0')
00704     {
00705         return TRUE_BOOLEXP;
00706     }
00707     if (!mudstate.bStandAlone)
00708     {
00709         parsing_internal = internal;
00710     }
00711     return parse_boolexp_E();
00712 }

void parse_range ( char **  ,
dbref ,
dbref  
)

Definition at line 1734 of file predicates.cpp.

References statedata::db_top, EV_STRIP_TS, mudstate, mux_atol(), mux_isspace, NUMBER_TOKEN, and parse_to().

Referenced by do_entrances(), do_find(), and search_setup().

01735 {
01736     char *buff1 = *name;
01737     if (buff1 && *buff1)
01738     {
01739         *name = parse_to(&buff1, ',', EV_STRIP_TS);
01740     }
01741     if (buff1 && *buff1)
01742     {
01743         char *buff2 = parse_to(&buff1, ',', EV_STRIP_TS);
01744         if (buff1 && *buff1)
01745         {
01746             while (mux_isspace(*buff1))
01747             {
01748                 buff1++;
01749             }
01750 
01751             if (*buff1 == NUMBER_TOKEN)
01752             {
01753                 buff1++;
01754             }
01755 
01756             *high_bound = mux_atol(buff1);
01757             if (*high_bound >= mudstate.db_top)
01758             {
01759                 *high_bound = mudstate.db_top - 1;
01760             }
01761         }
01762         else
01763         {
01764             *high_bound = mudstate.db_top - 1;
01765         }
01766 
01767         while (mux_isspace(*buff2))
01768         {
01769             buff2++;
01770         }
01771 
01772         if (*buff2 == NUMBER_TOKEN)
01773         {
01774             buff2++;
01775         }
01776 
01777         *low_bound = mux_atol(buff2);
01778         if (*low_bound < 0)
01779         {
01780             *low_bound = 0;
01781         }
01782     }
01783     else
01784     {
01785         *low_bound = 0;
01786         *high_bound = mudstate.db_top - 1;
01787     }
01788 }

bool parse_thing_slash ( dbref  ,
char *  ,
char **  ,
dbref  
)

Definition at line 1790 of file predicates.cpp.

References Good_obj, init_match(), MAT_EXIT_PARENTS, match_everything(), match_result(), NOTHING, and NOTYPE.

Referenced by get_obj_and_lock(), parse_attrib(), and parse_attrib_wild().

01791 {
01792     // Get name up to '/'.
01793     //
01794     char *str = thing;
01795     while (  *str != '\0'
01796           && *str != '/')
01797     {
01798         str++;
01799     }
01800 
01801     // If no '/' in string, return failure.
01802     //
01803     if (*str == '\0')
01804     {
01805         *after = NULL;
01806         *it = NOTHING;
01807         return false;
01808     }
01809     *str++ = '\0';
01810     *after = str;
01811 
01812     // Look for the object.
01813     //
01814     init_match(player, thing, NOTYPE);
01815     match_everything(MAT_EXIT_PARENTS);
01816     *it = match_result();
01817 
01818     // Return status of search.
01819     //
01820     return Good_obj(*it);
01821 }

char* parse_to ( char **  ,
char  ,
int   
)

Definition at line 179 of file eval.cpp.

References EV_NO_COMPRESS, EV_STRIP_CURLY, EV_STRIP_LS, isSpecial, mudconf, mux_isspace, NEXTCHAR, parse_to_cleanup(), confdata::space_compress, and stacklim.

Referenced by check_filter(), do_cpattr(), do_dolist(), do_force_prefixed(), do_mail_quick(), do_notify(), do_prog(), do_wait(), parse_arglist(), parse_range(), process_cmdent(), search_setup(), and Task_RunQueueEntry().

00180 {
00181 #define stacklim 32
00182     char stack[stacklim];
00183     char *rstr, *cstr, *zstr, *strFirewall;
00184     int sp, tp, bracketlev;
00185 
00186     if (  dstr == NULL
00187        || *dstr == NULL)
00188     {
00189         return NULL;
00190     }
00191 
00192     if (**dstr == '\0')
00193     {
00194         rstr = *dstr;
00195         *dstr = NULL;
00196         return rstr;
00197     }
00198     sp = 0;
00199     bool first = true;
00200     strFirewall = rstr = *dstr;
00201     if (  (  mudconf.space_compress
00202           || (eval & EV_STRIP_LS))
00203        && !(eval & EV_NO_COMPRESS))
00204     {
00205         while (mux_isspace(*rstr))
00206         {
00207             rstr++;
00208         }
00209         *dstr = rstr;
00210     }
00211     zstr = cstr = rstr;
00212     int iOriginalCode = isSpecial(L3, delim);
00213     isSpecial(L3, ' ') = 1; // Spaces are special.
00214     if (iOriginalCode <= 3)
00215     {
00216         // We can override this code.
00217         //
00218         isSpecial(L3, delim) = 8;
00219     }
00220 
00221     for (;;)
00222     {
00223         int iCode = isSpecial(L3, *cstr);
00224 
00225 TryAgain:
00226         if (iCode == 0)
00227         {
00228             // Mundane characters and not the delimiter we are looking for.
00229             //
00230             first = false;
00231             do
00232             {
00233                 NEXTCHAR
00234                 iCode = isSpecial(L3, *cstr);
00235             } while (iCode == 0);
00236         }
00237 
00238         if (iCode <= 4)
00239         {
00240             // 1 is 0x20 ' '  delim overridable
00241             // 2 is 0x5B '['  delim overridable
00242             // 3 is 0x28 '('  delim overridable
00243             // 4 is 0x25 '%', 0x5C '\\', or 0x1B ESC not overridable.
00244             //
00245             if (iCode <= 2)
00246             {
00247                 // 1 is 0x20 ' '  delim overridable
00248                 // 2 is 0x5B '['  delim overridable
00249                 //
00250                 if (iCode == 1)
00251                 {
00252                     // space
00253                     //
00254                     if (  mudconf.space_compress
00255                        && !(eval & EV_NO_COMPRESS))
00256                     {
00257                         if (first)
00258                         {
00259                             rstr++;
00260                         }
00261                         else if (  strFirewall < cstr
00262                                 && cstr[-1] == ' ')
00263                         {
00264                             zstr--;
00265                         }
00266                     }
00267                     NEXTCHAR
00268                 }
00269                 else
00270                 {
00271                     // '['
00272                     //
00273                     first = false;
00274                     if (sp < stacklim)
00275                     {
00276                         stack[sp++] = ']';
00277                     }
00278                     NEXTCHAR
00279                 }
00280             }
00281             else
00282             {
00283                 // 3 is 0x28 '('  delim overridable
00284                 // 4 is 0x25 '%', 0x5C '\\', or 0x1B ESC not overridable.
00285                 //
00286                 if (iCode == 3)
00287                 {
00288                     first = false;
00289                     if (sp < stacklim)
00290                     {
00291                         stack[sp++] = ')';
00292                     }
00293                     NEXTCHAR
00294                 }
00295                 else
00296                 {
00297                     // %, \, and ESC escapes.
00298                     //
00299                     first = false;
00300                     NEXTCHAR
00301                     if (*cstr)
00302                     {
00303                         NEXTCHAR
00304                     }
00305                 }
00306             }
00307         }
00308         else
00309         {
00310             // 5 is 0x29 ')' or 0x5D ']'  not overridable.
00311             // 6 is 0x7B '{' not overridable.
00312             // 7 is 0x00 '\0' not overridable.
00313             // 8 is the client-specific terminator.
00314             //
00315             if (iCode <= 6)
00316             {
00317                 // 5 is 0x29 ')' or 0x5D ']'  not overridable.
00318                 // 6 is 0x7B '{' not overridable.
00319                 //
00320                 if (iCode == 5)
00321                 {
00322                     // ) and ]
00323                     //
00324                     for (tp = sp - 1; tp >= 0 && stack[tp] != *cstr; tp--)
00325                     {
00326                         ; // Nothing.
00327                     }
00328 
00329                     // If we hit something on the stack, unwind to it. Otherwise (it's
00330                     // not on stack), if it's our delim we are done, and we convert the
00331                     // delim to a null and return a ptr to the char after the null. If
00332                     // it's not our delimiter, skip over it normally.
00333                     //
00334                     if (tp >= 0)
00335                     {
00336                         sp = tp;
00337                     }
00338                     else if (*cstr == delim)
00339                     {
00340                         rstr = parse_to_cleanup(eval, first, cstr, rstr, zstr, strFirewall);
00341                         *dstr = ++cstr;
00342                         isSpecial(L3, delim) = iOriginalCode;
00343                         isSpecial(L3, ' ') = 0; // Spaces no longer special
00344                         return rstr;
00345                     }
00346                     first = false;
00347                     NEXTCHAR
00348                 }
00349                 else
00350                 {
00351                     // {
00352                     //
00353                     bracketlev = 1;
00354                     if (eval & EV_STRIP_CURLY)
00355                     {
00356                         cstr++;
00357                     }
00358                     else
00359                     {
00360                         NEXTCHAR;
00361                     }
00362                     for (;;)
00363                     {
00364                         int iCodeL4 = isSpecial(L4, *cstr);
00365                         if (iCodeL4 == 0)
00366                         {
00367                             // Mudane Characters
00368                             //
00369                             do
00370                             {
00371                                 NEXTCHAR
00372                                 iCodeL4 = isSpecial(L4, *cstr);
00373                             } while (iCodeL4 == 0);
00374                         }
00375 
00376 
00377                         if (iCodeL4 == 1)
00378                         {
00379                             // %, \, and ESC escapes.
00380                             //
00381                             if (cstr[1])
00382                             {
00383                                 NEXTCHAR
00384                             }
00385                         }
00386                         else if (iCodeL4 == 2)
00387                         {
00388                             // '{'
00389                             //
00390                             bracketlev++;
00391                         }
00392                         else if (iCodeL4 == 3)
00393                         {
00394                             // '}'
00395                             //
00396                             bracketlev--;
00397                             if (bracketlev <= 0)
00398                             {
00399                                 break;
00400                             }
00401                         }
00402                         else
00403                         {
00404                             // '\0'
00405                             //
00406                             break;
00407                         }
00408                         NEXTCHAR
00409                     }
00410 
00411                     if (bracketlev == 0)
00412                     {
00413                         if (eval & EV_STRIP_CURLY)
00414                         {
00415                             cstr++;
00416                         }
00417                         else
00418                         {
00419                             NEXTCHAR
00420                         }
00421                     }
00422                     first = false;
00423                 }
00424             }
00425             else
00426             {
00427                 // 7 is 0x00 '\0' not overridable.
00428                 // 8 is the client-specific terminator.
00429                 //
00430                 if (iCode == 7)
00431                 {
00432                     // '\0' - End of string.
00433                     //
00434                     isSpecial(L3, delim) = iOriginalCode;
00435                     isSpecial(L3, ' ') = 0; // Spaces no longer special
00436                     break;
00437                 }
00438                 else
00439                 {
00440                     // Client-Specific terminator
00441                     //
00442                     if (sp == 0)
00443                     {
00444                         rstr = parse_to_cleanup(eval, first, cstr, rstr, zstr, strFirewall);
00445                         *dstr = ++cstr;
00446                         isSpecial(L3, delim) = iOriginalCode;
00447                         isSpecial(L3, ' ') = 0; // Spaces no longer special
00448                         return rstr;
00449                     }
00450 
00451                     // At this point, we need to process the iOriginalCode.
00452                     //
00453                     iCode = iOriginalCode;
00454                     goto TryAgain;
00455                 }
00456             }
00457         }
00458     }
00459     rstr = parse_to_cleanup(eval, first, cstr, rstr, zstr, strFirewall);
00460     *dstr = NULL;
00461     return rstr;
00462 }

bool payfor ( dbref  ,
int   
)

Definition at line 257 of file predicates.cpp.

References Free_Money, Owner, Pennies(), s_Pennies(), and Wizard.

Referenced by canpayfees(), do_entrances(), do_find(), do_kill(), do_mail_stats(), do_processcom(), FUNCTION(), get_stats(), give_money(), open_exit(), page_check(), and setup_que().

00258 {
00259     if (  Wizard(who)
00260        || Wizard(Owner(who))
00261        || Free_Money(who)
00262        || Free_Money(Owner(who)))
00263     {
00264         return true;
00265     }
00266     who = Owner(who);
00267     int tmp;
00268     if ((tmp = Pennies(who)) >= cost)
00269     {
00270         s_Pennies(who, tmp - cost);
00271         return true;
00272     }
00273     return false;
00274 }

void pcache_init ( void   ) 

Initializes the player cache.

This is called once to initialize the player cache and supporting data structures: Player cache structures are pooled, the Hash Table initializes itself, and the singly-linked list is started.

Returns:
None.

Definition at line 53 of file player_c.cpp.

References pcache_head, pool_init(), and POOL_PCACHE.

Referenced by main().

00054 {
00055     pool_init(POOL_PCACHE, sizeof(PCACHE));
00056     pcache_head = NULL;
00057 }

void pcache_reload ( dbref  player  ) 

Re-initializes Money and QueueMax items from the database.

Parameters:
player player object dbref.
Returns:
None.

Definition at line 151 of file player_c.cpp.

References Good_obj, OwnsOthers, pcache_find(), pcache_reload1(), and pcache_save().

Referenced by atr_add_raw_LEN(), and atr_clr().

00152 {
00153     if (  Good_obj(player)
00154        && OwnsOthers(player))
00155     {
00156         PCACHE *pp = pcache_find(player);
00157         pcache_save(pp);
00158         pcache_reload1(player, pp);
00159     }
00160 }

void pcache_sync ( void   ) 

Flushes any dirty player items to the database.

The primary access is via the singly-linked list. Upon return, all the player cache records are marked as clean.

Returns:
None.

Definition at line 220 of file player_c.cpp.

References pcache_head, and pcache_save().

Referenced by do_dbclean(), do_restart(), do_shutdown(), dump_database(), fork_and_dump(), and sighandler().

00221 {
00222     PCACHE *pp = pcache_head;
00223     while (pp)
00224     {
00225         pcache_save(pp);
00226         pp = pp->next;
00227     }
00228 }

void pcache_trim ( void   ) 

Ages and trims the player cache of stale entries.

pcache_trim() relies primarily on the singly-linked list, but it also maintains the Hash Table. To be trimmed, a player cache record must not have outstanding commands in the command queue.

The one level of aging is accomplished with PR_REF. On the first pass through the linked list, the PR_REF bit is removed. On the second pass through the list, the record is trimmed.

Returns:
None.

Definition at line 175 of file player_c.cpp.

References player_cache::cflags, free_pcache, hashdeleteLEN(), player_cache::next, pcache_head, pcache_htab, pcache_save(), PF_REF, player_cache::player, and player_cache::queue.

Referenced by dispatch_FreeListReconstruction().

00176 {
00177     PCACHE *pp = pcache_head;
00178     PCACHE *pplast = NULL;
00179     while (pp)
00180     {
00181         PCACHE *ppnext = pp->next;
00182         if (  pp->queue
00183            || (pp->cflags & PF_REF))
00184         {
00185             // This entry either has outstanding commands in the queue or we
00186             // need to let it age.
00187             //
00188             pp->cflags &= ~PF_REF;
00189             pplast = pp;
00190         }
00191         else
00192         {
00193             // Unlink and destroy this entry.
00194             //
00195             if (pplast)
00196             {
00197                 pplast->next = ppnext;
00198             }
00199             else
00200             {
00201                 pcache_head = ppnext;
00202             }
00203 
00204             pcache_save(pp);
00205             hashdeleteLEN(&(pp->player), sizeof(pp->player), &pcache_htab);
00206             free_pcache(pp);
00207         }
00208         pp = ppnext;
00209     }
00210 }

void PopIntegers ( int *  pi,
int  nNeeded 
)

Definition at line 1073 of file eval.cpp.

References free_lbuf, INTS_PER_FRAME, tag_intsframe::next, tag_intsframe::nints, pIntsFrame, and UNUSED_PARAMETER.

Referenced by add_prefix(), check_filter(), did_it(), do_ufun(), eval_boolexp(), FUNCTION(), mux_exec(), and process_hook().

01074 {
01075     UNUSED_PARAMETER(pi);
01076 
01077     if (pIntsFrame->nints == INTS_PER_FRAME)
01078     {
01079         IntsFrame *p = pIntsFrame->next;
01080         free_lbuf((char *)pIntsFrame);
01081         pIntsFrame = p;
01082     }
01083     //mux_assert(pi == pIntsFrame->ints + pIntsFrame->nints);
01084     pIntsFrame->nints += nNeeded;
01085 }

void PopPointers ( char **  p,
int  nNeeded 
)

Definition at line 1035 of file eval.cpp.

References free_lbuf, tag_ptrsframe::next, tag_ptrsframe::nptrs, pPtrsFrame, PTRS_PER_FRAME, and UNUSED_PARAMETER.

Referenced by add_prefix(), check_filter(), did_it(), do_ufun(), eval_boolexp(), FUNCTION(), mux_exec(), and process_hook().

01036 {
01037     UNUSED_PARAMETER(p);
01038 
01039     if (pPtrsFrame->nptrs == PTRS_PER_FRAME)
01040     {
01041         PtrsFrame *q = pPtrsFrame->next;
01042         free_lbuf((char *)pPtrsFrame);
01043         pPtrsFrame = q;
01044     }
01045     //mux_assert(p == pPtrsFrame->ptrs + pPtrsFrame->nptrs);
01046     pPtrsFrame->nptrs += nNeeded;
01047 }

char* process_command ( dbref  executor,
dbref  caller,
dbref  enactor,
bool  ,
char *  ,
char *  [],
int   
)

Definition at line 1649 of file command.cpp.

References A_EALIAS, A_LALIAS, A_VA, alloc_lbuf, AMATCH_CMD, atr_get, atr_match(), atr_pget, statedata::bStackLimitReached, CMDENT::callseq, check_access(), CmdCheck, CMDENT::cmdname, cmdtest(), statedata::command_htab, Contents, CS_NOSQUISH, statedata::curr_cmd, statedata::debug_cmd, do_comsystem(), do_enter_internal(), do_leave(), do_move(), DOLIST, ENDLOG, EV_EVAL, EV_FCHECK, EV_STRIP_CURLY, EV_TOP, Fixed, confdata::fixed_home_msg, free_lbuf, statedata::func_invk_ctr, statedata::func_nest_lev, confdata::global_error_obj, Going, Good_obj, goto_cmdp, Halted, Has_contents, Has_location, hashfindLEN(), confdata::have_comsys, confdata::have_zones, higcheck(), HOOK_AFAIL, hook_fail(), HOOK_IGNORE, HOOK_IGSWITCH, HOOK_PERMIT, CMDENT::hookmask, init_match_check_keys(), isPlayer, isRoom, last_match_result(), LBUF_SIZE, list_check(), Location, statedata::lock_nest_lev, LOG_ALLCOMMANDS, LOG_ALWAYS, LOG_BADCOMMANDS, LOG_BUGS, log_name_and_loc(), confdata::log_options, LOG_SUSPECTCMDS, log_text(), confdata::master_room, match_exit_with_parents(), match_master_exit(), confdata::match_mine, confdata::match_mine_pl, match_zone_exit(), matches_exit_from_list(), move_exit(), mudconf, mudstate, mux_assert, mux_exec(), mux_isspace, mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), mux_tolower, Name, No_Command, NOPERM_MESSAGE, NOTHING, notify, notify_quiet, statedata::nStackNest, statedata::ntfy_nest_lev, Owner, CMDENT::perms, prefix_cmds, process_cmdent(), confdata::restrict_home, search_nametab(), Slave, confdata::space_compress, STARTLOG, string_compare(), Suspect, SW_MULTIPLE, CMDENT::switches, tprintf(), TYPE_EXIT, Verbose, WizRoy, Zone, and zonecmdtest().

Referenced by do_command(), do_train(), and Task_RunQueueEntry().

01658 {
01659     static char preserve_cmd[LBUF_SIZE];
01660     char *pOriginalCommand = arg_command;
01661     static char SpaceCompressCommand[LBUF_SIZE];
01662     static char LowerCaseCommand[LBUF_SIZE];
01663     char *pCommand;
01664     char *p, *q, *arg, *pSlash, *cmdsave, *bp, *str, check2[2];
01665     int aflags, i;
01666     dbref exit, aowner;
01667     CMDENT *cmdp;
01668 
01669     // Robustify player.
01670     //
01671     cmdsave = mudstate.debug_cmd;
01672     mudstate.debug_cmd = (char *)"< process_command >";
01673     mudstate.nStackNest = 0;
01674     mudstate.bStackLimitReached = false;
01675     *(check2 + 1) = '\0';
01676 
01677     mux_assert(pOriginalCommand);
01678 
01679     if (!Good_obj(executor))
01680     {
01681         // We are using SpaceCompressCommand temporarily.
01682         //
01683         STARTLOG(LOG_BUGS, "CMD", "PLYR");
01684         sprintf(SpaceCompressCommand, "Bad player in process_command: %d",
01685             executor);
01686         log_text(SpaceCompressCommand);
01687         ENDLOG;
01688         mudstate.debug_cmd = cmdsave;
01689         return pOriginalCommand;
01690     }
01691 
01692     // Make sure player isn't going or halted.
01693     //
01694     if (  Going(executor)
01695        || (  Halted(executor)
01696           && !(  isPlayer(executor)
01697               && interactive)))
01698     {
01699         notify(Owner(executor),
01700             tprintf("Attempt to execute command by halted object #%d", executor));
01701         mudstate.debug_cmd = cmdsave;
01702         return pOriginalCommand;
01703     }
01704     if (  Suspect(executor)
01705        && (mudconf.log_options & LOG_SUSPECTCMDS))
01706     {
01707         STARTLOG(LOG_SUSPECTCMDS, "CMD", "SUSP");
01708         log_name_and_loc(executor);
01709         log_text(" entered: ");
01710         log_text(pOriginalCommand);
01711         ENDLOG;
01712     }
01713     else
01714     {
01715         STARTLOG(LOG_ALLCOMMANDS, "CMD", "ALL");
01716         log_name_and_loc(executor);
01717         log_text(" entered: ");
01718         log_text(pOriginalCommand);
01719         ENDLOG;
01720     }
01721 
01722     // Reset recursion limits.
01723     //
01724     mudstate.func_nest_lev = 0;
01725     mudstate.func_invk_ctr = 0;
01726     mudstate.ntfy_nest_lev = 0;
01727     mudstate.lock_nest_lev = 0;
01728 
01729     if (Verbose(executor))
01730     {
01731         notify(Owner(executor), tprintf("%s] %s", Name(executor), pOriginalCommand));
01732     }
01733 
01734     // Eat leading whitespace, and space-compress if configured.
01735     //
01736     while (mux_isspace(*pOriginalCommand))
01737     {
01738         pOriginalCommand++;
01739     }
01740     strcpy(preserve_cmd, pOriginalCommand);
01741     mudstate.debug_cmd = pOriginalCommand;
01742     mudstate.curr_cmd = preserve_cmd;
01743 
01744     if (mudconf.space_compress)
01745     {
01746         // Compress out the spaces and use that as the command
01747         //
01748         pCommand = SpaceCompressCommand;
01749 
01750         p = pOriginalCommand;
01751         q = SpaceCompressCommand;
01752         while (  *p
01753               && q < SpaceCompressCommand + LBUF_SIZE)
01754         {
01755             while (  *p
01756                   && !mux_isspace(*p)
01757                   && q < SpaceCompressCommand + LBUF_SIZE)
01758             {
01759                 *q++ = *p++;
01760             }
01761 
01762             while (mux_isspace(*p))
01763             {
01764                 p++;
01765             }
01766 
01767             if (  *p
01768                && q < SpaceCompressCommand + LBUF_SIZE)
01769             {
01770                 *q++ = ' ';
01771             }
01772         }
01773         *q = '\0';
01774     }
01775     else
01776     {
01777         // Don't compress the spaces. Use the original command
01778         // (without leading spaces) as the command to use.
01779         //
01780         pCommand = pOriginalCommand;
01781     }
01782 
01783     // Now comes the fun stuff.  First check for single-letter leadins.
01784     // We check these before checking HOME because they are among the
01785     // most frequently executed commands, and they can never be the
01786     // HOME command.
01787     //
01788     i = pCommand[0] & 0xff;
01789     int cval = 0;
01790     int hval = 0;
01791     if (i && (prefix_cmds[i] != NULL))
01792     {
01793         // CmdCheck tests for @icmd. higcheck tests for i/p hooks.
01794         // Both from RhostMUSH.
01795         // cval/hval values: 0 normal, 1 disable, 2 ignore
01796         //
01797         *check2 = (char)i;
01798         if (CmdCheck(executor))
01799         {
01800             cval = cmdtest(executor, check2);
01801         }
01802         else if (CmdCheck(Owner(executor)))
01803         {
01804             cval = cmdtest(Owner(executor), check2);
01805         }
01806         else
01807         {
01808             cval = 0;
01809         }
01810 
01811         if (cval == 0)
01812         {
01813             cval = zonecmdtest(executor, check2);
01814         }
01815 
01816         if (prefix_cmds[i]->hookmask & (HOOK_IGNORE|HOOK_PERMIT))
01817         {
01818             hval = higcheck(executor, caller, enactor, prefix_cmds[i], pCommand);
01819         }
01820         else
01821         {
01822             hval = 0;
01823         }
01824 
01825         if (  cval != 2
01826            && hval != 2)
01827         {
01828             if (  cval == 1
01829                || hval == 1)
01830             {
01831                 if (prefix_cmds[i]->hookmask & HOOK_AFAIL)
01832                 {
01833                     hook_fail(executor, prefix_cmds[i], pCommand);
01834                 }
01835                 else
01836                 {
01837                     notify(executor, NOPERM_MESSAGE);
01838                 }
01839                 return preserve_cmd;
01840             }
01841             process_cmdent(prefix_cmds[i], NULL, executor, caller, enactor,
01842                 interactive, pCommand, pCommand, args, nargs);
01843             if (mudstate.bStackLimitReached)
01844             {
01845                 STARTLOG(LOG_ALWAYS, "CMD", "SPAM");
01846                 log_name_and_loc(executor);
01847                 log_text(" entered: ");
01848                 log_text(pOriginalCommand);
01849                 ENDLOG;
01850             }
01851             mudstate.bStackLimitReached = false;
01852 
01853             mudstate.debug_cmd = cmdsave;
01854             return preserve_cmd;
01855         }
01856     }
01857 
01858     if (  mudconf.have_comsys
01859        && !Slave(executor)
01860        && !do_comsystem(executor, pCommand))
01861     {
01862         return preserve_cmd;
01863     }
01864 
01865     // Check for the HOME command.
01866     //
01867     if (  Has_location(executor)
01868        && string_compare(pCommand, "home") == 0)
01869     {
01870         // CmdCheck tests for @icmd. higcheck tests for i/p hooks.
01871         // Both from RhostMUSH.
01872         // cval/hval values: 0 normal, 1 disable, 2 ignore.
01873         //
01874         if (CmdCheck(executor))
01875         {
01876             cval = cmdtest(executor, "home");
01877         }
01878         else if (CmdCheck(Owner(executor)))
01879         {
01880             cval = cmdtest(Owner(executor), "home");
01881         }
01882         else
01883         {
01884             cval = 0;
01885         }
01886 
01887         if (cval == 0)
01888         {
01889             cval = zonecmdtest(executor, "home");
01890         }
01891 
01892         if (cval != 2)
01893         {
01894             if (!check_access(executor, mudconf.restrict_home))
01895             {
01896                 notify(executor, NOPERM_MESSAGE);
01897                 return preserve_cmd;
01898             }
01899             if (cval == 1)
01900             {
01901                 notify(executor, NOPERM_MESSAGE);
01902                 return preserve_cmd;
01903             }
01904             if (  (  Fixed(executor)
01905                   || Fixed(Owner(executor)))
01906                && !WizRoy(executor))
01907             {
01908                 notify(executor, mudconf.fixed_home_msg);
01909                 return preserve_cmd;
01910             }
01911             do_move(executor, caller, enactor, 0, "home");
01912             mudstate.debug_cmd = cmdsave;
01913             return preserve_cmd;
01914         }
01915     }
01916 
01917     // Only check for exits if we may use the goto command.
01918     //
01919     if (check_access(executor, goto_cmdp->perms))
01920     {
01921         // CmdCheck tests for @icmd. higcheck tests for i/p hooks.
01922         // Both from RhostMUSH.
01923         // cval/hval values: 0 normal, 1 disable, 2 ignore
01924         // Master room exits are not affected.
01925         //
01926         if (CmdCheck(executor))
01927         {
01928             cval = cmdtest(executor, "goto");
01929         }
01930         else if (CmdCheck(Owner(executor)))
01931         {
01932             cval = cmdtest(Owner(executor), "goto");
01933         }
01934         else
01935         {
01936             cval = 0;
01937         }
01938 
01939         if (cval == 0)
01940         {
01941             cval = zonecmdtest(executor, "goto");
01942         }
01943 
01944         if (goto_cmdp->hookmask & (HOOK_IGNORE|HOOK_PERMIT))
01945         {
01946             hval = higcheck(executor, caller, enactor, goto_cmdp, "goto");
01947         }
01948         else
01949         {
01950             hval = 0;
01951         }
01952 
01953         if (  cval != 2
01954            && hval != 2)
01955         {
01956             // Check for an exit name.
01957             //
01958             init_match_check_keys(executor, pCommand, TYPE_EXIT);
01959             match_exit_with_parents();
01960             exit = last_match_result();
01961             if (exit != NOTHING)
01962             {
01963                 if (cval || hval)
01964                 {
01965                     if (goto_cmdp->hookmask & HOOK_AFAIL)
01966                     {
01967                         hook_fail(executor, goto_cmdp, "goto");
01968                     }
01969                     else
01970                     {
01971                         notify(executor, NOPERM_MESSAGE);
01972                     }
01973                     return preserve_cmd;
01974                 }
01975                 move_exit(executor, exit, false, "You can't go that way.", 0);
01976                 mudstate.debug_cmd = cmdsave;
01977                 return preserve_cmd;
01978             }
01979 
01980             // Check for an exit in the master room.
01981             //
01982             init_match_check_keys(executor, pCommand, TYPE_EXIT);
01983             match_master_exit();
01984             exit = last_match_result();
01985             if (exit != NOTHING)
01986             {
01987                 move_exit(executor, exit, true, NULL, 0);
01988                 mudstate.debug_cmd = cmdsave;
01989                 return preserve_cmd;
01990             }
01991         }
01992     }
01993 
01994     // Set up a lowercase command and an arg pointer for the hashed
01995     // command check.  Since some types of argument processing destroy
01996     // the arguments, make a copy so that we keep the original command
01997     // line intact.  Store the edible copy in LowerCaseCommand after
01998     // the lower-cased command.
01999     //
02000 
02001     // Make lowercase command
02002     //
02003     for (p = pCommand, q = LowerCaseCommand;
02004          *p && !mux_isspace(*p);
02005          p++, q++)
02006     {
02007         *q = mux_tolower(*p);
02008     }
02009     *q = '\0';
02010     int nLowerCaseCommand = q - LowerCaseCommand;
02011 
02012     // Skip spaces before arg
02013     //
02014     while (mux_isspace(*p))
02015     {
02016         p++;
02017     }
02018 
02019     // Remember where arg starts
02020     //
02021     arg = p;
02022 
02023     // Strip off any command switches and save them.
02024     //
02025     pSlash = strchr(LowerCaseCommand, '/');
02026     if (pSlash)
02027     {
02028         nLowerCaseCommand = pSlash - LowerCaseCommand;
02029         *pSlash++ = '\0';
02030     }
02031 
02032     // Check for a builtin command (or an alias of a builtin command)
02033     //
02034     cmdp = (CMDENT *)hashfindLEN(LowerCaseCommand, nLowerCaseCommand, &mudstate.command_htab);
02035 
02036     /* If command is checked to ignore NONMATCHING switches, fall through */
02037     if (cmdp)
02038     {
02039         // CmdCheck tests for @icmd. higcheck tests for i/p hooks.
02040         // Both from RhostMUSH.
02041         // cval/hval values: 0 normal, 1 disable, 2 ignore
02042         //
02043         if (CmdCheck(executor))
02044         {
02045             cval = cmdtest(executor, cmdp->cmdname);
02046         }
02047         else if (CmdCheck(Owner(executor)))
02048         {
02049             cval = cmdtest(Owner(executor), cmdp->cmdname);
02050         }
02051         else
02052         {
02053             cval = 0;
02054         }
02055 
02056         if (cval == 0)
02057         {
02058             cval = zonecmdtest(executor, cmdp->cmdname);
02059         }
02060 
02061         if (cmdp->hookmask & (HOOK_IGNORE|HOOK_PERMIT))
02062         {
02063             hval = higcheck(executor, caller, enactor, cmdp, LowerCaseCommand);
02064         }
02065         else
02066         {
02067             hval = 0;
02068         }
02069 
02070         // If the command contains a switch, but the command doesn't support
02071         // any switches or the command contains one that isn't supported,
02072         // HOOK_IGSWITCH will allow us to treat the entire command as if it
02073         // weren't a built-in command.
02074         //
02075         int flagvalue;
02076         if (  (cmdp->hookmask & HOOK_IGSWITCH)
02077            && pSlash)
02078         {
02079             if (cmdp->switches)
02080             {
02081                 search_nametab(executor, cmdp->switches, pSlash, &flagvalue);
02082                 if (flagvalue & SW_MULTIPLE)
02083                 {
02084                     MUX_STRTOK_STATE ttswitch;
02085                     // All the switches given a command shouldn't exceed 200 chars together
02086                     char switch_buff[200];
02087                     char *switch_ptr;
02088                     sprintf(switch_buff, "%.199s", pSlash);
02089                     mux_strtok_src(&ttswitch, switch_buff);
02090                     mux_strtok_ctl(&ttswitch, "/");
02091                     switch_ptr = mux_strtok_parse(&ttswitch);
02092                     while (  switch_ptr
02093                           && *switch_ptr)
02094                     {
02095                         search_nametab(executor, cmdp->switches, switch_ptr, &flagvalue);
02096                         if (flagvalue == -1)
02097                         {
02098                             break;
02099                         }
02100                         switch_ptr = mux_strtok_parse(&ttswitch);
02101                     }
02102                 }
02103                 if (flagvalue == -1)
02104                 {
02105                     cval = 2;
02106                 }
02107             }
02108             else
02109             {
02110                 // Switch exists but no switches allowed for command.
02111                 //
02112                 cval = 2;
02113             }
02114         }
02115 
02116         if (  cval != 2
02117            && hval != 2)
02118         {
02119             if (  cval == 1
02120                || hval == 1)
02121             {
02122                 if (cmdp->hookmask & HOOK_AFAIL)
02123                 {
02124                     hook_fail(executor, cmdp, LowerCaseCommand);
02125                 }
02126                 else
02127                 {
02128                     notify(executor, NOPERM_MESSAGE);
02129                 }
02130                 return preserve_cmd;
02131             }
02132             if (  mudconf.space_compress
02133                && (cmdp->callseq & CS_NOSQUISH))
02134             {
02135                 // We handle this specially -- there is no space compression
02136                 // involved, so we must go back to the original command.
02137                 // We skip over the command and a single space to position
02138                 // arg at the arguments.
02139                 //
02140                 arg = pCommand = pOriginalCommand;
02141                 while (*arg && !mux_isspace(*arg))
02142                 {
02143                     arg++;
02144                 }
02145                 if (*arg)
02146                 {
02147                     // We stopped on the space, advance to next.
02148                     //
02149                     arg++;
02150                 }
02151             }
02152             process_cmdent(cmdp, pSlash, executor, caller, enactor, interactive,
02153                 arg, pCommand, args, nargs);
02154             if (mudstate.bStackLimitReached)
02155             {
02156                 STARTLOG(LOG_ALWAYS, "CMD", "SPAM");
02157                 log_name_and_loc(executor);
02158                 log_text(" entered: ");
02159                 log_text(pOriginalCommand);
02160                 ENDLOG;
02161             }
02162             mudstate.bStackLimitReached = false;
02163             mudstate.debug_cmd = cmdsave;
02164             return preserve_cmd;
02165         }
02166     }
02167 
02168     // Check for enter and leave aliases, user-defined commands on the
02169     // player, other objects where the player is, on objects in the
02170     // player's inventory, and on the room that holds the player. We
02171     // evaluate the command line here to allow chains of $-commands
02172     // to work.
02173     //
02174     bp = LowerCaseCommand;
02175     str = pCommand;
02176     mux_exec(LowerCaseCommand, &bp, executor, caller, enactor,
02177         EV_EVAL | EV_FCHECK | EV_STRIP_CURLY | EV_TOP, &str, args, nargs);
02178     *bp = '\0';
02179     bool succ = false;
02180 
02181     // Idea for enter/leave aliases from R'nice@TinyTIM
02182     //
02183     if (Has_location(executor) && Good_obj(Location(executor)))
02184     {
02185         // Check for a leave alias.
02186         //
02187         p = atr_pget(Location(executor), A_LALIAS, &aowner, &aflags);
02188         if (*p)
02189         {
02190             if (matches_exit_from_list(LowerCaseCommand, p))
02191             {
02192                 free_lbuf(p);
02193 
02194                 // CmdCheck tests for @icmd. higcheck tests for i/p hooks.
02195                 // Both from RhostMUSH.
02196                 // cval/hval values: 0 normal, 1 disable, 2 ignore
02197                 //
02198                 if (CmdCheck(executor))
02199                 {
02200                     cval = cmdtest(executor, "leave");
02201                 }
02202                 else if (CmdCheck(Owner(executor)))
02203                 {
02204                     cval = cmdtest(Owner(executor), "leave");
02205                 }
02206                 else
02207                 {
02208                     cval = 0;
02209                 }
02210 
02211                 if (cval == 0)
02212                 {
02213                     cval = zonecmdtest(executor, "leave");
02214                 }
02215 
02216                 cmdp = (CMDENT *)hashfindLEN((char *)"leave", strlen("leave"), &mudstate.command_htab);
02217 
02218                 if (cmdp->hookmask & (HOOK_IGNORE|HOOK_PERMIT))
02219                 {
02220                     hval = higcheck(executor, caller, enactor, cmdp, "leave");
02221                 }
02222                 else
02223                 {
02224                     hval = 0;
02225                 }
02226 
02227                 if (  cval != 2
02228                    && hval != 2)
02229                 {
02230                     if (  cval == 1
02231                        || hval == 1)
02232                     {
02233                         if (cmdp->hookmask & HOOK_AFAIL)
02234                         {
02235                             hook_fail(executor, cmdp, "leave");
02236                         }
02237                         else
02238                         {
02239                             notify(executor, NOPERM_MESSAGE);
02240                         }
02241                         return preserve_cmd;
02242                     }
02243                     do_leave(executor, caller, executor, 0);
02244                     return preserve_cmd;
02245                 }
02246             }
02247         }
02248         free_lbuf(p);
02249 
02250         DOLIST(exit, Contents(Location(executor)))
02251         {
02252             p = atr_pget(exit, A_EALIAS, &aowner, &aflags);
02253             if (*p)
02254             {
02255                 if (matches_exit_from_list(LowerCaseCommand, p))
02256                 {
02257                     free_lbuf(p);
02258 
02259                     // Check for enter aliases.
02260                     //
02261                     // CmdCheck tests for @icmd. higcheck tests for i/p hooks.
02262                     // Both from RhostMUSH.
02263                     // cval/hval values: 0 normal, 1 disable, 2 ignore
02264                     //
02265                     if (CmdCheck(executor))
02266                     {
02267                         cval = cmdtest(executor, "enter");
02268                     }
02269                     else if (CmdCheck(Owner(executor)))
02270                     {
02271                         cval = cmdtest(Owner(executor), "enter");
02272                     }
02273                     else
02274                     {
02275                         cval = 0;
02276                     }
02277 
02278                     if (cval == 0)
02279                     {
02280                         cval = zonecmdtest(executor, "enter");
02281                     }
02282 
02283                     cmdp = (CMDENT *)hashfindLEN((char *)"enter", strlen("enter"), &mudstate.command_htab);
02284 
02285                     if (cmdp->hookmask & (HOOK_IGNORE|HOOK_PERMIT))
02286                     {
02287                         hval = higcheck(executor, caller, enactor, cmdp, "enter");
02288                     }
02289                     else
02290                     {
02291                         hval = 0;
02292                     }
02293 
02294                     if (  cval != 2
02295                        && hval != 2)
02296                     {
02297                         if (  cval == 1
02298                            || hval == 1)
02299                         {
02300                             if (cmdp->hookmask & HOOK_AFAIL)
02301                             {
02302                                 hook_fail(executor, cmdp, "enter");
02303                             }
02304                             else
02305                             {
02306                                 notify(executor, NOPERM_MESSAGE);
02307                             }
02308                             return preserve_cmd;
02309                         }
02310                         do_enter_internal(executor, exit, false);
02311                         return preserve_cmd;
02312                     }
02313                     else if (cval == 1)
02314                     {
02315                         notify_quiet(executor, NOPERM_MESSAGE);
02316                         return preserve_cmd;
02317                     }
02318                 }
02319             }
02320             free_lbuf(p);
02321         }
02322     }
02323 
02324     // Check for $-command matches on me.
02325     //
02326     if (mudconf.match_mine && !No_Command(executor))
02327     {
02328         if (  (  !isPlayer(executor)
02329               || mudconf.match_mine_pl)
02330            && atr_match(executor, executor, AMATCH_CMD, LowerCaseCommand, preserve_cmd, true))
02331         {
02332             succ = true;
02333         }
02334     }
02335 
02336     // Check for $-command matches on nearby things and on my room.
02337     //
02338     if (Has_location(executor))
02339     {
02340         succ |= list_check(Contents(Location(executor)), executor, AMATCH_CMD, LowerCaseCommand, preserve_cmd, true);
02341 
02342         if (!No_Command(Location(executor)))
02343         {
02344             succ |= atr_match(Location(executor), executor, AMATCH_CMD, LowerCaseCommand, preserve_cmd, true);
02345         }
02346     }
02347 
02348     // Check for $-command matches in my inventory.
02349     //
02350     if (Has_contents(executor))
02351     {
02352         succ |= list_check(Contents(executor), executor, AMATCH_CMD, LowerCaseCommand, preserve_cmd, true);
02353     }
02354 
02355     if (  !succ
02356        && mudconf.have_zones)
02357     {
02358         // now do check on zones.
02359         //
02360         dbref zone = Zone(executor);
02361         dbref loc = Location(executor);
02362         dbref zone_loc = NOTHING;
02363         if (  Good_obj(loc)
02364            && Good_obj(zone_loc = Zone(loc)))
02365         {
02366             if (isRoom(zone_loc))
02367             {
02368                 // zone of player's location is a parent room.
02369                 //
02370                 if (loc != zone)
02371                 {
02372                     // check parent room exits.
02373                     //
02374                     init_match_check_keys(executor, pCommand, TYPE_EXIT);
02375                     match_zone_exit();
02376                     exit = last_match_result();
02377                     if (exit != NOTHING)
02378                     {
02379                         move_exit(executor, exit, true, NULL, 0);
02380                         mudstate.debug_cmd = cmdsave;
02381                         return preserve_cmd;
02382                     }
02383                     succ |= list_check(Contents(zone_loc), executor,
02384                                AMATCH_CMD, LowerCaseCommand, preserve_cmd,
02385                                true);
02386 
02387                     // end of parent room checks.
02388                     //
02389                 }
02390             }
02391             else
02392             {
02393                 // try matching commands on area zone object.
02394                 //
02395                 if (!No_Command(zone_loc))
02396                 {
02397                     succ |= atr_match(zone_loc, executor, AMATCH_CMD,
02398                        LowerCaseCommand, preserve_cmd, true);
02399                 }
02400             }
02401         }
02402 
02403         // End of matching on zone of player's location.
02404         //
02405 
02406         // if nothing matched with parent room/zone object, try matching
02407         // zone commands on the player's personal zone.
02408         //
02409         if (  !succ
02410            && Good_obj(zone)
02411            && !No_Command(zone)
02412            && zone_loc != zone)
02413         {
02414             succ |= atr_match(zone, executor, AMATCH_CMD, LowerCaseCommand, preserve_cmd, true);
02415         }
02416     }
02417 
02418     // If we didn't find anything, try in the master room.
02419     //
02420     if (!succ)
02421     {
02422         if (  Good_obj(mudconf.master_room)
02423            && Has_contents(mudconf.master_room))
02424         {
02425             succ |= list_check(Contents(mudconf.master_room), executor,
02426                 AMATCH_CMD, LowerCaseCommand, preserve_cmd, false);
02427 
02428             if (!No_Command(mudconf.master_room))
02429             {
02430                 succ |= atr_match(mudconf.master_room, executor, AMATCH_CMD,
02431                     LowerCaseCommand, preserve_cmd, false);
02432             }
02433         }
02434     }
02435 
02436     // If we still didn't find anything, tell how to get help.
02437     //
02438     if (!succ)
02439     {
02440         if (  Good_obj(mudconf.global_error_obj)
02441            && !Going(mudconf.global_error_obj))
02442         {
02443             char *errtext = atr_get(mudconf.global_error_obj, A_VA, &aowner, &aflags);
02444             char *errbuff = alloc_lbuf("process_command.error_msg");
02445             char *errbufc = errbuff;
02446             str = errtext;
02447             mux_exec(errbuff, &errbufc, mudconf.global_error_obj, caller, enactor,
02448                 EV_EVAL | EV_FCHECK | EV_STRIP_CURLY | EV_TOP, &str,
02449                 &pCommand, 1);
02450             *errbufc = '\0';
02451             notify(executor, errbuff);
02452             free_lbuf(errtext);
02453             free_lbuf(errbuff);
02454         }
02455         else
02456         {
02457             // We use LowerCaseCommand for another purpose.
02458             //
02459             notify(executor, "Huh?  (Type \"help\" for help.)");
02460             STARTLOG(LOG_BADCOMMANDS, "CMD", "BAD");
02461             log_name_and_loc(executor);
02462             log_text(" entered: ");
02463             log_text(pCommand);
02464             ENDLOG;
02465         }
02466     }
02467     mudstate.debug_cmd = cmdsave;
02468     return preserve_cmd;
02469 }

const char* PureName ( dbref  thing  ) 

Definition at line 475 of file db.cpp.

References A_NAME, aszSpecialDBRefNames, atr_get, atr_get_LEN(), confdata::cache_names, db, free_lbuf, mudconf, object::name, object::purename, StringCloneLen(), and strip_ansi().

Referenced by do_find(), match_exit_internal(), match_here(), match_list(), Moniker(), and search_perform().

00476 {
00477     if (thing < 0)
00478     {
00479         return aszSpecialDBRefNames[-thing];
00480     }
00481 
00482     dbref aowner;
00483     int aflags;
00484 
00485     char *pName, *pPureName;
00486     if (mudconf.cache_names)
00487     {
00488         if (!db[thing].purename)
00489         {
00490             size_t nName;
00491             size_t nPureName;
00492 #ifdef MEMORY_BASED
00493             pName = atr_get_LEN(thing, A_NAME, &aowner, &aflags, &nName);
00494             pPureName = strip_ansi(pName, &nPureName);
00495             free_lbuf(pName);
00496             db[thing].purename = StringCloneLen(pPureName, nPureName);
00497 #else // MEMORY_BASED
00498             if (!db[thing].name)
00499             {
00500                 pName = atr_get_LEN(thing, A_NAME, &aowner, &aflags, &nName);
00501                 db[thing].name = StringCloneLen(pName, nName);
00502                 free_lbuf(pName);
00503             }
00504             else
00505             {
00506                 nName = strlen(db[thing].name);
00507             }
00508             pName = db[thing].name;
00509             pPureName = strip_ansi(pName, &nPureName);
00510             if (nPureName == nName)
00511             {
00512                 db[thing].purename = pName;
00513             }
00514             else
00515             {
00516                 db[thing].purename = StringCloneLen(pPureName, nPureName);
00517             }
00518 #endif // MEMORY_BASED
00519         }
00520         return db[thing].purename;
00521     }
00522     pName = atr_get(thing, A_NAME, &aowner, &aflags);
00523     pPureName = strip_ansi(pName);
00524     free_lbuf(pName);
00525     return pPureName;
00526 }

int* PushIntegers ( int  nNeeded  ) 

Definition at line 1059 of file eval.cpp.

References alloc_lbuf, tag_intsframe::ints, INTS_PER_FRAME, tag_intsframe::next, tag_intsframe::nints, and pIntsFrame.

Referenced by add_prefix(), check_filter(), did_it(), do_ufun(), eval_boolexp(), FUNCTION(), mux_exec(), and process_hook().

01060 {
01061     if (  !pIntsFrame
01062        || pIntsFrame->nints < nNeeded)
01063     {
01064         IntsFrame *p = (IntsFrame *)alloc_lbuf("PushIntegers");
01065         p->next = pIntsFrame;
01066         p->nints = INTS_PER_FRAME;
01067         pIntsFrame = p;
01068     }
01069     pIntsFrame->nints -= nNeeded;
01070     return pIntsFrame->ints + pIntsFrame->nints;
01071 }

char** PushPointers ( int  nNeeded  ) 

Definition at line 1021 of file eval.cpp.

References alloc_lbuf, tag_ptrsframe::next, tag_ptrsframe::nptrs, pPtrsFrame, tag_ptrsframe::ptrs, and PTRS_PER_FRAME.

Referenced by add_prefix(), check_filter(), did_it(), do_ufun(), eval_boolexp(), FUNCTION(), mux_exec(), and process_hook().

01022 {
01023     if (  !pPtrsFrame
01024        || pPtrsFrame->nptrs < nNeeded)
01025     {
01026         PtrsFrame *p = (PtrsFrame *)alloc_lbuf("PushPointers");
01027         p->next = pPtrsFrame;
01028         p->nptrs = PTRS_PER_FRAME;
01029         pPtrsFrame = p;
01030     }
01031     pPtrsFrame->nptrs -= nNeeded;
01032     return pPtrsFrame->ptrs + pPtrsFrame->nptrs;
01033 }

void put_ConnectionInfoFields ( dbref  target,
long  anFields[4],
CLinearTimeAbsolute ltaLogout 
)

Definition at line 2946 of file netcommon.cpp.

References A_CONNINFO, alloc_lbuf, atr_add_raw_LEN(), free_lbuf, mux_i64toa(), mux_ltoa(), and CLinearTimeAbsolute::ReturnSeconds().

Referenced by shutdownsock().

02951 {
02952     char *pConnInfo = alloc_lbuf("put_CIF");
02953     char *p = pConnInfo;
02954     for (int i = 0; i < 4; i++)
02955     {
02956         p += mux_ltoa(anFields[i], p);
02957         *p++ = ' ';
02958     }
02959     p += mux_i64toa(ltaLogout.ReturnSeconds(), p);
02960     *p++ = 0;
02961 
02962     atr_add_raw_LEN(target, A_CONNINFO, pConnInfo, p - pConnInfo);
02963     free_lbuf(pConnInfo);
02964 }

int QueueMax ( dbref  player  ) 

Returns the player's upper limit of queued commands.

If a QueueMax is set on the player, we use that. Otherwise, there is a configurable game-wide limit (given by player_queue_limit) unless the player is a Wizard in which case, we reason that well behaved Wizard code should be able to schedule as much work as there are objects in the database -- larger game, more work to be expected in the queue.

Parameters:
player dbref of player object.
Returns:
None.

Definition at line 263 of file player_c.cpp.

References statedata::db_top, Good_obj, mudconf, mudstate, OwnsOthers, pcache_find(), player_cache::qmax, confdata::queuemax, and Wizard.

Referenced by setup_que().

00264 {
00265     int m = 0;
00266     if (  Good_obj(player)
00267        && OwnsOthers(player))
00268     {
00269         PCACHE *pp = pcache_find(player);
00270         if (pp->qmax >= 0)
00271         {
00272             m = pp->qmax;
00273         }
00274         else
00275         {
00276             // @queuemax was not valid so we use the game-wide limit.
00277             //
00278             m = mudconf.queuemax;
00279             if (  Wizard(player)
00280                && m < mudstate.db_top + 1)
00281             {
00282                 m = mudstate.db_top + 1;
00283             }
00284         }
00285     }
00286     return m;
00287 }

bool quick_wild ( const char *  ,
const char *   
)

Definition at line 35 of file wild.cpp.

References EQUAL, mudconf, mudstate, NOTEQUAL, quick_wild(), statedata::wild_invk_ctr, and confdata::wild_invk_lim.

Referenced by badname_check(), check_filter(), do_chanlist(), do_comlist(), find_wild_attrs(), FUNCTION(), list_vattrs(), quick_wild(), ReportMatchedTopics(), wild(), wild1(), and wild_match().

00036 {
00037     if (mudstate.wild_invk_ctr >= mudconf.wild_invk_lim)
00038     {
00039         return false;
00040     }
00041     mudstate.wild_invk_ctr++;
00042 
00043     while (*tstr != '*')
00044     {
00045         switch (*tstr)
00046         {
00047         case '?':
00048 
00049             // Single character match.  Return false if at end of data.
00050             //
00051             if (!*dstr)
00052             {
00053                 return false;
00054             }
00055             break;
00056 
00057         case '\\':
00058 
00059             // Escape character.  Move up, and force literal match of next
00060             // character.
00061             //
00062             tstr++;
00063 
00064             // FALL THROUGH
00065 
00066         default:
00067 
00068             // Literal character.  Check for a match. If matching end of data,
00069             // return true.
00070             //
00071             if (NOTEQUAL(*dstr, *tstr))
00072             {
00073                 return false;
00074             }
00075             if (!*dstr)
00076             {
00077                 return true;
00078             }
00079         }
00080         tstr++;
00081         dstr++;
00082     }
00083 
00084     // Skip over '*'.
00085     //
00086     tstr++;
00087 
00088     // Return true on trailing '*'.
00089     //
00090     if (!*tstr)
00091     {
00092         return true;
00093     }
00094 
00095     // Skip over wildcards.
00096     //
00097     while (  *tstr == '?'
00098           || *tstr == '*')
00099     {
00100         if (*tstr == '?')
00101         {
00102             if (!*dstr)
00103             {
00104                 return false;
00105             }
00106             dstr++;
00107         }
00108         tstr++;
00109     }
00110 
00111     // Skip over a backslash in the pattern string if it is there.
00112     //
00113     if (*tstr == '\\')
00114     {
00115         tstr++;
00116     }
00117 
00118     // Return true on trailing '*'.
00119     //
00120     if (!*tstr)
00121     {
00122         return true;
00123     }
00124 
00125     // Scan for possible matches.
00126     //
00127     while (*dstr)
00128     {
00129         if (  EQUAL(*dstr, *tstr)
00130            && quick_wild(tstr + 1, dstr + 1))
00131         {
00132             return true;
00133         }
00134         dstr++;
00135     }
00136     return false;
00137 }

void DCL_CDECL raw_broadcast ( int  ,
char *  ,
  ... 
)

Definition at line 209 of file netcommon.cpp.

References DESC_ITER_CONN, Flags, LBUF_SIZE, mux_vsnprintf(), descriptor_data::player, process_output(), queue_string(), and queue_write_LEN().

Referenced by announce_connect(), announce_disconnect(), do_backup(), do_fixdb(), do_kill(), do_name(), do_restart(), do_shutdown(), fork_and_dump(), load_restart_db(), and sighandler().

00210 {
00211     if (!fmt || !*fmt)
00212     {
00213         return;
00214     }
00215 
00216     char buff[LBUF_SIZE];
00217 
00218     va_list ap;
00219     va_start(ap, fmt);
00220     mux_vsnprintf(buff, LBUF_SIZE, fmt, ap);
00221     va_end(ap);
00222 
00223     DESC *d;
00224     DESC_ITER_CONN(d)
00225     {
00226         if ((Flags(d->player) & inflags) == inflags)
00227         {
00228             queue_string(d, buff);
00229             queue_write_LEN(d, "\r\n", 2);
00230             process_output(d, false);
00231         }
00232     }
00233 }

void raw_notify_html ( dbref  player,
const char *  msg 
)

Definition at line 126 of file netcommon.cpp.

References Connected, DESC_ITER_PLAYER, Html, statedata::inpipe, mudstate, statedata::poutbufc, statedata::poutnew, statedata::poutobj, queue_string(), and safe_str.

Referenced by notify_check().

00127 {
00128     if (!msg || !*msg)
00129     {
00130         return;
00131     }
00132 
00133     if (  mudstate.inpipe
00134        && player == mudstate.poutobj)
00135     {
00136         safe_str(msg, mudstate.poutnew, &mudstate.poutbufc);
00137         return;
00138     }
00139     if (  !Connected(player)
00140        || !Html(player))
00141     {
00142         return;
00143     }
00144 
00145     DESC *d;
00146     DESC_ITER_PLAYER(player, d)
00147     {
00148         queue_string(d, msg);
00149     }
00150 }

bool regexp_match ( char *  pattern,
char *  str,
int  case_opt,
char *  args[],
int  nargs 
)

Definition at line 73 of file game.cpp.

References alloc_lbuf, CMuxAlarm::bAlarmed, free_lbuf, LBUF_SIZE, MEMFREE, MuxAlarm, pcre_compile(), pcre_copy_substring(), and pcre_exec().

Referenced by atr_match1(), and process_cmdent().

00080 {
00081     int matches;
00082     int i;
00083     const char *errptr;
00084     int erroffset;
00085 
00086     /*
00087      * Load the regexp pattern. This allocates memory which must be
00088      * later freed. A free() of the regexp does free all structures
00089      * under it.
00090      */
00091 
00092     pcre *re;
00093     if (  MuxAlarm.bAlarmed
00094        || (re = pcre_compile(pattern, case_opt, &errptr, &erroffset, NULL)) == NULL)
00095     {
00096         /*
00097          * This is a matching error. We have an error message in
00098          * regexp_errbuf that we can ignore, since we're doing
00099          * command-matching.
00100          */
00101         return false;
00102     }
00103 
00104     // To capture N substrings, you need space for 3(N+1) offsets in the
00105     // offset vector. We'll allow 2N-1 substrings and possibly ignore some.
00106     //
00107     const int ovecsize = 6 * nargs;
00108     int *ovec = new int[ovecsize];
00109 
00110     /*
00111      * Now we try to match the pattern. The relevant fields will
00112      * automatically be filled in by this.
00113      */
00114     matches = pcre_exec(re, NULL, str, strlen(str), 0, 0, ovec, ovecsize);
00115     if (matches < 0)
00116     {
00117         delete [] ovec;
00118         MEMFREE(re);
00119         return false;
00120     }
00121 
00122     if (matches == 0)
00123     {
00124         // There were too many substring matches. See docs for
00125         // pcre_copy_substring().
00126         //
00127         matches = ovecsize / 3;
00128     }
00129 
00130     /*
00131      * Now we fill in our args vector. Note that in regexp matching,
00132      * 0 is the entire string matched, and the parenthesized strings
00133      * go from 1 to 9. We DO PRESERVE THIS PARADIGM, for consistency
00134      * with other languages.
00135      */
00136 
00137     for (i = 0; i < nargs; ++i)
00138     {
00139         args[i] = alloc_lbuf("regexp_match");
00140         if (pcre_copy_substring(str, ovec, matches, i,
00141                                 args[i], LBUF_SIZE) < 0)
00142         {
00143             free_lbuf(args[i]);
00144             args[i] = NULL;
00145         }
00146     }
00147 
00148     delete [] ovec;
00149     MEMFREE(re);
00150     return true;
00151 }

void ReleaseAllResources ( dbref  obj  ) 

Definition at line 3145 of file db.cpp.

References del_comsys(), do_channelnuke(), do_clearcom(), do_comdisconnect(), do_mail_clear(), do_mail_purge(), confdata::have_comsys, confdata::have_mailer, malias_cleanup(), and mudconf.

Referenced by CGuests::Create(), destroy_bad_obj(), destroy_obj(), and do_toad().

03146 {
03147     if (mudconf.have_comsys)
03148     {
03149         do_comdisconnect(obj);
03150         do_clearcom(obj, obj, obj, 0);
03151         do_channelnuke(obj);
03152         del_comsys(obj);
03153     }
03154     if (mudconf.have_mailer)
03155     {
03156         do_mail_clear(obj, NULL);
03157         do_mail_purge(obj);
03158         malias_cleanup(obj);
03159     }
03160 }

dbref remove_first ( dbref  ,
dbref   
)

Definition at line 52 of file predicates.cpp.

References DOLIST, Next, and s_Next.

Referenced by destroy_exit(), do_drop(), do_get(), move_object(), and move_the_exit().

00053 {
00054     if (head == thing)
00055     {
00056         return Next(thing);
00057     }
00058 
00059     dbref prev;
00060 
00061     DOLIST(prev, head)
00062     {
00063         if (Next(prev) == thing)
00064         {
00065             s_Next(prev, Next(thing));
00066             return head;
00067         }
00068     }
00069     return head;
00070 }

void RemoveFile ( char *  name  ) 

Definition at line 3428 of file db.cpp.

Referenced by cache_pass2(), dump_database_internal(), and main().

03429 {
03430     unlink(name);
03431 }

int ReplaceFile ( char *  old_name,
char *  new_name 
)

Definition at line 3415 of file db.cpp.

References ENDLINE, Log, and CLogFile::tinyprintf().

Referenced by dump_database_internal(), save_comsys(), and CLogFile::SetPrefix().

03416 {
03417     if (rename(old_name, new_name) == 0)
03418     {
03419         return 0;
03420     }
03421     else
03422     {
03423         Log.tinyprintf("rename %s to %s fails with errno of %s(%d)" ENDLINE, old_name, new_name, strerror(errno), errno);
03424     }
03425     return -1;
03426 }

void report ( void   ) 

Definition at line 45 of file game.cpp.

References statedata::curr_enactor, statedata::curr_executor, statedata::debug_cmd, ENDLOG, Good_obj, LOG_BUGS, log_name_and_loc(), log_text(), mudstate, and STARTLOG.

Referenced by sighandler().

00046 {
00047     STARTLOG(LOG_BUGS, "BUG", "INFO");
00048     log_text("Command: '");
00049     log_text(mudstate.debug_cmd);
00050     log_text("'");
00051     ENDLOG;
00052     if (Good_obj(mudstate.curr_executor))
00053     {
00054         STARTLOG(LOG_BUGS, "BUG", "INFO");
00055         log_text("Player: ");
00056         log_name_and_loc(mudstate.curr_executor);
00057         if (  mudstate.curr_enactor != mudstate.curr_executor
00058            && Good_obj(mudstate.curr_enactor))
00059         {
00060             log_text(" Enactor: ");
00061             log_name_and_loc(mudstate.curr_enactor);
00062         }
00063         ENDLOG;
00064     }
00065 }

void restore_global_regs ( const char *  ,
char *  [],
int  [] 
)

Definition at line 2148 of file eval.cpp.

References free_lbuf, statedata::glob_reg_len, statedata::global_regs, MAX_GLOBAL_REGS, mudstate, and UNUSED_PARAMETER.

Referenced by add_prefix(), check_filter(), did_it(), do_ufun(), eval_boolexp(), FUNCTION(), look_contents(), look_exits(), look_in(), mux_exec(), and process_hook().

02153 {
02154     UNUSED_PARAMETER(funcname);
02155 
02156     int i;
02157 
02158     for (i = 0; i < MAX_GLOBAL_REGS; i++)
02159     {
02160         if (preserve[i])
02161         {
02162             if (mudstate.global_regs[i])
02163             {
02164                 free_lbuf(mudstate.global_regs[i]);
02165             }
02166             mudstate.global_regs[i] = preserve[i];
02167             mudstate.glob_reg_len[i] = preserve_len[i];
02168         }
02169         else
02170         {
02171             if (mudstate.global_regs[i])
02172             {
02173                 mudstate.global_regs[i][0] = '\0';
02174             }
02175             mudstate.glob_reg_len[i] = 0;
02176         }
02177     }
02178 }

dbref reverse_list ( dbref   ) 

Definition at line 76 of file predicates.cpp.

References Next, NOTHING, and s_Next.

Referenced by process_sticky_dropto().

00077 {
00078     dbref newlist, rest;
00079 
00080     newlist = NOTHING;
00081     while (list != NOTHING)
00082     {
00083         rest = Next(list);
00084         s_Next(list, newlist);
00085         newlist = list;
00086         list = rest;
00087     }
00088     return newlist;
00089 }

void s_Moniker ( dbref  thing,
const char *  s 
)

Definition at line 655 of file db.cpp.

References A_MONIKER, atr_add_raw(), confdata::cache_names, db, MEMFREE, object::moniker, and mudconf.

Referenced by do_moniker().

00656 {
00657     atr_add_raw(thing, A_MONIKER, s);
00658     if (mudconf.cache_names)
00659     {
00660 #ifndef MEMORY_BASED
00661         if (db[thing].name == db[thing].moniker)
00662         {
00663             db[thing].moniker = NULL;
00664         }
00665 #endif // !MEMORY_BASED
00666         if (db[thing].moniker)
00667         {
00668             MEMFREE(db[thing].moniker);
00669             db[thing].moniker = NULL;
00670         }
00671     }
00672 }

void s_Name ( dbref  ,
const char *   
)

Definition at line 615 of file db.cpp.

References A_NAME, atr_add_raw(), confdata::cache_names, db, MEMFREE, object::moniker, mudconf, object::name, object::purename, and StringClone().

Referenced by CGuests::Create(), create_obj(), db_make_minimal(), db_read(), destroy_bad_obj(), destroy_obj(), do_clone(), do_fixdb(), do_name(), and do_toad().

00616 {
00617     atr_add_raw(thing, A_NAME, s);
00618 #ifndef MEMORY_BASED
00619     if (db[thing].name)
00620     {
00621         if (mudconf.cache_names)
00622         {
00623             if (db[thing].name == db[thing].purename)
00624             {
00625                 db[thing].purename = NULL;
00626             }
00627             if (db[thing].name == db[thing].moniker)
00628             {
00629                 db[thing].moniker = NULL;
00630             }
00631         }
00632         MEMFREE(db[thing].name);
00633         db[thing].name = NULL;
00634     }
00635     if (s)
00636     {
00637         db[thing].name = StringClone(s);
00638     }
00639 #endif // !MEMORY_BASED
00640     if (mudconf.cache_names)
00641     {
00642         if (db[thing].purename)
00643         {
00644             MEMFREE(db[thing].purename);
00645             db[thing].purename = NULL;
00646         }
00647         if (db[thing].moniker)
00648         {
00649             MEMFREE(db[thing].moniker);
00650             db[thing].moniker = NULL;
00651         }
00652     }
00653 }

void s_Pass ( dbref  ,
const char *   
)

Definition at line 674 of file db.cpp.

References A_PASS, and atr_add_raw().

Referenced by ChangePassword().

00675 {
00676     atr_add_raw(thing, A_PASS, s);
00677 }

void DCL_CDECL safe_tprintf_str ( char *  ,
char **  ,
const char *  ,
  ... 
)

Definition at line 32 of file predicates.cpp.

References LBUF_SIZE, and mux_vsnprintf().

Referenced by do_drop(), do_malias_list(), do_newpassword(), do_page(), FUNCTION(), get_handler(), grep_util(), and unparse_boolexp1().

00033 {
00034     va_list ap;
00035     va_start(ap, fmt);
00036     size_t nAvailable = LBUF_SIZE - (*bp - str);
00037     size_t len = mux_vsnprintf(*bp, (int)nAvailable, fmt, ap);
00038     va_end(ap);
00039     *bp += len;
00040 }

void save_and_clear_global_regs ( const char *  ,
char *  [],
int  [] 
)

Definition at line 2127 of file eval.cpp.

References statedata::glob_reg_len, statedata::global_regs, MAX_GLOBAL_REGS, mudstate, and UNUSED_PARAMETER.

Referenced by look_contents(), look_exits(), and look_in().

02132 {
02133     UNUSED_PARAMETER(funcname);
02134 
02135     int i;
02136 
02137     for (i = 0; i < MAX_GLOBAL_REGS; i++)
02138     {
02139         preserve[i] = mudstate.global_regs[i];
02140         preserve_len[i] = mudstate.glob_reg_len[i];
02141 
02142         mudstate.global_regs[i] = NULL;
02143         mudstate.glob_reg_len[i] = 0;
02144     }
02145 }

void save_global_regs ( const char *  ,
char *  [],
int  [] 
)

Definition at line 2100 of file eval.cpp.

References alloc_lbuf, statedata::glob_reg_len, statedata::global_regs, MAX_GLOBAL_REGS, and mudstate.

Referenced by add_prefix(), check_filter(), did_it(), do_ufun(), eval_boolexp(), FUNCTION(), mux_exec(), and process_hook().

02105 {
02106     int i;
02107 
02108     for (i = 0; i < MAX_GLOBAL_REGS; i++)
02109     {
02110         if (mudstate.global_regs[i])
02111         {
02112             preserve[i] = alloc_lbuf(funcname);
02113             int n = mudstate.glob_reg_len[i];
02114             memcpy(preserve[i], mudstate.global_regs[i], n);
02115             preserve[i][n] = '\0';
02116             preserve_len[i] = n;
02117         }
02118         else
02119         {
02120             preserve[i] = NULL;
02121             preserve_len[i] = 0;
02122         }
02123     }
02124 }

void set_modified ( dbref  thing  ) 

Definition at line 15 of file set.cpp.

References A_MODIFIED, atr_add_raw(), CLinearTimeAbsolute::GetLocal(), and CLinearTimeAbsolute::ReturnDateString().

Referenced by atr_add(), do_forwardlist(), do_moniker(), do_name(), do_unlock(), and do_wipe().

00016 {
00017     CLinearTimeAbsolute ltaNow;
00018     ltaNow.GetLocal();
00019     atr_add_raw(thing, A_MODIFIED, ltaNow.ReturnDateString(7));
00020 }

void set_prefix_cmds ( void   ) 

Fills in the table of single-character prefix commands.

Command entries for known prefix commands (" : ; \ # & - ~) are copied from the regular command table. Entries for all other starting characters are set to NULL.

Returns:
None.

Definition at line 912 of file command.cpp.

References prefix_cmds, and SET_PREFIX_CMD.

Referenced by do_addcommand(), and do_delcommand().

00913 {
00914     for (int i = 0; i < 256; i++)
00915     {
00916         prefix_cmds[i] = NULL;
00917     }
00918 
00919 #define SET_PREFIX_CMD(s) prefix_cmds[(unsigned char)(s)[0]] = \
00920         (CMDENT *) hashfindLEN((char *)(s), 1, &mudstate.command_htab)
00921     SET_PREFIX_CMD("\"");
00922     SET_PREFIX_CMD(":");
00923     SET_PREFIX_CMD(";");
00924     SET_PREFIX_CMD("\\");
00925     SET_PREFIX_CMD("#");
00926     SET_PREFIX_CMD("&");
00927     SET_PREFIX_CMD("-");
00928     SET_PREFIX_CMD("~");
00929 #undef SET_PREFIX_CMD
00930 }

void show_vrml_url ( dbref  ,
dbref   
)

Definition at line 2661 of file look.cpp.

References A_VRML_URL, alloc_lbuf, atr_pget, free_lbuf, Html, notify_html, and safe_str.

Referenced by look_in(), and process_enter_loc().

02662 {
02663     char *vrml_url;
02664     dbref aowner;
02665     int aflags;
02666 
02667     // If they don't care about HTML, just return.
02668     //
02669     if (!Html(thing))
02670     {
02671         return;
02672     }
02673 
02674     vrml_url = atr_pget(loc, A_VRML_URL, &aowner, &aflags);
02675     if (*vrml_url)
02676     {
02677         char *vrml_message, *vrml_cp;
02678 
02679         vrml_message = vrml_cp = alloc_lbuf("show_vrml_url");
02680         safe_str("<img xch_graph=load href=\"", vrml_message, &vrml_cp);
02681         safe_str(vrml_url, vrml_message, &vrml_cp);
02682         safe_str("\">", vrml_message, &vrml_cp);
02683         *vrml_cp = 0;
02684         notify_html(thing, vrml_message);
02685         free_lbuf(vrml_message);
02686     }
02687     else
02688     {
02689         notify_html(thing, "<img xch_graph=hide>");
02690     }
02691     free_lbuf(vrml_url);
02692 }

void stack_clr ( dbref  obj  ) 

Definition at line 3554 of file funceval.cpp.

References stack::data, free_lbuf, MEMFREE, next, stack::next, s_Stack, and Stack.

Referenced by destroy_bad_obj(), destroy_obj(), and FUNCTION().

03555 {
03556     // Clear the stack.
03557     //
03558     STACK *sp, *next;
03559     for (sp = Stack(obj); sp != NULL; sp = next)
03560     {
03561         next = sp->next;
03562         free_lbuf(sp->data);
03563         MEMFREE(sp);
03564         sp = NULL;
03565     }
03566     s_Stack(obj, NULL);
03567 }

dbref start_home ( void   ) 

Definition at line 102 of file object.cpp.

References mudconf, NOTHING, confdata::start_home, and confdata::start_room.

Referenced by create_player().

00103 {
00104     if (mudconf.start_home != NOTHING)
00105     {
00106         return mudconf.start_home;
00107     }
00108     return mudconf.start_room;
00109 }

bool start_log ( const char *  primary,
const char *  secondary 
)

Definition at line 52 of file log.cpp.

References statedata::bStandAlone, ENDLINE, CLinearTimeAbsolute::GetLocal(), FIELDEDTIME::iDayOfMonth, FIELDEDTIME::iHour, FIELDEDTIME::iMinute, FIELDEDTIME::iMonth, FIELDEDTIME::iSecond, FIELDEDTIME::iYear, Log, confdata::log_info, statedata::logging, LOGOPT_TIMESTAMP, confdata::mud_name, mudconf, mudstate, CLinearTimeAbsolute::ReturnFields(), CLogFile::tinyprintf(), and CLogFile::WriteString().

Referenced by log_perror(), pool_alloc(), pool_alloc_lbuf(), pool_free(), pool_free_lbuf(), and report_timecheck().

00053 {
00054     mudstate.logging++;
00055     if (  1 <= mudstate.logging
00056        && mudstate.logging <= 2)
00057     {
00058         if (!mudstate.bStandAlone)
00059         {
00060             // Format the timestamp.
00061             //
00062             char buffer[256];
00063             buffer[0] = '\0';
00064             if (mudconf.log_info & LOGOPT_TIMESTAMP)
00065             {
00066                 CLinearTimeAbsolute ltaNow;
00067                 ltaNow.GetLocal();
00068                 FIELDEDTIME ft;
00069                 ltaNow.ReturnFields(&ft);
00070                 sprintf(buffer, "%d.%02d%02d:%02d%02d%02d ",ft.iYear,
00071                     ft.iMonth, ft.iDayOfMonth, ft.iHour, ft.iMinute,
00072                     ft.iSecond);
00073             }
00074 
00075             // Write the header to the log.
00076             //
00077             if (  secondary
00078                && *secondary)
00079             {
00080                 Log.tinyprintf("%s%s %3s/%-5s: ", buffer, mudconf.mud_name,
00081                     primary, secondary);
00082             }
00083             else
00084             {
00085                 Log.tinyprintf("%s%s %-9s: ", buffer, mudconf.mud_name,
00086                     primary);
00087             }
00088         }
00089 
00090         // If a recursive call, log it and return indicating no log.
00091         //
00092         if (mudstate.logging == 1)
00093         {
00094             return true;
00095         }
00096         Log.WriteString("Recursive logging request." ENDLINE);
00097     }
00098     mudstate.logging--;
00099     return false;
00100 }

void tcache_init ( void   ) 

Definition at line 874 of file eval.cpp.

References tcache_head.

Referenced by main().

00875 {
00876     tcache_head = NULL;
00877     tcache_top = true;
00878     tcache_count = 0;
00879 }

char* DCL_CDECL tprintf ( const char *  ,
  ... 
)

Definition at line 22 of file predicates.cpp.

References LBUF_SIZE, and mux_vsnprintf().

Referenced by add_helpfile(), add_mail_message(), announce_connect(), announce_disconnect(), atr_encode(), CallBack_ShowDispatches(), canpayfees(), cf_log_notfound(), check_dead_refs(), check_floating(), check_mail(), convert_flags(), create_obj(), dbclean_CheckALISTtoAT(), dbclean_CheckALISTtoDB(), dbclean_CheckANHtoAT(), dbclean_CheckATtoANH(), debug_examine(), decode_power(), decompile_flags(), destroy_obj(), destroy_player(), did_it(), disp_from_on(), do_addcom(), do_addcommand(), do_attribute(), do_backup(), do_boot(), do_cemit(), do_chanlog(), do_channelwho(), do_chboot(), do_chopen(), do_chown(), do_chownall(), do_clone(), do_comconnectchannel(), do_comlast(), do_comlist(), do_comtitle(), do_comwho(), do_comwho_line(), do_cpattr(), do_create(), do_createchannel(), do_dbclean(), do_decomp(), do_delcom(), do_delcomchannel(), do_delcommand(), do_destroy(), do_destroychannel(), do_dig(), do_doing(), do_edit(), do_editchannel(), do_entrances(), do_examine(), do_expmail_start(), do_find(), do_fixdb(), do_flag(), do_function(), do_get(), do_halt(), do_hook(), do_icmd(), do_joinchannel(), do_kill(), do_last(), do_leavechannel(), do_link(), do_listcommands(), do_mail_cc(), do_mail_change_folder(), do_mail_debug(), do_mail_file(), do_mail_flags(), do_mail_fwd(), do_mail_list(), do_mail_nuke(), do_mail_proof(), do_mail_read(), do_mail_reply(), do_mail_retract(), do_mail_review(), do_mail_stats(), do_malias_add(), do_malias_adminlist(), do_malias_chown(), do_malias_create(), do_malias_delete(), do_malias_desc(), do_malias_list(), do_malias_list_all(), do_malias_remove(), do_malias_send(), do_malias_status(), do_motd(), do_move(), do_mvattr(), do_page(), do_pcreate(), do_pemit_single(), do_postpend(), do_prepend(), do_processcom(), do_prog(), do_queue(), do_say(), do_score(), do_shout(), do_stats(), do_toad(), do_train(), dump_database_internal(), dump_info(), dump_users(), edit_string_ansi(), FUNCTION(), fwdlist_load(), get_slave_result(), get_stats(), give_money(), give_thing(), handle_ears(), handle_prog(), hook_loop(), list_costs(), list_db_stats(), list_options(), list_process(), list_vattrs(), CGuests::ListAll(), load_game(), look_exits(), mail_check(), mail_return(), make_numlist(), CGuests::MakeGuestChar(), move_object(), new_mail_message(), open_exit(), page_check(), page_return(), parse_boolexp_L(), pool_free(), pool_free_lbuf(), pool_trace(), process_cmdent(), process_command(), process_enter_loc(), process_leave_loc(), record_login(), report_timecheck(), ReportMatchedTopics(), say_shout(), search_mark(), search_setup(), send_mail(), SendChannelMessage(), show_quota(), ShowPsLine(), SiteMonSend(), sweep_check(), tcache_finish(), view_atr(), and whisper_pose().

00023 {
00024     static char buff[LBUF_SIZE];
00025     va_list ap;
00026     va_start(ap, fmt);
00027     mux_vsnprintf(buff, LBUF_SIZE, fmt, ap);
00028     va_end(ap);
00029     return buff;
00030 }

double ulp ( double   ) 

Definition at line 1016 of file strtod.cpp.

References dval, Exp_mask, Exp_msk1, Exp_shift, Long, P, word0, and word1.

Referenced by mux_strtod(), and NearestPretty().

01017 {
01018     register Long L;
01019     double a;
01020 
01021     L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;
01022 #ifndef Avoid_Underflow
01023 #ifndef Sudden_Underflow
01024     if (L > 0)
01025     {
01026 #endif
01027 #endif
01028 #ifdef IBM
01029         L |= Exp_msk1 >> 4;
01030 #endif
01031         word0(a) = L;
01032         word1(a) = 0;
01033 #ifndef Avoid_Underflow
01034 #ifndef Sudden_Underflow
01035     }
01036     else
01037     {
01038         L = -L >> Exp_shift;
01039         if (L < Exp_shift)
01040         {
01041             word0(a) = 0x80000 >> L;
01042             word1(a) = 0;
01043         }
01044         else
01045         {
01046             word0(a) = 0;
01047             L -= Exp_shift;
01048             word1(a) = L >= 31 ? 1 : 1 << 31 - L;
01049         }
01050     }
01051 #endif
01052 #endif
01053     return dval(a);
01054 }

char* unparse_boolexp ( dbref  ,
BOOLEXP  
)

Definition at line 229 of file unparse.cpp.

References boolexp_buf, BOOLEXP_CONST, buftop, F_EXAMINE, and unparse_boolexp1().

Referenced by debug_examine(), do_examine(), and view_atr().

00230 {
00231     buftop = boolexp_buf;
00232     unparse_boolexp1(player, b, BOOLEXP_CONST, F_EXAMINE);
00233     *buftop = '\0';
00234     return boolexp_buf;
00235 }

char* unparse_boolexp_decompile ( dbref  ,
BOOLEXP  
)

Definition at line 237 of file unparse.cpp.

References boolexp_buf, BOOLEXP_CONST, buftop, F_DECOMPILE, and unparse_boolexp1().

Referenced by do_decomp().

00238 {
00239     buftop = boolexp_buf;
00240     unparse_boolexp1(player, b, BOOLEXP_CONST, F_DECOMPILE);
00241     *buftop = '\0';
00242     return boolexp_buf;
00243 }

char* unparse_boolexp_function ( dbref  ,
BOOLEXP  
)

Definition at line 245 of file unparse.cpp.

References boolexp_buf, BOOLEXP_CONST, buftop, F_FUNCTION, and unparse_boolexp1().

Referenced by FUNCTION().

00246 {
00247     buftop = boolexp_buf;
00248     unparse_boolexp1(player, b, BOOLEXP_CONST, F_FUNCTION);
00249     *buftop = '\0';
00250     return boolexp_buf;
00251 }

char* unparse_boolexp_quiet ( dbref  ,
BOOLEXP  
)

Definition at line 221 of file unparse.cpp.

References boolexp_buf, BOOLEXP_CONST, buftop, F_QUIET, and unparse_boolexp1().

Referenced by db_read(), and do_lock().

00222 {
00223     buftop = boolexp_buf;
00224     unparse_boolexp1(player, b, BOOLEXP_CONST, F_QUIET);
00225     *buftop = '\0';
00226     return boolexp_buf;
00227 }

void ValidateConfigurationDbrefs ( void   ) 

Definition at line 2049 of file conf.cpp.

References statedata::db_top, confdata::default_home, confdata::guest_char, confdata::guest_nuker, confdata::master_room, mudconf, mudstate, NOTHING, confdata::start_home, and confdata::start_room.

Referenced by do_admin(), and main().

02050 {
02051     static dbref *Table[] =
02052     {
02053         &mudconf.default_home,
02054         &mudconf.guest_char,
02055         &mudconf.guest_nuker,
02056         &mudconf.master_room,
02057         &mudconf.start_home,
02058         &mudconf.start_room,
02059         0
02060     };
02061 
02062     for (int i = 0; Table[i]; i++)
02063     {
02064         if (*Table[i] != NOTHING)
02065         {
02066             if (*Table[i] < 0 || mudstate.db_top <= *Table[i])
02067             {
02068                 *Table[i] = NOTHING;
02069             }
02070         }
02071     }
02072 }

bool ValidatePlayerName ( const char *  pName  ) 

Definition at line 486 of file predicates.cpp.

References statedata::bStandAlone, mudconf, mudstate, mux_isspace, mux_PlayerNameSet, confdata::name_spaces, and PLAYER_NAME_LIMIT.

Referenced by create_obj(), do_alias(), do_fixdb(), do_name(), and FUNCTION().

00487 {
00488     if (!pName)
00489     {
00490         return false;
00491     }
00492     size_t nName = strlen(pName);
00493 
00494     // Verify that name is not empty, but not too long, either.
00495     //
00496     if (  nName <= 0
00497        || PLAYER_NAME_LIMIT <= nName)
00498     {
00499         return false;
00500     }
00501 
00502     // Do not allow LOOKUP_TOKEN, NUMBER_TOKEN, NOT_TOKEN, or SPACE
00503     // as the first character, or SPACE as the last character
00504     //
00505     if (  strchr("*!#", *pName)
00506        || mux_isspace(pName[0])
00507        || mux_isspace(pName[nName-1]))
00508     {
00509         return false;
00510     }
00511 
00512     if (  mudstate.bStandAlone
00513        || mudconf.name_spaces)
00514     {
00515         mux_PlayerNameSet[(unsigned char)' '] = 1;
00516     }
00517     else
00518     {
00519         mux_PlayerNameSet[(unsigned char)' '] = 0;
00520     }
00521 
00522     // Only printable characters besides ARG_DELIMITER, AND_TOKEN,
00523     // and OR_TOKEN are allowed.
00524     //
00525     for (unsigned int i = 0; i < nName; i++)
00526     {
00527         if (!mux_PlayerNameSet(pName[i]))
00528         {
00529             return false;
00530         }
00531     }
00532 
00533     // Special names are specifically dis-allowed.
00534     //
00535     if (  (nName == 2 && memcmp("me", pName, 2) == 0)
00536        || (nName == 4 && (  memcmp("home", pName, 4) == 0
00537                          || memcmp("here", pName, 4) == 0)))
00538     {
00539         return false;
00540     }
00541     return true;
00542 }

void wait_que ( dbref  executor,
dbref  caller,
dbref  enactor,
bool  ,
CLinearTimeAbsolute ,
dbref  ,
int  ,
char *  ,
char *  [],
int  ,
char *  [] 
)

Definition at line 801 of file cque.cpp.

References bque::attr, CF_INTERP, confdata::control_flags, CScheduler::DeferImmediateTask(), CScheduler::DeferTask(), bque::enactor, isPlayer, bque::IsTimed, mudconf, NOTHING, PRIORITY_OBJECT, PRIORITY_PLAYER, PRIORITY_SUSPEND, scheduler, bque::sem, setup_que(), Task_RunQueueEntry(), Task_SemaphoreTimeout(), and bque::waittime.

Referenced by announce_connect(), announce_disconnect(), atr_match1(), bind_and_queue(), did_it(), do_dolist(), do_force(), do_if(), do_switch(), do_wait(), handle_prog(), and process_cmdent().

00814 {
00815     if (!(mudconf.control_flags & CF_INTERP))
00816     {
00817         return;
00818     }
00819 
00820     BQUE *tmp = setup_que(executor, caller, enactor, command, args, nargs, sargs);
00821     if (!tmp)
00822     {
00823         return;
00824     }
00825 
00826     int iPriority;
00827     if (isPlayer(tmp->enactor))
00828     {
00829         iPriority = PRIORITY_PLAYER;
00830     }
00831     else
00832     {
00833         iPriority = PRIORITY_OBJECT;
00834     }
00835 
00836     tmp->IsTimed = bTimed;
00837     tmp->waittime = ltaWhen;
00838     tmp->sem = sem;
00839     tmp->attr = attr;
00840 
00841     if (sem == NOTHING)
00842     {
00843         // Not a semaphore, so let it run it immediately or put it on
00844         // the wait queue.
00845         //
00846         if (tmp->IsTimed)
00847         {
00848             scheduler.DeferTask(tmp->waittime, iPriority, Task_RunQueueEntry, tmp, 0);
00849         }
00850         else
00851         {
00852             scheduler.DeferImmediateTask(iPriority, Task_RunQueueEntry, tmp, 0);
00853         }
00854     }
00855     else
00856     {
00857         if (!tmp->IsTimed)
00858         {
00859             // In this case, the timeout task below will never run,
00860             // but it allows us to manage all semaphores together in
00861             // the same data structure.
00862             //
00863             iPriority = PRIORITY_SUSPEND;
00864         }
00865         scheduler.DeferTask(tmp->waittime, iPriority, Task_SemaphoreTimeout, tmp, 0);
00866     }
00867 }

dbref where_is ( dbref   ) 

Definition at line 2028 of file predicates.cpp.

References Exits, Good_obj, Location, NOTHING, TYPE_EXIT, TYPE_PLAYER, TYPE_THING, and Typeof.

Referenced by do_pemit_single(), do_say(), FUNCTION(), locatable(), mux_exec(), nearby(), and notify_check().

02029 {
02030     if (!Good_obj(what))
02031     {
02032         return NOTHING;
02033     }
02034 
02035     dbref loc;
02036     switch (Typeof(what))
02037     {
02038     case TYPE_PLAYER:
02039     case TYPE_THING:
02040         loc = Location(what);
02041         break;
02042 
02043     case TYPE_EXIT:
02044         loc = Exits(what);
02045         break;
02046 
02047     default:
02048         loc = NOTHING;
02049         break;
02050     }
02051     return loc;
02052 }

dbref where_room ( dbref   ) 

Definition at line 2059 of file predicates.cpp.

References Good_obj, Has_location, isRoom, Location, mudconf, NOTHING, and confdata::ntfy_nest_lim.

Referenced by do_teleport_single(), dump_users(), and locatable().

02060 {
02061     for (int count = mudconf.ntfy_nest_lim; count > 0; count--)
02062     {
02063         if (!Good_obj(what))
02064         {
02065             break;
02066         }
02067         if (isRoom(what))
02068         {
02069             return what;
02070         }
02071         if (!Has_location(what))
02072         {
02073             break;
02074         }
02075         what = Location(what);
02076     }
02077     return NOTHING;
02078 }

bool wild ( char *  ,
char *  ,
char *  [],
int   
)

Definition at line 364 of file wild.cpp.

References alloc_lbuf, arglist, free_lbuf, mudstate, NOTEQUAL, numargs, quick_wild(), wild1(), and statedata::wild_invk_ctr.

Referenced by atr_match1(), notify_check(), and process_cmdent().

00365 {
00366     mudstate.wild_invk_ctr = 0;
00367 
00368     int i;
00369     char *scan;
00370 
00371     // Initialize the return array.
00372     //
00373     for (i = 0; i < nargs; i++)
00374     {
00375         args[i] = NULL;
00376     }
00377 
00378     // Do fast match.
00379     //
00380     while (  *tstr != '*'
00381           && *tstr != '?')
00382     {
00383         if (*tstr == '\\')
00384         {
00385             tstr++;
00386         }
00387         if (NOTEQUAL(*dstr, *tstr))
00388         {
00389             return false;
00390         }
00391         if (!*dstr)
00392         {
00393             return true;
00394         }
00395         tstr++;
00396         dstr++;
00397     }
00398 
00399     // Allocate space for the return args.
00400     //
00401     i = 0;
00402     scan = tstr;
00403     while (  *scan
00404           && i < nargs)
00405     {
00406         switch (*scan)
00407         {
00408         case '?':
00409 
00410             args[i] = alloc_lbuf("wild.?");
00411             i++;
00412             break;
00413 
00414         case '*':
00415 
00416             args[i] = alloc_lbuf("wild.*");
00417             i++;
00418         }
00419         scan++;
00420     }
00421 
00422     // Put stuff in globals for quick recursion.
00423     //
00424     arglist = args;
00425     numargs = nargs;
00426 
00427     // Do the match.
00428     //
00429     bool value = nargs ? wild1(tstr, dstr, 0) : quick_wild(tstr, dstr);
00430 
00431     // Clean out any fake match data left by wild1.
00432     //
00433     for (i = 0; i < nargs; i++)
00434     {
00435         if (  args[i] != NULL
00436            && (  !*args[i]
00437               || !value))
00438         {
00439             free_lbuf(args[i]);
00440             args[i] = NULL;
00441         }
00442     }
00443     return value;
00444 }

bool wild_match ( char *  ,
const char *   
)

Definition at line 452 of file wild.cpp.

References mudstate, mux_atol(), mux_isdigit, quick_wild(), and statedata::wild_invk_ctr.

Referenced by check_attr(), do_switch(), and switch_handler().

00453 {
00454     switch (*tstr)
00455     {
00456     case '>':
00457 
00458         tstr++;
00459         if (  mux_isdigit(*tstr)
00460            || *tstr == '-')
00461         {
00462             long lt = mux_atol(tstr);
00463             long ld = mux_atol(dstr);
00464             return (lt < ld);
00465         }
00466         else
00467         {
00468             return (strcmp(tstr, dstr) < 0);
00469         }
00470 
00471     case '<':
00472 
00473         tstr++;
00474         if (  mux_isdigit(*tstr)
00475            || *tstr == '-')
00476         {
00477             long lt = mux_atol(tstr);
00478             long ld = mux_atol(dstr);
00479             return (lt > ld);
00480         }
00481         else
00482         {
00483             return (strcmp(tstr, dstr) > 0);
00484         }
00485     }
00486     mudstate.wild_invk_ctr = 0;
00487     return quick_wild(tstr, dstr);
00488 }

bool xlate ( char *   ) 

Definition at line 2272 of file functions.cpp.

References PARSE_FLOAT_RESULT::iString, mux_isspace, PARSE_FLOAT_RESULT::nDigitsA, PARSE_FLOAT_RESULT::nDigitsB, ParseFloat(), PARSE_FLOAT_RESULT::pDigitsA, and PARSE_FLOAT_RESULT::pDigitsB.

Referenced by do_break(), do_if(), filter_handler(), FUNCTION(), process_hook(), and search_perform().

02273 {
02274     const char *p = arg;
02275     if (p[0] == '#')
02276     {
02277         if (p[1] == '-')
02278         {
02279             // '#-...' is false. This includes '#-0000' and '#-ABC'.
02280             // This cases are unlikely in practice. We can always come back
02281             // and cover these.
02282             //
02283             return false;
02284         }
02285         return true;
02286     }
02287 
02288     PARSE_FLOAT_RESULT pfr;
02289     if (ParseFloat(&pfr, p))
02290     {
02291         // Examine whether number was a zero value.
02292         //
02293         if (pfr.iString)
02294         {
02295             // This covers NaN, +Inf, -Inf, and Ind.
02296             //
02297             return false;
02298         }
02299 
02300         // We can ignore leading sign, exponent sign, and exponent as 0, -0,
02301         // and +0. Also, 0E+100 and 0.0e-100 are all zero.
02302         //
02303         // However, we need to cover 00000.0 and 0.00000 cases.
02304         //
02305         while (pfr.nDigitsA--)
02306         {
02307             if (*pfr.pDigitsA != '0')
02308             {
02309                 return true;
02310             }
02311             pfr.pDigitsA++;
02312         }
02313         while (pfr.nDigitsB--)
02314         {
02315             if (*pfr.pDigitsB != '0')
02316             {
02317                 return true;
02318             }
02319             pfr.pDigitsB++;
02320         }
02321         return false;
02322     }
02323     while (mux_isspace(*p))
02324     {
02325         p++;
02326     }
02327     if (p[0] == '\0')
02328     {
02329         return false;
02330     }
02331     return true;
02332 }


Variable Documentation

PortInfo aMainGamePorts[MAX_LISTEN_PORTS]

Definition at line 32 of file bsd.cpp.

Referenced by close_sockets(), dump_restart_db(), load_restart_db(), and main().

const char* AMBIGUOUS_MESSAGE

Definition at line 18 of file match.cpp.

Referenced by match_status().

int anum_alc_top

Definition at line 1110 of file db.cpp.

Referenced by db_write(), dbclean_CheckALISTtoAT(), dbclean_CheckALISTtoDB(), dbclean_CheckANHtoAT(), dbclean_CheckATtoANH(), dbclean_RemoveStaleAttributeNames(), and dbclean_RenumberAttributes().

bool break_called

Definition at line 21 of file cque.cpp.

Referenced by do_break(), and Task_RunQueueEntry().

const char* ColorTable[256]

Definition at line 939 of file eval.cpp.

Referenced by FUNCTION().

CLinearTimeAbsolute cs_ltime

Definition at line 21 of file attrcache.cpp.

Referenced by cache_init(), and list_db_stats().

long DebugTotalFiles

Definition at line 2258 of file game.cpp.

Referenced by CF_HAND(), do_shutdown(), dump_database_internal(), fcache_read(), helpindex_read(), list_system_resources(), load_comsys(), load_game(), load_restart_db(), ReportTopic(), and save_comsys().

long DebugTotalSockets

Definition at line 2259 of file game.cpp.

Referenced by boot_slave(), CleanUpSlaveSocket(), close_sockets(), list_system_resources(), load_restart_db(), make_socket(), new_connection(), and SetupPorts().

NAMETAB enable_names[]

Definition at line 736 of file wiz.cpp.

Referenced by do_global(), and do_list().

const char* FUNC_AMBIGUOUS

Definition at line 24 of file match.cpp.

const char* FUNC_FAIL_MESSAGE

Definition at line 20 of file match.cpp.

const char* FUNC_NOMATCH_MESSAGE

Definition at line 21 of file match.cpp.

const char* FUNC_NOPERM_MESSAGE

Definition at line 25 of file match.cpp.

const char* FUNC_NOT_FOUND

Definition at line 23 of file match.cpp.

pid_t game_pid

Definition at line 52 of file bsd.cpp.

Referenced by check_panicking(), list_process(), main(), and write_pidfile().

int maxd

Definition at line 49 of file bsd.cpp.

Referenced by boot_slave(), load_restart_db(), and shovechars().

const signed char mux_RegisterSet[256]

Definition at line 139 of file eval.cpp.

Referenced by FUNCTION(), mux_exec(), and real_regmatch().

unsigned int ndescriptors

Definition at line 35 of file bsd.cpp.

Referenced by initializesock(), load_restart_db(), and shovechars().

int nMainGamePorts

Definition at line 33 of file bsd.cpp.

Referenced by close_sockets(), dump_restart_db(), load_restart_db(), and main().

const char* NOMATCH_MESSAGE

Definition at line 17 of file match.cpp.

Referenced by do_examine(), do_function(), do_prog(), look_simple(), and match_status().

const char* NOPERM_MESSAGE

Definition at line 19 of file match.cpp.

Referenced by CF_HAND(), cf_set(), create_obj(), do_addcommand(), do_alias(), do_boot(), do_cemit(), do_channelwho(), do_cheader(), do_chopen(), do_chown(), do_clone(), do_createchannel(), do_delcommand(), do_destroychannel(), do_doing(), do_drop(), do_editchannel(), do_enter(), do_enter_internal(), do_examine(), do_forwardlist(), do_function(), do_get(), do_halt(), do_last(), do_link(), do_lock(), do_notify(), do_parent(), do_pemit_single(), do_prog(), do_ps(), do_quitprog(), do_quota(), do_restart(), do_set(), do_shutdown(), do_teleport_single(), do_trigger(), do_unlink(), do_unlock(), do_wait(), flag_set(), FUNCTION(), get_stats(), give_thing(), link_exit(), match_controlled_handler(), match_status(), open_exit(), power_set(), process_cmdent(), process_command(), and set_attr_internal().

const char* OUT_OF_RANGE

Definition at line 22 of file match.cpp.

CScheduler scheduler

Definition at line 19 of file timer.cpp.

Referenced by dispatch_CacheTick(), dispatch_CheckEvents(), dispatch_DatabaseDump(), dispatch_FreeListReconstruction(), dispatch_IdleCheck(), do_global(), do_ps(), do_queue(), do_timewarp(), halt_que(), init_timer(), nfy_que(), process_preload(), save_command(), shovechars(), sighandler(), Task_ProcessCommand(), and wait_que().

NAMETAB sigactions_nametab[]

Definition at line 4008 of file bsd.cpp.


Generated on Mon May 28 04:40:16 2007 for MUX by  doxygen 1.4.7