TinyMUSH 3.3
TinyMUSH Server
Loading...
Searching...
No Matches
Functions | Variables
funmisc.c File Reference

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>
Include dependency graph for funmisc.c:

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.

Parameters
buffNot used
bufcNot used
playerDBref of player
callerNot used
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments
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 []
 

Detailed Description

Misc functions.

Author
TinyMUSH development team (https://github.com/TinyMUSH)
Version
3.3
Date
2021-01-04

Function Documentation

◆ check_command()

bool check_command ( dbref  player,
char *  name,
char *  buff,
char **  bufc,
char *  cargs[],
int  ncargs 
)

Check if the player can execute a command.

Parameters
playerDBref of player
nameName of command
buffOutput buffer
bufcOutput buffer tracker
cargsCommand's arguments
ncargsNomber of command's arguments
Returns
true User can execute the command
false User is not allowed to used the command

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.

◆ do_convtime()

bool do_convtime ( char *  str,
struct tm *  ttm 
)

Converts time string to a struct tm.

Note
Time string format is always 24 characters long, in format Ddd Mmm DD HH:MM:SS YYYY
Parameters
strTime string
ttmPointer to a tm struct
Returns
true Converted
false Something went wrong

day-of-week or month

month

day of month

hours

minutes

seconds

year

We don't whether or not it's daylight savings time.

◆ fun_benchmark()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

Evaluate our times argument

Abort

◆ fun_case()

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().

Note
This functions expect that its arguments has not been evaluated.
Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber 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

◆ fun_ccount()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_cdepth()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_command()

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.

◆ fun_connrecord()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_convsecs()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_convtime()

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

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_create()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_die()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_etimefmt()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot 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

◆ fun_fcount()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_fdepth()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_force()

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>'.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerNot used
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_hasmodule()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_link()

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>'.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerNot used
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_lnum()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber 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.

◆ fun_lrand()

void fun_lrand ( char *  buff,
char **  bufc,
dbref  player,
dbref  caller,
dbref  cause,
char *  fargs[],
int  nfargs,
char *  cargs[],
int  ncargs 
)

Generate random list.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber 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.

◆ fun_modules()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNumber of function's arguments
cargsNot used
ncargsNot used

◆ fun_mushname()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_oemit()

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>'.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerNot used
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_pemit()

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>'.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_ps()

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>'.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

Check for the PID case first.

We either have nothing specified, or an object or player.

List all the PIDs that match.

◆ fun_rand()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_remit()

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>'.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_restarts()

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?

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_restarttime()

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?

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_s()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_secs()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_set()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerNot used
causeNot used
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber 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

◆ fun_starttime()

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?

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_subeval()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_switch()

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 '#!'.

Note
This functions expect that its arguments has not been evaluated.
Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber 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

◆ fun_switchall()

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 '#!'.

Note
This functions expect that its arguments has not been evaluated.
Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber 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

◆ fun_tel()

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>'.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerNot used
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_time()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_timefmt()

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().

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsFunction's arguments
nfargsNumber of function's arguments
cargsNot used
ncargsNot 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.

◆ fun_trigger()

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>'.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerNot used
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_version()

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.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_wait()

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>'.

Parameters
buffNot used
bufcNot used
playerDBref of player
callerNot used
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

◆ fun_wipe()

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>]'.

Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerNot used
causeDBref of cause
fargsFunction's arguments
nfargsNot used
cargsCommand's arguments
ncargsNomber of command's arguments

◆ handle_ifelse()

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.

Note
This functions expect that its arguments has not been evaluated.
Parameters
buffOutput buffer
bufcOutput buffer tracker
playerDBref of player
callerDBref of caller
causeDBref of cause
fargsFunction's arguments
nfargsNumber of function's arguments
cargsCommand's arguments
ncargsNomber 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

◆ list_qpids()

void list_qpids ( dbref  player_targ,
dbref  obj_targ,
BQUE queue,
char *  buff,
char **  bufc,
char *  bb_p 
)

List the queue pids.

Parameters
player_targDBref of target player
obj_targDBref of target object
queueQueue
buffOutput buffer
bufcOutput buffer tracker
bb_pOriginal value of output buffer tracher

Variable Documentation

◆ mdtab

MONTHDAYS mdtab[]
Initial value:
= {
{(char *)"Jan", 31},
{(char *)"Feb", 29},
{(char *)"Mar", 31},
{(char *)"Apr", 30},
{(char *)"May", 31},
{(char *)"Jun", 30},
{(char *)"Jul", 31},
{(char *)"Aug", 31},
{(char *)"Sep", 30},
{(char *)"Oct", 31},
{(char *)"Nov", 30},
{(char *)"Dec", 31}}