#include "copyright.h"
#include "config.h"
#include <limits.h>
#include <math.h>
#include "mudconf.h"
#include "db.h"
#include "flags.h"
#include "powers.h"
#include "attrs.h"
#include "externs.h"
#include "match.h"
#include "command.h"
#include "functions.h"
#include "misc.h"
#include "alloc.h"
#include "ansi.h"
#include "comsys.h"
#include "interface.h"
Include dependency graph for functions.c:
Go to the source code of this file.
Data Structures | |
struct | f_record |
struct | i_record |
Defines | |
#define | varargs_preamble(xname, xnargs) |
#define | evarargs_preamble(xname, xnargs) |
#define | mvarargs_preamble(xname, xminargs, xnargs) |
#define | ALPHANUM_LIST 1 |
#define | NUMERIC_LIST 2 |
#define | DBREF_LIST 3 |
#define | FLOAT_LIST 4 |
#define | get_substr(buf, p) |
#define | LEAPYEAR_1900(yr) ((yr)%400==100||((yr)%100!=0&&(yr)%4==0)) |
#define | UPTIME_UNITS 6 |
#define | IF_DELETE 0 |
#define | IF_REPLACE 1 |
#define | IF_INSERT 2 |
#define | SET_UNION 1 |
#define | SET_INTERSECT 2 |
#define | SET_DIFF 3 |
Typedefs | |
typedef f_record | f_rec |
typedef i_record | i_rec |
Functions | |
int | game_lag (void) |
void | cf_log_notfound (dbref player, char *cmd, const char *thingname, char *thing) |
void | fun_btdesignex () |
void | fun_btgetcharvalue () |
void | fun_btmakemechs () |
void | fun_btmapelev () |
void | fun_btmapterr () |
void | fun_btsetcharvalue () |
void | fun_btgetxcodevalue () |
void | fun_btmakepilotroll () |
void | fun_btsetxcodevalue () |
void | fun_btstores () |
void | fun_btunderrepair () |
void | fun_btdamages () |
void | fun_btcritstatus () |
void | fun_btarmorstatus () |
void | fun_btsetarmorstatus () |
void | fun_btweaponstatus () |
void | fun_btthreshold () |
void | fun_btdamagemech () |
void | fun_bttechstatus () |
void | fun_btpartmatch () |
void | fun_btpartname () |
void | fun_btloadmap () |
void | fun_btloadmech () |
void | fun_btmechfreqs () |
void | fun_btmapunits () |
void | fun_btgetxcodevalue_ref () |
void | fun_btarmorstatus_ref () |
void | fun_btcritstatus_ref () |
void | fun_btweaponstatus_ref () |
void | fun_btid2db () |
void | fun_bthexlos () |
void | fun_btlosm2m () |
void | fun_bthexemit () |
void | fun_btgetweight () |
void | fun_btpartweight () |
void | fun_btaddstores () |
void | fun_btremovestores () |
void | fun_bttechtime () |
void | fun_btcritslot () |
void | fun_btcritslot_ref () |
void | fun_btgetrange () |
void | fun_btsetmaxspeed () |
void | fun_btgetrealmaxspeed () |
void | fun_btgetbv () |
void | fun_btgetbv_ref () |
void | fun_bttechlist () |
void | fun_bttechlist_ref () |
void | fun_btpayload_ref () |
void | fun_btshowstatus_ref () |
void | fun_btshowwspecs_ref () |
void | fun_btshowcritstatus_ref () |
void | fun_btengrate () |
void | fun_btengrate_ref () |
void | fun_btweapstat () |
void | fun_btnumrepjobs () |
void | fun_btsetxy () |
void | fun_btmapemit () |
void | fun_btparttype () |
void | fun_btticweaps () |
void | fun_btunitfixable () |
void | fun_btlistblz () |
void | fun_bthexinblz () |
void | fun_btcharlist () |
void | fun_cobj () |
void | fun_config () |
void | fun_cwho () |
void | fun_clist () |
void | fun_cemit () |
void | fun_beep () |
void | fun_ansi () |
void | fun_zone () |
void | fun_link () |
void | fun_tel () |
void | fun_pemit () |
void | fun_create () |
void | fun_set () |
void | fun_setlock () |
void | fun_last () |
void | fun_matchall () |
void | fun_ports () |
void | fun_mix () |
void | fun_foreach () |
void | fun_munge () |
void | fun_visible () |
void | fun_elements () |
void | fun_grab () |
void | fun_graball () |
void | fun_scramble () |
void | fun_shuffle () |
void | fun_sortby () |
void | fun_default () |
void | fun_edefault () |
void | fun_udefault () |
void | fun_findable () |
void | fun_isword () |
void | fun_hasattr () |
void | fun_hasattrp () |
void | fun_zwho () |
void | fun_zplayers () |
void | fun_inzone () |
void | fun_children () |
void | fun_encrypt () |
void | fun_decrypt () |
void | fun_objeval () |
void | fun_squish () |
void | fun_stripansi () |
void | fun_zfun () |
void | fun_columns () |
void | fun_playmem () |
void | fun_objmem () |
void | fun_orflags () |
void | fun_andflags () |
void | fun_strtrunc () |
void | fun_ifelse () |
void | fun_inc () |
void | fun_dec () |
void | fun_mail () |
void | fun_mailfrom () |
void | fun_die () |
void | fun_lit () |
void | fun_shl () |
void | fun_shr () |
void | fun_vadd () |
void | fun_vsub () |
void | fun_vmul () |
void | fun_vmag () |
void | fun_vunit () |
void | fun_vdim () |
void | fun_strcat () |
void | fun_grep () |
void | fun_grepi () |
void | fun_art () |
void | fun_alphamax () |
void | fun_alphamin () |
void | fun_valid () |
void | fun_hastype () |
void | fun_lparent () |
void | fun_empty () |
void | fun_push () |
void | fun_peek () |
void | fun_pop () |
void | fun_items () |
void | fun_lstack () |
void | fun_regmatch () |
void | fun_translate () |
char * | trim_space_sep (char *str, char sep) |
char * | next_token (char *str, char sep) |
char * | split_token (char **sp, char sep) |
dbref | match_thing (dbref player, char *name) |
static int | autodetect_list (char *ptrs[], int nitems) |
static int | get_list_type (char *fargs[], int nfargs, int type_pos, char *ptrs[], int nitems) |
int | list2arr (char *arr[], int maxlen, char *list, char sep) |
void | arr2list (char *arr[], int alen, char *list, char **bufc, char sep) |
static int | dbnum (char *dbr) |
int | nearby_or_control (dbref player, dbref thing) |
static void | fval (char *buff, char **bufc, double result) |
int | fn_range_check (const char *fname, int nfargs, int minargs, int maxargs, char *result, char **bufc) |
int | delim_check (char *fargs[], int nfargs, int sep_arg, char *sep, char *buff, char **bufc, int eval, dbref player, dbref cause, char *cargs[], int ncargs) |
int | countwords (char *str, char sep) |
static void | fun_words (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_flags (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_rand (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_abs (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_sign (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
char * | silly_atr_get (dbref, int) |
time_t | mytime (dbref player) |
static void | fun_digittime (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_time (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_secs (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_convsecs (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
int | do_convtime (char *str, struct tm *ttm) |
static void | fun_convtime (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
char * | get_uptime_to_string (int uptime) |
char * | get_uptime_to_short_string (int uptime) |
static void | fun_convuptime (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_lag (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_starttime (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_startsecs (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_connrecord (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
int | check_read_perms (dbref player, dbref thing, ATTR *attr, int aowner, int aflags, char *buff, char **bufc) |
static void | fun_get (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_xget (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_get_eval (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_subeval (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_eval (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | do_ufun (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs, int is_local) |
static void | fun_u (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_ulocal (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_parent (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_parse (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_mid (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_first (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_rest (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_v (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_s (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_con (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_exit (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_next (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_loc (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_where (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_rloc (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_room (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_owner (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_controls (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_fullname (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_name (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_match (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_strmatch (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_extract (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
int | xlate (char *arg) |
static void | fun_index (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_cat (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_version (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_strlen (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_num (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_pmatch (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_gt (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_gte (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_lt (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_lte (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_eq (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_neq (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_and (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_or (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_xor (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_not (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_t (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_sqrt (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_add (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_sub (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_mul (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_floor (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_ceil (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_round (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_trunc (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_div (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_fdiv (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_mod (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_pi (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_e (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_sin (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_cos (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_tan (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_exp (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_power (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_ln (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_log (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_asin (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_acos (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_atan (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_dist2d (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_dist3d (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_comp (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_lcon (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_lexits (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_home (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_money (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_pos (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | do_itemfuns (char *buff, char **bufc, char *str, int el, char *word, char sep, int flag) |
static void | fun_ldelete (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_replace (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_insert (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_remove (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_member (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_secure (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_ansi_secure (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_escape (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_wordpos (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_type (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_hasflag (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_haspower (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_delete (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_lock (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_elock (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_lwho (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_nearby (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | process_sex (dbref player, char *what, const char *token, char *buff, char **bufc) |
static void | fun_obj (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_poss (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_subj (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_aposs (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_mudname (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_lcstr (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_ucstr (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_capstr (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_lnum (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_lattr (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | do_reverse (char *from, char *to) |
static void | fun_reverse (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_revwords (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_after (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_before (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_max (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_min (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_search (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_stats (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_merge (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_splice (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_repeat (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_iter (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_list (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_fold (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_filter (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_map (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_edit (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_locate (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_switch (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_case (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_space (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_idle (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_conn (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static int | a_comp (const void *s1, const void *s2) |
static int | f_comp (const void *s1, const void *s2) |
static int | i_comp (const void *s1, const void *s2) |
static void | do_asort (char *s[], int n, int sort_type) |
static void | fun_sort (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | handle_sets (char *fargs[], char *buff, char **bufc, int oper, char sep) |
static void | fun_setunion (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_setdiff (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_setinter (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_ljust (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_rjust (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_center (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_setq (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_setr (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_r (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_isnum (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_isdbref (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_trim (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_doing (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_poll (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_pairs (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
static void | fun_colorpairs (char *buff, char **bufc, dbref player, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) |
void | init_functab () |
void | do_function (dbref player, dbref cause, int key, char *fname, char *target) |
void | list_functable (dbref player) |
int | cf_func_access (int *vp, char *str, long extra, dbref player, char *cmd) |
Variables | |
UFUN * | ufun_head |
NAMETAB | indiv_attraccess_nametab [] |
static const char * | monthtab [] |
static const char | daystab [] |
struct { | |
int multip | |
char * name | |
char * sname | |
} | uptime_unit_table [UPTIME_UNITS] |
FUN | flist [] |
#define ALPHANUM_LIST 1 |
Definition at line 301 of file functions.c.
Referenced by autodetect_list(), do_asort(), get_list_type(), and handle_sets().
#define DBREF_LIST 3 |
Definition at line 303 of file functions.c.
Referenced by autodetect_list(), do_asort(), and get_list_type().
#define evarargs_preamble | ( | xname, | |||
xnargs | ) |
Value:
if (!fn_range_check(xname, nfargs, xnargs-1, xnargs, buff, bufc)) \ return; \ if (!delim_check(fargs, nfargs, xnargs, &sep, buff, bufc, 1, \ player, cause, cargs, ncargs)) \ return;
Definition at line 209 of file functions.c.
#define FLOAT_LIST 4 |
Definition at line 304 of file functions.c.
Referenced by autodetect_list(), do_asort(), and get_list_type().
#define get_substr | ( | buf, | |||
p | ) |
Value:
{ \ p = (char *)index(buf, ' '); \ if (p) { \ *p++ = '\0'; \ while (*p == ' ') p++; \ } \ }
Definition at line 724 of file functions.c.
Referenced by do_convtime().
#define IF_DELETE 0 |
#define IF_INSERT 2 |
#define IF_REPLACE 1 |
#define LEAPYEAR_1900 | ( | yr | ) | ((yr)%400==100||((yr)%100!=0&&(yr)%4==0)) |
Referenced by do_convtime().
#define mvarargs_preamble | ( | xname, | |||
xminargs, | |||||
xnargs | ) |
Value:
if (!fn_range_check(xname, nfargs, xminargs, xnargs, buff, bufc)) \ return; \ if (!delim_check(fargs, nfargs, xnargs, &sep, buff, bufc, 0, \ player, cause, cargs, ncargs)) \ return;
Definition at line 216 of file functions.c.
#define NUMERIC_LIST 2 |
Definition at line 302 of file functions.c.
Referenced by autodetect_list(), do_asort(), and get_list_type().
#define SET_DIFF 3 |
#define SET_INTERSECT 2 |
#define SET_UNION 1 |
#define UPTIME_UNITS 6 |
Converts number to minutes/secs/days
Definition at line 872 of file functions.c.
Referenced by get_uptime_to_short_string(), and get_uptime_to_string().
#define varargs_preamble | ( | xname, | |||
xnargs | ) |
Value:
if (!fn_range_check(xname, nfargs, xnargs-1, xnargs, buff, bufc)) \ return; \ if (!delim_check(fargs, nfargs, xnargs, &sep, buff, bufc, 0, \ player, cause, cargs, ncargs)) \ return;
Definition at line 202 of file functions.c.
Definition at line 4625 of file functions.c.
Definition at line 4626 of file functions.c.
static int a_comp | ( | const void * | s1, | |
const void * | s2 | |||
) | [static] |
void arr2list | ( | char * | arr[], | |
int | alen, | |||
char * | list, | |||
char ** | bufc, | |||
char | sep | |||
) |
static int autodetect_list | ( | char * | ptrs[], | |
int | nitems | |||
) | [static] |
Definition at line 306 of file functions.c.
References ALPHANUM_LIST, DBREF_LIST, FLOAT_LIST, is_integer(), is_number(), NUMBER_TOKEN, and NUMERIC_LIST.
Referenced by get_list_type().
00307 { 00308 int sort_type, i; 00309 char *p; 00310 00311 sort_type = NUMERIC_LIST; 00312 for(i = 0; i < nitems; i++) { 00313 switch (sort_type) { 00314 case NUMERIC_LIST: 00315 if(!is_number(ptrs[i])) { 00316 00317 /* 00318 * If non-numeric, switch to alphanum sort. * 00319 * 00320 * * * * * * Exception: if this is the 00321 * first * element * * and * it is a good 00322 * dbref, * switch to a * * dbref sort. * 00323 * We're a * little looser than * * the 00324 * normal * 'good * dbref' rules, any * * 00325 * number following # * the #-sign is 00326 * accepted. 00327 */ 00328 00329 if(i == 0) { 00330 p = ptrs[i]; 00331 if(*p++ != NUMBER_TOKEN) { 00332 return ALPHANUM_LIST; 00333 } else if(is_integer(p)) { 00334 sort_type = DBREF_LIST; 00335 } else { 00336 return ALPHANUM_LIST; 00337 } 00338 } else { 00339 return ALPHANUM_LIST; 00340 } 00341 } else if(index(ptrs[i], '.')) { 00342 sort_type = FLOAT_LIST; 00343 } 00344 break; 00345 case FLOAT_LIST: 00346 if(!is_number(ptrs[i])) { 00347 sort_type = ALPHANUM_LIST; 00348 return ALPHANUM_LIST; 00349 } 00350 break; 00351 case DBREF_LIST: 00352 p = ptrs[i]; 00353 if(*p++ != NUMBER_TOKEN) 00354 return ALPHANUM_LIST; 00355 if(!is_integer(p)) 00356 return ALPHANUM_LIST; 00357 break; 00358 default: 00359 return ALPHANUM_LIST; 00360 } 00361 } 00362 return sort_type; 00363 }
int cf_func_access | ( | int * | vp, | |
char * | str, | |||
long | extra, | |||
dbref | player, | |||
char * | cmd | |||
) |
Definition at line 5985 of file functions.c.
References cf_modify_bits(), flist, fun::name, fun::perms, and string_compare().
05986 { 05987 FUN *fp; 05988 UFUN *ufp; 05989 char *ap; 05990 05991 for(ap = str; *ap && !isspace(*ap); ap++); 05992 if(*ap) 05993 *ap++ = '\0'; 05994 05995 for(fp = flist; fp->name; fp++) { 05996 if(!string_compare(fp->name, str)) { 05997 return (cf_modify_bits(&fp->perms, ap, extra, player, cmd)); 05998 } 05999 } 06000 for(ufp = ufun_head; ufp; ufp = ufp->next) { 06001 if(!string_compare(ufp->name, str)) { 06002 return (cf_modify_bits(&ufp->perms, ap, extra, player, cmd)); 06003 } 06004 } 06005 cf_log_notfound(player, cmd, "Function", str); 06006 return -1; 06007 }
void cf_log_notfound | ( | dbref | player, | |
char * | cmd, | |||
const char * | thingname, | |||
char * | thing | |||
) |
Definition at line 430 of file conf.c.
00432 { 00433 char *buff; 00434 00435 if(mudstate.initializing) { 00436 log_error(LOG_STARTUP, "CNF", "NFND", "%s: %s %s not found.", cmd, 00437 thingname, thing); 00438 } else { 00439 buff = alloc_lbuf("cf_log_notfound"); 00440 sprintf(buff, "%s %s not found", thingname, thing); 00441 notify(player, buff); 00442 free_lbuf(buff); 00443 } 00444 }
int check_read_perms | ( | dbref | player, | |
dbref | thing, | |||
ATTR * | attr, | |||
int | aowner, | |||
int | aflags, | |||
char * | buff, | |||
char ** | bufc | |||
) |
Get attribute from object.
Definition at line 1030 of file functions.c.
References A_DESC, attr, Examinable, mudconf, nearby(), attr::number, confdata::read_rem_desc, safe_str, See_All, See_attr, and See_attr_explicit.
01032 { 01033 int see_it; 01034 01035 /* 01036 * If we have explicit read permission to the attr, return it 01037 */ 01038 01039 if(See_attr_explicit(player, thing, attr, aowner, aflags)) 01040 return 1; 01041 01042 /* 01043 * If we are nearby or have examine privs to the attr and it is * * * 01044 * 01045 * * visible to us, return it. 01046 */ 01047 01048 see_it = See_attr(player, thing, attr, aowner, aflags); 01049 if((Examinable(player, thing) || nearby(player, thing) || 01050 See_All(player)) && see_it) 01051 return 1; 01052 01053 /* 01054 * For any object, we can read its visible attributes, EXCEPT * for * 01055 * 01056 * * * * descs, which are only visible if read_rem_desc is on. 01057 */ 01058 01059 if(see_it) { 01060 if(!mudconf.read_rem_desc && (attr->number == A_DESC)) { 01061 safe_str("#-1 TOO FAR AWAY TO SEE", buff, bufc); 01062 return 0; 01063 } else { 01064 return 1; 01065 } 01066 } 01067 safe_str("#-1 PERMISSION DENIED", buff, bufc); 01068 return 0; 01069 }
int countwords | ( | char * | str, | |
char | sep | |||
) |
Returns number of words in a string. Added 1/28/91 Philip D. Wasson
Definition at line 528 of file functions.c.
References next_token(), and trim_space_sep().
00529 { 00530 int n; 00531 00532 str = trim_space_sep(str, sep); 00533 if(!*str) 00534 return 0; 00535 for(n = 0; str; str = next_token(str, sep), n++); 00536 return n; 00537 }
static int dbnum | ( | char * | dbr | ) | [static] |
Definition at line 410 of file functions.c.
Referenced by do_asort().
00411 { 00412 if((strlen(dbr) < 2) && (*dbr != '#')) 00413 return 0; 00414 else 00415 return atoi(dbr + 1); 00416 }
int delim_check | ( | char * | fargs[], | |
int | nfargs, | |||
int | sep_arg, | |||
char * | sep, | |||
char * | buff, | |||
char ** | bufc, | |||
int | eval, | |||
dbref | player, | |||
dbref | cause, | |||
char * | cargs[], | |||
int | ncargs | |||
) |
* delim_check: obtain delimiter
Definition at line 489 of file functions.c.
References alloc_lbuf, EV_EVAL, EV_FCHECK, exec(), free_lbuf, and safe_str.
00492 { 00493 char *tstr, *bp, *str; 00494 int tlen; 00495 00496 if(nfargs >= sep_arg) { 00497 tlen = strlen(fargs[sep_arg - 1]); 00498 if(tlen <= 1) 00499 eval = 0; 00500 if(eval) { 00501 tstr = bp = alloc_lbuf("delim_check"); 00502 str = fargs[sep_arg - 1]; 00503 exec(tstr, &bp, 0, player, cause, EV_EVAL | EV_FCHECK, &str, 00504 cargs, ncargs); 00505 *bp = '\0'; 00506 tlen = strlen(tstr); 00507 *sep = *tstr; 00508 free_lbuf(tstr); 00509 } 00510 if(tlen == 0) { 00511 *sep = ' '; 00512 } else if(tlen != 1) { 00513 safe_str("#-1 SEPARATOR MUST BE ONE CHARACTER", buff, bufc); 00514 return 0; 00515 } else if(!eval) { 00516 *sep = *fargs[sep_arg - 1]; 00517 } 00518 } else { 00519 *sep = ' '; 00520 } 00521 return 1; 00522 }
static void do_asort | ( | char * | s[], | |
int | n, | |||
int | sort_type | |||
) | [static] |
Definition at line 4661 of file functions.c.
References a_comp(), ALPHANUM_LIST, f_record::data, i_record::data, dbnum(), DBREF_LIST, f_comp(), FLOAT_LIST, i_comp(), and NUMERIC_LIST.
Referenced by fun_sort(), and handle_sets().
04662 { 04663 int i; 04664 f_rec *fp; 04665 i_rec *ip; 04666 04667 switch (sort_type) { 04668 case ALPHANUM_LIST: 04669 qsort((void *) s, n, sizeof(char *), a_comp); 04670 04671 break; 04672 case NUMERIC_LIST: 04673 ip = (i_rec *) malloc(n * sizeof(i_rec)); 04674 for(i = 0; i < n; i++) { 04675 ip[i].str = s[i]; 04676 ip[i].data = atoi(s[i]); 04677 } 04678 qsort((void *) ip, n, sizeof(i_rec), i_comp); 04679 for(i = 0; i < n; i++) { 04680 s[i] = ip[i].str; 04681 } 04682 free(ip); 04683 break; 04684 case DBREF_LIST: 04685 ip = (i_rec *) malloc(n * sizeof(i_rec)); 04686 for(i = 0; i < n; i++) { 04687 ip[i].str = s[i]; 04688 ip[i].data = dbnum(s[i]); 04689 } 04690 qsort((void *) ip, n, sizeof(i_rec), i_comp); 04691 for(i = 0; i < n; i++) { 04692 s[i] = ip[i].str; 04693 } 04694 free(ip); 04695 break; 04696 case FLOAT_LIST: 04697 fp = (f_rec *) malloc(n * sizeof(f_rec)); 04698 for(i = 0; i < n; i++) { 04699 fp[i].str = s[i]; 04700 fp[i].data = atof(s[i]); 04701 } 04702 qsort((void *) fp, n, sizeof(f_rec), f_comp); 04703 for(i = 0; i < n; i++) { 04704 s[i] = fp[i].str; 04705 } 04706 free(fp); 04707 break; 04708 } 04709 }
int do_convtime | ( | char * | str, | |
struct tm * | ttm | |||
) |
Definition at line 732 of file functions.c.
References alloc_sbuf, daystab, free_sbuf, get_substr, LEAPYEAR_1900, monthtab, safe_sb_str, and string_compare().
Referenced by check_mail_expiration(), fun_convtime(), and mail_match().
00733 { 00734 char *buf, *p, *q; 00735 int i; 00736 00737 if(!str || !ttm) 00738 return 0; 00739 while (*str == ' ') 00740 str++; 00741 buf = p = alloc_sbuf("do_convtime"); /* 00742 * make a temp copy of arg 00743 */ 00744 safe_sb_str(str, buf, &p); 00745 *p = '\0'; 00746 00747 get_substr(buf, p); /* 00748 * day-of-week or month 00749 */ 00750 if(!p || strlen(buf) != 3) { 00751 free_sbuf(buf); 00752 return 0; 00753 } 00754 for(i = 0; (i < 12) && string_compare(monthtab[i], p); i++); 00755 if(i == 12) { 00756 get_substr(p, q); /* 00757 * month 00758 */ 00759 if(!q || strlen(p) != 3) { 00760 free_sbuf(buf); 00761 return 0; 00762 } 00763 for(i = 0; (i < 12) && string_compare(monthtab[i], p); i++); 00764 if(i == 12) { 00765 free_sbuf(buf); 00766 return 0; 00767 } 00768 p = q; 00769 } 00770 ttm->tm_mon = i; 00771 00772 get_substr(p, q); /* 00773 * day of month 00774 */ 00775 if(!q || (ttm->tm_mday = atoi(p)) < 1 || ttm->tm_mday > daystab[i]) { 00776 free_sbuf(buf); 00777 return 0; 00778 } 00779 p = (char *) index(q, ':'); /* 00780 * hours 00781 */ 00782 if(!p) { 00783 free_sbuf(buf); 00784 return 0; 00785 } 00786 *p++ = '\0'; 00787 if((ttm->tm_hour = atoi(q)) > 23 || ttm->tm_hour < 0) { 00788 free_sbuf(buf); 00789 return 0; 00790 } 00791 if(ttm->tm_hour == 0) { 00792 while (isspace(*q)) 00793 q++; 00794 if(*q != '0') { 00795 free_sbuf(buf); 00796 return 0; 00797 } 00798 } 00799 q = (char *) index(p, ':'); /* 00800 * minutes 00801 */ 00802 if(!q) { 00803 free_sbuf(buf); 00804 return 0; 00805 } 00806 *q++ = '\0'; 00807 if((ttm->tm_min = atoi(p)) > 59 || ttm->tm_min < 0) { 00808 free_sbuf(buf); 00809 return 0; 00810 } 00811 if(ttm->tm_min == 0) { 00812 while (isspace(*p)) 00813 p++; 00814 if(*p != '0') { 00815 free_sbuf(buf); 00816 return 0; 00817 } 00818 } 00819 get_substr(q, p); /* 00820 * seconds 00821 */ 00822 if(!p || (ttm->tm_sec = atoi(q)) > 59 || ttm->tm_sec < 0) { 00823 free_sbuf(buf); 00824 return 0; 00825 } 00826 if(ttm->tm_sec == 0) { 00827 while (isspace(*q)) 00828 q++; 00829 if(*q != '0') { 00830 free_sbuf(buf); 00831 return 0; 00832 } 00833 } 00834 get_substr(p, q); /* 00835 * year 00836 */ 00837 if((ttm->tm_year = atoi(p)) == 0) { 00838 while (isspace(*p)) 00839 p++; 00840 if(*p != '0') { 00841 free_sbuf(buf); 00842 return 0; 00843 } 00844 } 00845 free_sbuf(buf); 00846 if(ttm->tm_year > 100) 00847 ttm->tm_year -= 1900; 00848 if(ttm->tm_year < 0) { 00849 return 0; 00850 } 00851 #define LEAPYEAR_1900(yr) ((yr)%400==100||((yr)%100!=0&&(yr)%4==0)) 00852 return (ttm->tm_mday != 29 || i != 1 || LEAPYEAR_1900(ttm->tm_year)); 00853 #undef LEAPYEAR_1900 00854 }
Definition at line 5831 of file functions.c.
References alloc_sbuf, free_sbuf, statedata::func_htab, hashfind(), mudstate, notify_quiet, safe_sb_str, and ToLower.
05833 { 05834 UFUN *ufp, *ufp2; 05835 ATTR *ap; 05836 char *np, *bp; 05837 int atr, aflags; 05838 dbref obj, aowner; 05839 05840 /* 05841 * Make a local uppercase copy of the function name 05842 */ 05843 05844 bp = np = alloc_sbuf("add_user_func"); 05845 safe_sb_str(fname, np, &bp); 05846 *bp = '\0'; 05847 for(bp = np; *bp; bp++) 05848 *bp = ToLower(*bp); 05849 05850 /* 05851 * Verify that the function doesn't exist in the builtin table 05852 */ 05853 05854 if(hashfind(np, &mudstate.func_htab) != NULL) { 05855 notify_quiet(player, 05856 "Function already defined in builtin function table."); 05857 free_sbuf(np); 05858 return; 05859 } 05860 /* 05861 * Make sure the target object exists 05862 */ 05863 05864 if(!parse_attrib(player, target, &obj, &atr)) { 05865 notify_quiet(player, "I don't see that here."); 05866 free_sbuf(np); 05867 return; 05868 } 05869 /* 05870 * Make sure the attribute exists 05871 */ 05872 05873 if(atr == NOTHING) { 05874 notify_quiet(player, "No such attribute."); 05875 free_sbuf(np); 05876 return; 05877 } 05878 /* 05879 * Make sure attribute is readably by me 05880 */ 05881 05882 ap = atr_num(atr); 05883 if(!ap) { 05884 notify_quiet(player, "No such attribute."); 05885 free_sbuf(np); 05886 return; 05887 } 05888 atr_get_info(obj, atr, &aowner, &aflags); 05889 if(!See_attr(player, obj, ap, aowner, aflags)) { 05890 notify_quiet(player, "Permission denied."); 05891 free_sbuf(np); 05892 return; 05893 } 05894 /* 05895 * Privileged functions require you control the obj. 05896 */ 05897 05898 if((key & FN_PRIV) && !Controls(player, obj)) { 05899 notify_quiet(player, "Permission denied."); 05900 free_sbuf(np); 05901 return; 05902 } 05903 /* 05904 * See if function already exists. If so, redefine it 05905 */ 05906 05907 ufp = (UFUN *) hashfind(np, &mudstate.ufunc_htab); 05908 05909 if(!ufp) { 05910 ufp = (UFUN *) malloc(sizeof(UFUN)); 05911 ufp->name = strsave(np); 05912 for(bp = (char *) ufp->name; *bp; bp++) 05913 *bp = ToUpper(*bp); 05914 ufp->obj = obj; 05915 ufp->atr = atr; 05916 ufp->perms = CA_PUBLIC; 05917 ufp->next = NULL; 05918 if(!ufun_head) { 05919 ufun_head = ufp; 05920 } else { 05921 for(ufp2 = ufun_head; ufp2->next; ufp2 = ufp2->next); 05922 ufp2->next = ufp; 05923 } 05924 hashadd(np, (int *) ufp, &mudstate.ufunc_htab); 05925 } 05926 ufp->obj = obj; 05927 ufp->atr = atr; 05928 ufp->flags = key; 05929 free_sbuf(np); 05930 if(!Quiet(player)) { 05931 char buffer[MBUF_SIZE]; 05932 snprintf(buffer, MBUF_SIZE - 1, "Function %s defined.", fname); 05933 notify_quiet(player, buffer); 05934 } 05935 }
static void do_itemfuns | ( | char * | buff, | |
char ** | bufc, | |||
char * | str, | |||
int | el, | |||
char * | word, | |||
char | sep, | |||
int | flag | |||
) | [static] |
Definition at line 2760 of file functions.c.
References IF_DELETE, IF_INSERT, IF_REPLACE, next_token(), safe_chr, safe_str, split_token(), and trim_space_sep().
Referenced by fun_insert(), fun_ldelete(), and fun_replace().
02762 { 02763 int ct, overrun; 02764 char *sptr, *iptr, *eptr; 02765 char nullb; 02766 02767 /* 02768 * If passed a null string return an empty string, except that we * * 02769 * 02770 * * * * are allowed to append to a null string. 02771 */ 02772 02773 if((!str || !*str) && ((flag != IF_INSERT) || (el != 1))) { 02774 return; 02775 } 02776 /* 02777 * we can't fiddle with anything before the first position 02778 */ 02779 02780 if(el < 1) { 02781 safe_str(str, buff, bufc); 02782 return; 02783 } 02784 /* 02785 * Split the list up into 'before', 'target', and 'after' chunks * * 02786 * * * pointed to by sptr, iptr, and eptr respectively. 02787 */ 02788 02789 nullb = '\0'; 02790 if(el == 1) { 02791 /* 02792 * No 'before' portion, just split off element 1 02793 */ 02794 02795 sptr = NULL; 02796 if(!str || !*str) { 02797 eptr = NULL; 02798 iptr = NULL; 02799 } else { 02800 eptr = trim_space_sep(str, sep); 02801 iptr = split_token(&eptr, sep); 02802 } 02803 } else { 02804 /* 02805 * Break off 'before' portion 02806 */ 02807 02808 sptr = eptr = trim_space_sep(str, sep); 02809 overrun = 1; 02810 for(ct = el; ct > 2 && eptr; eptr = next_token(eptr, sep), ct--); 02811 if(eptr) { 02812 overrun = 0; 02813 iptr = split_token(&eptr, sep); 02814 } 02815 /* 02816 * If we didn't make it to the target element, just return * 02817 * * * * the string. Insert is allowed to continue if we are 02818 * * * * * exactly at the end of the string, but replace 02819 * and * delete * * * * are not. 02820 */ 02821 02822 if(!(eptr || ((flag == IF_INSERT) && !overrun))) { 02823 safe_str(str, buff, bufc); 02824 return; 02825 } 02826 /* 02827 * Split the 'target' word from the 'after' portion. 02828 */ 02829 02830 if(eptr) 02831 iptr = split_token(&eptr, sep); 02832 else 02833 iptr = NULL; 02834 } 02835 02836 switch (flag) { 02837 case IF_DELETE: /* 02838 * deletion 02839 */ 02840 if(sptr) { 02841 safe_str(sptr, buff, bufc); 02842 if(eptr) 02843 safe_chr(sep, buff, bufc); 02844 } 02845 if(eptr) { 02846 safe_str(eptr, buff, bufc); 02847 } 02848 break; 02849 case IF_REPLACE: /* 02850 * replacing 02851 */ 02852 if(sptr) { 02853 safe_str(sptr, buff, bufc); 02854 safe_chr(sep, buff, bufc); 02855 } 02856 safe_str(word, buff, bufc); 02857 if(eptr) { 02858 safe_chr(sep, buff, bufc); 02859 safe_str(eptr, buff, bufc); 02860 } 02861 break; 02862 case IF_INSERT: /* 02863 * insertion 02864 */ 02865 if(sptr) { 02866 safe_str(sptr, buff, bufc); 02867 safe_chr(sep, buff, bufc); 02868 } 02869 safe_str(word, buff, bufc); 02870 if(iptr) { 02871 safe_chr(sep, buff, bufc); 02872 safe_str(iptr, buff, bufc); 02873 } 02874 if(eptr) { 02875 safe_chr(sep, buff, bufc); 02876 safe_str(eptr, buff, bufc); 02877 } 02878 break; 02879 } 02880 }
static void do_reverse | ( | char * | from, | |
char * | to | |||
) | [static] |
Definition at line 3477 of file functions.c.
Referenced by fun_reverse(), and fun_revwords().
03478 { 03479 char *tp; 03480 03481 tp = to + strlen(from); 03482 *tp-- = '\0'; 03483 while (*from) { 03484 *tp-- = *from++; 03485 } 03486 }
static void do_ufun | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs, | |||
int | is_local | |||
) | [static] |
Call a user-defined function.
Definition at line 1327 of file functions.c.
References alloc_lbuf, atr_num(), atr_pget(), atr_str(), check_read_perms(), free_lbuf, statedata::global_regs, Good_obj, MAX_GLOBAL_REGS, mudstate, NOTHING, attr::number, parse_attrib(), safe_str, StringCopy, and boolexp::thing.
Referenced by fun_u(), and fun_ulocal().
01330 { 01331 dbref aowner, thing; 01332 int aflags, anum, i; 01333 ATTR *ap; 01334 char *atext, *preserve[MAX_GLOBAL_REGS], *str; 01335 01336 /* 01337 * We need at least one argument 01338 */ 01339 01340 if(nfargs < 1) { 01341 safe_str("#-1 TOO FEW ARGUMENTS", buff, bufc); 01342 return; 01343 } 01344 /* 01345 * Two possibilities for the first arg: <obj>/<attr> and <attr>. 01346 */ 01347 01348 if(parse_attrib(player, fargs[0], &thing, &anum)) { 01349 if((anum == NOTHING) || (!Good_obj(thing))) 01350 ap = NULL; 01351 else 01352 ap = atr_num(anum); 01353 } else { 01354 thing = player; 01355 ap = atr_str(fargs[0]); 01356 } 01357 01358 /* 01359 * Make sure we got a good attribute 01360 */ 01361 01362 if(!ap) { 01363 return; 01364 } 01365 /* 01366 * Use it if we can access it, otherwise return an error. 01367 */ 01368 01369 atext = atr_pget(thing, ap->number, &aowner, &aflags); 01370 if(!atext) { 01371 free_lbuf(atext); 01372 return; 01373 } 01374 if(!*atext) { 01375 free_lbuf(atext); 01376 return; 01377 } 01378 if(!check_read_perms(player, thing, ap, aowner, aflags, buff, bufc)) { 01379 free_lbuf(atext); 01380 return; 01381 } 01382 /* 01383 * If we're evaluating locally, preserve the global registers. 01384 */ 01385 01386 if(is_local) { 01387 for(i = 0; i < MAX_GLOBAL_REGS; i++) { 01388 if(!mudstate.global_regs[i]) 01389 preserve[i] = NULL; 01390 else { 01391 preserve[i] = alloc_lbuf("u_regs"); 01392 StringCopy(preserve[i], mudstate.global_regs[i]); 01393 } 01394 } 01395 } 01396 /* 01397 * Evaluate it using the rest of the passed function args 01398 */ 01399 01400 str = atext; 01401 exec(buff, bufc, 0, thing, cause, EV_FCHECK | EV_EVAL, &str, 01402 &(fargs[1]), nfargs - 1); 01403 free_lbuf(atext); 01404 01405 /* 01406 * If we're evaluating locally, restore the preserved registers. 01407 */ 01408 01409 if(is_local) { 01410 for(i = 0; i < MAX_GLOBAL_REGS; i++) { 01411 if(preserve[i]) { 01412 if(!mudstate.global_regs[i]) 01413 mudstate.global_regs[i] = alloc_lbuf("u_reg"); 01414 StringCopy(mudstate.global_regs[i], preserve[i]); 01415 free_lbuf(preserve[i]); 01416 } else { 01417 if(mudstate.global_regs[i]) 01418 *(mudstate.global_regs[i]) = '\0'; 01419 } 01420 } 01421 } 01422 }
static int f_comp | ( | const void * | s1, | |
const void * | s2 | |||
) | [static] |
Definition at line 4643 of file functions.c.
Referenced by do_asort().
04644 { 04645 if(((f_rec *) s1)->data > ((f_rec *) s2)->data) 04646 return 1; 04647 if(((f_rec *) s1)->data < ((f_rec *) s2)->data) 04648 return -1; 04649 return 0; 04650 }
int fn_range_check | ( | const char * | fname, | |
int | nfargs, | |||
int | minargs, | |||
int | maxargs, | |||
char * | result, | |||
char ** | bufc | |||
) |
Check # of args to a function with an optional argument for validity.
Definition at line 469 of file functions.c.
References safe_tprintf_str().
00471 { 00472 if((nfargs >= minargs) && (nfargs <= maxargs)) 00473 return 1; 00474 00475 if(maxargs == (minargs + 1)) 00476 safe_tprintf_str(result, bufc, 00477 "#-1 FUNCTION (%s) EXPECTS %d OR %d ARGUMENTS", 00478 fname, minargs, maxargs); 00479 else 00480 safe_tprintf_str(result, bufc, 00481 "#-1 FUNCTION (%s) EXPECTS BETWEEN %d AND %d ARGUMENTS", 00482 fname, minargs, maxargs); 00483 return 0; 00484 }
static void fun_abs | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Returns the absolute value of its argument.
Definition at line 591 of file functions.c.
References fval(), and safe_str.
00593 { 00594 double num; 00595 00596 num = atof(fargs[0]); 00597 if(num == 0.0) { 00598 safe_str("0", buff, bufc); 00599 } else if(num < 0.0) { 00600 fval(buff, bufc, -num); 00601 } else { 00602 fval(buff, bufc, num); 00603 } 00604 }
static void fun_acos | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2515 of file functions.c.
References fval(), and safe_str.
02517 { 02518 double val; 02519 02520 val = atof(fargs[0]); 02521 if((val < -1) || (val > 1)) { 02522 safe_str("#-1 ACOS ARGUMENT OUT OF RANGE", buff, bufc); 02523 } else { 02524 fval(buff, bufc, acos(val)); 02525 } 02526 }
static void fun_add | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2291 of file functions.c.
References fval(), and safe_str.
02293 { 02294 double sum = 0; 02295 int i; 02296 02297 if(!nfargs) { 02298 safe_str("#-1 TOO FEW ARGUMENTS", buff, bufc); 02299 return; 02300 } 02301 for(i = 0; i < nfargs; i++) 02302 sum += atof(fargs[i]); 02303 02304 fval(buff, bufc, sum); 02305 }
static void fun_after | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3541 of file functions.c.
References fn_range_check(), safe_str, and trim_space_sep().
03543 { 03544 char *bp, *cp, *mp; 03545 int mlen; 03546 03547 if(nfargs == 0) { 03548 return; 03549 } 03550 if(!fn_range_check("AFTER", nfargs, 1, 2, buff, bufc)) 03551 return; 03552 bp = fargs[0]; 03553 mp = fargs[1]; 03554 03555 /* 03556 * Sanity-check arg1 and arg2 03557 */ 03558 03559 if(bp == NULL) 03560 bp = ""; 03561 if(mp == NULL) 03562 mp = " "; 03563 if(!mp || !*mp) 03564 mp = (char *) " "; 03565 mlen = strlen(mp); 03566 if((mlen == 1) && (*mp == ' ')) 03567 bp = trim_space_sep(bp, ' '); 03568 03569 /* 03570 * Look for the target string 03571 */ 03572 03573 while (*bp) { 03574 03575 /* 03576 * Search for the first character in the target string 03577 */ 03578 03579 cp = (char *) index(bp, *mp); 03580 if(cp == NULL) { 03581 03582 /* 03583 * Not found, return empty string 03584 */ 03585 03586 return; 03587 } 03588 /* 03589 * See if what follows is what we are looking for 03590 */ 03591 03592 if(!strncmp(cp, mp, mlen)) { 03593 03594 /* 03595 * Yup, return what follows 03596 */ 03597 03598 bp = cp + mlen; 03599 safe_str(bp, buff, bufc); 03600 return; 03601 } 03602 /* 03603 * Continue search after found first character 03604 */ 03605 03606 bp = cp + 1; 03607 } 03608 03609 /* 03610 * Ran off the end without finding it 03611 */ 03612 03613 return; 03614 }
void fun_alphamax | ( | ) |
void fun_alphamin | ( | ) |
static void fun_and | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2212 of file functions.c.
References safe_str, and safe_tprintf_str().
02214 { 02215 int i, val; 02216 02217 if(nfargs < 2) { 02218 safe_str("#-1 TOO FEW ARGUMENTS", buff, bufc); 02219 return; 02220 } 02221 02222 val = atoi(fargs[0]); 02223 for(i = 1; val && i < nfargs; i++) 02224 val = val && atoi(fargs[i]); 02225 02226 safe_tprintf_str(buff, bufc, "%d", val); 02227 }
void fun_andflags | ( | ) |
void fun_ansi | ( | ) |
static void fun_ansi_secure | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3016 of file functions.c.
References safe_chr.
03019 { 03020 char *s; 03021 03022 s = fargs[0]; 03023 while (*s) { 03024 switch (*s) { 03025 case '\033': 03026 safe_chr(*s++, buff, bufc); 03027 if(*s == '[') { 03028 safe_chr(*s, buff, bufc); 03029 break; 03030 } /* FALLTHRU */ 03031 case '%': 03032 case '[': 03033 case '$': 03034 case '\\': 03035 case ']': 03036 case '(': 03037 case ')': 03038 case '{': 03039 case '}': 03040 case ',': 03041 case ';': 03042 safe_chr(' ', buff, bufc); 03043 break; 03044 default: 03045 safe_chr(*s, buff, bufc); 03046 } 03047 s++; 03048 } 03049 }
static void fun_aposs | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3344 of file functions.c.
References process_sex().
03346 { 03347 process_sex(player, fargs[0], "%a", buff, bufc); 03348 }
void fun_art | ( | ) |
static void fun_asin | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2502 of file functions.c.
References fval(), and safe_str.
02504 { 02505 double val; 02506 02507 val = atof(fargs[0]); 02508 if((val < -1) || (val > 1)) { 02509 safe_str("#-1 ASIN ARGUMENT OUT OF RANGE", buff, bufc); 02510 } else { 02511 fval(buff, bufc, asin(val)); 02512 } 02513 }
static void fun_atan | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2528 of file functions.c.
References fval().
02530 { 02531 fval(buff, bufc, atan(atof(fargs[0]))); 02532 }
void fun_beep | ( | ) |
static void fun_before | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3616 of file functions.c.
References fn_range_check(), safe_str, and trim_space_sep().
03618 { 03619 char *bp, *cp, *mp, *ip; 03620 int mlen; 03621 03622 if(nfargs == 0) { 03623 return; 03624 } 03625 if(!fn_range_check("BEFORE", nfargs, 1, 2, buff, bufc)) 03626 return; 03627 03628 bp = fargs[0]; 03629 mp = fargs[1]; 03630 03631 /* 03632 * Sanity-check arg1 and arg2 03633 */ 03634 03635 if(bp == NULL) 03636 bp = ""; 03637 if(mp == NULL) 03638 mp = " "; 03639 if(!mp || !*mp) 03640 mp = (char *) " "; 03641 mlen = strlen(mp); 03642 if((mlen == 1) && (*mp == ' ')) 03643 bp = trim_space_sep(bp, ' '); 03644 ip = bp; 03645 03646 /* 03647 * Look for the target string 03648 */ 03649 03650 while (*bp) { 03651 03652 /* 03653 * Search for the first character in the target string 03654 */ 03655 03656 cp = (char *) index(bp, *mp); 03657 if(cp == NULL) { 03658 03659 /* 03660 * Not found, return entire string 03661 */ 03662 03663 safe_str(ip, buff, bufc); 03664 return; 03665 } 03666 /* 03667 * See if what follows is what we are looking for 03668 */ 03669 03670 if(!strncmp(cp, mp, mlen)) { 03671 03672 /* 03673 * Yup, return what follows 03674 */ 03675 03676 *cp = '\0'; 03677 safe_str(ip, buff, bufc); 03678 return; 03679 } 03680 /* 03681 * Continue search after found first character 03682 */ 03683 03684 bp = cp + 1; 03685 } 03686 03687 /* 03688 * Ran off the end without finding it 03689 */ 03690 03691 safe_str(ip, buff, bufc); 03692 return; 03693 }
void fun_btaddstores | ( | ) |
void fun_btarmorstatus | ( | ) |
void fun_btarmorstatus_ref | ( | ) |
void fun_btcharlist | ( | ) |
void fun_btcritslot | ( | ) |
void fun_btcritslot_ref | ( | ) |
void fun_btcritstatus | ( | ) |
void fun_btcritstatus_ref | ( | ) |
void fun_btdamagemech | ( | ) |
void fun_btdamages | ( | ) |
void fun_btdesignex | ( | ) |
void fun_btengrate | ( | ) |
void fun_btengrate_ref | ( | ) |
void fun_btgetbv | ( | ) |
void fun_btgetbv_ref | ( | ) |
void fun_btgetcharvalue | ( | ) |
void fun_btgetrange | ( | ) |
void fun_btgetrealmaxspeed | ( | ) |
void fun_btgetweight | ( | ) |
void fun_btgetxcodevalue | ( | ) |
void fun_btgetxcodevalue_ref | ( | ) |
void fun_bthexemit | ( | ) |
void fun_bthexinblz | ( | ) |
void fun_bthexlos | ( | ) |
void fun_btid2db | ( | ) |
void fun_btlistblz | ( | ) |
void fun_btloadmap | ( | ) |
void fun_btloadmech | ( | ) |
void fun_btlosm2m | ( | ) |
void fun_btmakemechs | ( | ) |
void fun_btmakepilotroll | ( | ) |
void fun_btmapelev | ( | ) |
void fun_btmapemit | ( | ) |
void fun_btmapterr | ( | ) |
void fun_btmapunits | ( | ) |
void fun_btmechfreqs | ( | ) |
void fun_btnumrepjobs | ( | ) |
void fun_btpartmatch | ( | ) |
void fun_btpartname | ( | ) |
void fun_btparttype | ( | ) |
void fun_btpartweight | ( | ) |
void fun_btpayload_ref | ( | ) |
void fun_btremovestores | ( | ) |
void fun_btsetarmorstatus | ( | ) |
void fun_btsetcharvalue | ( | ) |
void fun_btsetmaxspeed | ( | ) |
void fun_btsetxcodevalue | ( | ) |
void fun_btsetxy | ( | ) |
void fun_btshowcritstatus_ref | ( | ) |
void fun_btshowstatus_ref | ( | ) |
void fun_btshowwspecs_ref | ( | ) |
void fun_btstores | ( | ) |
void fun_bttechlist | ( | ) |
void fun_bttechlist_ref | ( | ) |
void fun_bttechstatus | ( | ) |
void fun_bttechtime | ( | ) |
void fun_btthreshold | ( | ) |
void fun_btticweaps | ( | ) |
void fun_btunderrepair | ( | ) |
void fun_btunitfixable | ( | ) |
void fun_btweaponstatus | ( | ) |
void fun_btweaponstatus_ref | ( | ) |
void fun_btweapstat | ( | ) |
static void fun_case | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4500 of file functions.c.
References alloc_lbuf, EV_EVAL, EV_FCHECK, EV_STRIP, exec(), free_lbuf, and StringCopy.
04502 { 04503 int i; 04504 char *mbuff, *buf, *bp, *str; 04505 04506 /* 04507 * If we don't have at least 2 args, return nothing 04508 */ 04509 04510 if(nfargs < 2) { 04511 return; 04512 } 04513 /* 04514 * Evaluate the target in fargs[0] 04515 */ 04516 04517 mbuff = bp = alloc_lbuf("fun_switch"); 04518 str = fargs[0]; 04519 exec(mbuff, &bp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04520 &str, cargs, ncargs); 04521 *bp = '\0'; 04522 04523 /* 04524 * Loop through the patterns looking for a match 04525 */ 04526 04527 for(i = 1; (i < nfargs - 1) && fargs[i] && fargs[i + 1]; i += 2) { 04528 if(*fargs[i] == *mbuff) { 04529 buf = alloc_lbuf("fun_switch"); 04530 StringCopy(buf, fargs[i + 1]); 04531 str = buf; 04532 exec(buff, bufc, 0, player, cause, 04533 EV_STRIP | EV_FCHECK | EV_EVAL, &str, cargs, ncargs); 04534 free_lbuf(buf); 04535 free_lbuf(mbuff); 04536 return; 04537 } 04538 } 04539 free_lbuf(mbuff); 04540 04541 /* 04542 * Nope, return the default if there is one 04543 */ 04544 04545 if((i < nfargs) && fargs[i]) { 04546 buf = alloc_lbuf("fun_switch"); 04547 StringCopy(buf, fargs[i]); 04548 str = buf; 04549 exec(buff, bufc, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04550 &str, cargs, ncargs); 04551 free_lbuf(buf); 04552 } 04553 return; 04554 }
static void fun_ceil | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2337 of file functions.c.
References safe_tprintf_str().
02339 { 02340 safe_tprintf_str(buff, bufc, "%.0f", ceil(atof(fargs[0]))); 02341 }
void fun_cemit | ( | ) |
static void fun_center | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5032 of file functions.c.
References LBUF_SIZE, safe_chr, safe_str, strip_ansi_r(), and varargs_preamble.
05034 { 05035 char sep; 05036 int i, len, lead_chrs, trail_chrs, width; 05037 char new[LBUF_SIZE]; 05038 05039 varargs_preamble("CENTER", 3); 05040 05041 width = atoi(fargs[1]); 05042 strncpy(new, fargs[0], LBUF_SIZE-1); 05043 len = strlen((char *) strip_ansi_r(new,fargs[0],strlen(fargs[0]))); 05044 05045 if(width > LBUF_SIZE) { 05046 safe_str("#-1 OUT OF RANGE", buff, bufc); 05047 return; 05048 } 05049 05050 if(len >= width) { 05051 safe_str(fargs[0], buff, bufc); 05052 return; 05053 } 05054 05055 lead_chrs = (width / 2) - (len / 2) + .5; 05056 for(i = 0; i < lead_chrs; i++) 05057 safe_chr(sep, buff, bufc); 05058 safe_str(fargs[0], buff, bufc); 05059 trail_chrs = width - lead_chrs - len; 05060 for(i = 0; i < trail_chrs; i++) 05061 safe_chr(sep, buff, bufc); 05062 }
void fun_children | ( | ) |
void fun_clist | ( | ) |
void fun_cobj | ( | ) |
static void fun_colorpairs | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5373 of file functions.c.
References AF_IS_LOCK, ANSI_GREEN, ANSI_NORMAL, ANSI_RED, ANSI_YELLOW, atr_get(), atr_num(), atr_pget(), attr, check_read_perms(), attr::flags, free_boolexp(), free_lbuf, LBUF_SIZE, NOTHING, parse_attrib(), parse_boolexp(), Read_attr, safe_str, boolexp::thing, and unparse_boolexp().
05376 { 05377 dbref thing, aowner; 05378 int attrib, free_buffer, aflags; 05379 ATTR *attr; 05380 char *atr_gotten; 05381 struct boolexp *bool; 05382 05383 char *tmp_char; 05384 char tmp_string[LBUF_SIZE]; 05385 char tmp_piece[2]; 05386 05387 if(!parse_attrib(player, fargs[0], &thing, &attrib)) { 05388 safe_str("#-1 NO MATCH", buff, bufc); 05389 return; 05390 } 05391 if(attrib == NOTHING) { 05392 return; 05393 } 05394 free_buffer = 1; 05395 attr = atr_num(attrib); /* 05396 * We need the attr's flags for this: 05397 */ 05398 if(!attr) { 05399 return; 05400 } 05401 if(attr->flags & AF_IS_LOCK) { 05402 atr_gotten = atr_get(thing, attrib, &aowner, &aflags); 05403 if(Read_attr(player, thing, attr, aowner, aflags)) { 05404 bool = parse_boolexp(player, atr_gotten, 1); 05405 free_lbuf(atr_gotten); 05406 atr_gotten = unparse_boolexp(player, bool); 05407 free_boolexp(bool); 05408 } else { 05409 free_lbuf(atr_gotten); 05410 atr_gotten = (char *) "#-1 PERMISSION DENIED"; 05411 } 05412 free_buffer = 0; 05413 } else { 05414 atr_gotten = atr_pget(thing, attrib, &aowner, &aflags); 05415 } 05416 05417 /* 05418 * Perform access checks. c_r_p fills buff with an error message * * 05419 * 05420 * * * * if needed. 05421 */ 05422 05423 if(check_read_perms(player, thing, attr, aowner, aflags, buff, bufc)) { 05424 05425 /* zero temporary string */ 05426 memset(tmp_string, 0, sizeof(tmp_string)); 05427 05428 /* Scan through the attribute, colorize what we want */ 05429 for(tmp_char = atr_gotten; *tmp_char; tmp_char++) { 05430 05431 switch (*tmp_char) { 05432 case '{': 05433 strncat(tmp_string, ANSI_RED, LBUF_SIZE); 05434 strncat(tmp_string, "{", LBUF_SIZE); 05435 strncat(tmp_string, ANSI_NORMAL, LBUF_SIZE); 05436 break; 05437 case '[': 05438 strncat(tmp_string, ANSI_YELLOW, LBUF_SIZE); 05439 strncat(tmp_string, "[", LBUF_SIZE); 05440 strncat(tmp_string, ANSI_NORMAL, LBUF_SIZE); 05441 break; 05442 case '(': 05443 strncat(tmp_string, ANSI_GREEN, LBUF_SIZE); 05444 strncat(tmp_string, "(", LBUF_SIZE); 05445 strncat(tmp_string, ANSI_NORMAL, LBUF_SIZE); 05446 break; 05447 case '}': 05448 strncat(tmp_string, ANSI_RED, LBUF_SIZE); 05449 strncat(tmp_string, "}", LBUF_SIZE); 05450 strncat(tmp_string, ANSI_NORMAL, LBUF_SIZE); 05451 break; 05452 case ']': 05453 strncat(tmp_string, ANSI_YELLOW, LBUF_SIZE); 05454 strncat(tmp_string, "]", LBUF_SIZE); 05455 strncat(tmp_string, ANSI_NORMAL, LBUF_SIZE); 05456 break; 05457 case ')': 05458 strncat(tmp_string, ANSI_GREEN, LBUF_SIZE); 05459 strncat(tmp_string, ")", LBUF_SIZE); 05460 strncat(tmp_string, ANSI_NORMAL, LBUF_SIZE); 05461 break; 05462 default: 05463 sprintf(tmp_piece, "%c", *tmp_char); 05464 strncat(tmp_string, tmp_piece, LBUF_SIZE); 05465 break; 05466 } 05467 05468 } 05469 05470 safe_str(tmp_string, buff, bufc); 05471 } 05472 05473 if(free_buffer) 05474 free_lbuf(atr_gotten); 05475 return; 05476 }
void fun_columns | ( | ) |
static void fun_con | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Returns first item in contents list of object/room
Definition at line 1639 of file functions.c.
References Contents, Examinable, Has_contents, match_thing(), NOTHING, safe_str, safe_tprintf_str(), and where_is().
01641 { 01642 dbref it; 01643 01644 it = match_thing(player, fargs[0]); 01645 01646 if((it != NOTHING) && (Has_contents(it)) && (Examinable(player, it) || 01647 (where_is(player) == it) 01648 || (it == cause))) { 01649 safe_tprintf_str(buff, bufc, "#%d", Contents(it)); 01650 return; 01651 } 01652 safe_str("#-1", buff, bufc); 01653 return; 01654 }
void fun_config | ( | ) |
static void fun_conn | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4609 of file functions.c.
References Dark, fetch_connect(), Good_obj, lookup_player(), NOTHING, safe_tprintf_str(), and Wizard.
04611 { 04612 dbref target; 04613 04614 target = lookup_player(player, fargs[0], 1); 04615 if(Good_obj(target) && Dark(target) && !Wizard(player)) 04616 target = NOTHING; 04617 safe_tprintf_str(buff, bufc, "%d", fetch_connect(target)); 04618 }
static void fun_connrecord | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
What is the record number of players connected?
Definition at line 1020 of file functions.c.
References mudstate, statedata::record_players, and safe_tprintf_str().
01023 { 01024 safe_tprintf_str(buff, bufc, "%d", mudstate.record_players); 01025 }
static void fun_controls | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1848 of file functions.c.
References Controls, match_thing(), NOTHING, safe_tprintf_str(), x, and y.
01850 { 01851 dbref x, y; 01852 01853 x = match_thing(player, fargs[0]); 01854 if(x == NOTHING) { 01855 safe_tprintf_str(buff, bufc, "%s", "#-1 ARG1 NOT FOUND"); 01856 return; 01857 } 01858 y = match_thing(player, fargs[1]); 01859 if(y == NOTHING) { 01860 safe_tprintf_str(buff, bufc, "%s", "#-1 ARG2 NOT FOUND"); 01861 return; 01862 } 01863 safe_tprintf_str(buff, bufc, "%d", Controls(x, y)); 01864 }
static void fun_convsecs | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Converts seconds to time string, based off 0:00 1/1/70
Definition at line 693 of file functions.c.
References safe_str.
00695 { 00696 char *temp; 00697 time_t tt; 00698 00699 tt = atol(fargs[0]); 00700 temp = (char *) ctime(&tt); 00701 temp[strlen(temp) - 1] = '\0'; 00702 safe_str(temp, buff, bufc); 00703 }
static void fun_convtime | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 856 of file functions.c.
References do_convtime(), mudstate, statedata::now, safe_str, and safe_tprintf_str().
00858 { 00859 struct tm *ttm; 00860 00861 ttm = localtime(&mudstate.now); 00862 if(do_convtime(fargs[0], ttm)) 00863 safe_tprintf_str(buff, bufc, "%d", timelocal(ttm)); 00864 else 00865 safe_str("-1", buff, bufc); 00866 }
static void fun_convuptime | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 974 of file functions.c.
References free_sbuf, get_uptime_to_string(), and safe_str.
00977 { 00978 char *uptimestring = get_uptime_to_string(atoi(fargs[0])); 00979 00980 safe_str(uptimestring, buff, bufc); 00981 free_sbuf(uptimestring); 00982 }
static void fun_cos | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2445 of file functions.c.
References fval().
02447 { 02448 fval(buff, bufc, cos(atof(fargs[0]))); 02449 }
void fun_create | ( | ) |
void fun_cwho | ( | ) |
void fun_dec | ( | ) |
void fun_decrypt | ( | ) |
void fun_default | ( | ) |
static void fun_delete | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3176 of file functions.c.
References alloc_lbuf, free_lbuf, and safe_str.
03178 { 03179 char *s, *temp, *bp; 03180 int i, start, nchars, len; 03181 03182 s = fargs[0]; 03183 start = atoi(fargs[1]); 03184 nchars = atoi(fargs[2]); 03185 len = strlen(s); 03186 if((start >= len) || (nchars <= 0)) { 03187 safe_str(s, buff, bufc); 03188 return; 03189 } 03190 bp = temp = alloc_lbuf("fun_delete"); 03191 for(i = 0; i < start; i++) 03192 *bp++ = (*s++); 03193 if((i + nchars) < len && (i + nchars) > 0) { 03194 s += nchars; 03195 while ((*bp++ = *s++)); 03196 } else 03197 *bp = '\0'; 03198 03199 safe_str(temp, buff, bufc); 03200 free_lbuf(temp); 03201 }
void fun_die | ( | ) |
static void fun_digittime | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 643 of file functions.c.
References safe_tprintf_str().
00646 { 00647 register struct tm *delta; 00648 static char buf[64]; 00649 time_t dt; 00650 00651 dt = atol(fargs[0]); 00652 00653 if(dt < 0) 00654 dt = 0; 00655 00656 delta = gmtime(&dt); 00657 if(delta->tm_yday > 0) { 00658 sprintf(buf, "%dd %02d:%02d", delta->tm_yday, delta->tm_hour, 00659 delta->tm_min); 00660 } else { 00661 sprintf(buf, "%02d:%02d", delta->tm_hour, delta->tm_min); 00662 } 00663 00664 safe_tprintf_str(buff, bufc, buf); 00665 00666 }
static void fun_dist2d | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2534 of file functions.c.
References safe_tprintf_str().
02536 { 02537 int d; 02538 double r; 02539 02540 d = atoi(fargs[0]) - atoi(fargs[2]); 02541 r = (double) (d * d); 02542 d = atoi(fargs[1]) - atoi(fargs[3]); 02543 r += (double) (d * d); 02544 d = (int) (sqrt(r) + 0.5); 02545 safe_tprintf_str(buff, bufc, "%d", d); 02546 }
static void fun_dist3d | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2548 of file functions.c.
References safe_tprintf_str().
02550 { 02551 int d; 02552 double r; 02553 02554 d = atoi(fargs[0]) - atoi(fargs[3]); 02555 r = (double) (d * d); 02556 d = atoi(fargs[1]) - atoi(fargs[4]); 02557 r += (double) (d * d); 02558 d = atoi(fargs[2]) - atoi(fargs[5]); 02559 r += (double) (d * d); 02560 d = (int) (sqrt(r) + 0.5); 02561 safe_tprintf_str(buff, bufc, "%d", d); 02562 }
static void fun_div | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2390 of file functions.c.
References safe_str, and safe_tprintf_str().
02392 { 02393 int bot; 02394 02395 bot = atoi(fargs[1]); 02396 if(bot == 0) { 02397 safe_str("#-1 DIVIDE BY ZERO", buff, bufc); 02398 } else { 02399 safe_tprintf_str(buff, bufc, "%d", (atoi(fargs[0]) / bot)); 02400 } 02401 }
static void fun_doing | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5218 of file functions.c.
References DESC_ITER_CONN, descriptor_data::descriptor, descriptor_data::doing, Hidden, is_number(), lookup_player(), NOTHING, descriptor_data::player, safe_str, and Wizard_Who.
05220 { 05221 if(is_number(fargs[0])) { 05222 int s = atoi(fargs[0]); 05223 unsigned short bFound = 0; 05224 DESC *d; 05225 DESC_ITER_CONN(d) { 05226 if(d->descriptor == s) { 05227 bFound = 1; 05228 break; 05229 } 05230 } 05231 if(bFound && (d->player == player || Wizard_Who(player))) { 05232 safe_str(d->doing, buff, bufc); 05233 } else { 05234 /* [cad] Mux2.3 returns empty string here, not sure what 05235 convention is used here. Just return #-1 for now */ 05236 safe_str("#-1", buff, bufc); 05237 } 05238 } else { 05239 dbref victim = lookup_player(player, fargs[0], 1); 05240 if(victim == NOTHING) { 05241 safe_str("#-1 PLAYER DOES NOT EXIST", buff, bufc); 05242 return; 05243 } 05244 05245 if(Wizard_Who(player) 05246 || !Hidden(victim)) { 05247 DESC *d; 05248 DESC_ITER_CONN(d) { 05249 if(d->player == victim) { 05250 safe_str(d->doing, buff, bufc); 05251 return; 05252 } 05253 } 05254 } 05255 safe_str("#-1 NOT A CONNECTED PLAYER", buff, bufc); 05256 } 05257 }
static void fun_e | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2433 of file functions.c.
References safe_str.
02435 { 02436 safe_str("2.718281828", buff, bufc); 02437 }
void fun_edefault | ( | ) |
static void fun_edit | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4302 of file functions.c.
References edit_string(), free_lbuf, LBUF_SIZE, safe_str, and strip_ansi_r().
04304 { 04305 char *tstr; 04306 char new[LBUF_SIZE]; 04307 04308 strncpy(new, fargs[0], LBUF_SIZE-1); 04309 edit_string((char *) strip_ansi_r(new,fargs[0],strlen(fargs[0])), &tstr, fargs[1], fargs[2]); 04310 safe_str(tstr, buff, bufc); 04311 free_lbuf(tstr); 04312 }
void fun_elements | ( | ) |
static void fun_elock | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3234 of file functions.c.
References A_LOCK, atr_get(), attr, eval_boolexp(), free_boolexp(), free_lbuf, get_obj_and_lock(), Good_obj, match_thing(), nearby_or_control(), attr::number, parse_boolexp(), Read_attr, safe_str, and safe_tprintf_str().
03236 { 03237 dbref it, victim, aowner; 03238 int aflags; 03239 char *tbuf; 03240 ATTR *attr; 03241 struct boolexp *bool; 03242 03243 /* 03244 * Parse lock supplier into obj + lock 03245 */ 03246 03247 if(!get_obj_and_lock(player, fargs[0], &it, &attr, buff, bufc)) 03248 return; 03249 03250 /* 03251 * Get the victim and ensure we can do it 03252 */ 03253 03254 victim = match_thing(player, fargs[1]); 03255 if(!Good_obj(victim)) { 03256 safe_str("#-1 NOT FOUND", buff, bufc); 03257 } else if(!nearby_or_control(player, victim) && 03258 !nearby_or_control(player, it)) { 03259 safe_str("#-1 TOO FAR AWAY", buff, bufc); 03260 } else { 03261 tbuf = atr_get(it, attr->number, &aowner, &aflags); 03262 if((attr->number == A_LOCK) || 03263 Read_attr(player, it, attr, aowner, aflags)) { 03264 bool = parse_boolexp(player, tbuf, 1); 03265 safe_tprintf_str(buff, bufc, "%d", eval_boolexp(victim, it, it, 03266 bool)); 03267 free_boolexp(bool); 03268 } else { 03269 safe_str("0", buff, bufc); 03270 } 03271 free_lbuf(tbuf); 03272 } 03273 }
void fun_empty | ( | ) |
void fun_encrypt | ( | ) |
static void fun_eq | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2200 of file functions.c.
References safe_tprintf_str().
02202 { 02203 safe_tprintf_str(buff, bufc, "%d", (atof(fargs[0]) == atof(fargs[1]))); 02204 }
static void fun_escape | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3051 of file functions.c.
References safe_chr.
03053 { 03054 char *s, *d; 03055 03056 d = *bufc; 03057 s = fargs[0]; 03058 while (*s) { 03059 switch (*s) { 03060 case '%': 03061 case '\\': 03062 case '[': 03063 case ']': 03064 case '{': 03065 case '}': 03066 case ';': 03067 safe_chr('\\', buff, bufc); 03068 default: 03069 if(*bufc == d) 03070 safe_chr('\\', buff, bufc); 03071 safe_chr(*s, buff, bufc); 03072 } 03073 s++; 03074 } 03075 }
static void fun_eval | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1255 of file functions.c.
References AF_IS_LOCK, atr_get(), atr_num(), atr_pget(), attr, check_read_perms(), EV_EVAL, EV_FIGNORE, exec(), attr::flags, free_boolexp(), free_lbuf, MBUF_SIZE, NOTHING, parse_attrib(), parse_boolexp(), Read_attr, safe_str, boolexp::thing, and unparse_boolexp().
01257 { 01258 dbref thing, aowner; 01259 int attrib, free_buffer, aflags, eval_it; 01260 ATTR *attr; 01261 char *atr_gotten, *str; 01262 struct boolexp *bool; 01263 char buffer[MBUF_SIZE]; 01264 01265 if((nfargs != 1) && (nfargs != 2)) { 01266 safe_str("#-1 FUNCTION (EVAL) EXPECTS 1 OR 2 ARGUMENTS", buff, bufc); 01267 return; 01268 } 01269 if(nfargs == 1) { 01270 str = fargs[0]; 01271 exec(buff, bufc, 0, player, cause, EV_EVAL, &str, (char **) NULL, 0); 01272 return; 01273 } 01274 if(!*fargs[0] || !*fargs[1]) 01275 return; 01276 01277 snprintf(buffer, MBUF_SIZE-1, "%s/%s", fargs[0], fargs[1]); 01278 if(!parse_attrib(player, buffer, &thing, &attrib)) { 01279 safe_str("#-1 NO MATCH", buff, bufc); 01280 return; 01281 } 01282 if(attrib == NOTHING) { 01283 return; 01284 } 01285 free_buffer = 1; 01286 eval_it = 1; 01287 attr = atr_num(attrib); 01288 if(!attr) { 01289 return; 01290 } 01291 if(attr->flags & AF_IS_LOCK) { 01292 atr_gotten = atr_get(thing, attrib, &aowner, &aflags); 01293 if(Read_attr(player, thing, attr, aowner, aflags)) { 01294 bool = parse_boolexp(player, atr_gotten, 1); 01295 free_lbuf(atr_gotten); 01296 atr_gotten = unparse_boolexp(player, bool); 01297 free_boolexp(bool); 01298 } else { 01299 free_lbuf(atr_gotten); 01300 atr_gotten = (char *) "#-1 PERMISSION DENIED"; 01301 } 01302 free_buffer = 0; 01303 eval_it = 0; 01304 } else { 01305 atr_gotten = atr_pget(thing, attrib, &aowner, &aflags); 01306 } 01307 if(!check_read_perms(player, thing, attr, aowner, aflags, buff, bufc)) { 01308 if(free_buffer) 01309 free_lbuf(atr_gotten); 01310 return; 01311 } 01312 if(eval_it) { 01313 str = atr_gotten; 01314 exec(buff, bufc, 0, thing, player, EV_FIGNORE | EV_EVAL, &str, 01315 (char **) NULL, 0); 01316 } else { 01317 safe_str(atr_gotten, buff, bufc); 01318 } 01319 if(free_buffer) 01320 free_lbuf(atr_gotten); 01321 return; 01322 }
static void fun_exit | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1660 of file functions.c.
References Dark, DOLIST, Examinable, exit_visible(), Exits, Good_obj, Has_exits, match_thing(), safe_str, safe_tprintf_str(), VE_LOC_DARK, and VE_LOC_XAM.
01662 { 01663 dbref it, exit; 01664 int key; 01665 01666 it = match_thing(player, fargs[0]); 01667 if(Good_obj(it) && Has_exits(it) && Good_obj(Exits(it))) { 01668 key = 0; 01669 if(Examinable(player, it)) 01670 key |= VE_LOC_XAM; 01671 if(Dark(it)) 01672 key |= VE_LOC_DARK; 01673 DOLIST(exit, Exits(it)) { 01674 if(exit_visible(exit, player, key)) { 01675 safe_tprintf_str(buff, bufc, "#%d", exit); 01676 return; 01677 } 01678 } 01679 } 01680 safe_str("#-1", buff, bufc); 01681 return; 01682 }
static void fun_exp | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2457 of file functions.c.
References fval().
02459 { 02460 fval(buff, bufc, exp(atof(fargs[0]))); 02461 }
static void fun_extract | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1977 of file functions.c.
References next_token(), safe_str, split_token(), trim_space_sep(), and varargs_preamble.
01979 { 01980 int start, len; 01981 char *r, *s, *t, sep; 01982 01983 varargs_preamble("EXTRACT", 4); 01984 01985 s = fargs[0]; 01986 start = atoi(fargs[1]); 01987 len = atoi(fargs[2]); 01988 01989 if((start < 1) || (len < 1)) { 01990 return; 01991 } 01992 /* 01993 * Skip to the start of the string to save 01994 */ 01995 01996 start--; 01997 s = trim_space_sep(s, sep); 01998 while (start && s) { 01999 s = next_token(s, sep); 02000 start--; 02001 } 02002 02003 /* 02004 * If we ran of the end of the string, return nothing 02005 */ 02006 02007 if(!s || !*s) { 02008 return; 02009 } 02010 /* 02011 * Count off the words in the string to save 02012 */ 02013 02014 r = s; 02015 len--; 02016 while (len && s) { 02017 s = next_token(s, sep); 02018 len--; 02019 } 02020 02021 /* 02022 * Chop off the rest of the string, if needed 02023 */ 02024 02025 if(s && *s) 02026 t = split_token(&s, sep); 02027 safe_str(r, buff, bufc); 02028 }
static void fun_filter | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4153 of file functions.c.
References alloc_lbuf, atr_num(), atr_pget(), atr_str(), EV_EVAL, EV_FCHECK, EV_STRIP, exec(), free_lbuf, Good_obj, NOTHING, attr::number, parse_attrib(), safe_chr, safe_str, See_attr, split_token(), StringCopy, boolexp::thing, trim_space_sep(), and varargs_preamble.
04155 { 04156 dbref aowner, thing; 04157 int aflags, anum, first; 04158 ATTR *ap; 04159 char *atext, *result, *curr, *objstring, *bp, *str, *cp, *atextbuf, sep; 04160 04161 varargs_preamble("FILTER", 3); 04162 04163 /* 04164 * Two possibilities for the first arg: <obj>/<attr> and <attr>. 04165 */ 04166 04167 if(parse_attrib(player, fargs[0], &thing, &anum)) { 04168 if((anum == NOTHING) || (!Good_obj(thing))) 04169 ap = NULL; 04170 else 04171 ap = atr_num(anum); 04172 } else { 04173 thing = player; 04174 ap = atr_str(fargs[0]); 04175 } 04176 04177 /* 04178 * Make sure we got a good attribute 04179 */ 04180 04181 if(!ap) { 04182 return; 04183 } 04184 /* 04185 * Use it if we can access it, otherwise return an error. 04186 */ 04187 04188 atext = atr_pget(thing, ap->number, &aowner, &aflags); 04189 if(!atext) { 04190 return; 04191 } else if(!*atext || !See_attr(player, thing, ap, aowner, aflags)) { 04192 free_lbuf(atext); 04193 return; 04194 } 04195 /* 04196 * Now iteratively eval the attrib with the argument list 04197 */ 04198 04199 cp = curr = trim_space_sep(fargs[1], sep); 04200 atextbuf = alloc_lbuf("fun_filter"); 04201 first = 1; 04202 while (cp) { 04203 objstring = split_token(&cp, sep); 04204 StringCopy(atextbuf, atext); 04205 result = bp = alloc_lbuf("fun_filter"); 04206 str = atextbuf; 04207 exec(result, &bp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04208 &str, &objstring, 1); 04209 *bp = '\0'; 04210 if(!first && *result == '1') 04211 safe_chr(sep, buff, bufc); 04212 if(*result == '1') { 04213 safe_str(objstring, buff, bufc); 04214 first = 0; 04215 } 04216 free_lbuf(result); 04217 } 04218 free_lbuf(atext); 04219 free_lbuf(atextbuf); 04220 }
void fun_findable | ( | ) |
static void fun_first | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Returns first word in a string
Definition at line 1525 of file functions.c.
References safe_str, split_token(), trim_space_sep(), and varargs_preamble.
01527 { 01528 char *s, *first, sep; 01529 01530 /* 01531 * If we are passed an empty arglist return a null string 01532 */ 01533 01534 if(nfargs == 0) { 01535 return; 01536 } 01537 varargs_preamble("FIRST", 2); 01538 s = trim_space_sep(fargs[0], sep); /* 01539 * leading spaces ... 01540 */ 01541 first = split_token(&s, sep); 01542 if(first) { 01543 safe_str(first, buff, bufc); 01544 } 01545 }
static void fun_flags | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Returns the flags on an object. Because is case-insensitive, not quite as useful as it could be.
Definition at line 556 of file functions.c.
References Examinable, free_sbuf, match_thing(), mudconf, NOTHING, confdata::pub_flags, safe_str, and unparse_flags.
00558 { 00559 dbref it; 00560 char *buff2; 00561 00562 it = match_thing(player, fargs[0]); 00563 if((it != NOTHING) && (mudconf.pub_flags || Examinable(player, it) || 00564 (it == cause))) { 00565 buff2 = unparse_flags(player, it); 00566 safe_str(buff2, buff, bufc); 00567 free_sbuf(buff2); 00568 } else 00569 safe_str("#-1", buff, bufc); 00570 return; 00571 }
static void fun_floor | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2331 of file functions.c.
References safe_tprintf_str().
02333 { 02334 safe_tprintf_str(buff, bufc, "%.0f", floor(atof(fargs[0]))); 02335 }
static void fun_fold | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4040 of file functions.c.
References alloc_lbuf, atr_num(), atr_pget(), atr_str(), EV_EVAL, EV_FCHECK, EV_STRIP, exec(), free_lbuf, Good_obj, mvarargs_preamble, NOTHING, attr::number, parse_attrib(), safe_str, See_attr, split_token(), StringCopy, and boolexp::thing.
04042 { 04043 dbref aowner, thing; 04044 int aflags, anum; 04045 ATTR *ap; 04046 char *atext, *result, *curr, *bp, *str, *cp, *atextbuf, *clist[2], 04047 *rstore, sep; 04048 04049 /* 04050 * We need two to four arguements only 04051 */ 04052 04053 mvarargs_preamble("FOLD", 2, 4); 04054 04055 /* 04056 * Two possibilities for the first arg: <obj>/<attr> and <attr>. 04057 */ 04058 04059 if(parse_attrib(player, fargs[0], &thing, &anum)) { 04060 if((anum == NOTHING) || (!Good_obj(thing))) 04061 ap = NULL; 04062 else 04063 ap = atr_num(anum); 04064 } else { 04065 thing = player; 04066 ap = atr_str(fargs[0]); 04067 } 04068 04069 /* 04070 * Make sure we got a good attribute 04071 */ 04072 04073 if(!ap) { 04074 return; 04075 } 04076 /* 04077 * Use it if we can access it, otherwise return an error. 04078 */ 04079 04080 atext = atr_pget(thing, ap->number, &aowner, &aflags); 04081 if(!atext) { 04082 return; 04083 } else if(!*atext || !See_attr(player, thing, ap, aowner, aflags)) { 04084 free_lbuf(atext); 04085 return; 04086 } 04087 /* 04088 * Evaluate it using the rest of the passed function args 04089 */ 04090 04091 cp = curr = fargs[1]; 04092 atextbuf = alloc_lbuf("fun_fold"); 04093 StringCopy(atextbuf, atext); 04094 04095 /* 04096 * may as well handle first case now 04097 */ 04098 04099 if((nfargs >= 3) && (fargs[2])) { 04100 clist[0] = fargs[2]; 04101 clist[1] = split_token(&cp, sep); 04102 result = bp = alloc_lbuf("fun_fold"); 04103 str = atextbuf; 04104 exec(result, &bp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04105 &str, clist, 2); 04106 *bp = '\0'; 04107 } else { 04108 clist[0] = split_token(&cp, sep); 04109 clist[1] = split_token(&cp, sep); 04110 result = bp = alloc_lbuf("fun_fold"); 04111 str = atextbuf; 04112 exec(result, &bp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04113 &str, clist, 2); 04114 *bp = '\0'; 04115 } 04116 04117 rstore = result; 04118 result = NULL; 04119 04120 while (cp) { 04121 clist[0] = rstore; 04122 clist[1] = split_token(&cp, sep); 04123 StringCopy(atextbuf, atext); 04124 result = bp = alloc_lbuf("fun_fold"); 04125 str = atextbuf; 04126 exec(result, &bp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04127 &str, clist, 2); 04128 *bp = '\0'; 04129 StringCopy(rstore, result); 04130 free_lbuf(result); 04131 } 04132 safe_str(rstore, buff, bufc); 04133 free_lbuf(rstore); 04134 free_lbuf(atext); 04135 free_lbuf(atextbuf); 04136 }
void fun_foreach | ( | ) |
static void fun_fullname | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1871 of file functions.c.
References isPlayer, match_thing(), mudconf, Name(), nearby_or_control(), NOTHING, confdata::read_rem_name, and safe_str.
01873 { 01874 dbref it; 01875 01876 it = match_thing(player, fargs[0]); 01877 if(it == NOTHING) { 01878 return; 01879 } 01880 if(!mudconf.read_rem_name) { 01881 if(!nearby_or_control(player, it) && (!isPlayer(it))) { 01882 safe_str("#-1 TOO FAR AWAY TO SEE", buff, bufc); 01883 return; 01884 } 01885 } 01886 safe_str(Name(it), buff, bufc); 01887 }
static void fun_get | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1071 of file functions.c.
References AF_IS_LOCK, atr_get(), atr_num(), atr_pget(), attr, check_read_perms(), attr::flags, free_boolexp(), free_lbuf, NOTHING, parse_attrib(), parse_boolexp(), Read_attr, safe_str, and unparse_boolexp().
01073 { 01074 dbref thing, aowner; 01075 int attrib, free_buffer, aflags; 01076 ATTR *attr; 01077 char *atr_gotten; 01078 struct boolexp *bool; 01079 01080 if(!parse_attrib(player, fargs[0], &thing, &attrib)) { 01081 safe_str("#-1 NO MATCH", buff, bufc); 01082 return; 01083 } 01084 if(attrib == NOTHING) { 01085 return; 01086 } 01087 free_buffer = 1; 01088 attr = atr_num(attrib); /* 01089 * We need the attr's flags for this: 01090 */ 01091 if(!attr) { 01092 return; 01093 } 01094 if(attr->flags & AF_IS_LOCK) { 01095 atr_gotten = atr_get(thing, attrib, &aowner, &aflags); 01096 if(Read_attr(player, thing, attr, aowner, aflags)) { 01097 bool = parse_boolexp(player, atr_gotten, 1); 01098 free_lbuf(atr_gotten); 01099 atr_gotten = unparse_boolexp(player, bool); 01100 free_boolexp(bool); 01101 } else { 01102 free_lbuf(atr_gotten); 01103 atr_gotten = (char *) "#-1 PERMISSION DENIED"; 01104 } 01105 free_buffer = 0; 01106 } else { 01107 atr_gotten = atr_pget(thing, attrib, &aowner, &aflags); 01108 } 01109 01110 /* 01111 * Perform access checks. c_r_p fills buff with an error message * * 01112 * 01113 * * * * if needed. 01114 */ 01115 01116 if(check_read_perms(player, thing, attr, aowner, aflags, buff, bufc)) 01117 safe_str(atr_gotten, buff, bufc); 01118 if(free_buffer) 01119 free_lbuf(atr_gotten); 01120 return; 01121 }
static void fun_get_eval | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1181 of file functions.c.
References AF_IS_LOCK, atr_get(), atr_num(), atr_pget(), attr, check_read_perms(), EV_EVAL, EV_FIGNORE, exec(), attr::flags, free_boolexp(), free_lbuf, NOTHING, parse_attrib(), parse_boolexp(), Read_attr, safe_str, boolexp::thing, and unparse_boolexp().
01183 { 01184 dbref thing, aowner; 01185 int attrib, free_buffer, aflags, eval_it; 01186 ATTR *attr; 01187 char *atr_gotten, *str; 01188 struct boolexp *bool; 01189 01190 if(!parse_attrib(player, fargs[0], &thing, &attrib)) { 01191 safe_str("#-1 NO MATCH", buff, bufc); 01192 return; 01193 } 01194 if(attrib == NOTHING) { 01195 return; 01196 } 01197 free_buffer = 1; 01198 eval_it = 1; 01199 attr = atr_num(attrib); /* 01200 * We need the attr's flags for this: 01201 */ 01202 if(!attr) { 01203 return; 01204 } 01205 if(attr->flags & AF_IS_LOCK) { 01206 atr_gotten = atr_get(thing, attrib, &aowner, &aflags); 01207 if(Read_attr(player, thing, attr, aowner, aflags)) { 01208 bool = parse_boolexp(player, atr_gotten, 1); 01209 free_lbuf(atr_gotten); 01210 atr_gotten = unparse_boolexp(player, bool); 01211 free_boolexp(bool); 01212 } else { 01213 free_lbuf(atr_gotten); 01214 atr_gotten = (char *) "#-1 PERMISSION DENIED"; 01215 } 01216 free_buffer = 0; 01217 eval_it = 0; 01218 } else { 01219 atr_gotten = atr_pget(thing, attrib, &aowner, &aflags); 01220 } 01221 if(!check_read_perms(player, thing, attr, aowner, aflags, buff, bufc)) { 01222 if(free_buffer) 01223 free_lbuf(atr_gotten); 01224 return; 01225 } 01226 if(eval_it) { 01227 str = atr_gotten; 01228 exec(buff, bufc, 0, thing, player, EV_FIGNORE | EV_EVAL, &str, 01229 (char **) NULL, 0); 01230 } else { 01231 safe_str(atr_gotten, buff, bufc); 01232 } 01233 if(free_buffer) 01234 free_lbuf(atr_gotten); 01235 return; 01236 }
void fun_grab | ( | ) |
void fun_graball | ( | ) |
void fun_grep | ( | ) |
void fun_grepi | ( | ) |
static void fun_gt | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2176 of file functions.c.
References safe_tprintf_str().
02178 { 02179 safe_tprintf_str(buff, bufc, "%d", (atof(fargs[0]) > atof(fargs[1]))); 02180 }
static void fun_gte | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2182 of file functions.c.
References safe_tprintf_str().
02184 { 02185 safe_tprintf_str(buff, bufc, "%d", (atof(fargs[0]) >= atof(fargs[1]))); 02186 }
void fun_hasattr | ( | ) |
void fun_hasattrp | ( | ) |
static void fun_hasflag | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3136 of file functions.c.
References Examinable, Good_obj, has_flag(), match_thing(), mudconf, confdata::pub_flags, and safe_str.
03138 { 03139 dbref it; 03140 03141 it = match_thing(player, fargs[0]); 03142 if(!Good_obj(it)) { 03143 safe_str("#-1 NOT FOUND", buff, bufc); 03144 return; 03145 } 03146 if(mudconf.pub_flags || Examinable(player, it) || (it == cause)) { 03147 if(has_flag(player, it, fargs[1])) 03148 safe_str("1", buff, bufc); 03149 else 03150 safe_str("0", buff, bufc); 03151 } else { 03152 safe_str("#-1 PERMISSION DENIED", buff, bufc); 03153 } 03154 }
static void fun_haspower | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3156 of file functions.c.
References Examinable, Good_obj, has_power(), match_thing(), mudconf, confdata::pub_flags, and safe_str.
03158 { 03159 dbref it; 03160 03161 it = match_thing(player, fargs[0]); 03162 if(!Good_obj(it)) { 03163 safe_str("#-1 NOT FOUND", buff, bufc); 03164 return; 03165 } 03166 if(mudconf.pub_flags || Examinable(player, it) || (it == cause)) { 03167 if(has_power(player, it, fargs[1])) 03168 safe_str("1", buff, bufc); 03169 else 03170 safe_str("0", buff, bufc); 03171 } else { 03172 safe_str("#-1 PERMISSION DENIED", buff, bufc); 03173 } 03174 }
void fun_hastype | ( | ) |
static void fun_home | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2680 of file functions.c.
References Dropto, Examinable, Good_obj, Has_dropto, Has_home, Home, isExit, match_thing(), safe_str, safe_tprintf_str(), and where_is().
02682 { 02683 dbref it; 02684 02685 it = match_thing(player, fargs[0]); 02686 if(!Good_obj(it) || !Examinable(player, it)) 02687 safe_str("#-1", buff, bufc); 02688 else if(Has_home(it)) 02689 safe_tprintf_str(buff, bufc, "#%d", Home(it)); 02690 else if(Has_dropto(it)) 02691 safe_tprintf_str(buff, bufc, "#%d", Dropto(it)); 02692 else if(isExit(it)) 02693 safe_tprintf_str(buff, bufc, "#%d", where_is(it)); 02694 else 02695 safe_str("#-1", buff, bufc); 02696 return; 02697 }
static void fun_idle | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4598 of file functions.c.
References Dark, fetch_idle(), Good_obj, lookup_player(), NOTHING, safe_tprintf_str(), and Wizard.
04600 { 04601 dbref target; 04602 04603 target = lookup_player(player, fargs[0], 1); 04604 if(Good_obj(target) && Dark(target) && !Wizard(player)) 04605 target = NOTHING; 04606 safe_tprintf_str(buff, bufc, "%d", fetch_idle(target)); 04607 }
void fun_ifelse | ( | ) |
void fun_inc | ( | ) |
static void fun_index | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2064 of file functions.c.
02066 { 02067 int start, end; 02068 char c, *s, *p; 02069 02070 s = fargs[0]; 02071 c = *fargs[1]; 02072 start = atoi(fargs[2]); 02073 end = atoi(fargs[3]); 02074 02075 if((start < 1) || (end < 1) || (*s == '\0')) 02076 return; 02077 if(c == '\0') 02078 c = ' '; 02079 02080 /* 02081 * move s to point to the start of the item we want 02082 */ 02083 02084 start--; 02085 while (start && s && *s) { 02086 if((s = (char *) index(s, c)) != NULL) 02087 s++; 02088 start--; 02089 } 02090 02091 /* 02092 * skip over just spaces 02093 */ 02094 02095 while (s && (*s == ' ')) 02096 s++; 02097 if(!s || !*s) 02098 return; 02099 02100 /* 02101 * figure out where to end the string 02102 */ 02103 02104 p = s; 02105 while (end && p && *p) { 02106 if((p = (char *) index(p, c)) != NULL) { 02107 if(--end == 0) { 02108 do { 02109 p--; 02110 } while ((*p == ' ') && (p > s)); 02111 *(++p) = '\0'; 02112 safe_str(s, buff, bufc); 02113 return; 02114 } else { 02115 p++; 02116 } 02117 } 02118 } 02119 02120 /* 02121 * if we've gotten this far, we've run off the end of the string 02122 */ 02123 02124 safe_str(s, buff, bufc); 02125 }
static void fun_insert | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2905 of file functions.c.
References do_itemfuns(), IF_INSERT, and varargs_preamble.
02907 { /* 02908 * insert a word at position X of a list 02909 */ 02910 char sep; 02911 02912 varargs_preamble("INSERT", 4); 02913 do_itemfuns(buff, bufc, fargs[0], atoi(fargs[1]), fargs[2], sep, 02914 IF_INSERT); 02915 }
void fun_inzone | ( | ) |
static void fun_isdbref | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5130 of file functions.c.
References Good_obj, NUMBER_TOKEN, parse_dbref(), and safe_str.
05132 { 05133 char *p; 05134 dbref dbitem; 05135 05136 p = fargs[0]; 05137 if(*p++ == NUMBER_TOKEN) { 05138 dbitem = parse_dbref(p); 05139 if(Good_obj(dbitem)) { 05140 safe_str("1", buff, bufc); 05141 return; 05142 } 05143 } 05144 safe_str("0", buff, bufc); 05145 }
static void fun_isnum | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
void fun_isword | ( | ) |
void fun_items | ( | ) |
static void fun_iter | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3955 of file functions.c.
References alloc_lbuf, BOUND_VAR, EV_EVAL, EV_FCHECK, EV_STRIP, evarargs_preamble, exec(), free_lbuf, LISTPLACE_VAR, number, replace_string(), safe_chr, split_token(), tprintf(), and trim_space_sep().
03957 { 03958 char *curr, *objstring, *buff2, *buff3, *cp, *dp, sep, *str; 03959 int first, number = 0; 03960 03961 evarargs_preamble("ITER", 3); 03962 dp = cp = curr = alloc_lbuf("fun_iter"); 03963 str = fargs[0]; 03964 exec(curr, &dp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, &str, 03965 cargs, ncargs); 03966 *dp = '\0'; 03967 cp = trim_space_sep(cp, sep); 03968 if(!*cp) { 03969 free_lbuf(curr); 03970 return; 03971 } 03972 first = 1; 03973 while (cp) { 03974 if(!first) 03975 safe_chr(' ', buff, bufc); 03976 first = 0; 03977 number++; 03978 objstring = split_token(&cp, sep); 03979 buff2 = replace_string(BOUND_VAR, objstring, fargs[1]); 03980 buff3 = replace_string(LISTPLACE_VAR, tprintf("%d", number), buff2); 03981 str = buff3; 03982 exec(buff, bufc, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 03983 &str, cargs, ncargs); 03984 free_lbuf(buff2); 03985 free_lbuf(buff3); 03986 } 03987 free_lbuf(curr); 03988 }
static void fun_lag | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 984 of file functions.c.
References game_lag(), and safe_str.
00986 { 00987 char buf[256]; 00988 00989 sprintf(buf, "%d", game_lag()); 00990 safe_str(buf, buff, bufc); 00991 }
void fun_last | ( | ) |
static void fun_lattr | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3440 of file functions.c.
References atr_num(), attr, attr::name, NOTHING, olist_first(), olist_next(), olist_pop(), olist_push(), parse_attrib_wild(), safe_chr, safe_str, and boolexp::thing.
03442 { 03443 dbref thing; 03444 int ca, first; 03445 ATTR *attr; 03446 03447 /* 03448 * Check for wildcard matching. parse_attrib_wild checks for read 03449 * permission, so we don't have to. Have p_a_w assume the slash-star if 03450 * it is missing. 03451 */ 03452 03453 first = 1; 03454 olist_push(); 03455 if(parse_attrib_wild(player, fargs[0], &thing, 0, 0, 1)) { 03456 for(ca = olist_first(); ca != NOTHING; ca = olist_next()) { 03457 attr = atr_num(ca); 03458 if(attr) { 03459 if(!first) 03460 safe_chr(' ', buff, bufc); 03461 first = 0; 03462 safe_str((char *) attr->name, buff, bufc); 03463 } 03464 } 03465 } else { 03466 safe_str("#-1 NO MATCH", buff, bufc); 03467 } 03468 olist_pop(); 03469 return; 03470 }
static void fun_lcon | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2588 of file functions.c.
References alloc_sbuf, Contents, DOLIST, Examinable, free_sbuf, Has_contents, Location, match_thing(), NOTHING, safe_str, and boolexp::thing.
02590 { 02591 dbref thing, it; 02592 char *tbuf; 02593 int first = 1; 02594 02595 it = match_thing(player, fargs[0]); 02596 if((it != NOTHING) && (Has_contents(it)) && (Examinable(player, it) || 02597 (Location(player) == it) 02598 || (it == cause))) { 02599 tbuf = alloc_sbuf("fun_lcon"); 02600 DOLIST(thing, Contents(it)) { 02601 if(!first) 02602 sprintf(tbuf, " #%d", thing); 02603 else { 02604 sprintf(tbuf, "#%d", thing); 02605 first = 0; 02606 } 02607 safe_str(tbuf, buff, bufc); 02608 } 02609 free_sbuf(tbuf); 02610 } else 02611 safe_str("#-1", buff, bufc); 02612 }
static void fun_lcstr | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3366 of file functions.c.
References ToLower.
03368 { 03369 char *ap; 03370 03371 ap = fargs[0]; 03372 while (*ap) { 03373 **bufc = ToLower(*ap); 03374 ap++; 03375 (*bufc)++; 03376 } 03377 }
static void fun_ldelete | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2882 of file functions.c.
References do_itemfuns(), IF_DELETE, and varargs_preamble.
02884 { /* 02885 * delete a word at position X of a list 02886 */ 02887 char sep; 02888 02889 varargs_preamble("LDELETE", 3); 02890 do_itemfuns(buff, bufc, fargs[0], atoi(fargs[1]), NULL, sep, IF_DELETE); 02891 }
static void fun_lexits | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2619 of file functions.c.
References alloc_sbuf, Dark, DOLIST, Examinable, exit_visible(), Exits, free_sbuf, Good_obj, Has_exits, ITER_PARENTS, match_thing(), safe_str, boolexp::thing, VE_BASE_DARK, VE_LOC_DARK, VE_LOC_XAM, and where_is().
02621 { 02622 dbref thing, it, parent; 02623 char *tbuf; 02624 int exam, lev, key; 02625 int first = 1; 02626 02627 it = match_thing(player, fargs[0]); 02628 02629 if(!Good_obj(it) || !Has_exits(it)) { 02630 safe_str("#-1", buff, bufc); 02631 return; 02632 } 02633 exam = Examinable(player, it); 02634 if(!exam && (where_is(player) != it) && (it != cause)) { 02635 safe_str("#-1", buff, bufc); 02636 return; 02637 } 02638 tbuf = alloc_sbuf("fun_lexits"); 02639 02640 /* 02641 * Return info for all parent levels 02642 */ 02643 02644 ITER_PARENTS(it, parent, lev) { 02645 02646 /* 02647 * Look for exits at each level 02648 */ 02649 02650 if(!Has_exits(parent)) 02651 continue; 02652 key = 0; 02653 if(Examinable(player, parent)) 02654 key |= VE_LOC_XAM; 02655 if(Dark(parent)) 02656 key |= VE_LOC_DARK; 02657 if(Dark(it)) 02658 key |= VE_BASE_DARK; 02659 DOLIST(thing, Exits(parent)) { 02660 if(exit_visible(thing, player, key)) { 02661 if(!first) 02662 sprintf(tbuf, " #%d", thing); 02663 else { 02664 sprintf(tbuf, "#%d", thing); 02665 first = 0; 02666 } 02667 safe_str(tbuf, buff, bufc); 02668 } 02669 } 02670 } 02671 free_sbuf(tbuf); 02672 return; 02673 }
void fun_link | ( | ) |
static void fun_list | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3990 of file functions.c.
References alloc_lbuf, BOUND_VAR, EV_EVAL, EV_FCHECK, EV_STRIP, evarargs_preamble, exec(), free_lbuf, LISTPLACE_VAR, notify, number, replace_string(), split_token(), tprintf(), and trim_space_sep().
03992 { 03993 char *curr, *objstring, *buff2, *buff3, *result, *cp, *dp, *str, sep; 03994 int number = 0; 03995 03996 evarargs_preamble("LIST", 3); 03997 cp = curr = dp = alloc_lbuf("fun_list"); 03998 str = fargs[0]; 03999 exec(curr, &dp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, &str, 04000 cargs, ncargs); 04001 cp = trim_space_sep(cp, sep); 04002 if(!*cp) { 04003 free_lbuf(curr); 04004 return; 04005 } 04006 while (cp) { 04007 number++; 04008 objstring = split_token(&cp, sep); 04009 buff2 = replace_string(BOUND_VAR, objstring, fargs[1]); 04010 buff3 = replace_string(LISTPLACE_VAR, tprintf("%d", number), buff2); 04011 dp = result = alloc_lbuf("fun_list.2"); 04012 str = buff3; 04013 exec(result, &dp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04014 &str, cargs, ncargs); 04015 *dp = '\0'; 04016 free_lbuf(buff2); 04017 free_lbuf(buff3); 04018 notify(cause, result); 04019 free_lbuf(result); 04020 } 04021 free_lbuf(curr); 04022 }
void fun_lit | ( | ) |
static void fun_ljust | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4974 of file functions.c.
References LBUF_SIZE, safe_chr, safe_str, strip_ansi_r(), and varargs_preamble.
04976 { 04977 int spaces, i; 04978 char sep; 04979 char new[LBUF_SIZE]; 04980 04981 varargs_preamble("LJUST", 3); 04982 strncpy(new, fargs[0], LBUF_SIZE-1); 04983 spaces = atoi(fargs[1]) - strlen((char *) strip_ansi_r(new,fargs[0],strlen(fargs[0]))); 04984 04985 /* 04986 * Sanitize number of spaces 04987 */ 04988 04989 if(spaces <= 0) { 04990 /* 04991 * no padding needed, just return string 04992 */ 04993 safe_str(fargs[0], buff, bufc); 04994 return; 04995 } else if(spaces > LBUF_SIZE) { 04996 spaces = LBUF_SIZE; 04997 } 04998 safe_str(fargs[0], buff, bufc); 04999 for(i = 0; i < spaces; i++) 05000 safe_chr(sep, buff, bufc); 05001 }
static void fun_lnum | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3408 of file functions.c.
References safe_str.
03410 { 03411 char tbuff[10]; 03412 int ctr, limit, llimit = 0, over; 03413 03414 if(nfargs > 2 || nfargs < 1) { 03415 safe_str("#-1 TOO FEW ARGUMENTS", buff, bufc); 03416 return; 03417 } 03418 over = 0; 03419 limit = atoi(fargs[0]); 03420 if(nfargs == 2) { 03421 llimit = atoi(fargs[0]); 03422 limit = atoi(fargs[1]) + 1; 03423 } else 03424 limit = atoi(fargs[0]); 03425 if(limit > 0 && llimit >= 0 && llimit < limit) { 03426 for(ctr = llimit; ctr < limit && !over; ctr++) { 03427 { 03428 sprintf(tbuff, "%s%d", ctr != llimit ? " " : "", ctr); 03429 over = safe_str(tbuff, buff, bufc); 03430 } 03431 } 03432 } 03433 }
static void fun_loc | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1727 of file functions.c.
References locatable(), Location, match_thing(), safe_str, and safe_tprintf_str().
01729 { 01730 dbref it; 01731 01732 it = match_thing(player, fargs[0]); 01733 if(locatable(player, it, cause)) 01734 safe_tprintf_str(buff, bufc, "#%d", Location(it)); 01735 else 01736 safe_str("#-1", buff, bufc); 01737 return; 01738 }
static void fun_locate | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4319 of file functions.c.
References Good_obj, init_match(), init_match_check_keys(), last_match_result(), MAT_EXIT_PARENTS, match_absolute(), match_carried_exit_with_parents(), match_controlled(), match_everything(), match_exit_with_parents(), match_here(), match_me(), match_neighbor(), match_player(), match_possession(), match_result(), match_status(), match_thing(), NOTYPE, safe_str, safe_tprintf_str(), See_All, boolexp::thing, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, and TYPE_THING.
04321 { 04322 int pref_type, check_locks, verbose, multiple; 04323 dbref thing, what; 04324 char *cp; 04325 04326 pref_type = NOTYPE; 04327 check_locks = verbose = multiple = 0; 04328 04329 /* 04330 * Find the thing to do the looking, make sure we control it. 04331 */ 04332 04333 if(See_All(player)) 04334 thing = match_thing(player, fargs[0]); 04335 else 04336 thing = match_controlled(player, fargs[0]); 04337 if(!Good_obj(thing)) { 04338 safe_str("#-1 PERMISSION DENIED", buff, bufc); 04339 return; 04340 } 04341 /* 04342 * Get pre- and post-conditions and modifiers 04343 */ 04344 04345 for(cp = fargs[2]; *cp; cp++) { 04346 switch (*cp) { 04347 case 'E': 04348 pref_type = TYPE_EXIT; 04349 break; 04350 case 'L': 04351 check_locks = 1; 04352 break; 04353 case 'P': 04354 pref_type = TYPE_PLAYER; 04355 break; 04356 case 'R': 04357 pref_type = TYPE_ROOM; 04358 break; 04359 case 'T': 04360 pref_type = TYPE_THING; 04361 break; 04362 case 'V': 04363 verbose = 1; 04364 break; 04365 case 'X': 04366 multiple = 1; 04367 break; 04368 } 04369 } 04370 04371 /* 04372 * Set up for the search 04373 */ 04374 04375 if(check_locks) 04376 init_match_check_keys(thing, fargs[1], pref_type); 04377 else 04378 init_match(thing, fargs[1], pref_type); 04379 04380 /* 04381 * Search for each requested thing 04382 */ 04383 04384 for(cp = fargs[2]; *cp; cp++) { 04385 switch (*cp) { 04386 case 'a': 04387 match_absolute(); 04388 break; 04389 case 'c': 04390 match_carried_exit_with_parents(); 04391 break; 04392 case 'e': 04393 match_exit_with_parents(); 04394 break; 04395 case 'h': 04396 match_here(); 04397 break; 04398 case 'i': 04399 match_possession(); 04400 break; 04401 case 'm': 04402 match_me(); 04403 break; 04404 case 'n': 04405 match_neighbor(); 04406 break; 04407 case 'p': 04408 match_player(); 04409 break; 04410 case '*': 04411 match_everything(MAT_EXIT_PARENTS); 04412 break; 04413 } 04414 } 04415 04416 /* 04417 * Get the result and return it to the caller 04418 */ 04419 04420 if(multiple) 04421 what = last_match_result(); 04422 else 04423 what = match_result(); 04424 04425 if(verbose) 04426 (void) match_status(player, what); 04427 04428 safe_tprintf_str(buff, bufc, "#%d", what); 04429 }
static void fun_lock | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3203 of file functions.c.
References atr_get(), attr, free_boolexp(), free_lbuf, get_obj_and_lock(), attr::number, parse_boolexp(), Read_attr, safe_str, and unparse_boolexp_function().
03205 { 03206 dbref it, aowner; 03207 int aflags; 03208 char *tbuf; 03209 ATTR *attr; 03210 struct boolexp *bool; 03211 03212 /* 03213 * Parse the argument into obj + lock 03214 */ 03215 03216 if(!get_obj_and_lock(player, fargs[0], &it, &attr, buff, bufc)) 03217 return; 03218 03219 /* 03220 * Get the attribute and decode it if we can read it 03221 */ 03222 03223 tbuf = atr_get(it, attr->number, &aowner, &aflags); 03224 if(Read_attr(player, it, attr, aowner, aflags)) { 03225 bool = parse_boolexp(player, tbuf, 1); 03226 free_lbuf(tbuf); 03227 tbuf = (char *) unparse_boolexp_function(player, bool); 03228 free_boolexp(bool); 03229 safe_str(tbuf, buff, bufc); 03230 } else 03231 free_lbuf(tbuf); 03232 }
void fun_lparent | ( | ) |
void fun_lstack | ( | ) |
static void fun_lt | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2188 of file functions.c.
References safe_tprintf_str().
02190 { 02191 safe_tprintf_str(buff, bufc, "%d", (atof(fargs[0]) < atof(fargs[1]))); 02192 }
static void fun_lte | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2194 of file functions.c.
References safe_tprintf_str().
02196 { 02197 safe_tprintf_str(buff, bufc, "%d", (atof(fargs[0]) <= atof(fargs[1]))); 02198 }
static void fun_lwho | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3280 of file functions.c.
References make_ulist().
03282 { 03283 make_ulist(player, buff, bufc); 03284 }
void fun_mail | ( | ) |
void fun_mailfrom | ( | ) |
static void fun_map | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4234 of file functions.c.
References alloc_lbuf, atr_num(), atr_pget(), atr_str(), EV_EVAL, EV_FCHECK, EV_STRIP, exec(), free_lbuf, Good_obj, NOTHING, attr::number, parse_attrib(), safe_chr, See_attr, split_token(), StringCopy, boolexp::thing, trim_space_sep(), and varargs_preamble.
04236 { 04237 dbref aowner, thing; 04238 int aflags, anum, first; 04239 ATTR *ap; 04240 char *atext, *objstring, *str, *cp, *atextbuf, sep; 04241 04242 varargs_preamble("MAP", 3); 04243 04244 /* 04245 * Two possibilities for the second arg: <obj>/<attr> and <attr>. 04246 */ 04247 04248 if(parse_attrib(player, fargs[0], &thing, &anum)) { 04249 if((anum == NOTHING) || (!Good_obj(thing))) 04250 ap = NULL; 04251 else 04252 ap = atr_num(anum); 04253 } else { 04254 thing = player; 04255 ap = atr_str(fargs[0]); 04256 } 04257 04258 /* 04259 * Make sure we got a good attribute 04260 */ 04261 04262 if(!ap) { 04263 return; 04264 } 04265 /* 04266 * Use it if we can access it, otherwise return an error. 04267 */ 04268 04269 atext = atr_pget(thing, ap->number, &aowner, &aflags); 04270 if(!atext) { 04271 return; 04272 } else if(!*atext || !See_attr(player, thing, ap, aowner, aflags)) { 04273 free_lbuf(atext); 04274 return; 04275 } 04276 /* 04277 * now process the list one element at a time 04278 */ 04279 04280 cp = trim_space_sep(fargs[1], sep); 04281 atextbuf = alloc_lbuf("fun_map"); 04282 first = 1; 04283 while (cp) { 04284 if(!first) 04285 safe_chr(sep, buff, bufc); 04286 first = 0; 04287 objstring = split_token(&cp, sep); 04288 StringCopy(atextbuf, atext); 04289 str = atextbuf; 04290 exec(buff, bufc, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04291 &str, &objstring, 1); 04292 } 04293 free_lbuf(atext); 04294 free_lbuf(atextbuf); 04295 }
static void fun_match | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1926 of file functions.c.
References quick_wild(), safe_str, safe_tprintf_str(), split_token(), trim_space_sep(), and varargs_preamble.
01928 { 01929 int wcount; 01930 char *r, *s, sep; 01931 01932 varargs_preamble("MATCH", 3); 01933 01934 /* 01935 * Check each word individually, returning the word number of the * * 01936 * 01937 * * * * first one that matches. If none match, return 0. 01938 */ 01939 01940 wcount = 1; 01941 s = trim_space_sep(fargs[0], sep); 01942 do { 01943 r = split_token(&s, sep); 01944 if(quick_wild(fargs[1], r)) { 01945 safe_tprintf_str(buff, bufc, "%d", wcount); 01946 return; 01947 } 01948 wcount++; 01949 } while (s); 01950 safe_str("0", buff, bufc); 01951 }
void fun_matchall | ( | ) |
static void fun_max | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3700 of file functions.c.
References fval(), and safe_str.
03702 { 03703 int i, j, got_one; 03704 double max; 03705 03706 max = 0; 03707 for(i = 0, got_one = 0; i < nfargs; i++) { 03708 if(fargs[i]) { 03709 j = atof(fargs[i]); 03710 if(!got_one || (j > max)) { 03711 got_one = 1; 03712 max = j; 03713 } 03714 } 03715 } 03716 03717 if(!got_one) 03718 safe_str("#-1 TOO FEW ARGUMENTS", buff, bufc); 03719 else 03720 fval(buff, bufc, max); 03721 return; 03722 }
static void fun_member | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2963 of file functions.c.
References safe_str, safe_tprintf_str(), split_token(), trim_space_sep(), and varargs_preamble.
02965 { 02966 int wcount; 02967 char *r, *s, sep; 02968 02969 varargs_preamble("MEMBER", 3); 02970 wcount = 1; 02971 s = trim_space_sep(fargs[0], sep); 02972 do { 02973 r = split_token(&s, sep); 02974 if(!strcmp(fargs[1], r)) { 02975 safe_tprintf_str(buff, bufc, "%d", wcount); 02976 return; 02977 } 02978 wcount++; 02979 } while (s); 02980 safe_str("0", buff, bufc); 02981 }
static void fun_merge | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3825 of file functions.c.
References c, LBUF_SIZE, and safe_str.
03827 { 03828 char *str, *rep; 03829 char c; 03830 03831 /* 03832 * do length checks first 03833 */ 03834 03835 if(strlen(fargs[0]) != strlen(fargs[1])) { 03836 safe_str("#-1 STRING LENGTHS MUST BE EQUAL", buff, bufc); 03837 return; 03838 } 03839 if(strlen(fargs[2]) > 1) { 03840 safe_str("#-1 TOO MANY CHARACTERS", buff, bufc); 03841 return; 03842 } 03843 /* 03844 * find the character to look for. null character is considered * a * 03845 * 03846 * * * * space 03847 */ 03848 03849 if(!*fargs[2]) 03850 c = ' '; 03851 else 03852 c = *fargs[2]; 03853 03854 /* 03855 * walk strings, copy from the appropriate string 03856 */ 03857 03858 for(str = fargs[0], rep = fargs[1]; 03859 *str && *rep && ((*bufc - buff) < LBUF_SIZE); 03860 str++, rep++, (*bufc)++) { 03861 if(*str == c) 03862 **bufc = *rep; 03863 else 03864 **bufc = *str; 03865 } 03866 03867 /* 03868 * There is no need to check for overflowing the buffer since * both 03869 * * * * strings are LBUF_SIZE or less and the new string cannot be * 03870 * * any * * longer. 03871 */ 03872 03873 return; 03874 }
static void fun_mid | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
mid(foobar,2,3) returns oba
Definition at line 1499 of file functions.c.
References LBUF_SIZE, safe_str, and strip_ansi_r().
01501 { 01502 int l, len; 01503 char *oldp; 01504 char new[LBUF_SIZE]; 01505 01506 oldp = *bufc; 01507 l = atoi(fargs[1]); 01508 len = atoi(fargs[2]); 01509 if((l < 0) || (len < 0) || ((len + l) > LBUF_SIZE) || ((len + 1) < 0)) { 01510 safe_str("#-1 OUT OF RANGE", buff, bufc); 01511 return; 01512 } 01513 strncpy(new, fargs[0], LBUF_SIZE-1); 01514 if(l < strlen(strip_ansi_r(new,fargs[0],strlen(fargs[0])))) 01515 safe_str(strip_ansi_r(new,fargs[0],strlen(fargs[0])) + l, buff, bufc); 01516 oldp[len] = 0; 01517 if((oldp + len) < *bufc) { 01518 *bufc = oldp + len; 01519 } 01520 }
static void fun_min | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3724 of file functions.c.
References fval(), and safe_str.
03726 { 03727 int i, j, got_one; 03728 double min; 03729 03730 min = 0; 03731 for(i = 0, got_one = 0; i < nfargs; i++) { 03732 if(fargs[i]) { 03733 j = atof(fargs[i]); 03734 if(!got_one || (j < min)) { 03735 got_one = 1; 03736 min = j; 03737 } 03738 } 03739 } 03740 03741 if(!got_one) { 03742 safe_str("#-1 TOO FEW ARGUMENTS", buff, bufc); 03743 } else { 03744 fval(buff, bufc, min); 03745 } 03746 return; 03747 }
void fun_mix | ( | ) |
static void fun_mod | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2416 of file functions.c.
References safe_tprintf_str().
02418 { 02419 int bot; 02420 02421 bot = atoi(fargs[1]); 02422 if(bot == 0) 02423 bot = 1; 02424 safe_tprintf_str(buff, bufc, "%d", atoi(fargs[0]) % bot); 02425 }
static void fun_money | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2704 of file functions.c.
References Examinable, match_thing(), NOTHING, Pennies(), safe_str, and safe_tprintf_str().
02706 { 02707 dbref it; 02708 02709 it = match_thing(player, fargs[0]); 02710 if((it == NOTHING) || !Examinable(player, it)) 02711 safe_str("#-1", buff, bufc); 02712 else 02713 safe_tprintf_str(buff, bufc, "%d", Pennies(it)); 02714 }
static void fun_mudname | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
static void fun_mul | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2313 of file functions.c.
References fval(), and safe_str.
02315 { 02316 int i; 02317 double prod; 02318 02319 if(!nfargs) { 02320 safe_str("#-1 TOO FEW ARGUMENTS", buff, bufc); 02321 return; 02322 } 02323 02324 prod = atof(fargs[0]); 02325 for(i = 1; i < nfargs; i++) 02326 prod *= atof(fargs[i]); 02327 02328 fval(buff, bufc, prod); 02329 }
void fun_munge | ( | ) |
static void fun_name | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1894 of file functions.c.
References isExit, isPlayer, Long_Fingers, match_thing(), mudconf, Name(), nearby_or_control(), NOTHING, confdata::read_rem_name, and safe_str.
01896 { 01897 dbref it; 01898 char *s, *temp; 01899 01900 it = match_thing(player, fargs[0]); 01901 if(it == NOTHING) { 01902 return; 01903 } 01904 if(!mudconf.read_rem_name) { 01905 if(!nearby_or_control(player, it) && !isPlayer(it) && 01906 !Long_Fingers(player)) { 01907 safe_str("#-1 TOO FAR AWAY TO SEE", buff, bufc); 01908 return; 01909 } 01910 } 01911 temp = *bufc; 01912 safe_str(Name(it), buff, bufc); 01913 if(isExit(it)) { 01914 for(s = temp; (s != *bufc) && (*s != ';'); s++); 01915 if(*s == ';') 01916 *bufc = s; 01917 } 01918 }
static void fun_nearby | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3291 of file functions.c.
References match_thing(), nearby(), nearby_or_control(), and safe_str.
03293 { 03294 dbref obj1, obj2; 03295 03296 obj1 = match_thing(player, fargs[0]); 03297 obj2 = match_thing(player, fargs[1]); 03298 if(!(nearby_or_control(player, obj1) || nearby_or_control(player, obj2))) 03299 safe_str("0", buff, bufc); 03300 else if(nearby(obj1, obj2)) 03301 safe_str("1", buff, bufc); 03302 else 03303 safe_str("0", buff, bufc); 03304 }
static void fun_neq | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2206 of file functions.c.
References safe_tprintf_str().
02208 { 02209 safe_tprintf_str(buff, bufc, "%d", (atof(fargs[0]) != atof(fargs[1]))); 02210 }
static void fun_next | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1689 of file functions.c.
References Dark, DOLIST, Examinable, exit_visible(), Good_obj, Has_siblings, isExit, loc, match_thing(), Next, safe_str, safe_tprintf_str(), VE_LOC_DARK, VE_LOC_XAM, and where_is().
01691 { 01692 dbref it, loc, exit, ex_here; 01693 int key; 01694 01695 it = match_thing(player, fargs[0]); 01696 if(Good_obj(it) && Has_siblings(it)) { 01697 loc = where_is(it); 01698 ex_here = Good_obj(loc) ? Examinable(player, loc) : 0; 01699 if(ex_here || (loc == player) || (loc == where_is(player))) { 01700 if(!isExit(it)) { 01701 safe_tprintf_str(buff, bufc, "#%d", Next(it)); 01702 return; 01703 } else { 01704 key = 0; 01705 if(ex_here) 01706 key |= VE_LOC_XAM; 01707 if(Dark(loc)) 01708 key |= VE_LOC_DARK; 01709 DOLIST(exit, it) { 01710 if((exit != it) && exit_visible(exit, player, key)) { 01711 safe_tprintf_str(buff, bufc, "#%d", exit); 01712 return; 01713 } 01714 } 01715 } 01716 } 01717 } 01718 safe_str("#-1", buff, bufc); 01719 return; 01720 }
static void fun_not | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2264 of file functions.c.
References safe_tprintf_str(), and xlate().
02266 { 02267 safe_tprintf_str(buff, bufc, "%d", !xlate(fargs[0])); 02268 }
static void fun_num | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2154 of file functions.c.
References match_thing(), and safe_tprintf_str().
02156 { 02157 safe_tprintf_str(buff, bufc, "#%d", match_thing(player, fargs[0])); 02158 }
static void fun_obj | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3326 of file functions.c.
References process_sex().
03328 { 03329 process_sex(player, fargs[0], "%o", buff, bufc); 03330 }
void fun_objeval | ( | ) |
void fun_objmem | ( | ) |
static void fun_or | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2229 of file functions.c.
References safe_str, and safe_tprintf_str().
02231 { 02232 int i, val; 02233 02234 if(nfargs < 2) { 02235 safe_str("#-1 TOO FEW ARGUMENTS", buff, bufc); 02236 return; 02237 } 02238 02239 val = atoi(fargs[0]); 02240 for(i = 1; !val && i < nfargs; i++) 02241 val = val || atoi(fargs[i]); 02242 02243 safe_tprintf_str(buff, bufc, "%d", val); 02244 }
void fun_orflags | ( | ) |
static void fun_owner | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1822 of file functions.c.
References atr_pget_info(), match_thing(), NOTHING, Owner, parse_attrib(), and safe_tprintf_str().
01824 { 01825 dbref it, aowner; 01826 int atr, aflags; 01827 01828 if(parse_attrib(player, fargs[0], &it, &atr)) { 01829 if(atr == NOTHING) { 01830 it = NOTHING; 01831 } else { 01832 atr_pget_info(it, atr, &aowner, &aflags); 01833 it = aowner; 01834 } 01835 } else { 01836 it = match_thing(player, fargs[0]); 01837 if(it != NOTHING) 01838 it = Owner(it); 01839 } 01840 safe_tprintf_str(buff, bufc, "#%d", it); 01841 }
static void fun_pairs | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5275 of file functions.c.
References AF_IS_LOCK, atr_get(), atr_num(), atr_pget(), attr, check_read_perms(), attr::flags, free_boolexp(), free_lbuf, LBUF_SIZE, NOTHING, parse_attrib(), parse_boolexp(), Read_attr, safe_str, and unparse_boolexp().
05277 { 05278 dbref thing, aowner; 05279 int attrib, free_buffer, aflags; 05280 ATTR *attr; 05281 char *atr_gotten; 05282 struct boolexp *bool; 05283 05284 char *tmp_char; 05285 int right_brace = 0, left_brace = 0, right_square_bracket = 0, 05286 left_square_bracket = 0, right_parenthesis = 0, left_parenthesis = 0; 05287 05288 if(!parse_attrib(player, fargs[0], &thing, &attrib)) { 05289 safe_str("#-1 NO MATCH", buff, bufc); 05290 return; 05291 } 05292 if(attrib == NOTHING) { 05293 return; 05294 } 05295 free_buffer = 1; 05296 attr = atr_num(attrib); /* 05297 * We need the attr's flags for this: 05298 */ 05299 if(!attr) { 05300 return; 05301 } 05302 if(attr->flags & AF_IS_LOCK) { 05303 atr_gotten = atr_get(thing, attrib, &aowner, &aflags); 05304 if(Read_attr(player, thing, attr, aowner, aflags)) { 05305 bool = parse_boolexp(player, atr_gotten, 1); 05306 free_lbuf(atr_gotten); 05307 atr_gotten = unparse_boolexp(player, bool); 05308 free_boolexp(bool); 05309 } else { 05310 free_lbuf(atr_gotten); 05311 atr_gotten = (char *) "#-1 PERMISSION DENIED"; 05312 } 05313 free_buffer = 0; 05314 } else { 05315 atr_gotten = atr_pget(thing, attrib, &aowner, &aflags); 05316 } 05317 05318 /* 05319 * Perform access checks. c_r_p fills buff with an error message * * 05320 * 05321 * * * * if needed. 05322 */ 05323 05324 if(check_read_perms(player, thing, attr, aowner, aflags, buff, bufc)) { 05325 05326 /* Scan through the attribute and count the various brackets */ 05327 for(tmp_char = atr_gotten; *tmp_char; tmp_char++) { 05328 05329 switch (*tmp_char) { 05330 case '{': 05331 left_brace++; 05332 break; 05333 case '[': 05334 left_square_bracket++; 05335 break; 05336 case '(': 05337 left_parenthesis++; 05338 break; 05339 case '}': 05340 right_brace++; 05341 break; 05342 case ']': 05343 right_square_bracket++; 05344 break; 05345 case ')': 05346 right_parenthesis++; 05347 break; 05348 default: 05349 break; 05350 } 05351 05352 } 05353 05354 snprintf(atr_gotten, LBUF_SIZE, "%d %d %d %d %d %d", 05355 left_brace, 05356 left_square_bracket, 05357 left_parenthesis, 05358 right_parenthesis, right_square_bracket, right_brace); 05359 safe_str(atr_gotten, buff, bufc); 05360 } 05361 05362 if(free_buffer) 05363 free_lbuf(atr_gotten); 05364 return; 05365 }
static void fun_parent | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Get parent of object.
Definition at line 1439 of file functions.c.
References Examinable, Good_obj, match_thing(), Parent, safe_str, and safe_tprintf_str().
01441 { 01442 dbref it; 01443 01444 it = match_thing(player, fargs[0]); 01445 if(Good_obj(it) && (Examinable(player, it) || (it == cause))) { 01446 safe_tprintf_str(buff, bufc, "#%d", Parent(it)); 01447 } else { 01448 safe_str("#-1", buff, bufc); 01449 } 01450 return; 01451 }
static void fun_parse | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Make list from evaluating arg3 with each member of arg2. arg1 specifies a delimiter character to use in the parsing of arg2. NOTE: This function expects that its arguments have not been evaluated.
Definition at line 1458 of file functions.c.
References alloc_lbuf, BOUND_VAR, EV_EVAL, EV_FCHECK, EV_STRIP, evarargs_preamble, exec(), free_lbuf, LISTPLACE_VAR, MBUF_SIZE, number, replace_string(), safe_chr, split_token(), and trim_space_sep().
01460 { 01461 char *curr, *objstring, *buff2, *buff3, *cp, sep; 01462 char *dp, *str; 01463 int first, number = 0; 01464 char buffer[MBUF_SIZE]; 01465 01466 evarargs_preamble("PARSE", 3); 01467 cp = curr = dp = alloc_lbuf("fun_parse"); 01468 str = fargs[0]; 01469 exec(curr, &dp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, &str, 01470 cargs, ncargs); 01471 *dp = '\0'; 01472 cp = trim_space_sep(cp, sep); 01473 if(!*cp) { 01474 free_lbuf(curr); 01475 return; 01476 } 01477 first = 1; 01478 while (cp) { 01479 if(!first) 01480 safe_chr(' ', buff, bufc); 01481 first = 0; 01482 number++; 01483 objstring = split_token(&cp, sep); 01484 buff2 = replace_string(BOUND_VAR, objstring, fargs[1]); 01485 snprintf(buffer, MBUF_SIZE-1, "%d", number); 01486 buff3 = replace_string(LISTPLACE_VAR, buffer, buff2); 01487 str = buff3; 01488 exec(buff, bufc, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 01489 &str, cargs, ncargs); 01490 free_lbuf(buff2); 01491 free_lbuf(buff3); 01492 } 01493 free_lbuf(curr); 01494 }
void fun_peek | ( | ) |
void fun_pemit | ( | ) |
static void fun_pi | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2427 of file functions.c.
References safe_str.
02429 { 02430 safe_str("3.141592654", buff, bufc); 02431 }
void fun_playmem | ( | ) |
static void fun_pmatch | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2160 of file functions.c.
References lookup_player(), match_thing(), NOTHING, safe_str, safe_tprintf_str(), and boolexp::thing.
02162 { 02163 dbref thing; 02164 02165 if(*fargs[0] == '#') { 02166 safe_tprintf_str(buff, bufc, "#%d", match_thing(player, fargs[0])); 02167 return; 02168 } 02169 if(!((thing = lookup_player(player, fargs[0], 1)) == NOTHING)) { 02170 safe_tprintf_str(buff, bufc, "#%d", thing); 02171 return; 02172 } else 02173 safe_str("#-1 NO MATCH", buff, bufc); 02174 }
static void fun_poll | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5263 of file functions.c.
References statedata::doing_hdr, mudstate, and safe_str.
void fun_pop | ( | ) |
void fun_ports | ( | ) |
static void fun_pos | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2721 of file functions.c.
References safe_str, and safe_tprintf_str().
02723 { 02724 int i = 1; 02725 char *s, *t, *u; 02726 02727 i = 1; 02728 s = fargs[1]; 02729 while (*s) { 02730 u = s; 02731 t = fargs[0]; 02732 while (*t && *t == *u) 02733 ++t, ++u; 02734 if(*t == '\0') { 02735 safe_tprintf_str(buff, bufc, "%d", i); 02736 return; 02737 } 02738 ++i, ++s; 02739 } 02740 safe_str("#-1", buff, bufc); 02741 return; 02742 }
static void fun_poss | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3332 of file functions.c.
References process_sex().
03334 { 03335 process_sex(player, fargs[0], "%p", buff, bufc); 03336 }
static void fun_power | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2463 of file functions.c.
References fval(), and safe_str.
02465 { 02466 double val1, val2; 02467 02468 val1 = atof(fargs[0]); 02469 val2 = atof(fargs[1]); 02470 if(val1 < 0) { 02471 safe_str("#-1 POWER OF NEGATIVE", buff, bufc); 02472 } else { 02473 fval(buff, bufc, pow(val1, val2)); 02474 } 02475 }
void fun_push | ( | ) |
static void fun_r | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5101 of file functions.c.
References statedata::global_regs, mudstate, and safe_str.
05103 { 05104 int regnum; 05105 05106 regnum = atoi(fargs[0]); 05107 if((regnum < 0) || (regnum >= MAX_GLOBAL_REGS)) { 05108 safe_str("#-1 INVALID GLOBAL REGISTER", buff, bufc); 05109 } else if(mudstate.global_regs[regnum]) { 05110 safe_str(mudstate.global_regs[regnum], buff, bufc); 05111 } 05112 }
static void fun_rand | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Return a random number from 0 to arg1-1
Definition at line 576 of file functions.c.
References random, safe_str, and safe_tprintf_str().
00578 { 00579 int num; 00580 00581 num = atoi(fargs[0]); 00582 if(num < 1) 00583 safe_str("0", buff, bufc); 00584 else 00585 safe_tprintf_str(buff, bufc, "%ld", (random() % num)); 00586 }
void fun_regmatch | ( | ) |
static void fun_remove | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2922 of file functions.c.
References safe_chr, safe_str, split_token(), and varargs_preamble.
02924 { 02925 char *s, *sp, *word; 02926 char sep; 02927 int first, found; 02928 02929 varargs_preamble("REMOVE", 3); 02930 if(index(fargs[1], sep)) { 02931 safe_str("#-1 CAN ONLY DELETE ONE ELEMENT", buff, bufc); 02932 return; 02933 } 02934 s = fargs[0]; 02935 word = fargs[1]; 02936 02937 /* 02938 * Walk through the string copying words until (if ever) we get to * 02939 * * * * one that matches the target word. 02940 */ 02941 02942 sp = s; 02943 found = 0; 02944 first = 1; 02945 while (s) { 02946 sp = split_token(&s, sep); 02947 if(found || strcmp(sp, word)) { 02948 if(!first) 02949 safe_chr(sep, buff, bufc); 02950 safe_str(sp, buff, bufc); 02951 first = 0; 02952 } else { 02953 found = 1; 02954 } 02955 } 02956 }
static void fun_repeat | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3931 of file functions.c.
References LBUF_SIZE, and safe_str.
03933 { 03934 int times, i; 03935 03936 times = atoi(fargs[1]); 03937 if((times < 1) || (fargs[0] == NULL) || (!*fargs[0])) { 03938 return; 03939 } else if(times == 1) { 03940 safe_str(fargs[0], buff, bufc); 03941 } else if(strlen(fargs[0]) * times >= (LBUF_SIZE - 1)) { 03942 safe_str("#-1 STRING TOO LONG", buff, bufc); 03943 } else { 03944 for(i = 0; i < times; i++) 03945 safe_str(fargs[0], buff, bufc); 03946 } 03947 }
static void fun_replace | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2893 of file functions.c.
References do_itemfuns(), IF_REPLACE, and varargs_preamble.
02895 { /* 02896 * replace a word at position X of a list 02897 */ 02898 char sep; 02899 02900 varargs_preamble("REPLACE", 4); 02901 do_itemfuns(buff, bufc, fargs[0], atoi(fargs[1]), fargs[2], sep, 02902 IF_REPLACE); 02903 }
static void fun_rest | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Returns all but the first word in a string
Definition at line 1550 of file functions.c.
References safe_str, split_token(), trim_space_sep(), and varargs_preamble.
01552 { 01553 char *s, *first, sep; 01554 01555 /* 01556 * If we are passed an empty arglist return a null string 01557 */ 01558 01559 if(nfargs == 0) { 01560 return; 01561 } 01562 varargs_preamble("REST", 2); 01563 s = trim_space_sep(fargs[0], sep); /* 01564 * leading spaces ... 01565 */ 01566 first = split_token(&s, sep); 01567 if(s) { 01568 safe_str(s, buff, bufc); 01569 } 01570 }
static void fun_reverse | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3488 of file functions.c.
References do_reverse().
03490 { 03491 do_reverse(fargs[0], *bufc); 03492 *bufc += strlen(fargs[0]); 03493 }
static void fun_revwords | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3495 of file functions.c.
References alloc_lbuf, do_reverse(), free_lbuf, safe_chr, split_token(), and varargs_preamble.
03497 { 03498 char *temp, *tp, *t1, sep; 03499 int first; 03500 03501 /* 03502 * If we are passed an empty arglist return a null string 03503 */ 03504 03505 if(nfargs == 0) { 03506 return; 03507 } 03508 varargs_preamble("REVWORDS", 2); 03509 temp = alloc_lbuf("fun_revwords"); 03510 03511 /* 03512 * Reverse the whole string 03513 */ 03514 03515 do_reverse(fargs[0], temp); 03516 03517 /* 03518 * Now individually reverse each word in the string. This will 03519 * undo the reversing of the words (so the words themselves are 03520 * forwards again. 03521 */ 03522 03523 tp = temp; 03524 first = 1; 03525 while (tp) { 03526 if(!first) 03527 safe_chr(sep, buff, bufc); 03528 t1 = split_token(&tp, sep); 03529 do_reverse(t1, *bufc); 03530 *bufc += strlen(t1); 03531 first = 0; 03532 } 03533 free_lbuf(temp); 03534 }
static void fun_rjust | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5003 of file functions.c.
References LBUF_SIZE, safe_chr, safe_str, strip_ansi_r(), and varargs_preamble.
05005 { 05006 int spaces, i; 05007 char sep; 05008 char new[LBUF_SIZE]; 05009 05010 varargs_preamble("RJUST", 3); 05011 strncpy(new, fargs[0], LBUF_SIZE-1); 05012 spaces = atoi(fargs[1]) - strlen((char *) strip_ansi_r(new,fargs[0],strlen(fargs[0]))); 05013 05014 /* 05015 * Sanitize number of spaces 05016 */ 05017 05018 if(spaces <= 0) { 05019 /* 05020 * no padding needed, just return string 05021 */ 05022 safe_str(fargs[0], buff, bufc); 05023 return; 05024 } else if(spaces > LBUF_SIZE) { 05025 spaces = LBUF_SIZE; 05026 } 05027 for(i = 0; i < spaces; i++) 05028 safe_chr(sep, buff, bufc); 05029 safe_str(fargs[0], buff, bufc); 05030 }
static void fun_rloc | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1763 of file functions.c.
References Good_obj, Has_location, locatable(), Location, match_thing(), mudconf, confdata::ntfy_nest_lim, safe_str, and safe_tprintf_str().
01765 { 01766 int i, levels; 01767 dbref it; 01768 01769 levels = atoi(fargs[1]); 01770 if(levels > mudconf.ntfy_nest_lim) 01771 levels = mudconf.ntfy_nest_lim; 01772 01773 it = match_thing(player, fargs[0]); 01774 if(locatable(player, it, cause)) { 01775 for(i = 0; i < levels; i++) { 01776 if(!Good_obj(it) || !Has_location(it)) 01777 break; 01778 it = Location(it); 01779 } 01780 safe_tprintf_str(buff, bufc, "#%d", it); 01781 return; 01782 } 01783 safe_str("#-1", buff, bufc); 01784 }
static void fun_room | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1791 of file functions.c.
References Good_obj, isRoom, locatable(), Location, match_thing(), mudconf, confdata::ntfy_nest_lim, safe_str, and safe_tprintf_str().
01793 { 01794 dbref it; 01795 int count; 01796 01797 it = match_thing(player, fargs[0]); 01798 if(locatable(player, it, cause)) { 01799 for(count = mudconf.ntfy_nest_lim; count > 0; count--) { 01800 it = Location(it); 01801 if(!Good_obj(it)) 01802 break; 01803 if(isRoom(it)) { 01804 safe_tprintf_str(buff, bufc, "#%d", it); 01805 return; 01806 } 01807 } 01808 safe_str("#-1", buff, bufc); 01809 } else if(isRoom(it)) { 01810 safe_tprintf_str(buff, bufc, "#%d", it); 01811 } else { 01812 safe_str("#-1", buff, bufc); 01813 } 01814 return; 01815 }
static void fun_round | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2343 of file functions.c.
References safe_tprintf_str().
02345 { 02346 const char *fstr; 02347 char *oldp; 02348 02349 oldp = *bufc; 02350 02351 switch (atoi(fargs[1])) { 02352 case 1: 02353 fstr = "%.1f"; 02354 break; 02355 case 2: 02356 fstr = "%.2f"; 02357 break; 02358 case 3: 02359 fstr = "%.3f"; 02360 break; 02361 case 4: 02362 fstr = "%.4f"; 02363 break; 02364 case 5: 02365 fstr = "%.5f"; 02366 break; 02367 case 6: 02368 fstr = "%.6f"; 02369 break; 02370 default: 02371 fstr = "%.0f"; 02372 break; 02373 } 02374 safe_tprintf_str(buff, bufc, (char *) fstr, atof(fargs[0])); 02375 02376 /* Handle bogus result of "-0" from sprintf. Yay, cclib. */ 02377 02378 if(!strcmp(oldp, "-0")) { 02379 *oldp = '0'; 02380 *bufc = oldp + 1; 02381 } 02382 }
static void fun_s | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Force substitution to occur.
Definition at line 1626 of file functions.c.
References EV_EVAL, EV_FIGNORE, and exec().
01628 { 01629 char *str; 01630 01631 str = fargs[0]; 01632 exec(buff, bufc, 0, player, cause, EV_FIGNORE | EV_EVAL, &str, cargs, 01633 ncargs); 01634 }
void fun_scramble | ( | ) |
static void fun_search | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3754 of file functions.c.
References alloc_sbuf, free_sbuf, NOTHING, olist_first(), olist_next(), olist_pop(), olist_push(), safe_str, search_perform(), search_setup(), and boolexp::thing.
03756 { 03757 dbref thing; 03758 char *bp, *nbuf; 03759 SEARCH searchparm; 03760 03761 /* 03762 * Set up for the search. If any errors, abort. 03763 */ 03764 03765 if(!search_setup(player, fargs[0], &searchparm)) { 03766 safe_str("#-1 ERROR DURING SEARCH", buff, bufc); 03767 return; 03768 } 03769 /* 03770 * Do the search and report the results 03771 */ 03772 03773 olist_push(); 03774 search_perform(player, cause, &searchparm); 03775 bp = *bufc; 03776 nbuf = alloc_sbuf("fun_search"); 03777 for(thing = olist_first(); thing != NOTHING; thing = olist_next()) { 03778 if(bp == *bufc) 03779 sprintf(nbuf, "#%d", thing); 03780 else 03781 sprintf(nbuf, " #%d", thing); 03782 safe_str(nbuf, buff, bufc); 03783 } 03784 free_sbuf(nbuf); 03785 olist_pop(); 03786 }
static void fun_secs | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Seconds since 0:00 1/1/70
Definition at line 684 of file functions.c.
References mudstate, statedata::now, and safe_tprintf_str().
00686 { 00687 safe_tprintf_str(buff, bufc, "%d", mudstate.now); 00688 }
static void fun_secure | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2988 of file functions.c.
References safe_chr.
02990 { 02991 char *s; 02992 02993 s = fargs[0]; 02994 while (*s) { 02995 switch (*s) { 02996 case '%': 02997 case '$': 02998 case '\\': 02999 case '[': 03000 case ']': 03001 case '(': 03002 case ')': 03003 case '{': 03004 case '}': 03005 case ',': 03006 case ';': 03007 safe_chr(' ', buff, bufc); 03008 break; 03009 default: 03010 safe_chr(*s, buff, bufc); 03011 } 03012 s++; 03013 } 03014 }
void fun_set | ( | ) |
static void fun_setdiff | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4949 of file functions.c.
References handle_sets(), SET_DIFF, and varargs_preamble.
04951 { 04952 char sep; 04953 04954 varargs_preamble("SETDIFF", 3); 04955 handle_sets(fargs, buff, bufc, SET_DIFF, sep); 04956 return; 04957 }
static void fun_setinter | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4959 of file functions.c.
References handle_sets(), SET_INTERSECT, and varargs_preamble.
04961 { 04962 char sep; 04963 04964 varargs_preamble("SETINTER", 3); 04965 handle_sets(fargs, buff, bufc, SET_INTERSECT, sep); 04966 return; 04967 }
void fun_setlock | ( | ) |
static void fun_setq | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5069 of file functions.c.
References alloc_lbuf, statedata::global_regs, mudstate, safe_str, and StringCopy.
05071 { 05072 int regnum; 05073 05074 regnum = atoi(fargs[0]); 05075 if((regnum < 0) || (regnum >= MAX_GLOBAL_REGS)) { 05076 safe_str("#-1 INVALID GLOBAL REGISTER", buff, bufc); 05077 } else { 05078 if(!mudstate.global_regs[regnum]) 05079 mudstate.global_regs[regnum] = alloc_lbuf("fun_setq"); 05080 StringCopy(mudstate.global_regs[regnum], fargs[1]); 05081 } 05082 }
static void fun_setr | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5084 of file functions.c.
References alloc_lbuf, statedata::global_regs, mudstate, safe_str, and StringCopy.
05086 { 05087 int regnum; 05088 05089 regnum = atoi(fargs[0]); 05090 if((regnum < 0) || (regnum >= MAX_GLOBAL_REGS)) { 05091 safe_str("#-1 INVALID GLOBAL REGISTER", buff, bufc); 05092 return; 05093 } else { 05094 if(!mudstate.global_regs[regnum]) 05095 mudstate.global_regs[regnum] = alloc_lbuf("fun_setq"); 05096 StringCopy(mudstate.global_regs[regnum], fargs[1]); 05097 } 05098 safe_str(fargs[1], buff, bufc); 05099 }
static void fun_setunion | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4939 of file functions.c.
References handle_sets(), SET_UNION, and varargs_preamble.
04941 { 04942 char sep; 04943 04944 varargs_preamble("SETUNION", 3); 04945 handle_sets(fargs, buff, bufc, SET_UNION, sep); 04946 return; 04947 }
void fun_shl | ( | ) |
void fun_shr | ( | ) |
void fun_shuffle | ( | ) |
static void fun_sign | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Returns -1, 0, or 1 based on the the sign of its argument.
Definition at line 609 of file functions.c.
References safe_str.
00611 { 00612 double num; 00613 00614 num = atof(fargs[0]); 00615 if(num < 0) 00616 safe_str("-1", buff, bufc); 00617 else if(num > 0) 00618 safe_str("1", buff, bufc); 00619 else 00620 safe_str("0", buff, bufc); 00621 }
static void fun_sin | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2439 of file functions.c.
References fval().
02441 { 02442 fval(buff, bufc, sin(atof(fargs[0]))); 02443 }
static void fun_sort | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4711 of file functions.c.
References alloc_lbuf, arr2list(), do_asort(), free_lbuf, get_list_type(), LBUF_SIZE, list2arr(), mvarargs_preamble, and StringCopy.
04713 { 04714 int nitems, sort_type; 04715 char *list, sep; 04716 char *ptrs[LBUF_SIZE / 2]; 04717 04718 /* 04719 * If we are passed an empty arglist return a null string 04720 */ 04721 04722 if(nfargs == 0) { 04723 return; 04724 } 04725 mvarargs_preamble("SORT", 1, 3); 04726 04727 /* 04728 * Convert the list to an array 04729 */ 04730 04731 list = alloc_lbuf("fun_sort"); 04732 StringCopy(list, fargs[0]); 04733 nitems = list2arr(ptrs, LBUF_SIZE / 2, list, sep); 04734 sort_type = get_list_type(fargs, nfargs, 2, ptrs, nitems); 04735 do_asort(ptrs, nitems, sort_type); 04736 arr2list(ptrs, nitems, buff, bufc, sep); 04737 free_lbuf(list); 04738 }
void fun_sortby | ( | ) |
static void fun_space | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4561 of file functions.c.
References is_integer(), and LBUF_SIZE.
04563 { 04564 int num; 04565 char *cp; 04566 04567 if(!fargs[0] || !(*fargs[0])) { 04568 num = 1; 04569 } else { 04570 num = atoi(fargs[0]); 04571 } 04572 04573 if(num < 1) { 04574 04575 /* 04576 * If negative or zero spaces return a single space, * * * * 04577 * -except- allow 'space(0)' to return "" for calculated * * 04578 * * * padding 04579 */ 04580 04581 if(!is_integer(fargs[0]) || (num != 0)) { 04582 num = 1; 04583 } 04584 } else if(num >= LBUF_SIZE) { 04585 num = LBUF_SIZE - 1; 04586 } 04587 for(cp = *bufc; num > 0; num--) 04588 *cp++ = ' '; 04589 *bufc = cp; 04590 return; 04591 }
static void fun_splice | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3881 of file functions.c.
References countwords(), safe_chr, safe_str, split_token(), and varargs_preamble.
03883 { 03884 char *p1, *p2, *q1, *q2, sep; 03885 int words, i, first; 03886 03887 varargs_preamble("SPLICE", 4); 03888 03889 /* 03890 * length checks 03891 */ 03892 03893 if(countwords(fargs[2], sep) > 1) { 03894 safe_str("#-1 TOO MANY WORDS", buff, bufc); 03895 return; 03896 } 03897 words = countwords(fargs[0], sep); 03898 if(words != countwords(fargs[1], sep)) { 03899 safe_str("#-1 NUMBER OF WORDS MUST BE EQUAL", buff, bufc); 03900 return; 03901 } 03902 /* 03903 * loop through the two lists 03904 */ 03905 03906 p1 = fargs[0]; 03907 q1 = fargs[1]; 03908 first = 1; 03909 for(i = 0; i < words; i++) { 03910 p2 = split_token(&p1, sep); 03911 q2 = split_token(&q1, sep); 03912 if(!first) 03913 safe_chr(sep, buff, bufc); 03914 if(!strcmp(p2, fargs[2])) 03915 safe_str(q2, buff, bufc); /* 03916 * replace 03917 */ 03918 else 03919 safe_str(p2, buff, bufc); /* 03920 * copy 03921 */ 03922 first = 0; 03923 } 03924 }
static void fun_sqrt | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2276 of file functions.c.
References fval(), and safe_str.
02278 { 02279 double val; 02280 02281 val = atof(fargs[0]); 02282 if(val < 0) { 02283 safe_str("#-1 SQUARE ROOT OF NEGATIVE", buff, bufc); 02284 } else if(val == 0) { 02285 safe_str("0", buff, bufc); 02286 } else { 02287 fval(buff, bufc, sqrt(val)); 02288 } 02289 }
void fun_squish | ( | ) |
static void fun_startsecs | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
What time (in seconds) did this system last reboot?
Definition at line 1010 of file functions.c.
References mudstate, safe_tprintf_str(), and statedata::start_time.
01013 { 01014 safe_tprintf_str(buff, bufc, "%d", mudstate.start_time); 01015 }
static void fun_starttime | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
What time did this system last reboot?
Definition at line 996 of file functions.c.
References mudstate, safe_str, and statedata::start_time.
00999 { 01000 char *temp; 01001 01002 temp = (char *) ctime(&mudstate.start_time); 01003 temp[strlen(temp) - 1] = '\0'; 01004 safe_str(temp, buff, bufc); 01005 }
static void fun_stats | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3793 of file functions.c.
References get_stats(), lookup_player(), NOTHING, stats_type::s_exits, stats_type::s_garbage, stats_type::s_players, stats_type::s_rooms, stats_type::s_things, stats_type::s_total, safe_str, safe_tprintf_str(), and string_compare().
03795 { 03796 dbref who; 03797 STATS statinfo; 03798 03799 if((!fargs[0]) || !*fargs[0] || !string_compare(fargs[0], "all")) { 03800 who = NOTHING; 03801 } else { 03802 who = lookup_player(player, fargs[0], 1); 03803 if(who == NOTHING) { 03804 safe_str("#-1 NOT FOUND", buff, bufc); 03805 return; 03806 } 03807 } 03808 if(!get_stats(player, who, &statinfo)) { 03809 safe_str("#-1 ERROR GETTING STATS", buff, bufc); 03810 return; 03811 } 03812 safe_tprintf_str(buff, bufc, "%d %d %d %d %d %d", statinfo.s_total, 03813 statinfo.s_rooms, statinfo.s_exits, statinfo.s_things, 03814 statinfo.s_players, statinfo.s_garbage); 03815 }
void fun_strcat | ( | ) |
void fun_stripansi | ( | ) |
static void fun_strlen | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2145 of file functions.c.
References LBUF_SIZE, safe_tprintf_str(), and strip_ansi_r().
02147 { 02148 char new[LBUF_SIZE]; 02149 strncpy(new, fargs[0], LBUF_SIZE-1); 02150 safe_tprintf_str(buff, bufc, "%d", 02151 (int) strlen((char *) strip_ansi_r(new,fargs[0],strlen(fargs[0])))); 02152 }
static void fun_strmatch | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1953 of file functions.c.
References quick_wild(), and safe_str.
01955 { 01956 /* 01957 * Check if we match the whole string. If so, return 1 01958 */ 01959 01960 if(quick_wild(fargs[1], fargs[0])) 01961 safe_str("1", buff, bufc); 01962 else 01963 safe_str("0", buff, bufc); 01964 return; 01965 }
void fun_strtrunc | ( | ) |
static void fun_sub | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2307 of file functions.c.
References fval().
02309 { 02310 fval(buff, bufc, atof(fargs[0]) - atof(fargs[1])); 02311 }
static void fun_subeval | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1238 of file functions.c.
References EV_FIGNORE, EV_NO_COMPRESS, EV_NO_LOCATION, EV_NOFCHECK, exec(), and safe_str.
01240 { 01241 char *str; 01242 01243 if(nfargs != 1) { 01244 safe_str("#-1 FUNCTION (EVALNOCOMP) EXPECTS 1 OR 2 ARGUMENTS", 01245 buff, bufc); 01246 return; 01247 } 01248 01249 str = fargs[0]; 01250 exec(buff, bufc, 0, player, cause, 01251 EV_NO_LOCATION | EV_NOFCHECK | EV_FIGNORE | EV_NO_COMPRESS, &str, 01252 (char **) NULL, 0); 01253 }
static void fun_subj | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3338 of file functions.c.
References process_sex().
03340 { 03341 process_sex(player, fargs[0], "%s", buff, bufc); 03342 }
static void fun_switch | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 4437 of file functions.c.
References alloc_lbuf, EV_EVAL, EV_FCHECK, EV_STRIP, exec(), free_lbuf, quick_wild(), and StringCopy.
04439 { 04440 int i; 04441 char *mbuff, *tbuff, *buf, *bp, *str; 04442 04443 /* 04444 * If we don't have at least 2 args, return nothing 04445 */ 04446 04447 if(nfargs < 2) { 04448 return; 04449 } 04450 /* 04451 * Evaluate the target in fargs[0] 04452 */ 04453 04454 mbuff = bp = alloc_lbuf("fun_switch"); 04455 str = fargs[0]; 04456 exec(mbuff, &bp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04457 &str, cargs, ncargs); 04458 *bp = '\0'; 04459 04460 /* 04461 * Loop through the patterns looking for a match 04462 */ 04463 04464 for(i = 1; (i < nfargs - 1) && fargs[i] && fargs[i + 1]; i += 2) { 04465 tbuff = bp = alloc_lbuf("fun_switch.2"); 04466 str = fargs[i]; 04467 exec(tbuff, &bp, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04468 &str, cargs, ncargs); 04469 *bp = '\0'; 04470 if(quick_wild(tbuff, mbuff)) { 04471 free_lbuf(tbuff); 04472 buf = alloc_lbuf("fun_switch"); 04473 StringCopy(buf, fargs[i + 1]); 04474 str = buf; 04475 exec(buff, bufc, 0, player, cause, 04476 EV_STRIP | EV_FCHECK | EV_EVAL, &str, cargs, ncargs); 04477 free_lbuf(buf); 04478 free_lbuf(mbuff); 04479 return; 04480 } 04481 free_lbuf(tbuff); 04482 } 04483 free_lbuf(mbuff); 04484 04485 /* 04486 * Nope, return the default if there is one 04487 */ 04488 04489 if((i < nfargs) && fargs[i]) { 04490 buf = alloc_lbuf("fun_switch"); 04491 StringCopy(buf, fargs[i]); 04492 str = buf; 04493 exec(buff, bufc, 0, player, cause, EV_STRIP | EV_FCHECK | EV_EVAL, 04494 &str, cargs, ncargs); 04495 free_lbuf(buf); 04496 } 04497 return; 04498 }
static void fun_t | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2270 of file functions.c.
References safe_tprintf_str(), and xlate().
02272 { 02273 safe_tprintf_str(buff, bufc, "%d", !(!xlate(fargs[0]))); 02274 }
static void fun_tan | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2451 of file functions.c.
References fval().
02453 { 02454 fval(buff, bufc, tan(atof(fargs[0]))); 02455 }
void fun_tel | ( | ) |
static void fun_time | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Returns nicely-formatted time.
Definition at line 671 of file functions.c.
References mudstate, statedata::now, and safe_str.
00673 { 00674 char *temp; 00675 00676 temp = (char *) ctime(&mudstate.now); 00677 temp[strlen(temp) - 1] = '\0'; 00678 safe_str(temp, buff, bufc); 00679 }
void fun_translate | ( | ) |
static void fun_trim | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 5152 of file functions.c.
References mvarargs_preamble, safe_str, and ToLower.
05154 { 05155 char *p, *lastchar, *q, sep; 05156 int trim; 05157 05158 if(nfargs == 0) { 05159 return; 05160 } 05161 mvarargs_preamble("TRIM", 1, 3); 05162 if(nfargs >= 2) { 05163 switch (ToLower(*fargs[1])) { 05164 case 'l': 05165 trim = 1; 05166 break; 05167 case 'r': 05168 trim = 2; 05169 break; 05170 default: 05171 trim = 3; 05172 break; 05173 } 05174 } else { 05175 trim = 3; 05176 } 05177 05178 if(trim == 2 || trim == 3) { 05179 p = lastchar = fargs[0]; 05180 while (*p != '\0') { 05181 if(*p != sep) 05182 lastchar = p; 05183 p++; 05184 } 05185 *(lastchar + 1) = '\0'; 05186 } 05187 q = fargs[0]; 05188 if(trim == 1 || trim == 3) { 05189 while (*q != '\0') { 05190 if(*q == sep) 05191 q++; 05192 else 05193 break; 05194 } 05195 } 05196 safe_str(q, buff, bufc); 05197 }
static void fun_trunc | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2384 of file functions.c.
References safe_tprintf_str().
02386 { 02387 safe_tprintf_str(buff, bufc, "%.0f", atof(fargs[0])); 02388 }
static void fun_type | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3107 of file functions.c.
References Good_obj, match_thing(), safe_str, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.
03109 { 03110 dbref it; 03111 03112 it = match_thing(player, fargs[0]); 03113 if(!Good_obj(it)) { 03114 safe_str("#-1 NOT FOUND", buff, bufc); 03115 return; 03116 } 03117 switch (Typeof(it)) { 03118 case TYPE_ROOM: 03119 safe_str("ROOM", buff, bufc); 03120 break; 03121 case TYPE_EXIT: 03122 safe_str("EXIT", buff, bufc); 03123 break; 03124 case TYPE_PLAYER: 03125 safe_str("PLAYER", buff, bufc); 03126 break; 03127 case TYPE_THING: 03128 safe_str("THING", buff, bufc); 03129 break; 03130 default: 03131 safe_str("#-1 ILLEGAL TYPE", buff, bufc); 03132 } 03133 return; 03134 }
static void fun_u | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1424 of file functions.c.
References do_ufun().
01426 { 01427 do_ufun(buff, bufc, player, cause, fargs, nfargs, cargs, ncargs, 0); 01428 }
static void fun_ucstr | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3379 of file functions.c.
References ToUpper.
03381 { 03382 char *ap; 03383 03384 ap = fargs[0]; 03385 while (*ap) { 03386 **bufc = ToUpper(*ap); 03387 ap++; 03388 (*bufc)++; 03389 } 03390 }
void fun_udefault | ( | ) |
static void fun_ulocal | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1430 of file functions.c.
References do_ufun().
01432 { 01433 do_ufun(buff, bufc, player, cause, fargs, nfargs, cargs, ncargs, 1); 01434 }
static void fun_v | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Function form of -substitution
Definition at line 1575 of file functions.c.
References alloc_sbuf, atr_pget(), atr_pget_info(), atr_str(), EV_FIGNORE, exec(), free_lbuf, free_sbuf, attr::number, safe_sb_chr, safe_sb_str, safe_str, and See_attr.
01577 { 01578 dbref aowner; 01579 int aflags; 01580 char *sbuf, *sbufc, *tbuf, *str; 01581 ATTR *ap; 01582 01583 tbuf = fargs[0]; 01584 if(isalpha(tbuf[0]) && tbuf[1]) { 01585 01586 /* 01587 * Fetch an attribute from me. First see if it exists, * * * 01588 * 01589 * * returning a null string if it does not. 01590 */ 01591 01592 ap = atr_str(fargs[0]); 01593 if(!ap) { 01594 return; 01595 } 01596 /* 01597 * If we can access it, return it, otherwise return a * null 01598 * * * * string 01599 */ 01600 01601 atr_pget_info(player, ap->number, &aowner, &aflags); 01602 if(See_attr(player, player, ap, aowner, aflags)) { 01603 tbuf = atr_pget(player, ap->number, &aowner, &aflags); 01604 safe_str(tbuf, buff, bufc); 01605 free_lbuf(tbuf); 01606 } 01607 return; 01608 } 01609 /* 01610 * Not an attribute, process as %<arg> 01611 */ 01612 01613 sbuf = alloc_sbuf("fun_v"); 01614 sbufc = sbuf; 01615 safe_sb_chr('%', sbuf, &sbufc); 01616 safe_sb_str(fargs[0], sbuf, &sbufc); 01617 *sbufc = '\0'; 01618 str = sbuf; 01619 exec(buff, bufc, 0, player, cause, EV_FIGNORE, &str, cargs, ncargs); 01620 free_sbuf(sbuf); 01621 }
void fun_vadd | ( | ) |
void fun_valid | ( | ) |
void fun_vdim | ( | ) |
static void fun_version | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
void fun_visible | ( | ) |
void fun_vmag | ( | ) |
void fun_vmul | ( | ) |
void fun_vsub | ( | ) |
void fun_vunit | ( | ) |
static void fun_where | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1745 of file functions.c.
References locatable(), match_thing(), safe_str, safe_tprintf_str(), and where_is().
01747 { 01748 dbref it; 01749 01750 it = match_thing(player, fargs[0]); 01751 if(locatable(player, it, cause)) 01752 safe_tprintf_str(buff, bufc, "#%d", where_is(it)); 01753 else 01754 safe_str("#-1", buff, bufc); 01755 return; 01756 }
static void fun_wordpos | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 3081 of file functions.c.
References safe_str, safe_tprintf_str(), split_token(), trim_space_sep(), and varargs_preamble.
03083 { 03084 int charpos, i; 03085 char *cp, *tp, *xp, sep; 03086 03087 varargs_preamble("WORDPOS", 3); 03088 03089 charpos = atoi(fargs[1]); 03090 cp = fargs[0]; 03091 if((charpos > 0) && (charpos <= strlen(cp))) { 03092 tp = &(cp[charpos - 1]); 03093 cp = trim_space_sep(cp, sep); 03094 xp = split_token(&cp, sep); 03095 for(i = 1; xp; i++) { 03096 if(tp < (xp + strlen(xp))) 03097 break; 03098 xp = split_token(&cp, sep); 03099 } 03100 safe_tprintf_str(buff, bufc, "%d", i); 03101 return; 03102 } 03103 safe_str("#-1", buff, bufc); 03104 return; 03105 }
static void fun_words | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 539 of file functions.c.
References countwords(), safe_str, safe_tprintf_str(), and varargs_preamble.
00541 { 00542 char sep; 00543 00544 if(nfargs == 0) { 00545 safe_str("0", buff, bufc); 00546 return; 00547 } 00548 varargs_preamble("WORDS", 2); 00549 safe_tprintf_str(buff, bufc, "%d", countwords(fargs[0], sep)); 00550 }
static void fun_xget | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 1123 of file functions.c.
References AF_IS_LOCK, atr_get(), atr_num(), atr_pget(), attr, check_read_perms(), attr::flags, free_boolexp(), free_lbuf, MBUF_SIZE, NOTHING, parse_attrib(), parse_boolexp(), Read_attr, safe_str, boolexp::thing, and unparse_boolexp().
01125 { 01126 dbref thing, aowner; 01127 int attrib, free_buffer, aflags; 01128 ATTR *attr; 01129 char *atr_gotten; 01130 struct boolexp *bool; 01131 char buffer[MBUF_SIZE]; 01132 01133 01134 if(!*fargs[0] || !*fargs[1]) 01135 return; 01136 01137 snprintf(buffer, MBUF_SIZE - 1, "%s/%s", fargs[0], fargs[1]); 01138 if(!parse_attrib(player, buffer, &thing, &attrib)) { 01139 safe_str("#-1 NO MATCH", buff, bufc); 01140 return; 01141 } 01142 if(attrib == NOTHING) { 01143 return; 01144 } 01145 free_buffer = 1; 01146 attr = atr_num(attrib); /* 01147 * We need the attr's flags for this: 01148 */ 01149 if(!attr) { 01150 return; 01151 } 01152 if(attr->flags & AF_IS_LOCK) { 01153 atr_gotten = atr_get(thing, attrib, &aowner, &aflags); 01154 if(Read_attr(player, thing, attr, aowner, aflags)) { 01155 bool = parse_boolexp(player, atr_gotten, 1); 01156 free_lbuf(atr_gotten); 01157 atr_gotten = unparse_boolexp(player, bool); 01158 free_boolexp(bool); 01159 } else { 01160 free_lbuf(atr_gotten); 01161 atr_gotten = (char *) "#-1 PERMISSION DENIED"; 01162 } 01163 free_buffer = 0; 01164 } else { 01165 atr_gotten = atr_pget(thing, attrib, &aowner, &aflags); 01166 } 01167 01168 /* 01169 * Perform access checks. c_r_p fills buff with an error message * * 01170 * 01171 * * * * if needed. 01172 */ 01173 01174 if(check_read_perms(player, thing, attr, aowner, aflags, buff, bufc)) 01175 safe_str(atr_gotten, buff, bufc); 01176 if(free_buffer) 01177 free_lbuf(atr_gotten); 01178 return; 01179 }
static void fun_xor | ( | char * | buff, | |
char ** | bufc, | |||
dbref | player, | |||
dbref | cause, | |||
char * | fargs[], | |||
int | nfargs, | |||
char * | cargs[], | |||
int | ncargs | |||
) | [static] |
Definition at line 2246 of file functions.c.
References safe_str, and safe_tprintf_str().
02248 { 02249 int i, val; 02250 02251 if(nfargs < 2) { 02252 safe_str("#-1 TOO FEW ARGUMENTS", buff, bufc); 02253 return; 02254 } 02255 02256 val = atoi(fargs[0]); 02257 for(i = 1; i < nfargs; i++) { 02258 int tval = atoi(fargs[i]); 02259 val = (val && !tval) || (!val && tval); 02260 } 02261 safe_tprintf_str(buff, bufc, "%d", val); 02262 }
void fun_zfun | ( | ) |
void fun_zone | ( | ) |
void fun_zplayers | ( | ) |
void fun_zwho | ( | ) |
static void fval | ( | char * | buff, | |
char ** | bufc, | |||
double | result | |||
) | [static] |
Copy the floating point value into a buffer and make it presentable
Definition at line 435 of file functions.c.
References safe_tprintf_str().
Referenced by fun_abs(), fun_acos(), fun_add(), fun_asin(), fun_atan(), fun_cos(), fun_exp(), fun_fdiv(), fun_ln(), fun_log(), fun_max(), fun_min(), fun_mul(), fun_power(), fun_sin(), fun_sqrt(), fun_sub(), and fun_tan().
00436 { 00437 char *p, *buf1; 00438 00439 buf1 = *bufc; 00440 safe_tprintf_str(buff, bufc, "%.6f", result); /* 00441 * get double val * * 00442 * into buffer 00443 */ 00444 **bufc = '\0'; 00445 p = (char *) rindex(buf1, '0'); 00446 if(p == NULL) { /* 00447 * remove useless trailing 0's 00448 */ 00449 return; 00450 } else if(*(p + 1) == '\0') { 00451 while (*p == '0') { 00452 *p-- = '\0'; 00453 } 00454 *bufc = p + 1; 00455 } 00456 p = (char *) rindex(buf1, '.'); /* 00457 * take care of dangling '.' 00458 */ 00459 if((p != NULL) && (*(p + 1) == '\0')) { 00460 *p = '\0'; 00461 *bufc = p; 00462 } 00463 }
int game_lag | ( | void | ) |
Definition at line 19 of file mech.tech.c.
Referenced by fun_lag(), and game_lag_time().
00020 { 00021 if(!muxevent_tick) 00022 return 0; 00023 return 100 * (mudstate.now - mudstate.restart_time) / muxevent_tick - 100; 00024 }
static int get_list_type | ( | char * | fargs[], | |
int | nfargs, | |||
int | type_pos, | |||
char * | ptrs[], | |||
int | nitems | |||
) | [static] |
Definition at line 365 of file functions.c.
References ALPHANUM_LIST, autodetect_list(), DBREF_LIST, FLOAT_LIST, NUMERIC_LIST, and ToLower.
Referenced by fun_sort().
00367 { 00368 if(nfargs >= type_pos) { 00369 switch (ToLower(*fargs[type_pos - 1])) { 00370 case 'd': 00371 return DBREF_LIST; 00372 case 'n': 00373 return NUMERIC_LIST; 00374 case 'f': 00375 return FLOAT_LIST; 00376 case '\0': 00377 return autodetect_list(ptrs, nitems); 00378 default: 00379 return ALPHANUM_LIST; 00380 } 00381 } 00382 return autodetect_list(ptrs, nitems); 00383 }
char* get_uptime_to_short_string | ( | int | uptime | ) |
Definition at line 932 of file functions.c.
References alloc_sbuf, multip, sname, uptime_unit_table, and UPTIME_UNITS.
00933 { 00934 char *buf = alloc_sbuf("get_uptime_to_string"); 00935 int units[UPTIME_UNITS]; 00936 int taim = uptime; 00937 int ut = 0, uc = 0, foofaa; 00938 00939 if(uptime <= 0) { 00940 strcpy(buf, "#-1 INVALID VALUE"); 00941 return buf; 00942 } 00943 for(ut = 0; ut < UPTIME_UNITS; ut++) 00944 units[ut] = 0; 00945 ut = 0; 00946 buf[0] = 0; 00947 while (taim > 0) { 00948 if((foofaa = (taim / uptime_unit_table[ut].multip)) > 0) { 00949 uc++; 00950 units[ut] = foofaa; 00951 taim -= uptime_unit_table[ut].multip * foofaa; 00952 } 00953 ut++; 00954 } 00955 /* 00956 * Now, we got it.. 00957 */ 00958 for(ut = 0; ut < UPTIME_UNITS; ut++) { 00959 if(units[ut]) { 00960 uc--; 00961 if(units[ut] > 1) 00962 sprintf(buf + strlen(buf), "%d%s", units[ut], 00963 uptime_unit_table[ut].sname); 00964 else 00965 sprintf(buf + strlen(buf), "%d%s", units[ut], 00966 uptime_unit_table[ut].sname); 00967 if(uc > 0) 00968 strcat(buf, " "); 00969 } 00970 } 00971 return buf; 00972 }
char* get_uptime_to_string | ( | int | uptime | ) |
Definition at line 888 of file functions.c.
References alloc_sbuf, multip, name, uptime_unit_table, and UPTIME_UNITS.
Referenced by do_comwho(), fun_convuptime(), and silly_get_uptime_to_string().
00889 { 00890 char *buf = alloc_sbuf("get_uptime_to_string"); 00891 int units[UPTIME_UNITS]; 00892 int taim = uptime; 00893 int ut = 0, uc = 0, foofaa; 00894 00895 if(uptime <= 0) { 00896 strcpy(buf, "#-1 INVALID VALUE"); 00897 return buf; 00898 } 00899 for(ut = 0; ut < UPTIME_UNITS; ut++) 00900 units[ut] = 0; 00901 ut = 0; 00902 buf[0] = 0; 00903 while (taim > 0) { 00904 if((foofaa = (taim / uptime_unit_table[ut].multip)) > 0) { 00905 uc++; 00906 units[ut] = foofaa; 00907 taim -= uptime_unit_table[ut].multip * foofaa; 00908 } 00909 ut++; 00910 } 00911 /* 00912 * Now, we got it.. 00913 */ 00914 for(ut = 0; ut < UPTIME_UNITS; ut++) { 00915 if(units[ut]) { 00916 uc--; 00917 if(units[ut] > 1) 00918 sprintf(buf + strlen(buf), "%d %ss", units[ut], 00919 uptime_unit_table[ut].name); 00920 else 00921 sprintf(buf + strlen(buf), "%d %s", units[ut], 00922 uptime_unit_table[ut].name); 00923 if(uc > 1) 00924 strcat(buf, ", "); 00925 else if(uc > 0) 00926 strcat(buf, " and "); 00927 } 00928 } 00929 return buf; 00930 }
static void handle_sets | ( | char * | fargs[], | |
char * | buff, | |||
char ** | bufc, | |||
int | oper, | |||
char | sep | |||
) | [static] |
Definition at line 4749 of file functions.c.
References alloc_lbuf, ALPHANUM_LIST, do_asort(), free_lbuf, LBUF_SIZE, list2arr(), safe_chr, safe_str, SET_DIFF, SET_INTERSECT, SET_UNION, and StringCopy.
Referenced by fun_setdiff(), fun_setinter(), and fun_setunion().
04751 { 04752 char *list1, *list2, *oldp; 04753 char *ptrs1[LBUF_SIZE], *ptrs2[LBUF_SIZE]; 04754 int i1, i2, n1, n2, val, first; 04755 04756 list1 = alloc_lbuf("fun_setunion.1"); 04757 StringCopy(list1, fargs[0]); 04758 n1 = list2arr(ptrs1, LBUF_SIZE, list1, sep); 04759 do_asort(ptrs1, n1, ALPHANUM_LIST); 04760 04761 list2 = alloc_lbuf("fun_setunion.2"); 04762 StringCopy(list2, fargs[1]); 04763 n2 = list2arr(ptrs2, LBUF_SIZE, list2, sep); 04764 do_asort(ptrs2, n2, ALPHANUM_LIST); 04765 04766 i1 = i2 = 0; 04767 first = 1; 04768 oldp = *bufc; 04769 **bufc = '\0'; 04770 04771 switch (oper) { 04772 case SET_UNION: /* 04773 * Copy elements common to both lists 04774 */ 04775 04776 /* 04777 * Handle case of two identical single-element lists 04778 */ 04779 04780 if((n1 == 1) && (n2 == 1) && (!strcmp(ptrs1[0], ptrs2[0]))) { 04781 safe_str(ptrs1[0], buff, bufc); 04782 break; 04783 } 04784 /* 04785 * Process until one list is empty 04786 */ 04787 04788 while ((i1 < n1) && (i2 < n2)) { 04789 04790 /* 04791 * Skip over duplicates 04792 */ 04793 04794 if((i1 > 0) || (i2 > 0)) { 04795 while ((i1 < n1) && !strcmp(ptrs1[i1], oldp)) 04796 i1++; 04797 while ((i2 < n2) && !strcmp(ptrs2[i2], oldp)) 04798 i2++; 04799 } 04800 /* 04801 * Compare and copy 04802 */ 04803 04804 if((i1 < n1) && (i2 < n2)) { 04805 if(!first) 04806 safe_chr(sep, buff, bufc); 04807 first = 0; 04808 oldp = *bufc; 04809 if(strcmp(ptrs1[i1], ptrs2[i2]) < 0) { 04810 safe_str(ptrs1[i1], buff, bufc); 04811 i1++; 04812 } else { 04813 safe_str(ptrs2[i2], buff, bufc); 04814 i2++; 04815 } 04816 **bufc = '\0'; 04817 } 04818 } 04819 04820 /* 04821 * Copy rest of remaining list, stripping duplicates 04822 */ 04823 04824 for(; i1 < n1; i1++) { 04825 if(strcmp(oldp, ptrs1[i1])) { 04826 if(!first) 04827 safe_chr(sep, buff, bufc); 04828 first = 0; 04829 oldp = *bufc; 04830 safe_str(ptrs1[i1], buff, bufc); 04831 **bufc = '\0'; 04832 } 04833 } 04834 for(; i2 < n2; i2++) { 04835 if(strcmp(oldp, ptrs2[i2])) { 04836 if(!first) 04837 safe_chr(sep, buff, bufc); 04838 first = 0; 04839 oldp = *bufc; 04840 safe_str(ptrs2[i2], buff, bufc); 04841 **bufc = '\0'; 04842 } 04843 } 04844 break; 04845 case SET_INTERSECT: /* 04846 * Copy elements not in both lists 04847 */ 04848 04849 while ((i1 < n1) && (i2 < n2)) { 04850 val = strcmp(ptrs1[i1], ptrs2[i2]); 04851 if(!val) { 04852 04853 /* 04854 * Got a match, copy it 04855 */ 04856 04857 if(!first) 04858 safe_chr(sep, buff, bufc); 04859 first = 0; 04860 oldp = *bufc; 04861 safe_str(ptrs1[i1], buff, bufc); 04862 i1++; 04863 i2++; 04864 while ((i1 < n1) && !strcmp(ptrs1[i1], oldp)) 04865 i1++; 04866 while ((i2 < n2) && !strcmp(ptrs2[i2], oldp)) 04867 i2++; 04868 } else if(val < 0) { 04869 i1++; 04870 } else { 04871 i2++; 04872 } 04873 } 04874 break; 04875 case SET_DIFF: /* 04876 * Copy elements unique to list1 04877 */ 04878 04879 while ((i1 < n1) && (i2 < n2)) { 04880 val = strcmp(ptrs1[i1], ptrs2[i2]); 04881 if(!val) { 04882 04883 /* 04884 * Got a match, increment pointers 04885 */ 04886 04887 oldp = ptrs1[i1]; 04888 while ((i1 < n1) && !strcmp(ptrs1[i1], oldp)) 04889 i1++; 04890 while ((i2 < n2) && !strcmp(ptrs2[i2], oldp)) 04891 i2++; 04892 } else if(val < 0) { 04893 04894 /* 04895 * Item in list1 not in list2, copy 04896 */ 04897 04898 if(!first) 04899 safe_chr(sep, buff, bufc); 04900 first = 0; 04901 safe_str(ptrs1[i1], buff, bufc); 04902 oldp = ptrs1[i1]; 04903 i1++; 04904 while ((i1 < n1) && !strcmp(ptrs1[i1], oldp)) 04905 i1++; 04906 } else { 04907 04908 /* 04909 * Item in list2 but not in list1, discard 04910 */ 04911 04912 oldp = ptrs2[i2]; 04913 i2++; 04914 while ((i2 < n2) && !strcmp(ptrs2[i2], oldp)) 04915 i2++; 04916 } 04917 } 04918 04919 /* 04920 * Copy remainder of list1 04921 */ 04922 04923 while (i1 < n1) { 04924 if(!first) 04925 safe_chr(sep, buff, bufc); 04926 first = 0; 04927 safe_str(ptrs1[i1], buff, bufc); 04928 oldp = ptrs1[i1]; 04929 i1++; 04930 while ((i1 < n1) && !strcmp(ptrs1[i1], oldp)) 04931 i1++; 04932 } 04933 } 04934 free_lbuf(list1); 04935 free_lbuf(list2); 04936 return; 04937 }
static int i_comp | ( | const void * | s1, | |
const void * | s2 | |||
) | [static] |
Definition at line 4652 of file functions.c.
Referenced by delete(), do_asort(), and tree_srch().
04653 { 04654 if(((i_rec *) s1)->data > ((i_rec *) s2)->data) 04655 return 1; 04656 if(((i_rec *) s1)->data < ((i_rec *) s2)->data) 04657 return -1; 04658 return 0; 04659 }
void init_functab | ( | void | ) |
Definition at line 5808 of file functions.c.
References alloc_sbuf, flist, free_sbuf, statedata::func_htab, HASH_FACTOR, hashadd(), hashinit(), mudstate, fun::name, ToLower, ufun_head, and statedata::ufunc_htab.
Referenced by main().
05809 { 05810 FUN *fp; 05811 char *buff, *cp, *dp; 05812 05813 buff = alloc_sbuf("init_functab"); 05814 hashinit(&mudstate.func_htab, 100 * HASH_FACTOR); 05815 for(fp = flist; fp->name; fp++) { 05816 cp = (char *) fp->name; 05817 dp = buff; 05818 while (*cp) { 05819 *dp = ToLower(*cp); 05820 cp++; 05821 dp++; 05822 } 05823 *dp = '\0'; 05824 hashadd(buff, (int *) fp, &mudstate.func_htab); 05825 } 05826 free_sbuf(buff); 05827 ufun_head = NULL; 05828 hashinit(&mudstate.ufunc_htab, 11); 05829 }
int list2arr | ( | char * | arr[], | |
int | maxlen, | |||
char * | list, | |||
char | sep | |||
) |
Definition at line 385 of file functions.c.
References split_token(), and trim_space_sep().
00386 { 00387 char *p; 00388 int i; 00389 00390 list = trim_space_sep(list, sep); 00391 p = split_token(&list, sep); 00392 for(i = 0; p && i < maxlen; i++, p = split_token(&list, sep)) { 00393 arr[i] = p; 00394 } 00395 return i; 00396 }
void list_functable | ( | dbref | player | ) |
Definition at line 5942 of file functions.c.
References alloc_lbuf, check_access(), flist, fun::name, and fun::perms.
Referenced by do_list().
05943 { 05944 FUN *fp; 05945 UFUN *ufp; 05946 char *buf, *bp, *cp; 05947 05948 buf = alloc_lbuf("list_functable"); 05949 bp = buf; 05950 05951 /* Hardcoded Functions */ 05952 for(cp = (char *) "Functions:"; *cp; cp++) 05953 *bp++ = *cp; 05954 for(fp = flist; fp->name; fp++) { 05955 if(check_access(player, fp->perms)) { 05956 *bp++ = ' '; 05957 for(cp = (char *) (fp->name); *cp; cp++) 05958 *bp++ = *cp; 05959 } 05960 } 05961 *bp = '\0'; 05962 notify(player, buf); 05963 05964 /* User-Defined functions (via @function) */ 05965 bp = buf; 05966 safe_str("User-Functions:", buf, &bp); 05967 05968 for(ufp = ufun_head; ufp; ufp = ufp->next) { 05969 if(check_access(player, ufp->perms)) { 05970 *bp++ = ' '; 05971 for(cp = (char *) (ufp->name); *cp; cp++) 05972 *bp++ = *cp; 05973 } 05974 } 05975 *bp = '\0'; 05976 notify(player, buf); 05977 free_lbuf(buf); 05978 }
Definition at line 289 of file functions.c.
References init_match(), MAT_EXIT_PARENTS, match_everything(), noisy_match_result(), and NOTYPE.
00290 { 00291 init_match(player, name, NOTYPE); 00292 match_everything(MAT_EXIT_PARENTS); 00293 return (noisy_match_result()); 00294 }
time_t mytime | ( | dbref | player | ) |
Definition at line 625 of file functions.c.
References A_TZ, mudstate, statedata::now, and silly_atr_get().
00626 { 00627 struct timeval tv; 00628 struct timezone tz; 00629 char *tzstr; 00630 int hours, dst; 00631 00632 tzstr = silly_atr_get(player, A_TZ); 00633 if(sscanf(tzstr, "%d:%d", &hours, &dst) < 2) 00634 return mudstate.now; 00635 tz.tz_minuteswest = (0 - hours) * 60; 00636 tz.tz_dsttime = dst; 00637 gettimeofday(&tv, &tz); 00638 return tv.tv_sec; 00639 }
Check if player is near or controls thing
Definition at line 421 of file functions.c.
References Controls, Good_obj, and nearby().
Referenced by fun_elock(), fun_fullname(), fun_name(), fun_nearby(), and process_sex().
00422 { 00423 if(!Good_obj(player) || !Good_obj(thing)) 00424 return 0; 00425 if(Controls(player, thing)) 00426 return 1; 00427 if(!nearby(player, thing)) 00428 return 0; 00429 return 1; 00430 }
char* next_token | ( | char * | str, | |
char | sep | |||
) |
Definition at line 246 of file functions.c.
00247 { 00248 while (*str && (*str != sep)) 00249 str++; 00250 if(!*str) 00251 return NULL; 00252 str++; 00253 if(sep == ' ') { 00254 while (*str == sep) 00255 str++; 00256 } 00257 return str; 00258 }
static void process_sex | ( | dbref | player, | |
char * | what, | |||
const char * | token, | |||
char * | buff, | |||
char ** | bufc | |||
) | [static] |
Definition at line 3311 of file functions.c.
References exec(), Good_obj, isPlayer, match_thing(), nearby_or_control(), and safe_str.
Referenced by fun_aposs(), fun_obj(), fun_poss(), and fun_subj().
03313 { 03314 dbref it; 03315 char *str; 03316 03317 it = match_thing(player, what); 03318 if(!Good_obj(it) || (!isPlayer(it) && !nearby_or_control(player, it))) { 03319 safe_str("#-1 NO MATCH", buff, bufc); 03320 } else { 03321 str = (char *) token; 03322 exec(buff, bufc, 0, it, it, 0, &str, (char **) NULL, 0); 03323 } 03324 }
char* silly_atr_get | ( | dbref | , | |
int | ||||
) |
Definition at line 44 of file glue.hcode.c.
Referenced by add_links(), auto_command_udisembark(), autoeject(), char_disembark(), char_eject(), CreateNewSpecialObject(), do_name(), econ_change_items(), econ_find_items(), fun_btstores(), fun_bttechtime(), generic_retrieve_stuff(), get_statustemplate_attr(), GetMechID(), GetMechToMechID(), GetMechToMechID_base(), initialize_pc(), list_matching(), loading_bay_whine(), map_update(), map_view(), mech_contacts(), mech_eject(), mech_enter_event(), mech_enterbay(), mech_lrsmap(), mech_Rfixstuff(), mech_Rsetmapindex(), mech_startup(), mech_tacmap(), mech_udisembark(), mech_view(), mechrep_Rrestore(), mytime(), PrintGenericStatus(), PrintReport(), recursively_updatelinks(), retrieve_attrs(), retrieve_health(), sendC3TrackEmit(), sendchannelstuff(), set_colorscheme(), SetCargoWeight(), show_charstatus(), showNetworkData(), showNetworkTargets(), tech_addtechtime(), tech_status(), ValidMap(), and WhichSpecialS().
00045 { 00046 int i, j; 00047 static char buf[LBUF_SIZE]; 00048 00049 atr_get_str(buf, id, flag, &i, &j); 00050 return buf; 00051 #if 0 /* This would waste memory, so.. :P */ 00052 return atr_pget(id, flag, &i, &j); 00053 #endif 00054 }
char* split_token | ( | char ** | sp, | |
char | sep | |||
) |
Definition at line 265 of file functions.c.
00266 { 00267 char *str, *save; 00268 00269 save = str = *sp; 00270 if(!str) { 00271 *sp = NULL; 00272 return NULL; 00273 } 00274 while (*str && (*str != sep)) 00275 str++; 00276 if(*str) { 00277 *str++ = '\0'; 00278 if(sep == ' ') { 00279 while (*str == sep) 00280 str++; 00281 } 00282 } else { 00283 str = NULL; 00284 } 00285 *sp = str; 00286 return save; 00287 }
char* trim_space_sep | ( | char * | str, | |
char | sep | |||
) |
Trim off leading and trailing spaces if the separator char is a space
Definition at line 226 of file functions.c.
00227 { 00228 char *p; 00229 00230 if(*str == '\0') return str; 00231 if(sep != ' ') 00232 return str; 00233 while (*str && (*str == ' ')) 00234 str++; 00235 for(p = str; *p; p++); 00236 for(p--; *p == ' ' && p > str; p--); 00237 p++; 00238 *p = '\0'; 00239 return str; 00240 }
int xlate | ( | char * | arg | ) |
Definition at line 2030 of file functions.c.
References is_integer(), and trim_space_sep().
02031 { 02032 int temp; 02033 char *temp2; 02034 02035 if(arg[0] == '#') { 02036 arg++; 02037 /* #- anything is false */ 02038 if(arg[1] == '-') { 02039 return 0; 02040 } 02041 if(is_integer(arg)) { 02042 temp = atoi(arg); 02043 if(temp == -1) 02044 temp = 0; 02045 return temp; 02046 } 02047 return 0; 02048 } 02049 temp2 = trim_space_sep(arg, ' '); 02050 if(!*temp2) 02051 return 0; 02052 if(is_integer(temp2)) 02053 return atoi(temp2); 02054 return 1; 02055 }
const char daystab[] [static] |
Initial value:
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
Definition at line 714 of file functions.c.
Referenced by do_convtime().
Definition at line 5482 of file functions.c.
Referenced by cf_func_access(), dump_users(), init_functab(), and list_functable().
const char* monthtab[] [static] |
Initial value:
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
Definition at line 710 of file functions.c.
Referenced by do_convtime().
int multip |
Definition at line 875 of file functions.c.
Referenced by get_uptime_to_short_string(), and get_uptime_to_string().
char* name |
Definition at line 876 of file functions.c.
Referenced by AmmoIFromString(), armor_effect(), artillery_hit(), auto_addcommand(), auto_parse_command(), auto_radio_command_help(), auto_read_command_node(), cause_armordamage(), CriticalStatus(), DestroyMainWeapon(), do_malias_create(), DoSpecialObjectHelp(), DoWeaponDestroyedCrit(), DoWeaponJamCrit(), dumpweapon_fun(), find_mechname_by_mechref(), FindAmmoType(), FindGunnerySkillName(), FireWeapon(), flag_description(), fun_btcharlist(), fun_btgetxcodevalue(), fun_btgetxcodevalue_ref(), fun_btsetcharvalue(), fun_btsetxcodevalue(), fun_btticweaps(), fun_create(), fun_objeval(), get_uptime_to_string(), grep_util(), HandleMechCrit(), handleWeaponCrit(), init_btechstats(), interp_nametab(), JamMainWeapon(), list_charvaluestuff(), list_xcodestuff(), list_xcodevalues(), listtic_fun(), load_template(), LoadSpecialObjects(), LoseWeapon(), make_guest(), mech_lateral(), mech_list_maker(), mech_mechprefs(), mech_speed(), mech_weaponstatus(), mech_weight_sub_mech(), mech_weight_sub_veh(), mem_usage(), part_figure_out_name_sub(), part_figure_out_shname(), payloadlist_func(), PrintEnemyWeaponStatus(), PrintWeaponStatus(), recycle_weaponry(), scan_template_dir(), scoreEnhancedWeaponCriticalHit(), set_xcodestuff(), show_charstatus(), valid_ammo_mode(), WeaponIFromString(), and wspec_fun().
char* sname |
struct { ... } uptime_unit_table[UPTIME_UNITS] |
Referenced by get_uptime_to_short_string(), and get_uptime_to_string().