src/file_c.h File Reference

#include "copyright.h"
#include "db.h"
#include "interface.h"

Include dependency graph for file_c.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define FC_CONN   0
#define FC_CONN_SITE   1
#define FC_CONN_DOWN   2
#define FC_CONN_FULL   3
#define FC_CONN_GUEST   4
#define FC_CONN_REG   5
#define FC_CREA_NEW   6
#define FC_CREA_REG   7
#define FC_MOTD   8
#define FC_WIZMOTD   9
#define FC_QUIT   10
#define FC_LAST   10

Functions

void fcache_rawdump (int fd, int num)
void fcache_dump (DESC *d, int num)
void fcache_send (dbref, int)
void fcache_load (dbref)
void fcache_init (void)


Define Documentation

#define FC_CONN   0

Definition at line 15 of file file_c.h.

Referenced by welcome_user().

#define FC_CONN_DOWN   2

Definition at line 17 of file file_c.h.

Referenced by check_connect().

#define FC_CONN_FULL   3

Definition at line 18 of file file_c.h.

Referenced by check_connect().

#define FC_CONN_GUEST   4

Definition at line 19 of file file_c.h.

Referenced by check_connect(), and do_motd().

#define FC_CONN_REG   5

Definition at line 20 of file file_c.h.

Referenced by welcome_user().

#define FC_CONN_SITE   1

Definition at line 16 of file file_c.h.

Referenced by accept_new_connection().

#define FC_CREA_NEW   6

Definition at line 21 of file file_c.h.

Referenced by check_connect().

#define FC_CREA_REG   7

Definition at line 22 of file file_c.h.

Referenced by check_connect().

#define FC_LAST   10

Definition at line 26 of file file_c.h.

Referenced by fcache_dump(), and fcache_rawdump().

#define FC_MOTD   8

Definition at line 23 of file file_c.h.

Referenced by check_connect(), and do_motd().

#define FC_QUIT   10

Definition at line 25 of file file_c.h.

Referenced by shutdownsock().

#define FC_WIZMOTD   9

Definition at line 24 of file file_c.h.

Referenced by check_connect(), and do_motd().


Function Documentation

void fcache_dump ( DESC d,
int  num 
)

Definition at line 258 of file file_c.c.

References FC_LAST, fcache, and fcache_dumpbase().

Referenced by check_connect(), failconn(), fcache_send(), shutdownsock(), and welcome_user().

00259 {
00260         if((num < 0) || (num > FC_LAST))
00261                 return;
00262         fcache_dumpbase(d, fcache, num);
00263 }

void fcache_init ( void   ) 

Definition at line 311 of file file_c.c.

References fcache, fcache_load(), filecache_hdr::fileblock, filecache_hdr::filename, and NOTHING.

Referenced by main().

00312 {
00313         FCACHE *fp;
00314 
00315         for(fp = fcache; fp->filename; fp++) {
00316                 fp->fileblock = NULL;
00317         }
00318         fcache_load(NOTHING);
00319 }

void fcache_load ( dbref   ) 

Definition at line 279 of file file_c.c.

References alloc_lbuf, alloc_sbuf, confdata::conn_dir, filecache_hdr::desc, fcache, fcache_conn, fcache_read(), fcache_read_dir(), filecache_hdr::fileblock, filecache_hdr::filename, free_lbuf, free_sbuf, MAX_CONN, mudconf, NOTHING, notify, Quiet, and safe_str.

Referenced by do_readcache(), and fcache_init().

00280 {
00281         FCACHE *fp;
00282         char *buff, *bufc, *sbuf;
00283         int i;
00284 
00285         buff = bufc = alloc_lbuf("fcache_load.lbuf");
00286         sbuf = alloc_sbuf("fcache_load.sbuf");
00287         for(fp = fcache; fp->filename; fp++) {
00288                 i = fcache_read(&fp->fileblock, fp->filename);
00289                 if((player != NOTHING) && !Quiet(player)) {
00290                         sprintf(sbuf, "%d", i);
00291                         if(fp == fcache)
00292                                 safe_str((char *) "File sizes: ", buff, &bufc);
00293                         else
00294                                 safe_str((char *) "  ", buff, &bufc);
00295                         safe_str((char *) fp->desc, buff, &bufc);
00296                         safe_str((char *) "...", buff, &bufc);
00297                         safe_str(sbuf, buff, &bufc);
00298                 }
00299         }
00300         *bufc = '\0';
00301         if(*mudconf.conn_dir)
00302                 fcache_read_dir(mudconf.conn_dir, fcache_conn, &fcache_conn_c,
00303                                                 MAX_CONN);
00304         if((player != NOTHING) && !Quiet(player)) {
00305                 notify(player, buff);
00306         }
00307         free_lbuf(buff);
00308         free_sbuf(sbuf);
00309 }

void fcache_rawdump ( int  fd,
int  num 
)

Definition at line 220 of file file_c.c.

References filecache_block::data, FC_LAST, fcache, filecache_hdr::fileblock, filecache_block::hdr, filecache_block::filecache_block_hdr::nchars, filecache_block::filecache_block_hdr::nxt, and WRITE.

Referenced by accept_new_connection().

00221 {
00222         int cnt, remaining;
00223         char *start;
00224         FBLOCK *fp;
00225 
00226         if((num < 0) || (num > FC_LAST))
00227                 return;
00228         fp = fcache[num].fileblock;
00229 
00230         while (fp != NULL) {
00231                 start = fp->data;
00232                 remaining = fp->hdr.nchars;
00233                 while (remaining > 0) {
00234 
00235                         cnt = WRITE(fd, start, remaining);
00236                         if(cnt < 0)
00237                                 return;
00238                         remaining -= cnt;
00239                         start += cnt;
00240                 }
00241                 fp = fp->hdr.nxt;
00242         }
00243         return;
00244 }

void fcache_send ( dbref  ,
int   
)

Definition at line 270 of file file_c.c.

References DESC_ITER_PLAYER, and fcache_dump().

Referenced by do_list_file(), and do_motd().

00271 {
00272         DESC *d;
00273 
00274         DESC_ITER_PLAYER(player, d) {
00275                 fcache_dump(d, num);
00276         }
00277 }


Generated on Mon May 28 04:25:29 2007 for BattletechMUX by  doxygen 1.4.7