#include "copyright.h"#include "autoconf.h"#include "config.h"#include "externs.h"#include <limits.h>#include <math.h>#include "ansi.h"#include "attrs.h"#include "command.h"#include "comsys.h"#include "functions.h"#include "misc.h"#include "pcre.h"Include dependency graph for funceval.cpp:

Go to the source code of this file.
Defines | |
| #define | CWHO_ON 0 |
| #define | CWHO_OFF 1 |
| #define | CWHO_ALL 2 |
| #define | ANSI_F 0x00000001 |
| #define | ANSI_H 0x00000002 |
| #define | ANSI_U 0x00000004 |
| #define | ANSI_I 0x00000008 |
| #define | ANSI_FC 0x00000010 |
| #define | ANSI_BC 0x00000020 |
| #define | DEFAULT_DEFAULT 1 |
| #define | DEFAULT_EDEFAULT 2 |
| #define | DEFAULT_UDEFAULT 4 |
| #define | MINIMUM_RESIZE (4096*sizeof(UINT32)) |
Typedefs | |
| typedef int | PV (const void *, const void *) |
Functions | |
| bool | parse_and_get_attrib (dbref executor, char *fargs[], char **atext, dbref *thing, char *buff, char **bufc) |
| FUNCTION (fun_cwho) | |
| FUNCTION (fun_beep) | |
| static void | SimplifyColorLetters (char *pOut, char *pIn) |
| FUNCTION (fun_ansi) | |
| FUNCTION (fun_zone) | |
| static bool | check_command (dbref player, char *name, char *buff, char **bufc) |
| FUNCTION (fun_link) | |
| FUNCTION (fun_tel) | |
| FUNCTION (fun_pemit) | |
| FUNCTION (fun_oemit) | |
| FUNCTION (fun_emit) | |
| FUNCTION (fun_remit) | |
| FUNCTION (fun_cemit) | |
| FUNCTION (fun_create) | |
| FUNCTION (fun_textfile) | |
| static void | set_attr_internal (dbref player, dbref thing, int attrnum, char *attrtext, int key, char *buff, char **bufc) |
| FUNCTION (fun_set) | |
| static unsigned int | GenCode (char *pCode, const char *pCodeASCII) |
| static char * | crypt_code (char *code, char *text, bool type) |
| FUNCTION (fun_encrypt) | |
| FUNCTION (fun_decrypt) | |
| static void | scan_zone (dbref executor, char *szZone, int ObjectType, char *buff, char **bufc) |
| FUNCTION (fun_zwho) | |
| FUNCTION (fun_inzone) | |
| FUNCTION (fun_children) | |
| FUNCTION (fun_objeval) | |
| FUNCTION (fun_localize) | |
| FUNCTION (fun_null) | |
| FUNCTION (fun_squish) | |
| FUNCTION (fun_stripansi) | |
| FUNCTION (fun_zfun) | |
| FUNCTION (fun_columns) | |
| FUNCTION (fun_table) | |
| static int | mem_usage (dbref thing) |
| FUNCTION (fun_objmem) | |
| FUNCTION (fun_playmem) | |
| static bool | handle_flaglists (dbref player, char *name, char *fstr, bool type) |
| FUNCTION (fun_orflags) | |
| FUNCTION (fun_andflags) | |
| FUNCTION (fun_strtrunc) | |
| FUNCTION (fun_ifelse) | |
| FUNCTION (fun_mail) | |
| FUNCTION (fun_mailfrom) | |
| static void | hasattr_handler (char *buff, char **bufc, dbref executor, char *fargs[], bool bCheckParent) |
| FUNCTION (fun_hasattr) | |
| FUNCTION (fun_hasattrp) | |
| static void | default_handler (char *buff, char **bufc, dbref executor, dbref caller, dbref enactor, char *fargs[], int nfargs, char *cargs[], int ncargs, int key) |
| FUNCTION (fun_default) | |
| FUNCTION (fun_edefault) | |
| FUNCTION (fun_udefault) | |
| FUNCTION (fun_findable) | |
| FUNCTION (fun_isword) | |
| FUNCTION (fun_visible) | |
| FUNCTION (fun_elements) | |
| FUNCTION (fun_grab) | |
| FUNCTION (fun_graball) | |
| FUNCTION (fun_scramble) | |
| FUNCTION (fun_shuffle) | |
| FUNCTION (fun_pickrand) | |
| static int | u_comp (const void *s1, const void *s2) |
| static void | sane_qsort (void *array[], int left, int right, PV compare) |
| FUNCTION (fun_sortby) | |
| FUNCTION (fun_last) | |
| FUNCTION (fun_matchall) | |
| FUNCTION (fun_ports) | |
| FUNCTION (fun_mix) | |
| FUNCTION (fun_foreach) | |
| FUNCTION (fun_munge) | |
| FUNCTION (fun_die) | |
| FUNCTION (fun_lrand) | |
| FUNCTION (fun_lit) | |
| FUNCTION (fun_dumping) | |
| FUNCTION (fun_unpack) | |
| static size_t | mux_Pack (INT64 val, int iRadix, char *buf) |
| FUNCTION (fun_pack) | |
| FUNCTION (fun_strcat) | |
| static char * | grep_util (dbref player, dbref thing, char *pattern, char *lookfor, int len, bool insensitive) |
| static void | grep_handler (char *buff, char **bufc, dbref executor, char *fargs[], bool bCaseInsens) |
| FUNCTION (fun_grep) | |
| FUNCTION (fun_grepi) | |
| FUNCTION (fun_alphamax) | |
| FUNCTION (fun_alphamin) | |
| FUNCTION (fun_valid) | |
| FUNCTION (fun_hastype) | |
| FUNCTION (fun_lparent) | |
| static int | stacksize (dbref doer) |
| FUNCTION (fun_lstack) | |
| void | stack_clr (dbref obj) |
| FUNCTION (fun_empty) | |
| FUNCTION (fun_items) | |
| FUNCTION (fun_peek) | |
| FUNCTION (fun_pop) | |
| FUNCTION (fun_push) | |
| static void | real_regmatch (const char *search, const char *pattern, char *registers, int nfargs, char *buff, char **bufc, bool cis) |
| FUNCTION (fun_regmatch) | |
| FUNCTION (fun_regmatchi) | |
| static void | real_regrab (char *search, const char *pattern, SEP *psep, char *buff, char **bufc, bool cis, bool all) |
| FUNCTION (fun_regrab) | |
| FUNCTION (fun_regrabi) | |
| FUNCTION (fun_regraball) | |
| FUNCTION (fun_regraballi) | |
| FUNCTION (fun_translate) | |
| static void | room_list (dbref player, dbref enactor, dbref room, int level, int maxlevels, bool showall) |
| FUNCTION (fun_lrooms) | |
Variables | |
| static const unsigned char | ansi_have_table [256] |
| static char | ucomp_buff [LBUF_SIZE] |
| static dbref | ucomp_executor |
| static dbref | ucomp_caller |
| static dbref | ucomp_enactor |
| static char | aRadixTable [] |
| #define ANSI_BC 0x00000020 |
Definition at line 151 of file funceval.cpp.
| #define ANSI_F 0x00000001 |
Definition at line 146 of file funceval.cpp.
| #define ANSI_FC 0x00000010 |
Definition at line 150 of file funceval.cpp.
| #define ANSI_H 0x00000002 |
Definition at line 147 of file funceval.cpp.
| #define ANSI_I 0x00000008 |
Definition at line 149 of file funceval.cpp.
| #define ANSI_U 0x00000004 |
Definition at line 148 of file funceval.cpp.
| #define CWHO_ALL 2 |
| #define CWHO_OFF 1 |
| #define CWHO_ON 0 |
| #define DEFAULT_DEFAULT 1 |
| #define DEFAULT_EDEFAULT 2 |
| #define DEFAULT_UDEFAULT 4 |
| #define MINIMUM_RESIZE (4096*sizeof(UINT32)) |
| typedef int PV(const void *, const void *) |
Definition at line 2416 of file funceval.cpp.
| static bool check_command | ( | dbref | player, | |
| char * | name, | |||
| char * | buff, | |||
| char ** | bufc | |||
| ) | [static] |
Definition at line 278 of file funceval.cpp.
References Builder, CA_GBL_BUILD, CF_BUILD, check_access(), statedata::command_htab, confdata::control_flags, hashfindLEN(), Invalid_Objtype, mudconf, mudstate, CMDENT::perms, Protect, and safe_noperm.
Referenced by FUNCTION().
00279 { 00280 CMDENT *cmdp = (CMDENT *)hashfindLEN(name, strlen(name), &mudstate.command_htab); 00281 if (cmdp) 00282 { 00283 // Perform checks similiar to (but not exactly like) the 00284 // ones in process_cmdent(): object type checks, permission 00285 // checks, ands global flags. 00286 // 00287 if ( Invalid_Objtype(player) 00288 || !check_access(player, cmdp->perms) 00289 || ( !Builder(player) 00290 && Protect(CA_GBL_BUILD) 00291 && !(mudconf.control_flags & CF_BUILD))) 00292 { 00293 safe_noperm(buff, bufc); 00294 return true; 00295 } 00296 } 00297 return false; 00298 }
| static char* crypt_code | ( | char * | code, | |
| char * | text, | |||
| bool | type | |||
| ) | [static] |
Definition at line 740 of file funceval.cpp.
References GenCode(), iMod(), LBUF_SIZE, and strip_ansi().
Referenced by FUNCTION().
00741 { 00742 if ( !text 00743 || text[0] == '\0') 00744 { 00745 return ""; 00746 } 00747 if ( !code 00748 || code[0] == '\0') 00749 { 00750 return text; 00751 } 00752 00753 char codebuff[LBUF_SIZE]; 00754 unsigned int nCode = GenCode(codebuff, code); 00755 if (nCode == 0) 00756 { 00757 return text; 00758 } 00759 00760 static char textbuff[LBUF_SIZE]; 00761 char *p = strip_ansi(text); 00762 char *q = codebuff; 00763 unsigned int nq = nCode; 00764 char *r = textbuff; 00765 00766 int iMod = '~' - ' ' + 1; 00767 00768 // Encryption loop: 00769 // 00770 while (*p) 00771 { 00772 unsigned char ch = *p; 00773 if ( ' ' <= ch 00774 && ch <= '~') 00775 { 00776 int iCode = ch - ' '; 00777 if (type) 00778 { 00779 iCode += *q; 00780 if (iMod <= iCode) 00781 { 00782 iCode -= iMod; 00783 } 00784 } 00785 else 00786 { 00787 iCode -= *q; 00788 if (iCode < 0) 00789 { 00790 iCode += iMod; 00791 } 00792 } 00793 *r++ = iCode + ' '; 00794 q++; 00795 nq--; 00796 if (0 == nq) 00797 { 00798 q = codebuff; 00799 nq = nCode; 00800 } 00801 } 00802 p++; 00803 } 00804 *r = '\0'; 00805 return textbuff; 00806 }
| static void default_handler | ( | char * | buff, | |
| char ** | bufc, | |||
| dbref | executor, | |||
| dbref | caller, | |||
| dbref | enactor, | |||
| char * | fargs[], | |||
| int | nfargs, | |||
| char * | cargs[], | |||
| int | ncargs, | |||
| int | key | |||
| ) | [static] |
Definition at line 1897 of file funceval.cpp.
References alloc_lbuf, atr_pget, atr_str(), DEFAULT_DEFAULT, DEFAULT_EDEFAULT, DEFAULT_UDEFAULT, EV_EVAL, EV_FCHECK, EV_FIGNORE, EV_STRIP_CURLY, EV_TOP, free_lbuf, MAX_ARG, mux_exec(), attr::number, parse_attrib(), safe_str, and See_attr.
Referenced by FUNCTION().
01899 { 01900 // Evaluating the first argument. 01901 // 01902 char *objattr = alloc_lbuf("default_handler"); 01903 char *bp = objattr; 01904 char *str = fargs[0]; 01905 mux_exec(objattr, &bp, executor, caller, enactor, 01906 EV_EVAL | EV_STRIP_CURLY | EV_FCHECK, &str, cargs, ncargs); 01907 *bp = '\0'; 01908 01909 // Parse the first argument as either <dbref>/<attrname> or <attrname>. 01910 // 01911 dbref thing; 01912 ATTR *pattr; 01913 01914 if (!parse_attrib(executor, objattr, &thing, &pattr)) 01915 { 01916 thing = executor; 01917 pattr = atr_str(objattr); 01918 } 01919 free_lbuf(objattr); 01920 01921 if ( pattr 01922 && See_attr(executor, thing, pattr)) 01923 { 01924 dbref aowner; 01925 int aflags; 01926 char *atr_gotten = atr_pget(thing, pattr->number, &aowner, &aflags); 01927 if (atr_gotten[0] != '\0') 01928 { 01929 switch (key) 01930 { 01931 case DEFAULT_DEFAULT: 01932 safe_str(atr_gotten, buff, bufc); 01933 break; 01934 01935 case DEFAULT_EDEFAULT: 01936 str = atr_gotten; 01937 mux_exec(buff, bufc, thing, executor, executor, 01938 EV_FIGNORE | EV_EVAL, &str, (char **)NULL, 0); 01939 break; 01940 01941 case DEFAULT_UDEFAULT: 01942 { 01943 char *xargs[MAX_ARG]; 01944 int nxargs = nfargs-2; 01945 int i; 01946 for (i = 0; i < nxargs; i++) 01947 { 01948 xargs[i] = alloc_lbuf("fun_udefault_args"); 01949 char *bp2 = xargs[i]; 01950 str = fargs[i+2]; 01951 01952 mux_exec(xargs[i], &bp2, 01953 thing, caller, enactor, 01954 EV_TOP | EV_STRIP_CURLY | EV_FCHECK | EV_EVAL, 01955 &str, cargs, ncargs); 01956 *bp2 = '\0'; 01957 } 01958 01959 str = atr_gotten; 01960 mux_exec(buff, bufc, thing, caller, enactor, 01961 EV_FCHECK | EV_EVAL, &str, xargs, nxargs); 01962 01963 for (i = 0; i < nxargs; i++) 01964 { 01965 free_lbuf(xargs[i]); 01966 } 01967 } 01968 break; 01969 01970 } 01971 free_lbuf(atr_gotten); 01972 return; 01973 } 01974 free_lbuf(atr_gotten); 01975 } 01976 01977 // If we've hit this point, we've not gotten anything useful, so 01978 // we go and evaluate the default. 01979 // 01980 str = fargs[1]; 01981 mux_exec(buff, bufc, executor, caller, enactor, 01982 EV_EVAL | EV_STRIP_CURLY | EV_FCHECK, &str, cargs, ncargs); 01983 }
| FUNCTION | ( | fun_lrooms | ) |
Definition at line 4289 of file funceval.cpp.
References statedata::bfReport, statedata::bfTraverse, CBitField::Clear(), CBitField::ClearAll(), statedata::db_top, DO_WHOLE_DB, Good_obj, isRoom, CBitField::IsSet(), ItemToList_AddInteger(), ItemToList_Final(), ItemToList_Init(), match_thing_quiet(), mudstate, mux_atol(), N, CBitField::Resize(), room_list(), safe_match_result(), safe_str, CBitField::Set(), UNUSED_PARAMETER, and xlate().
04290 { 04291 UNUSED_PARAMETER(caller); 04292 UNUSED_PARAMETER(cargs); 04293 UNUSED_PARAMETER(ncargs); 04294 04295 dbref room = match_thing_quiet(executor, fargs[0]); 04296 if (!Good_obj(room)) 04297 { 04298 safe_match_result(room, buff, bufc); 04299 return; 04300 } 04301 else if (!isRoom(room)) 04302 { 04303 safe_str("#-1 FIRST ARGUMENT MUST BE A ROOM", buff, bufc); 04304 return; 04305 } 04306 04307 int N = 1; 04308 if (nfargs >= 2) 04309 { 04310 N = mux_atol(fargs[1]); 04311 if (N < 0) 04312 { 04313 safe_str("#-1 SECOND ARGUMENT MUST BE A POSITIVE NUMBER", 04314 buff, bufc); 04315 return; 04316 } 04317 else if (N > 50) 04318 { 04319 // Maybe this can be turned into a config parameter to prevent 04320 // misuse by putting in really large values. 04321 // 04322 safe_str("#-1 SECOND ARGUMENT IS TOO LARGE", buff, bufc); 04323 return; 04324 } 04325 } 04326 04327 bool B = true; 04328 if (nfargs == 3) 04329 { 04330 B = xlate(fargs[2]); 04331 } 04332 04333 mudstate.bfReport.Resize(mudstate.db_top-1); 04334 mudstate.bfTraverse.Resize(mudstate.db_top-1); 04335 mudstate.bfReport.ClearAll(); 04336 mudstate.bfTraverse.ClearAll(); 04337 04338 mudstate.bfTraverse.Set(room); 04339 room_list(executor, enactor, room, 0, N, B); 04340 mudstate.bfReport.Clear(room); 04341 04342 ITL pContext; 04343 ItemToList_Init(&pContext, buff, bufc, '#'); 04344 dbref i; 04345 DO_WHOLE_DB(i) 04346 { 04347 if ( mudstate.bfReport.IsSet(i) 04348 && !ItemToList_AddInteger(&pContext, i)) 04349 { 04350 break; 04351 } 04352 } 04353 ItemToList_Final(&pContext); 04354 }
| FUNCTION | ( | fun_translate | ) |
Definition at line 4053 of file funceval.cpp.
References safe_str, translate_string(), and UNUSED_PARAMETER.
04054 { 04055 UNUSED_PARAMETER(executor); 04056 UNUSED_PARAMETER(caller); 04057 UNUSED_PARAMETER(enactor); 04058 UNUSED_PARAMETER(nfargs); 04059 UNUSED_PARAMETER(cargs); 04060 UNUSED_PARAMETER(ncargs); 04061 04062 int ch = fargs[1][0]; 04063 bool type = (ch == 'p' || ch == '1'); 04064 safe_str(translate_string(fargs[0], type), buff, bufc); 04065 }
| FUNCTION | ( | fun_regraballi | ) |
Definition at line 4036 of file funceval.cpp.
References DELIM_DFLT, DELIM_STRING, OPTIONAL_DELIM, and real_regrab().
04037 { 04038 SEP sep; 04039 if (!OPTIONAL_DELIM(3, sep, DELIM_DFLT|DELIM_STRING)) 04040 { 04041 return; 04042 } 04043 real_regrab(fargs[0], fargs[1], &sep, buff, bufc, true, true); 04044 }
| FUNCTION | ( | fun_regraball | ) |
Definition at line 4026 of file funceval.cpp.
References DELIM_DFLT, DELIM_STRING, OPTIONAL_DELIM, and real_regrab().
04027 { 04028 SEP sep; 04029 if (!OPTIONAL_DELIM(3, sep, DELIM_DFLT|DELIM_STRING)) 04030 { 04031 return; 04032 } 04033 real_regrab(fargs[0], fargs[1], &sep, buff, bufc, false, true); 04034 }
| FUNCTION | ( | fun_regrabi | ) |
Definition at line 4016 of file funceval.cpp.
References DELIM_DFLT, DELIM_STRING, OPTIONAL_DELIM, and real_regrab().
04017 { 04018 SEP sep; 04019 if (!OPTIONAL_DELIM(3, sep, DELIM_DFLT|DELIM_STRING)) 04020 { 04021 return; 04022 } 04023 real_regrab(fargs[0], fargs[1], &sep, buff, bufc, true, false); 04024 }
| FUNCTION | ( | fun_regrab | ) |
Definition at line 4006 of file funceval.cpp.
References DELIM_DFLT, DELIM_STRING, OPTIONAL_DELIM, and real_regrab().
04007 { 04008 SEP sep; 04009 if (!OPTIONAL_DELIM(3, sep, DELIM_DFLT|DELIM_STRING)) 04010 { 04011 return; 04012 } 04013 real_regrab(fargs[0], fargs[1], &sep, buff, bufc, false, false); 04014 }
| FUNCTION | ( | fun_regmatchi | ) |
Definition at line 3924 of file funceval.cpp.
References real_regmatch(), and UNUSED_PARAMETER.
03925 { 03926 UNUSED_PARAMETER(executor); 03927 UNUSED_PARAMETER(enactor); 03928 UNUSED_PARAMETER(caller); 03929 UNUSED_PARAMETER(enactor); 03930 UNUSED_PARAMETER(cargs); 03931 UNUSED_PARAMETER(ncargs); 03932 03933 real_regmatch(fargs[0], fargs[1], fargs[2], nfargs, buff, bufc, true); 03934 }
| FUNCTION | ( | fun_regmatch | ) |
Definition at line 3912 of file funceval.cpp.
References real_regmatch(), and UNUSED_PARAMETER.
03913 { 03914 UNUSED_PARAMETER(executor); 03915 UNUSED_PARAMETER(enactor); 03916 UNUSED_PARAMETER(caller); 03917 UNUSED_PARAMETER(enactor); 03918 UNUSED_PARAMETER(cargs); 03919 UNUSED_PARAMETER(ncargs); 03920 03921 real_regmatch(fargs[0], fargs[1], fargs[2], nfargs, buff, bufc, false); 03922 }
| FUNCTION | ( | fun_push | ) |
Definition at line 3772 of file funceval.cpp.
References alloc_lbuf, Controls, stack::data, Good_obj, ISOUTOFMEMORY, match_thing_quiet(), MEMALLOC, mudconf, stack::next, s_Stack, safe_match_result(), safe_noperm, safe_str, Stack, confdata::stack_limit, stacksize(), and UNUSED_PARAMETER.
03773 { 03774 UNUSED_PARAMETER(caller); 03775 UNUSED_PARAMETER(enactor); 03776 UNUSED_PARAMETER(cargs); 03777 UNUSED_PARAMETER(ncargs); 03778 03779 dbref doer; 03780 char *data; 03781 03782 if (nfargs <= 1 || !*fargs[1]) 03783 { 03784 doer = executor; 03785 data = fargs[0]; 03786 } 03787 else 03788 { 03789 doer = match_thing_quiet(executor, fargs[0]); 03790 if (!Good_obj(doer)) 03791 { 03792 safe_match_result(doer, buff, bufc); 03793 return; 03794 } 03795 data = fargs[1]; 03796 } 03797 03798 if (!Controls(executor, doer)) 03799 { 03800 safe_noperm(buff, bufc); 03801 return; 03802 } 03803 if (stacksize(doer) >= mudconf.stack_limit) 03804 { 03805 safe_str("#-1 STACK SIZE EXCEEDED", buff, bufc); 03806 return; 03807 } 03808 STACK *sp = (STACK *)MEMALLOC(sizeof(STACK)); 03809 ISOUTOFMEMORY(sp); 03810 sp->next = Stack(doer); 03811 sp->data = alloc_lbuf("push"); 03812 strcpy(sp->data, data); 03813 s_Stack(doer, sp); 03814 }
| FUNCTION | ( | fun_pop | ) |
Definition at line 3694 of file funceval.cpp.
References Controls, stack::data, free_lbuf, Good_obj, match_thing_quiet(), MEMFREE, mux_atol(), stack::next, pos, s_Stack, safe_match_result(), safe_noperm, safe_str, Stack, stacksize(), and UNUSED_PARAMETER.
03695 { 03696 UNUSED_PARAMETER(caller); 03697 UNUSED_PARAMETER(enactor); 03698 UNUSED_PARAMETER(cargs); 03699 UNUSED_PARAMETER(ncargs); 03700 03701 dbref doer; 03702 03703 if (nfargs <= 0 || !*fargs[0]) 03704 { 03705 doer = executor; 03706 } 03707 else 03708 { 03709 doer = match_thing_quiet(executor, fargs[0]); 03710 if (!Good_obj(doer)) 03711 { 03712 safe_match_result(doer, buff, bufc); 03713 return; 03714 } 03715 } 03716 if (!Controls(executor, doer)) 03717 { 03718 safe_noperm(buff, bufc); 03719 return; 03720 } 03721 03722 int pos; 03723 if (nfargs <= 1 || !*fargs[1]) 03724 { 03725 pos = 0; 03726 } 03727 else 03728 { 03729 pos = mux_atol(fargs[1]); 03730 } 03731 if (stacksize(doer) == 0) 03732 { 03733 return; 03734 } 03735 if (pos > (stacksize(doer) - 1)) 03736 { 03737 safe_str("#-1 POSITION TOO LARGE", buff, bufc); 03738 return; 03739 } 03740 03741 STACK *sp = Stack(doer); 03742 STACK *prev = NULL; 03743 int count = 0; 03744 while (count != pos) 03745 { 03746 if (sp == NULL) 03747 { 03748 return; 03749 } 03750 prev = sp; 03751 sp = sp->next; 03752 count++; 03753 } 03754 03755 safe_str(sp->data, buff, bufc); 03756 if (count == 0) 03757 { 03758 s_Stack(doer, sp->next); 03759 free_lbuf(sp->data); 03760 MEMFREE(sp); 03761 sp = NULL; 03762 } 03763 else 03764 { 03765 prev->next = sp->next; 03766 free_lbuf(sp->data); 03767 MEMFREE(sp); 03768 sp = NULL; 03769 } 03770 }
| FUNCTION | ( | fun_peek | ) |
Definition at line 3631 of file funceval.cpp.
References Controls, stack::data, Good_obj, match_thing_quiet(), mux_atol(), stack::next, pos, safe_match_result(), safe_noperm, safe_str, Stack, stacksize(), and UNUSED_PARAMETER.
03632 { 03633 UNUSED_PARAMETER(caller); 03634 UNUSED_PARAMETER(enactor); 03635 UNUSED_PARAMETER(cargs); 03636 UNUSED_PARAMETER(ncargs); 03637 03638 STACK *sp; 03639 dbref doer; 03640 int count, pos; 03641 03642 if (nfargs <= 0 || !*fargs[0]) 03643 { 03644 doer = executor; 03645 } 03646 else 03647 { 03648 doer = match_thing_quiet(executor, fargs[0]); 03649 if (!Good_obj(doer)) 03650 { 03651 safe_match_result(doer, buff, bufc); 03652 return; 03653 } 03654 } 03655 03656 if (!Controls(executor, doer)) 03657 { 03658 safe_noperm(buff, bufc); 03659 return; 03660 } 03661 if (nfargs <= 1 || !*fargs[1]) 03662 { 03663 pos = 0; 03664 } 03665 else 03666 { 03667 pos = mux_atol(fargs[1]); 03668 } 03669 03670 if (stacksize(doer) == 0) 03671 { 03672 return; 03673 } 03674 if (pos > (stacksize(doer) - 1)) 03675 { 03676 safe_str("#-1 POSITION TOO LARGE", buff, bufc); 03677 return; 03678 } 03679 count = 0; 03680 sp = Stack(doer); 03681 while (count != pos) 03682 { 03683 if (sp == NULL) 03684 { 03685 return; 03686 } 03687 count++; 03688 sp = sp->next; 03689 } 03690 03691 safe_str(sp->data, buff, bufc); 03692 }
| FUNCTION | ( | fun_items | ) |
Definition at line 3600 of file funceval.cpp.
References Controls, Good_obj, match_thing_quiet(), safe_ltoa(), safe_match_result(), safe_noperm, stacksize(), and UNUSED_PARAMETER.
03601 { 03602 UNUSED_PARAMETER(caller); 03603 UNUSED_PARAMETER(enactor); 03604 UNUSED_PARAMETER(cargs); 03605 UNUSED_PARAMETER(ncargs); 03606 03607 dbref doer; 03608 03609 if (nfargs == 0 || !*fargs[0]) 03610 { 03611 doer = executor; 03612 } 03613 else 03614 { 03615 doer = match_thing_quiet(executor, fargs[0]); 03616 if (!Good_obj(doer)) 03617 { 03618 safe_match_result(doer, buff, bufc); 03619 return; 03620 } 03621 } 03622 03623 if (!Controls(executor, doer)) 03624 { 03625 safe_noperm(buff, bufc); 03626 return; 03627 } 03628 safe_ltoa(stacksize(doer), buff, bufc); 03629 }
| FUNCTION | ( | fun_empty | ) |
Definition at line 3569 of file funceval.cpp.
References Controls, Good_obj, match_thing_quiet(), safe_match_result(), safe_noperm, stack_clr(), and UNUSED_PARAMETER.
03570 { 03571 UNUSED_PARAMETER(caller); 03572 UNUSED_PARAMETER(enactor); 03573 UNUSED_PARAMETER(cargs); 03574 UNUSED_PARAMETER(ncargs); 03575 03576 dbref doer; 03577 03578 if (nfargs == 0 || !*fargs[0]) 03579 { 03580 doer = executor; 03581 } 03582 else 03583 { 03584 doer = match_thing_quiet(executor, fargs[0]); 03585 if (!Good_obj(doer)) 03586 { 03587 safe_match_result(doer, buff, bufc); 03588 return; 03589 } 03590 } 03591 03592 if (!Controls(executor, doer)) 03593 { 03594 safe_noperm(buff, bufc); 03595 return; 03596 } 03597 stack_clr(doer); 03598 }
| FUNCTION | ( | fun_lstack | ) |
Definition at line 3513 of file funceval.cpp.
References Controls, stack::data, Good_obj, match_thing_quiet(), stack::next, safe_chr, safe_match_result(), safe_noperm, safe_str, Stack, and UNUSED_PARAMETER.
03514 { 03515 UNUSED_PARAMETER(caller); 03516 UNUSED_PARAMETER(enactor); 03517 UNUSED_PARAMETER(cargs); 03518 UNUSED_PARAMETER(ncargs); 03519 03520 STACK *sp; 03521 dbref doer; 03522 03523 if (nfargs == 0 || !*fargs[0]) 03524 { 03525 doer = executor; 03526 } 03527 else 03528 { 03529 doer = match_thing_quiet(executor, fargs[0]); 03530 if (!Good_obj(doer)) 03531 { 03532 safe_match_result(doer, buff, bufc); 03533 return; 03534 } 03535 } 03536 03537 if (!Controls(executor, doer)) 03538 { 03539 safe_noperm(buff, bufc); 03540 return; 03541 } 03542 for (sp = Stack(doer); sp != NULL; sp = sp->next) 03543 { 03544 safe_str(sp->data, buff, bufc); 03545 if (sp->next != NULL) 03546 { 03547 safe_chr(' ', buff, bufc); 03548 } 03549 } 03550 }
| FUNCTION | ( | fun_lparent | ) |
Definition at line 3453 of file funceval.cpp.
References Examinable, Good_obj, ItemToList_AddInteger(), ItemToList_Final(), ItemToList_Init(), match_thing_quiet(), mudconf, Parent, confdata::parent_nest_lim, safe_match_result(), safe_noperm, and UNUSED_PARAMETER.
03454 { 03455 UNUSED_PARAMETER(caller); 03456 UNUSED_PARAMETER(enactor); 03457 UNUSED_PARAMETER(nfargs); 03458 UNUSED_PARAMETER(cargs); 03459 UNUSED_PARAMETER(ncargs); 03460 03461 dbref it = match_thing_quiet(executor, fargs[0]); 03462 if (!Good_obj(it)) 03463 { 03464 safe_match_result(it, buff, bufc); 03465 return; 03466 } 03467 else if (!Examinable(executor, it)) 03468 { 03469 safe_noperm(buff, bufc); 03470 return; 03471 } 03472 03473 ITL pContext; 03474 ItemToList_Init(&pContext, buff, bufc, '#'); 03475