#define VARIABLE 1
#define CONSTANT 2
#define KEY_WORD 3
#define KEY_WORD_NUM 11
#define ERROR -1
int port;
char *rootDoc;
char keywords[]
[SSIZE]={"echo","for","while","if","elseif","else","break","continue","return","switch","case","de
fault"};
//map<string,string> mapStr; //定义一个存放 php 变量名及对应 value 的 map 数组,错误!这个
变量还不能定义成全局变量,要考虑到多用户的情况
int getInfo(const char *dest,const char *src,char *result);
inline int isSubStr(const char *dest,const char *src,int &left,int &right);
inline void getSubStr(char *buffer,int i,char *dest);
void getEnv(char *buffer);
void process(char *buffer,int client_fd);
inline void clear_line_break(char *buffer,int &i,int len);
inline int isKeyWord(char *tmp);
inline bool isDigital(char *str);
int commPraser(char *str,int len,int &i,char*tmp);
inline int getVar(char *src,char *dest,map<string,string> &mapStr); //mapStr 必 须 作 为 引
用传递,否则所做的改变无效
int conditionPraser(char *str,int len,int i,map<string,string> &mapStr);
inline void doEcho(FILE *tmpfp,char *str,int len,int &i,map<string,string> &mapStr);
inline void getCrossBody(char *str,int len,int &i,char *mainBody);
void insertVar(char *key,char *var,map<string,string> &mapStr);
void do_while(FILE *tmpfp,char *str,int len,int &i,map<string,string> &mapStr);
void do_for(FILE *tmpfp,char *str,int len,int &i,map<string,string> &mapStr);
void do_if(FILE *tmpfp,char *str,char *tmp,int len,int &i,map<string,string> &mapStr);
void do_assign(char *key,char *str,map<string,string> &mapStr);
void doPraser(FILE *tmpfp,char *str,int len,int i,map<string,string> &mapStr);
void phpPraser(int client_fd,FILE *fp,char *buffer);
void transfer(int client_fd,char *path);
void log(const char *inf,int line,int tag=0);
/*
* 功能:查询 src 中是否有 key 值 dest,如果有则取出对应的 value 存放到 result 中
* 返回值:返回 0 表示成功查找到相应 key,-1 表示查找失败
* */
int getInfo(const char *dest,const char *src,char *result)
{
int left,right,j;
评论5
最新资源