/*用星际译王 *******************
*笔山书院BBS站
********************************/
#include "bbslib.h"
int bbsdict_main()
{
char buf[256];
char *s;
//int whichdict;
char param1[256];
int p[2];
pid_t childpid;
html_header(1);
check_msg();
changemode(DICT);
hprintf("%s","\n\033[1;32m _____ __ __ __");
hprintf
("%s","\n | \\|__|.----.| |_|__|.-----.-----.---.-.----.--.--.");
hprintf
("%s","\n | -- | || __|| _| || _ | | _ | _| | |");
hprintf
("%s","\n |_____/|__||____||____|__||_____|__|__|___._|__| |___ |");
hprintf
("%s","\n |_____|\033[m");
hprintf("%s","\n\n欢迎使用本站的字典。本字典为 星际译王 + 朗道中英文词典 + 牛津中英文词典");
hprintf
("%s","\n本字典主要为\033[1;33m「英汉」\033[m部分, 但亦可作\033[1;33m「汉英」\033[m查询。");
hprintf
("%s","\n系统将根据您所输入的字串, 自动判断您所要翻查的是英文字还是中文字。");
hprintf("%s","\n请输入您欲翻查的英文单词或短语或中文字词。");
printf("<form action=dict method=post>\n<input name=q><input type=submit value=查询></form>\n");
bzero(buf,sizeof(buf));
strsncpy(buf, getparm("q"), 128);
if (buf[0] ) {
char *avoid = "/&;!`'\"|?~<>^()[]{}$\n\r\\", *ptr;
int n = strlen(avoid);
strsncpy(param1, buf, sizeof (param1));
while (n > 0) {
n--;
ptr = strchr(param1+1, avoid[n]);
if (ptr != NULL)
*ptr = 0;
}
char pidstr[20];
char cmdbuff[256];
bzero(cmdbuff,sizeof(cmdbuff));
tracelog("%s sdcv(字典) \"%s\" %s %s %d",currentuser->userid, param1,
currentuser->userid, fromhost, getpid());
snprintf(cmdbuff,sizeof(cmdbuff)-1,"LANG=zh_CN /usr/bin/sdcv -n \"%s\" > " BBSHOME "/bbstmpfs/tmp/dict.%d.%s ",
param1,getpid(),currentuser->userid);
system(cmdbuff);
printf("<hr>");
sprintf(buf, BBSHOME "/bbstmpfs/tmp/dict.%d.%s", getpid(),currentuser->userid);
bbsshowfile(buf,0);
unlink(buf);
}
}
--
FROM 218.194.249.0