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

File cache management. More...

#include "config.h"
#include "constants.h"
#include "typedefs.h"
#include "macros.h"
#include "externs.h"
#include "prototypes.h"
#include <stdbool.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
Include dependency graph for file_c.c:

Functions

void do_list_file (dbref player, dbref cause __attribute__((unused)), int extra __attribute__((unused)), char *arg)
 Show text file. More...
 
FBLOCKfcache_fill (FBLOCK *fp, char ch)
 Add date to a file block. More...
 
int fcache_read (FBLOCK **cp, char *filename)
 Read a file into cache. More...
 
void fcache_rawdump (int fd, int num)
 Raw dump a cache file to a file descriptor. More...
 
void fcache_dump (DESC *d, int num)
 Dump a file to a descriptor. More...
 
void fcache_send (dbref player, int num)
 Send the content of a file cache to a player. More...
 
void fcache_load (dbref player)
 Load all files into cache. More...
 
void fcache_init (void)
 Initialize the file cache. More...
 

Variables

FCACHE fcache []
 Text files cache. More...
 

Detailed Description

File cache management.

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

Function Documentation

◆ do_list_file()

void do_list_file ( dbref  player,
dbref cause   __attribute__(unused),
int extra   __attribute__(unused),
char *  arg 
)

Show text file.

Parameters
playerDBref of player
causeNot used
extraNot used
argFile to show

◆ fcache_dump()

void fcache_dump ( DESC d,
int  num 
)

Dump a file to a descriptor.

Parameters
dDescriptor
numIndex of the file in the file cache

◆ fcache_fill()

FBLOCK * fcache_fill ( FBLOCK fp,
char  ch 
)

Add date to a file block.

Parameters
fpFile block
chcharacter to add
Returns
FBLOCK* Updated file block.

We filled the current buffer. Go get a new one.

◆ fcache_init()

void fcache_init ( void  )

Initialize the file cache.

◆ fcache_load()

void fcache_load ( dbref  player)

Load all files into cache.

Parameters
playerDBref of player

◆ fcache_rawdump()

void fcache_rawdump ( int  fd,
int  num 
)

Raw dump a cache file to a file descriptor.

Parameters
fdFile descriptor
numIndex of the file in the file cache

◆ fcache_read()

int fcache_read ( FBLOCK **  cp,
char *  filename 
)

Read a file into cache.

Parameters
cpCache buffer
filenameFile to read
Returns
int Size of cached text.

Free a prior buffer chain

Set up the initial cache buffer to make things easier

Read the text file into a new chain

Failure: log the event

Process the file, one lbuf at a time

If we didn't read anything in, toss the initial buffer

◆ fcache_send()

void fcache_send ( dbref  player,
int  num 
)

Send the content of a file cache to a player.

Parameters
playerDBref of player
numIndex of the file in the file cache

Variable Documentation

◆ fcache

FCACHE fcache[]
Initial value:
= {
{&mushconf.conn_file, NULL, "Conn"},
{&mushconf.site_file, NULL, "Conn/Badsite"},
{&mushconf.down_file, NULL, "Conn/Down"},
{&mushconf.full_file, NULL, "Conn/Full"},
{&mushconf.guest_file, NULL, "Conn/Guest"},
{&mushconf.creg_file, NULL, "Conn/Reg"},
{&mushconf.crea_file, NULL, "Crea/Newuser"},
{&mushconf.regf_file, NULL, "Crea/RegFail"},
{&mushconf.motd_file, NULL, "Motd"},
{&mushconf.wizmotd_file, NULL, "Wizmotd"},
{&mushconf.quit_file, NULL, "Quit"},
{&mushconf.htmlconn_file, NULL, "Conn/Html"},
{NULL, NULL, NULL}}
char * motd_file
Definition: typedefs.h:856
char * full_file
Definition: typedefs.h:860
char * wizmotd_file
Definition: typedefs.h:857
char * crea_file
Definition: typedefs.h:862
char * conn_file
Definition: typedefs.h:853
char * guest_file
Definition: typedefs.h:852
char * htmlconn_file
Definition: typedefs.h:874
char * quit_file
Definition: typedefs.h:858
char * regf_file
Definition: typedefs.h:855
char * creg_file
Definition: typedefs.h:854
char * site_file
Definition: typedefs.h:861
char * down_file
Definition: typedefs.h:859

Text files cache.