41 lines · 746 B · C
RawDownload
// Data structures // A Pascal-style stringtypedef struct pstring {	uint	length;	unsigned char	*data;} pstring; // An entry in the hash tabletypedef struct hentry hentry;struct hentry {	hentry *prev;	hentry *next;	pstring *key;	pstring *value;}; // A hash tabletypedef struct htable {	RWLock l;	uint	size;	hentry **tab;} htable; // The current client connectiontypedef struct Client {	pstring **args; // the current command with arguments	int nargs; // the number of args for the current command	int fd;	// the network connection} Client; // A commandtypedef struct Command {	char*	name;	int		(*proc)(Client*);	int		nargs; // number of arguments (size of the pstring array)} Command;  // Our hash tablehtable *ht;