📄 conf.h
字号:
#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <ctype.h>#include <string.h>#include <signal.h>#include <time.h>#include <unistd.h>#include <netdb.h>#include <dirent.h>#include <stdlib.h>#include <ctype.h>#include <sys/types.h>#include <sys/wait.h>#include <sys/stat.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <locale.h>/* #define DEBUG /* */#define DEBUG#ifndef DEBUG#define VERSION "V1.0D Btree"#define DEB(xxx) {}#define MAXAGENTS 8#else#define VERSION "V1.0D Btree DEBUGGED"#define DEB(xxx) {printf("--- %s\n",xxx);fflush(stdout);}#define MAXAGENTS 1#endif#define DBHOSTS "indexdata/db.hosts"#define DBINDEX "indexdata/db.index"#define DBITEMOFFSET "indexdata/db.itemoffset"#define DBKEYS "indexdata/db.keys"#define MMAPTMPFILE "/tmp/mmaped_file"#define SPECIALREGCHAR "?+()|.*^$[]"#define SPECIALWILDCHAR "*?"#define MINLENGTHOFSEARCH 3#define S_PREOK 1#define S_OK 0#define S_ERROR -1#define S_CLOSED -2#define S_ERROR_INFIMA -3 /* A fix to the Major BBS's RFC 959 LIST violation */#define MAX 1024#define MAXHOSTS 3000#define CR 13#define LF 10#define ESC 27#define TOP256 256/******************** B-tree stuff ********************/#define KEYSIZE 3 /* Size of a key for the Btree */#define B 10 /* Btree: A=5, B=10 */#define BTREEENDMARK (BTcnts)(-1)typedef unsigned short BTcnts;struct DiskBTreeRef { char top[KEYSIZE]; long offset;};struct DiskBTreeHead{ char key[KEYSIZE]; struct DiskBTreeRef treerefs[B]; short numhosts; long numrefs;};#define BTREENUMINFO 64struct BTreeInfo { short cnt; long refs[BTREENUMINFO]; struct BTreeInfo *next;};#define BTREENUMHOST 16struct HostRef{ short host; long offset; long len;};struct BTreeHost { short cnt; struct HostRef refs[BTREENUMHOST]; struct BTreeHost *next;}; struct BTreeItem { char *key; BTreeInfo *info; BTreeHost *host; char *tops[B]; BTreeItem *refs[B]; BTcnts lastfileno; long lastoffset; long diskoffset; long infocnt; BTreeInfo *lastinfo; BTreeHost *lasthost;};struct TripleList { char *key; struct TripleList *next;};extern struct TripleList **TriIndex;extern char *BTreeMax;extern struct BTreeItem *Bhead;extern struct TripleList *Thead, *Tptr, *Tptr2;extern long triplecount;extern long nodecount;extern long diskoffset;extern long refcount;void addB(TripleList *, BTreeItem *, BTreeItem **, char **);void LoadTriples(void);BTreeItem *LocateBItem(char *, BTreeItem *);void AddRef(BTreeItem *, long);void AddHostRef(BTreeItem *, int);void CreateBtree(long, long);void AnnounceMethod(void);void IndexHostOffset(BTreeItem *, long *);void SaveHostIndex(char *, char*);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -