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

Attribute interface, some flatfile and object routines. 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 <fcntl.h>
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
Include dependency graph for db.c:

Functions

void tf_xclose (FILE *fd)
 Close file/stream. More...
 
int tf_fiddle (int tfd)
 Fiddle file/stream. More...
 
int tf_xopen (char *fname, int mode)
 Open a file. More...
 
const char * mode_txt (int mode)
 Convert mode to char mode. More...
 
void tf_init (void)
 Initialize tf file handler. More...
 
int tf_open (char *fname, int mode)
 Open file. More...
 
void tf_close (int fdes __attribute__((unused)))
 Close file. More...
 
FILE * tf_fopen (char *fname, int mode)
 Open file. More...
 
void tf_fclose (FILE *fd __attribute__((unused)))
 Close file. More...
 
FILE * tf_popen (char *fname, int mode)
 Open file. More...
 
int fwdlist_ck (int, dbref, dbref, int, char *)
 
int propdir_ck (int, dbref, dbref, int, char *)
 
void fwdlist_set (dbref thing, FWDLIST *ifp)
 Set cached forwarding lists. More...
 
void fwdlist_clr (dbref thing)
 Clear cached forwarding lists. More...
 
int fwdlist_load (FWDLIST *fp, dbref player, char *atext)
 Load text into a forwardlist. More...
 
int fwdlist_rewrite (FWDLIST *fp, char *atext)
 Generate a text string from a FWDLIST buffer. More...
 
int fwdlist_ck (int key __attribute__((unused)), dbref player, dbref thing, int anum __attribute__((unused)), char *atext)
 Check a list of dbref numbers to forward to for AUDIBLE. More...
 
FWDLISTfwdlist_get (dbref thing)
 Fetch a forward list. More...
 
void propdir_set (dbref thing, PROPDIR *ifp)
 Set propdir. More...
 
void propdir_clr (dbref thing)
 Clear a propdir. More...
 
int propdir_load (PROPDIR *fp, dbref player, char *atext)
 Load a propdir. More...
 
int propdir_rewrite (PROPDIR *fp, char *atext)
 Rewrite a propdir. More...
 
int propdir_ck (int key __attribute__((unused)), dbref player, dbref thing, int anum __attribute__((unused)), char *atext)
 Check a popdir. More...
 
PROPDIRpropdir_get (dbref thing)
 Fetch a Propdir. More...
 
void safe_name (dbref thing, char *outbuf, char **bufc)
 Sanitize a name. More...
 
char * Name (dbref thing)
 Get the name of a thing. More...
 
char * PureName (dbref thing)
 Get the pure name (no ansi) of the thing. More...
 
void s_Name (dbref thing, char *s)
 Set the name of the thing. More...
 
void safe_exit_name (dbref it, char *buff, char **bufc)
 Sanitize an exit name. More...
 
void s_Pass (dbref thing, const char *s)
 Add a raw attribute to a thing. More...
 
void do_attribute (dbref player, dbref cause __attribute__((unused)), int key, char *aname, char *value)
 Manage user-named attributes. More...
 
void do_fixdb (dbref player, dbref cause __attribute__((unused)), int key, char *arg1, char *arg2)
 Directly edit database fields. More...
 
void init_attrtab (void)
 Initialize the attribute hash tables. More...
 
ATTRatr_str (char *s)
 Look up an attribute by name. More...
 
void anum_extend (int newtop)
 Grow the attr num lookup table. More...
 
ATTRatr_num (int anum)
 Look up an attribute by number. More...
 
int mkattr (char *buff)
 Lookup attribute by name, creating if needed. More...
 
int al_decode (char **app)
 Fetch an attribute number from an alist. More...
 
void al_code (char **app, int atrnum)
 Store an attribute number in an alist. More...
 
bool Commer (dbref thing)
 check if an object has any $-commands in its attributes. More...
 
void al_extend (char **buffer, int *bufsiz, int len, bool copy)
 Get more space for attributes, if needed. More...
 
int al_size (char *astr)
 Return length of attribute list in chars. More...
 
void al_store (void)
 Write modified attribute list. More...
 
char * al_fetch (dbref thing)
 Load attribute list. More...
 
void al_add (dbref thing, int attrnum)
 Add an attribute to an attribute list. More...
 
void al_delete (dbref thing, int attrnum)
 Remove an attribute from an attribute list. More...
 
void makekey (dbref thing, int atr, UDB_ANAME *abuff)
 Make a key. More...
 
void al_destroy (dbref thing)
 wipe out an object's attribute list. More...
 
char * atr_encode (char *iattr, dbref thing, dbref owner, int flags, int atr __attribute__((unused)))
 Encode an attribute string. More...
 
void atr_decode (char *iattr, char *oattr, dbref thing, dbref *owner, int *flags, int atr __attribute__((unused)), int *alen)
 Decode an attribute string. More...
 
void atr_clr (dbref thing, int atr)
 clear an attribute in the list. More...
 
void atr_add_raw (dbref thing, int atr, char *buff)
 add attribute of type atr to list More...
 
void atr_add (dbref thing, int atr, char *buff, dbref owner, int flags)
 add attribute of type atr to list More...
 
void atr_set_owner (dbref thing, int atr, dbref owner)
 Set owner of attribute. More...
 
void atr_set_flags (dbref thing, int atr, dbref flags)
 Set flag of attribute. More...
 
char * atr_get_raw (dbref thing, int atr)
 Get an attribute from the database. More...
 
char * atr_get_str (char *s, dbref thing, int atr, dbref *owner, int *flags, int *alen)
 Get an attribute from the database. More...
 
char * atr_get (dbref thing, int atr, dbref *owner, int *flags, int *alen)
 Get an attribute from the database. More...
 
bool atr_get_info (dbref thing, int atr, dbref *owner, int *flags)
 Get information about an attribute. More...
 
char * atr_pget_str (char *s, dbref thing, int atr, dbref *owner, int *flags, int *alen)
 Get a propdir attribute. More...
 
char * atr_pget (dbref thing, int atr, dbref *owner, int *flags, int *alen)
 
More...
 
int atr_pget_info (dbref thing, int atr, dbref *owner, int *flags)
 Get information about a propdir attribute. More...
 
void atr_free (dbref thing)
 Remove all attributes of an object. More...
 
void atr_cpy (dbref player __attribute__((unused)), dbref dest, dbref source)
 Copy all attributes from one object to another. Takes the player argument to ensure that only attributes that COULD be set by the player are copied. More...
 
void atr_chown (dbref obj)
 Change the ownership of the attributes of an object to the current owner if they are not locked. More...
 
int atr_next (char **attrp)
 Return next attribute in attribute list. More...
 
void atr_push (void)
 Push attr lists. More...
 
void atr_pop (void)
 Pop attr lists. More...
 
int atr_head (dbref thing, char **attrp)
 Returns the head of the attr list for object 'thing'. More...
 
void initialize_objects (dbref first, dbref last)
 Initialize an object. More...
 
void db_grow (dbref newtop)
 Extend the struct database. More...
 
void db_free (void)
 Free a DB. More...
 
void db_make_minimal (void)
 Create a minimal DB. More...
 
dbref parse_dbref_only (const char *s)
 Enforce completely numeric dbrefs. More...
 
dbref parse_objid (const char *s, const char *p)
 Parse an object id. More...
 
dbref parse_dbref (const char *s)
 Parse string for dbref. More...
 
void putstring (FILE *f, const char *s)
 Write string to file, escaping char as needed. More...
 
void putref (FILE *f, int d)
 
void putlong (FILE *f, long l)
 
char * getstring (FILE *f, bool new_strings)
 Read a trring from file, unescaping char as needed. More...
 
dbref getref (FILE *f)
 Get dbref from file. More...
 
long getlong (FILE *f)
 Get long int from file. More...
 
int init_gdbm_db (char *gdbmfile)
 Initializing a GDBM file. More...
 
bool check_zone (dbref player, dbref thing)
 checks back through a zone tree for control More...
 
bool check_zone_for_player (dbref player, dbref thing)
 
void dump_restart_db (void)
 Write a restart db. More...
 
void load_restart_db (void)
 Load a restart DB. More...
 

Variables

OBJdb = NULL
 
NAMEnames = NULL
 
NAMEpurenames = NULL
 
int sock
 
int ndescriptors
 
int maxd
 
FILE * t_fd
 
bool t_is_pipe = false
 
ATTR ** anum_table = NULL
 
int anum_alc_top = 0
 

Detailed Description

Attribute interface, some flatfile and object routines.

Author
TinyMUSH development team (https://github.com/TinyMUSH)
Version
3.3
Date
2020-12-28

Function Documentation

◆ al_add()

void al_add ( dbref  thing,
int  attrnum 
)

Add an attribute to an attribute list.

Parameters
thingDBref of thing
attrnumAttribute number

If trying to modify List attrib, return. Otherwise, get the attribute list.

See if attr is in the list. If so, exit (need not do anything)

Nope, extend it

extend returned different buffer, re-find the end

Add the new attribute on to the end

◆ al_code()

void al_code ( char **  app,
int  atrnum 
)

Store an attribute number in an alist.

Parameters
appAttribute list
atrnumAttribute number

◆ al_decode()

int al_decode ( char **  app)

Fetch an attribute number from an alist.

Parameters
appAttribute list
Returns
int

◆ al_delete()

void al_delete ( dbref  thing,
int  attrnum 
)

Remove an attribute from an attribute list.

Parameters
thingDBref of thing
attrnumAttribute number

If trying to modify List attrib, return. Otherwise, get the attribute list.

◆ al_destroy()

void al_destroy ( dbref  thing)

wipe out an object's attribute list.

Parameters
thingDBref of thing

remove from cache

◆ al_extend()

void al_extend ( char **  buffer,
int *  bufsiz,
int  len,
bool  copy 
)

Get more space for attributes, if needed.

Parameters
bufferAttribute buffer
bufsizBuffer size
lenLength
copyCopy buffer content to the extended buffer?

◆ al_fetch()

char * al_fetch ( dbref  thing)

Load attribute list.

Parameters
thingDBref of thing
Returns
char*

We only need fetch if we change things

Fetch and set up the attribute list

◆ al_size()

int al_size ( char *  astr)

Return length of attribute list in chars.

Parameters
astrAttribute list
Returns
int

◆ al_store()

void al_store ( void  )

Write modified attribute list.

◆ anum_extend()

void anum_extend ( int  newtop)

Grow the attr num lookup table.

Parameters
newtopNew size

◆ atr_add()

void atr_add ( dbref  thing,
int  atr,
char *  buff,
dbref  owner,
int  flags 
)

add attribute of type atr to list

Parameters
thingDBref of thing
atrAttribute type
buffAttribute buffer
ownerDBref of owner
flagsAttribute flags

◆ atr_add_raw()

void atr_add_raw ( dbref  thing,
int  atr,
char *  buff 
)

add attribute of type atr to list

Parameters
thingDBref of thing
atrAttribute type
buffAttribute buffer

Delete the entry from cache

Store the value in cache

◆ atr_chown()

void atr_chown ( dbref  obj)

Change the ownership of the attributes of an object to the current owner if they are not locked.

Parameters
objDBref of object

◆ atr_clr()

void atr_clr ( dbref  thing,
int  atr 
)

clear an attribute in the list.

Parameters
thingDBref of thing
atrAttribute number

Delete the entry from cache

◆ atr_cpy()

void atr_cpy ( dbref player   __attribute__(unused),
dbref  dest,
dbref  source 
)

Copy all attributes from one object to another. Takes the player argument to ensure that only attributes that COULD be set by the player are copied.

Parameters
playerDBref of player
destDBref of source
sourceDBref of destination

change owner

Only set attrs that owner has perm to set

◆ atr_decode()

void atr_decode ( char *  iattr,
char *  oattr,
dbref  thing,
dbref *  owner,
int *  flags,
int atr   __attribute__(unused),
int *  alen 
)

Decode an attribute string.

Parameters
iattrInput attribute string
oattrOutput attribute string
thingDBref of thing
ownerDBref of owner
flagsFlags
atrAttribute number
alenAttribute len

See if the first char of the attribute is the special character

It is, crack the attr apart

Get the attribute owner

If delimiter is not ':', just return attribute

Get the attribute flags

If delimiter is not ':', just return attribute

Get the attribute text

Not the special character, return normal info

◆ atr_encode()

char * atr_encode ( char *  iattr,
dbref  thing,
dbref  owner,
int  flags,
int atr   __attribute__(unused) 
)

Encode an attribute string.

Parameters
iattrAttribute string
thingDBref of thing
ownerDBref of owner
flagsFlags
atrAttribute numbrer
Returns
char*

If using the default owner and flags (almost all attributes will), just store the string.

Encode owner and flags into the attribute text

◆ atr_free()

void atr_free ( dbref  thing)

Remove all attributes of an object.

Parameters
thingDBref of thing

Just to be on the safe side

◆ atr_get()

char * atr_get ( dbref  thing,
int  atr,
dbref *  owner,
int *  flags,
int *  alen 
)

Get an attribute from the database.

Parameters
thingDBref of thing
atrAttribute type
ownerDBref of owner
flagsFlags
alenAttribute length
Returns
char*

◆ atr_get_info()

bool atr_get_info ( dbref  thing,
int  atr,
dbref *  owner,
int *  flags 
)

Get information about an attribute.

Parameters
thingDBref of thing
atrAttribute type
ownerDBref of owner
flagsFlags
Returns
bool

◆ atr_get_raw()

char * atr_get_raw ( dbref  thing,
int  atr 
)

Get an attribute from the database.

Parameters
thingDBref of thing
atrAttribute type
Returns
char*

Fetch the entry from cache and return it

◆ atr_get_str()

char * atr_get_str ( char *  s,
dbref  thing,
int  atr,
dbref *  owner,
int *  flags,
int *  alen 
)

Get an attribute from the database.

Parameters
sString buffer
thingDBref of thing
atrAttribute type
ownerDBref of owner
flagsAttribute flag
alenAttribute length
Returns
char*

◆ atr_head()

int atr_head ( dbref  thing,
char **  attrp 
)

Returns the head of the attr list for object 'thing'.

Parameters
thingDBref of thing
attrpAttribute
Returns
int

Get attribute list. Save a read if it is in the modify atr list

If no list, return nothing

Set up the list and return the first entry

◆ atr_next()

int atr_next ( char **  attrp)

Return next attribute in attribute list.

Parameters
attrp
Returns
int

◆ atr_num()

ATTR * atr_num ( int  anum)

Look up an attribute by number.

Parameters
anumAttribute number
Returns
ATTR*
Todo:
Should return a buffer instead of a static pointer

Look for a predefined attribute

It's a user-defined attribute, we need to copy data

All failed, return NULL

◆ atr_pget()

char * atr_pget ( dbref  thing,
int  atr,
dbref *  owner,
int *  flags,
int *  alen 
)

Get a propdir attribute

Parameters
thingDBref of thing
atrAttribute type
ownerOwner of thing
flagsFlags
alenAttribute length
Returns
char*

◆ atr_pget_info()

int atr_pget_info ( dbref  thing,
int  atr,
dbref *  owner,
int *  flags 
)

Get information about a propdir attribute.

Parameters
thingDBref of thing
atrAttribute type
ownerDBref of owner
flagsFlags
Returns
int

◆ atr_pget_str()

char * atr_pget_str ( char *  s,
dbref  thing,
int  atr,
dbref *  owner,
int *  flags,
int *  alen 
)

Get a propdir attribute.

Parameters
sString buffer
thingDBref of thing
atrAttribute type
ownerOwner of thing
flagsFlags
alenAttribute length
Returns
char*

◆ atr_pop()

void atr_pop ( void  )

Pop attr lists.

◆ atr_push()

void atr_push ( void  )

Push attr lists.

◆ atr_set_flags()

void atr_set_flags ( dbref  thing,
int  atr,
dbref  flags 
)

Set flag of attribute.

Parameters
thingDBref of thing
atrAttribute type
flagsFlags

◆ atr_set_owner()

void atr_set_owner ( dbref  thing,
int  atr,
dbref  owner 
)

Set owner of attribute.

Parameters
thingDBref of thing
atrAttribute type
ownerDBref of owner

◆ atr_str()

ATTR * atr_str ( char *  s)

Look up an attribute by name.

Parameters
sAttribute name
Returns
ATTR*
Todo:
Should return a buffer instead of a static pointer
Todo:
Should return a buffer instead of a static pointer

Convert the buffer name to uppercase. Limit length of name.

Look for a predefined attribute

Nope, look for a user attribute

If we got one, load tattr and return a pointer to it.

No exact match, try for a prefix match on predefined attribs. Check for both longer versions and shorter versions.

All failed, return NULL

◆ check_zone()

bool check_zone ( dbref  player,
dbref  thing 
)

checks back through a zone tree for control

Parameters
player
thing
Returns
bool

We check Control_OK on the thing itself, not on its ZMO that allows us to have things default into a zone without needing to be controlled by that ZMO.

If the zone doesn't have a ControlLock, DON'T allow control.

◆ Commer()

bool Commer ( dbref  thing)

check if an object has any $-commands in its attributes.

Parameters
thingDBref of thing
Returns
int

◆ db_free()

void db_free ( void  )

Free a DB.

◆ db_grow()

void db_grow ( dbref  newtop)

Extend the struct database.

Parameters
newtopNew top of database

Determine what to do based on requested size, current top and size. Make sure we grow in reasonable-size chunks to prevent frequent reallocations of the db array.

If requested size is smaller than the current db size, ignore it

If requested size is greater than the current db size but smaller than the amount of space we have allocated, raise the db size and initialize the new area.

Grow by a minimum of delta objects

Enforce minimum database size

Grow the name tables

An old name cache exists. Copy it.

Creating a brand new struct database. Fill in the 'reserved' area in case it gets referenced.

An old name cache exists. Copy it.

Creating a brand new struct database. Fill in the 'reserved' area in case it gets referenced.

Grow the db array

An old struct database exists. Copy it to the new buffer

Creating a brand new struct database. Fill in the 'reserved' area in case it gets referenced.

Go do the rest of the things

Call all modules

Grow the db mark buffer

◆ db_make_minimal()

void db_make_minimal ( void  )

Create a minimal DB.

should be #1

Manually link to Limbo, just in case

◆ do_attribute()

void do_attribute ( dbref  player,
dbref cause   __attribute__(unused),
int  key,
char *  aname,
char *  value 
)

Manage user-named attributes.

Parameters
playerDBref of player
causeDBref of cause
keyKey
anameAttribute name
valueValue

Look up the user-named attribute we want to play with. Note vattr names have a limited size.

Modify access to user-named attribute

Check for negation

Set or clear the appropriate bit

Set the dirty bit

Get the next token

Make sure the new name doesn't already exist

Remove the attribute

Print info, like @list user_attr does

◆ do_fixdb()

void do_fixdb ( dbref  player,
dbref cause   __attribute__(unused),
int  key,
char *  arg1,
char *  arg2 
)

Directly edit database fields.

Parameters
playerDBref of plauyer
causeDBref of cause
keyKey
arg1Argument 1
arg2Argument 2

◆ dump_restart_db()

void dump_restart_db ( void  )

Write a restart db.

We maintain a version number for the restart database, so we can restart even if the format of the restart db has been changed in the new executable.

◆ fwdlist_ck() [1/2]

int fwdlist_ck ( int key   __attribute__(unused),
dbref  player,
dbref  thing,
int anum   __attribute__(unused),
char *  atext 
)

Check a list of dbref numbers to forward to for AUDIBLE.

Parameters
keyKey
playerDBref of player
thingDBref of thing
anumAttribute
atextAttribute text
Returns
int

Set the cached forwardlist

◆ fwdlist_ck() [2/2]

int fwdlist_ck ( int  ,
dbref  ,
dbref  ,
int  ,
char *   
)

Check routine forward declaration.

◆ fwdlist_clr()

void fwdlist_clr ( dbref  thing)

Clear cached forwarding lists.

Parameters
thingDBref of thing

If a forwardlist exists, delete it

◆ fwdlist_get()

FWDLIST * fwdlist_get ( dbref  thing)

Fetch a forward list.

Parameters
thingDBref of thing
Returns
FWDLIST*

◆ fwdlist_load()

int fwdlist_load ( FWDLIST fp,
dbref  player,
char *  atext 
)

Load text into a forwardlist.

Parameters
fpForward list
playerDBref of player
atextText
Returns
int

skip spaces

remember string

terminate string

◆ fwdlist_rewrite()

int fwdlist_rewrite ( FWDLIST fp,
char *  atext 
)

Generate a text string from a FWDLIST buffer.

Parameters
fpForward list
atextText buffer
Returns
int

◆ fwdlist_set()

void fwdlist_set ( dbref  thing,
FWDLIST ifp 
)

Set cached forwarding lists.

Parameters
thingDBref of thing
ifpForward list

If fwdlist is null, clear

Copy input forwardlist to a correctly-sized buffer

Replace an existing forwardlist, or add a new one

the add or replace failed

◆ getlong()

long getlong ( FILE *  f)

Get long int from file.

Parameters
fFile
Returns
long

◆ getref()

dbref getref ( FILE *  f)

Get dbref from file.

Parameters
fFile
Returns
dbref

◆ getstring()

char * getstring ( FILE *  f,
bool  new_strings 
)

Read a trring from file, unescaping char as needed.

Parameters
fFile
new_strings
Returns
char*

If EOF or null, return

If a newline, return if prior char is not a cr. Otherwise keep on truckin'

◆ init_attrtab()

void init_attrtab ( void  )

Initialize the attribute hash tables.

◆ init_gdbm_db()

int init_gdbm_db ( char *  gdbmfile)

Initializing a GDBM file.

Parameters
gdbmfileFilename
Returns
int

Calculate proper database block size

◆ initialize_objects()

void initialize_objects ( dbref  first,
dbref  last 
)

Initialize an object.

Parameters
firstDBref of first object to initialize
lastDBref of last object to initialize

◆ load_restart_db()

void load_restart_db ( void  )

Load a restart DB.

Note that d->address is NOT INITIALIZED, and it DOES get used later, particularly when checking logout.

In case we've had anything bizarre happen...

◆ makekey()

void makekey ( dbref  thing,
int  atr,
UDB_ANAME abuff 
)

Make a key.

Parameters
thingDBref of thing
atrAttribute number
abuffAttribute buffer

◆ mkattr()

int mkattr ( char *  buff)

Lookup attribute by name, creating if needed.

Parameters
buffAttribute name
Returns
int

Unknown attr, create a new one. Check if it matches any attribute type pattern that we have defined; if it does, give it those flags. Otherwise, use the default vattr flags.

◆ mode_txt()

const char * mode_txt ( int  mode)

Convert mode to char mode.

Parameters
mode
Returns
const char*

◆ Name()

char * Name ( dbref  thing)

Get the name of a thing.

Parameters
thingDBref of the thing
Returns
char*

◆ parse_dbref()

dbref parse_dbref ( const char *  s)

Parse string for dbref.

Parameters
sString
Returns
dbref

Either pure dbrefs or objids are okay

◆ parse_dbref_only()

dbref parse_dbref_only ( const char *  s)

Enforce completely numeric dbrefs.

Parameters
sString to check
Returns
dbref

◆ parse_objid()

dbref parse_objid ( const char *  s,
const char *  p 
)

Parse an object id.

Parameters
sString
pPointer to ':' in string
Returns
dbref

We're passed two parameters: the start of the string, and the pointer to where the ':' in the string is. If the latter is NULL, go find it.

ObjID takes the format <dbref>:<timestamp as long int> If we match the dbref but its creation time doesn't match the timestamp, we don't have a match.

◆ propdir_ck()

int propdir_ck ( int key   __attribute__(unused),
dbref  player,
dbref  thing,
int anum   __attribute__(unused),
char *  atext 
)

Check a popdir.

Parameters
keyKey
playerDBref of player
thingDBref of thing
anumAttribute
atextAttribute text
Returns
int

Set the cached propdir

◆ propdir_clr()

void propdir_clr ( dbref  thing)

Clear a propdir.

Parameters
thingDBref of thing

If a propdir exists, delete it

◆ propdir_get()

PROPDIR * propdir_get ( dbref  thing)

Fetch a Propdir.

Parameters
thingDBref of thing
Returns
PROPDIR*

◆ propdir_load()

int propdir_load ( PROPDIR fp,
dbref  player,
char *  atext 
)

Load a propdir.

Parameters
fpPropdir
playerDBref of player
atextText
Returns
int

skip spaces

remember string

terminate string

◆ propdir_rewrite()

int propdir_rewrite ( PROPDIR fp,
char *  atext 
)

Rewrite a propdir.

Parameters
fpPropdir
atextText
Returns
int

◆ propdir_set()

void propdir_set ( dbref  thing,
PROPDIR ifp 
)

Set propdir.

Parameters
thingDBref of thing
ifpPropdir.

If propdir list is null, clear

Copy input propdir to a correctly-sized buffer

Replace an existing propdir, or add a new one

the add or replace failed

◆ PureName()

char * PureName ( dbref  thing)

Get the pure name (no ansi) of the thing.

Parameters
thingDBref of the thing
Returns
char*

◆ putstring()

void putstring ( FILE *  f,
const char *  s 
)

Write string to file, escaping char as needed.

Parameters
fFile
sString

◆ s_Name()

void s_Name ( dbref  thing,
char *  s 
)

Set the name of the thing.

Parameters
thingDBref of thing
sName

Truncate the name if we have to

◆ s_Pass()

void s_Pass ( dbref  thing,
const char *  s 
)

Add a raw attribute to a thing.

Parameters
thingDBref of the thing
sAttribute

◆ safe_exit_name()

void safe_exit_name ( dbref  it,
char *  buff,
char **  bufc 
)

Sanitize an exit name.

Parameters
itDBref of exit
buffBuffer
bufcTracking buffer

◆ safe_name()

void safe_name ( dbref  thing,
char *  outbuf,
char **  bufc 
)

Sanitize a name.

Parameters
thingThing to check name
outbufOutput buffer
bufcTracking buffer

Retrieving a name never counts against an object's access time.

◆ tf_close()

void tf_close ( int fdes   __attribute__(unused))

Close file.

Parameters
fdesFile descriptor

◆ tf_fclose()

void tf_fclose ( FILE *fd   __attribute__(unused))

Close file.

Parameters
fdFile descriptor

◆ tf_fiddle()

int tf_fiddle ( int  tfd)

Fiddle file/stream.

Parameters
tfdDescriptor
Returns
int

◆ tf_fopen()

FILE * tf_fopen ( char *  fname,
int  mode 
)

Open file.

Parameters
fnameFile
modeMode
Returns
FILE*

◆ tf_init()

void tf_init ( void  )

Initialize tf file handler.

◆ tf_open()

int tf_open ( char *  fname,
int  mode 
)

Open file.

Parameters
fnameFilename
modeMode
Returns
int

◆ tf_popen()

FILE * tf_popen ( char *  fname,
int  mode 
)

Open file.

Parameters
fnameFile
modeFile mode
Returns
FILE*

◆ tf_xclose()

void tf_xclose ( FILE *  fd)

Close file/stream.

Parameters
fd

◆ tf_xopen()

int tf_xopen ( char *  fname,
int  mode 
)

Open a file.

Parameters
fnameFilename
modeMode
Returns
int

Variable Documentation

◆ anum_alc_top

int anum_alc_top = 0

Top of attr num lookup table

◆ db

OBJ* db = NULL

Restart definitions struct database

◆ maxd

int maxd
extern

Max Descriptors

◆ names

NAME* names = NULL

Name buffer

◆ ndescriptors

int ndescriptors
extern

New Descriptor

◆ purenames

NAME* purenames = NULL

Pure Name Buffer

◆ sock

int sock
extern
Attention
Since this is the core of the whole show, better keep theses globals. Game socket

◆ t_fd

FILE* t_fd

Main BD file descriptor

◆ t_is_pipe

bool t_is_pipe = false

Are we piping from stdin?