TinyMUSH 3.3
TinyMUSH Server
|
Misc functions. More...
#include "config.h"
#include "constants.h"
#include "typedefs.h"
#include "macros.h"
#include "externs.h"
#include "prototypes.h"
#include <stdbool.h>
#include <ctype.h>
#include <string.h>
#include <sys/time.h>
Functions | |||||||||||||||||||
void | fun_switchall (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) | ||||||||||||||||||
The switchall() function compares <str> against <pat1>, <pat2>, etc. (allowing * to match any number of characters and ? to match any 1 character), and returns the corresponding <resN> parameters (without any delimiters) for all <patN> patterns that match. If none match, then the default result <dflt> is returned. The evaluated value of <str> can be obtained as '#$'. If switchall() and switch() are nested, the nest level can be obtained with '#!'. More... | |||||||||||||||||||
void | fun_switch (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) | ||||||||||||||||||
The switch() function compares <str> against <pat1>, <pat2>, etc (allowing to match any number of characters and ? to match any 1 character), and returns the corresponding <resN> parameter for the first <patN> pattern that matches. If none match, then the default result <dflt> is returned. The evaluated value of <str> can be obtained as '#$'. If switch() and switchall() are nested, the nest level can be obtained with '#!'. More... | |||||||||||||||||||
void | fun_case (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) | ||||||||||||||||||
This function is similar to switch(), save that it looks for an exact match between the patterns and the string, rather than doing a 'wildcard' match (case-insensitive match with '*' and '?'), and the '#$' token replacement is not done. It performs marginally faster than switch(). More... | |||||||||||||||||||
void | handle_ifelse (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) | ||||||||||||||||||
Handle if else cases. More... | |||||||||||||||||||
void | fun_rand (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Return a random number from 0 to arg1 - 1. More... | |||||||||||||||||||
void | fun_die (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Roll XdY dice. More... | |||||||||||||||||||
void | fun_lrand (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) | ||||||||||||||||||
Generate random list. More... | |||||||||||||||||||
void | fun_lnum (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) | ||||||||||||||||||
Return a list of numbers. More... | |||||||||||||||||||
void | fun_time (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Returns nicely-formatted time. More... | |||||||||||||||||||
void | fun_secs (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Seconds since 0:00 1/1/70. More... | |||||||||||||||||||
void | fun_convsecs (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Converts seconds to time string, based off 0:00 1/1/70. More... | |||||||||||||||||||
bool | do_convtime (char *str, struct tm *ttm) | ||||||||||||||||||
Converts time string to a struct tm. More... | |||||||||||||||||||
void | fun_convtime (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
converts time string to seconds, based off 0:00 1/1/70 More... | |||||||||||||||||||
void | fun_timefmt (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs, char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Interface to strftime(). More... | |||||||||||||||||||
void | fun_etimefmt (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Format a number of seconds into a human-readable time. More... | |||||||||||||||||||
void | fun_starttime (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
What time did this system last reboot? More... | |||||||||||||||||||
void | fun_restarts (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
How many times have we restarted? More... | |||||||||||||||||||
void | fun_restarttime (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
When did we last restart? More... | |||||||||||||||||||
void | fun_version (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Return the MUSH version. More... | |||||||||||||||||||
void | fun_mushname (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Return the name of the Mush. More... | |||||||||||||||||||
void | fun_modules (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs, char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Return a list of modules. More... | |||||||||||||||||||
void | fun_hasmodule (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Return 1 if a module is installed, 0 if it is not. More... | |||||||||||||||||||
void | fun_connrecord (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Get max number of simultaneous connects. More... | |||||||||||||||||||
void | fun_fcount (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
State of the function invocation counters. More... | |||||||||||||||||||
void | fun_fdepth (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
State of the function recursion counters. More... | |||||||||||||||||||
void | fun_ccount (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
State of the command invocation counters. More... | |||||||||||||||||||
void | fun_cdepth (char *buff, char **bufc, dbref player __attribute__((unused)), dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[] __attribute__((unused)), int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
State of the command recursion counters. More... | |||||||||||||||||||
void | fun_benchmark (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
Benchmark softcode. More... | |||||||||||||||||||
void | fun_s (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
Force substitution to occur. More... | |||||||||||||||||||
void | fun_subeval (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Like s(), but don't do function evaluations. More... | |||||||||||||||||||
bool | check_command (dbref player, char *name, char *buff, char **bufc, char *cargs[], int ncargs) | ||||||||||||||||||
Check if the player can execute a command. More... | |||||||||||||||||||
void | fun_link (char *buff, char **bufc, dbref player, dbref caller __attribute__((unused)), dbref cause, char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
This side-effect function links an object to a location, behaving identically to the command: 'object>=<destination>'. More... | |||||||||||||||||||
void | fun_tel (char *buff, char **bufc, dbref player, dbref caller __attribute__((unused)), dbref cause, char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
This side-effect function teleports an object from one place to another, behaving identically to the command: '@tel <object>=<destination>'. More... | |||||||||||||||||||
void | fun_wipe (char *buff, char **bufc, dbref player, dbref caller __attribute__((unused)), dbref cause, char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
This side-effect function erases some or all attributes from an object, behaving identically to the command: '@wipe <object>[</wild-attr>]'. More... | |||||||||||||||||||
void | fun_pemit (char *buff, char **bufc, dbref player, dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
This side-effect function sends a message to the list of dbrefs, behaving identically to the command: '@pemit/list <string>'. More... | |||||||||||||||||||
void | fun_remit (char *buff, char **bufc, dbref player, dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
This side-effect function sends a message to the list of dbrefs, behaving identically to the command: '@pemit/list/contents <string>'. More... | |||||||||||||||||||
void | fun_oemit (char *buff, char **bufc, dbref player, dbref caller __attribute__((unused)), dbref cause, char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
This side-effect function sends a message to everyone in <target>'s location with the exception of <target>, behaving identically to the command: '@oemit <target> = <string>'. More... | |||||||||||||||||||
void | fun_force (char *buff, char **bufc, dbref player, dbref caller __attribute__((unused)), dbref cause, char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
This side-effect function behaves identically to the command '@force <object>=<action>'. More... | |||||||||||||||||||
void | fun_trigger (char *buff, char **bufc, dbref player, dbref caller __attribute__((unused)), dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) | ||||||||||||||||||
This side-effect function behaves identically to the command '@trigger <object>/<attribute>=<arg 0>,<arg 1>,...<arg N>'. More... | |||||||||||||||||||
void | fun_wait (char *buff __attribute__((unused)), char **bufc __attribute__((unused)), dbref player, dbref caller __attribute__((unused)), dbref cause, char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
This side-effect function behaves identically to the command '@wait <timer>=<command>'. More... | |||||||||||||||||||
, @parent, @teleport, @unlink, @unlock, | |||||||||||||||||||
This function executes <command> with the given arguments. <command> is presently limited to @chown, @clone, @destroy, @lock, and @wipe.
| |||||||||||||||||||
void | fun_command (char *buff __attribute__((unused)), char **bufc __attribute__((unused)), dbref player, dbref caller __attribute__((unused)), dbref cause, char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
void | fun_create (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs) | ||||||||||||||||||
Creates a room, thing or exit. More... | |||||||||||||||||||
void | fun_set (char *buff, char **bufc, dbref player, dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[], int ncargs) | ||||||||||||||||||
Sets an attribute on an object. More... | |||||||||||||||||||
void | list_qpids (dbref player_targ, dbref obj_targ, BQUE *queue, char *buff, char **bufc, char *bb_p) | ||||||||||||||||||
List the queue pids. More... | |||||||||||||||||||
void | fun_ps (char *buff, char **bufc, dbref player, dbref caller __attribute__((unused)), dbref cause __attribute__((unused)), char *fargs[], int nfargs __attribute__((unused)), char *cargs[] __attribute__((unused)), int ncargs __attribute__((unused))) | ||||||||||||||||||
Gets details about the queue. ps(): Lists everything on the queue by PID ps(<object or player>): Lists PIDs enqueued by object or player's stuff ps(<PID>): Results in '<PID>:<wait status> <command>'. More... | |||||||||||||||||||
Variables | |
void(* | handler_fun_command_no_args )(dbref, dbref, int) |
void(* | handler_fun_command_one_args )(dbref, dbref, int, char *) |
void(* | handler_fun_command_two_args )(dbref, dbref, int, char *, char *) |
MONTHDAYS | mdtab [] |
Misc functions.
bool check_command | ( | dbref | player, |
char * | name, | ||
char * | buff, | ||
char ** | bufc, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Check if the player can execute a command.
player | DBref of player |
name | Name of command |
buff | Output buffer |
bufc | Output buffer tracker |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
Note that these permission checks are NOT identical to the ones in process_cmdent(). In particular, side-effects are NOT subject to the CA_GBL_INTERP flag. This is a design decision based on the concept that these are functions and not commands, even though they behave like commands in many respects. This is also the same reason why side-effects don't trigger hooks.
bool do_convtime | ( | char * | str, |
struct tm * | ttm | ||
) |
Converts time string to a struct tm.
str | Time string |
ttm | Pointer to a tm struct |
day-of-week or month
month
day of month
hours
minutes
seconds
year
We don't whether or not it's daylight savings time.
void fun_benchmark | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Benchmark softcode.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
Evaluate our times argument
Abort
void fun_case | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
This function is similar to switch(), save that it looks for an exact match between the patterns and the string, rather than doing a 'wildcard' match (case-insensitive match with '*' and '?'), and the '#$' token replacement is not done. It performs marginally faster than switch().
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
If we don't have at least 2 args, return nothing
Evaluate the target in fargs[0]
Loop through the patterns looking for an exact match
Nope, return the default if there is one
void fun_ccount | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
State of the command invocation counters.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_cdepth | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
State of the command recursion counters.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_command | ( | char *buff | __attribute__(unused), |
char **bufc | __attribute__(unused), | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref | cause, | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Strip command flags that are irrelevant.
void fun_connrecord | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Get max number of simultaneous connects.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_convsecs | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Converts seconds to time string, based off 0:00 1/1/70.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_convtime | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
converts time string to seconds, based off 0:00 1/1/70
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_create | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Creates a room, thing or exit.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_die | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Roll XdY dice.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_etimefmt | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Format a number of seconds into a human-readable time.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
Figure out time values
Try to be semi-useful. Keep value of secs; zero out the rest
Parse and print format string
save place in case we need to go back
Optional width
Show the first non-zero thing
If it's 0 and we're hidezero, just hide it. If it's 0 and we're hideearly, we only hide it if we haven't got some bigger increment that's non-zero.
Start from the first non-zero thing
void fun_fcount | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
State of the function invocation counters.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_fdepth | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
State of the function recursion counters.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_force | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref | cause, | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
This side-effect function behaves identically to the command '@force <object>=<action>'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | Not used |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_hasmodule | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Return 1 if a module is installed, 0 if it is not.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_link | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref | cause, | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
This side-effect function links an object to a location, behaving identically to the command: 'object>=<destination>'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | Not used |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_lnum | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Return a list of numbers.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
lnum() is special, since its single delimiter is really an output delimiter.
still want to generate if arg is 1
We keep 0-100 pre-generated so we can do quick copies.
If it's an ascending sequence crossing from negative numbers into positive, get the negative numbers out of the way first.
Copy as much out of the pre-gen as we can.
Print a new list.
void fun_lrand | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Generate random list.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
Special: the delim is really an output delim.
If we're generating no numbers, since this is a list function, we return empty, rather than returning 0.
This is an error condition. Just return an empty list. We obviously can't return a random number between X and Y if Y is less than X.
Just generate a list of n repetitions.
We've hit this point, we have a range. Generate a list.
void fun_modules | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int | nfargs, | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Return a list of modules.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Not used |
ncargs | Not used |
void fun_mushname | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Return the name of the Mush.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_oemit | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref | cause, | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
This side-effect function sends a message to everyone in <target>'s location with the exception of <target>, behaving identically to the command: '@oemit <target> = <string>'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | Not used |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_pemit | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
This side-effect function sends a message to the list of dbrefs, behaving identically to the command: '@pemit/list
<string>'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_ps | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Gets details about the queue. ps(): Lists everything on the queue by PID ps(<object or player>): Lists PIDs enqueued by object or player's stuff ps(<PID>): Results in '<PID>:<wait status> <command>'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
Check for the PID case first.
We either have nothing specified, or an object or player.
List all the PIDs that match.
void fun_rand | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Return a random number from 0 to arg1 - 1.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_remit | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
This side-effect function sends a message to the list of dbrefs, behaving identically to the command: '@pemit/list/contents
<string>'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_restarts | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
How many times have we restarted?
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_restarttime | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
When did we last restart?
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_s | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Force substitution to occur.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_secs | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Seconds since 0:00 1/1/70.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_set | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Sets an attribute on an object.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
obj/attr form?
must specify flag name
are we clearing?
valid attribute flag?
make sure attribute is present
can we write to attribute?
just do it!
find thing
check for attr set first
check for _
set it
set/clear a flag
void fun_starttime | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
What time did this system last reboot?
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_subeval | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Like s(), but don't do function evaluations.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_switch | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
The switch() function compares <str> against <pat1>, <pat2>, etc (allowing to match any number of characters and ? to match any 1 character), and returns the corresponding <resN> parameter for the first <patN> pattern that matches. If none match, then the default result <dflt> is returned. The evaluated value of <str> can be obtained as '#$'. If switch() and switchall() are nested, the nest level can be obtained with '#!'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
If we don't have at least 2 args, return nothing
Evaluate the target in fargs[0]
Loop through the patterns looking for a match
Nope, return the default if there is one
void fun_switchall | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
The switchall() function compares <str> against <pat1>, <pat2>, etc. (allowing * to match any number of characters and ? to match any 1 character), and returns the corresponding <resN> parameters (without any delimiters) for all <patN> patterns that match. If none match, then the default result <dflt> is returned. The evaluated value of <str> can be obtained as '#$'. If switchall() and switch() are nested, the nest level can be obtained with '#!'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
If we don't have at least 2 args, return nothing
Evaluate the target in fargs[0]
Loop through the patterns looking for a match
If we didn't match, return the default if there is one
void fun_tel | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref | cause, | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
This side-effect function teleports an object from one place to another, behaving identically to the command: '@tel <object>=<destination>'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | Not used |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_time | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Returns nicely-formatted time.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_timefmt | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char * | fargs[], | ||
int | nfargs, | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Interface to strftime().
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Not used |
ncargs | Not used |
Check number of arguments.
Construct the format string. We need to convert instances of '$' into percent signs for strftime(), unless we get a '$$', which we treat as a literal '$'. Step on '$n' as invalid (output literal 'n'), because some strftime()s use it to insert a newline.
Get the time and format it. We do this using the local timezone.
void fun_trigger | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
This side-effect function behaves identically to the command '@trigger <object>/<attribute>=<arg 0>,<arg 1>,...<arg N>'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | Not used |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_version | ( | char * | buff, |
char ** | bufc, | ||
dbref player | __attribute__(unused), | ||
dbref caller | __attribute__(unused), | ||
dbref cause | __attribute__(unused), | ||
char *fargs[] | __attribute__(unused), | ||
int nfargs | __attribute__(unused), | ||
char *cargs[] | __attribute__(unused), | ||
int ncargs | __attribute__(unused) | ||
) |
Return the MUSH version.
buff | Output buffer |
bufc | Output buffer tracker |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
void fun_wait | ( | char *buff | __attribute__(unused), |
char **bufc | __attribute__(unused), | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref | cause, | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
This side-effect function behaves identically to the command '@wait <timer>=<command>'.
buff | Not used |
bufc | Not used |
player | DBref of player |
caller | Not used |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void fun_wipe | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref caller | __attribute__(unused), | ||
dbref | cause, | ||
char * | fargs[], | ||
int nfargs | __attribute__(unused), | ||
char * | cargs[], | ||
int | ncargs | ||
) |
This side-effect function erases some or all attributes from an object, behaving identically to the command: '@wipe <object>[</wild-attr>]'.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | Not used |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Not used |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
void handle_ifelse | ( | char * | buff, |
char ** | bufc, | ||
dbref | player, | ||
dbref | caller, | ||
dbref | cause, | ||
char * | fargs[], | ||
int | nfargs, | ||
char * | cargs[], | ||
int | ncargs | ||
) |
Handle if else cases.
buff | Output buffer |
bufc | Output buffer tracker |
player | DBref of player |
caller | DBref of caller |
cause | DBref of cause |
fargs | Function's arguments |
nfargs | Number of function's arguments |
cargs | Command's arguments |
ncargs | Nomber of command's arguments |
We default to bool-style, but we offer the option of the MUX-style nonzero – it's true if it's not empty or zero.
xlate() destructively modifies the string
Not default mode: Use our condition to execute result clause
Do 'false' clause
Do 'true' clause
void list_qpids | ( | dbref | player_targ, |
dbref | obj_targ, | ||
BQUE * | queue, | ||
char * | buff, | ||
char ** | bufc, | ||
char * | bb_p | ||
) |
List the queue pids.
player_targ | DBref of target player |
obj_targ | DBref of target object |
queue | Queue |
buff | Output buffer |
bufc | Output buffer tracker |
bb_p | Original value of output buffer tracher |
MONTHDAYS mdtab[] |