TinyMUSH 3.3
TinyMUSH Server
Loading...
Searching...
No Matches
Functions
funstring.c File Reference

String functions. More...

#include "config.h"
#include "constants.h"
#include "typedefs.h"
#include "macros.h"
#include "externs.h"
#include "prototypes.h"
#include <ctype.h>
#include <string.h>
Include dependency graph for funstring.c:

Functions

void fun_isword (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)))
 Is every character in the argument a letter? More...
 
void fun_isalnum (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)))
 isalnum: is every character in the argument a letter or number? More...
 
void fun_isnum (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)))
 Is the argument a number? More...
 
void fun_isdbref (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)))
 Is the argument a valid dbref? More...
 
void fun_isobjid (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)))
 Is the argument a valid objid? More...
 
void fun_null (char *buff __attribute__((unused)), char **bufc __attribute__((unused)), 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)))
 Just eat the contents of the string. Handy for those times when you've output a bunch of junk in a function call and just want to dispose of the output (like if you've done an iter() that just did a bunch of side-effects, and now you have bunches of spaces you need to get rid of. More...
 
void fun_squish (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
 Squash occurrences of a given character down to 1. We do this both on leading and trailing chars, as well as internal ones; if the player wants to trim off the leading and trailing as well, they can always call trim(). More...
 
void fun_trim (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
 Trim off unwanted white space. More...
 
void fun_after (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 substring after a specified string. More...
 
void fun_before (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 substring before a specified string. More...
 
void fun_lcstr (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)))
 Lowercase string. More...
 
void fun_ucstr (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)))
 Uppercase string. More...
 
void fun_capstr (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)))
 Capitalize string. More...
 
void fun_space (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)))
 Make spaces. More...
 
void fun_ljust (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)))
 Left justify string, specifying fill character. More...
 
void fun_rjust (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)))
 Right justify string, specifying fill character. More...
 
void fun_center (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)))
 Center string, specifying fill character. More...
 
void fun_left (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)))
 Returns first n characters in a string. More...
 
void fun_right (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)))
 fun_right: Returns last n characters in a string More...
 
void fun_chomp (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)))
 If the line ends with CRLF, CR, or LF, chop it off. More...
 
void fun_comp (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)))
 Exact-string compare. More...
 
void fun_streq (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)))
 non-case-sensitive string compare More...
 
void fun_strmatch (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)))
 wildcard string compare More...
 
void fun_edit (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)))
 Edit text. More...
 
void fun_merge (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)))
 Given two strings and a character, merge the two strings by replacing characters in string1 that are the same as the given character by the corresponding character in string2 (by position). The strings must be of the same length. More...
 
void fun_secure (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)))
 Returns <string> after replacing the characters [](){};,%$ with spaces. More...
 
void fun_escape (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)))
 Returns <string> after adding an escape character () at the start of the string and also before each of the characters %;[]{}\ that appear in the string. More...
 
void fun_esc (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)))
 Less aggressive escape; it does not put a \ at the start of the string, and it only escapes %[]\ – making it more suitable for strings that you simply don't want evaluated. More...
 
void fun_stripchars (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
 Remove all of a set of characters from a string. More...
 
void fun_ansi (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)))
 Highlight a string using ANSI terminal effects. More...
 
void fun_stripansi (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)))
 
void crunch_code (char *code)
 
void crypt_code (char *buff, char **bufc, char *code, char *text, int type)
 
void fun_encrypt (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)))
 
void fun_decrypt (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)))
 
void fun_scramble (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)))
 
void fun_reverse (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)))
 
void fun_mid (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)))
 
void fun_translate (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)))
 
void fun_pos (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)))
 
void fun_lpos (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
 
void fun_diffpos (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)))
 
void fun_wordpos (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
 
void fun_ansipos (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)))
 
void fun_repeat (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)))
 
void perform_border (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)))
 
void perform_align (int n_cols, char **raw_colstrs, char **data, char fillc, Delim col_sep, Delim row_sep, char *buff, char **bufc)
 
void fun_align (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
 
void fun_lalign (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
 
void fun_cat (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)))
 
void fun_strcat (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)))
 
void fun_join (char *buff, char **bufc, dbref player, dbref caller, dbref cause, char *fargs[], int nfargs, char *cargs[], int ncargs)
 
void fun_strlen (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)))
 
void fun_delete (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)))
 
void fun_lit (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)))
 
void fun_art (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)))
 
void fun_alphamax (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)))
 
void fun_alphamin (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)))
 
void fun_valid (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)))
 
void fun_beep (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)))
 

Detailed Description

String functions.

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

Function Documentation

◆ fun_after()

void fun_after ( 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 substring after a specified string.

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

< haystack

< needle

Sanity-check arg1 and arg2

Get ansi state of the first needle char

Look for the needle string

See if what follows is what we are looking for

Yup, return what follows

Nope, continue searching

Ran off the end without finding it

◆ fun_ansi()

void fun_ansi ( 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) 
)

Highlight a string using ANSI terminal effects.

+colorname #RRGGBB <#RRGGBB> <RR GG BB> XTERN Old Style

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

Now that normal ansi has been done, time for xterm

Xterm colors

We are dealing with background

We are dealing with foreground

Ok we got a color to process

Now we have the color string... Time to handle it

◆ fun_before()

void fun_before ( 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 substring before a specified string.

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

< haystack

< needle

Sanity-check arg1 and arg2

Get ansi state of the first needle char

Look for the needle string

See if what follows is what we are looking for

Yup, return what came before this

Nope, continue searching

Ran off the end without finding it

◆ fun_capstr()

void fun_capstr ( 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) 
)

Capitalize string.

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

void fun_center ( 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) 
)

Center string, specifying fill character.

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

< chars left in buffer

NULL character fill

single character fill

multi character fill

we have a remainder here

no fill character specified

NULL character fill

single character fill

multi character fill

we have a remainder here

no fill character specified

◆ fun_chomp()

void fun_chomp ( 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) 
)

If the line ends with CRLF, CR, or LF, chop it off.

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

◆ fun_comp()

void fun_comp ( 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) 
)

Exact-string compare.

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

◆ fun_edit()

void fun_edit ( 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) 
)

Edit text.

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

◆ fun_esc()

void fun_esc ( 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) 
)

Less aggressive escape; it does not put a \ at the start of the string, and it only escapes %[]\ – making it more suitable for strings that you simply don't want evaluated.

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

◆ fun_escape()

void fun_escape ( 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) 
)

Returns <string> after adding an escape character () at the start of the string and also before each of the characters %;[]{}\ that appear in the string.

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

◆ fun_isalnum()

void fun_isalnum ( 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) 
)

isalnum: is every character in the argument a letter or number?

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

◆ fun_isdbref()

void fun_isdbref ( 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) 
)

Is the argument a valid dbref?

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

just the string '#' won't do!

◆ fun_isnum()

void fun_isnum ( 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) 
)

Is the argument a number?

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

◆ fun_isobjid()

void fun_isobjid ( 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) 
)

Is the argument a valid objid?

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

just the string '#' won't do!

◆ fun_isword()

void fun_isword ( 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) 
)

Is every character in the argument a letter?

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

◆ fun_lcstr()

void fun_lcstr ( 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) 
)

Lowercase string.

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

void fun_left ( 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) 
)

Returns first n characters in a string.

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

◆ fun_ljust()

void fun_ljust ( 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) 
)

Left justify string, specifying fill character.

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

Sanitize number of spaces

no padding needed, just return string

< chars left in buffer

NULL character fill

single character fill

multi character fill

we have a remainder here

no fill character specified

◆ fun_merge()

void fun_merge ( 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) 
)

Given two strings and a character, merge the two strings by replacing characters in string1 that are the same as the given character by the corresponding character in string2 (by position). The strings must be of the same length.

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

do length checks first

find the character to look for. null character is considered a space

walk strings, copy from the appropriate string

◆ fun_null()

void fun_null ( char *buff   __attribute__(unused),
char **bufc   __attribute__(unused),
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) 
)

Just eat the contents of the string. Handy for those times when you've output a bunch of junk in a function call and just want to dispose of the output (like if you've done an iter() that just did a bunch of side-effects, and now you have bunches of spaces you need to get rid of.

Parameters
buffNot used
bufcNot used
playerNot used
callerNot used
causeNot used
fargsNot used
nfargsNot used
cargsNot used
ncargsNot used

◆ fun_right()

void fun_right ( 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) 
)

fun_right: Returns last n characters in a string

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

◆ fun_rjust()

void fun_rjust ( 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) 
)

Right justify string, specifying fill character.

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

Sanitize number of spaces

no padding needed, just return string

< chars left in buffer

NULL character fill

single character fill

multi character fill

we have a remainder here

no fill character specified

◆ fun_secure()

void fun_secure ( 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) 
)

Returns <string> after replacing the characters [](){};,%$ with spaces.

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

◆ fun_space()

void fun_space ( 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) 
)

Make spaces.

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

If negative or zero spaces return a single space, -except- allow 'space(0)' to return "" for calculated padding

◆ fun_squish()

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

Squash occurrences of a given character down to 1. We do this both on leading and trailing chars, as well as internal ones; if the player wants to trim off the leading and trailing as well, they can always call trim().

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

Move over and copy the non-sep characters

If we've reached the end of the string, leave the loop.

Otherwise, we've hit a sep char. Move over it, and then move on to the next non-separator. Note that we're overwriting our own string as we do this. However, the other pointer will always be ahead of our current copy pointer.

Must terminate the string

◆ fun_streq()

void fun_streq ( 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) 
)

non-case-sensitive string compare

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

◆ fun_stripchars()

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

Remove all of a set of characters from a string.

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

Output delimiter should default to null, not a space

◆ fun_strmatch()

void fun_strmatch ( 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) 
)

wildcard string compare

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

Check if we match the whole string. If so, return 1

◆ fun_trim()

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

Trim off unwanted white space.

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

Single-character delimiters are easy.

Multi-character delimiters take more work.

< last char in string

◆ fun_ucstr()

void fun_ucstr ( 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) 
)

Uppercase string.

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