TinyMUSH 3.3
TinyMUSH Server
|
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>
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))) |
String functions.
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.
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 |
< 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
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
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 |
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
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.
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 |
< 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
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.
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_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.
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 |
< 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
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.
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_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.
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_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.
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_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.
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_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.
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_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?
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_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?
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 |
just the string '#' won't do!
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?
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_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?
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 |
just the string '#' won't do!
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?
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_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.
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_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.
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_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.
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 |
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
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.
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 |
do length checks first
find the character to look for. null character is considered a space
walk strings, copy from the appropriate string
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.
buff | Not used |
bufc | Not used |
player | Not used |
caller | Not used |
cause | Not used |
fargs | Not used |
nfargs | Not used |
cargs | Not used |
ncargs | Not used |
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
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_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.
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 |
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
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.
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_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.
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 |
If negative or zero spaces return a single space, -except- allow 'space(0)' to return "" for calculated padding
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().
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 |
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
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
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_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.
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 |
Output delimiter should default to null, not a space
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
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 |
Check if we match the whole string. If so, return 1
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.
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 |
Single-character delimiters are easy.
Multi-character delimiters take more work.
< last char in string
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.
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 |