SetupBBS 板


这只程式要有 popupmenu 功能才能直接使用唷 ~ 假如没有的话 , 得把 main 中的 popupmenu_ans 改成 vans :) /*-------------------------------------------------------*/ /* star.c (YZU WindTopBBS Ver 3.02 ) */ /*-------------------------------------------------------*/ /* author : [email protected] */ /* target : http://mindcity.sina.com.tw */ /* create : 01/07/09 */ /* modify : 03/07/12 */ /*-------------------------------------------------------*/ #include "bbs.h" #define mouts(y,x,s) { move(y,x); outs(s); } #define PROXY_PORT 8080 #define PROXY_HREF "proxy.yzu.edu.tw" #define SERVER_HREF "http://mindcity.sina.com.tw" #define LINE_WORD 50 char *tag_s[4] = {"!--START:HORO_TODAY--","!--START:HORO_TOMORROW--"}; char *tag_e[4] = {"!--END:HORO_TODAY--","!--END:HORO_TOMORROW--"}; char *star[12] = {"aries","taurus","gemini","cancer","leo","virgo", "libra","scorpio","sagittarius","capricorn","aquarius","pisces"}; char *draw_star[20] = {"╭─╮","│ │","╰─╮","│ │","╰─╯", "╭┬╮","│││","│││"," │ "," │ ", "╭─╮","│ │","├─┤","│ │","│ │", "╭─╮","│ │","├─╯","│ \ ","│ │"}; static int http_conn(char *server, char *s,int kind) { int sockfd, start_show,chinese=0,state=0; int cc, tlen,word=0,show=0; char *xhead, *xtail, tag[128], fname[50]; static char pool[2048]; FILE *fp; mouts(23, 0, "正在连接伺服器,请稍後.........."); if ((sockfd = dns_open(server, PROXY_PORT)) < 0) { vmsg("无法与伺服器取得连结,查询失败"); return 0; } else { refresh(); } write(sockfd, s, strlen(s)); shutdown(sockfd, 1); /* parser return message from web server */ xhead = pool; xtail = pool; tlen = 0; start_show = 0; sprintf(fname, "tmp/%s.star", cuser.userid); clear(); fp = fopen(fname, "w"); fprintf(fp,"\n %s",draw_star[show++]); for (;;) { if (xhead >= xtail) { xhead = pool; cc = read(sockfd, xhead, sizeof(pool)); if (cc <= 0) break; xtail = xhead + cc; } cc = *xhead++; if ((tlen == strlen(tag_s[kind])+1) && (!str_ncmp(tag,tag_s[kind],strlen(tag_s[kind])))) start_show = 1; if ((tlen == strlen(tag_e[kind])+1) && (!str_ncmp(tag,tag_e[kind],strlen(tag_e[kind])))) break; if (cc == '<' || cc == '&') { tlen = 1; continue; } if (tlen) { if (cc == '>' || cc == ';') { if ((tlen == 3) && (!str_ncmp(tag, "br", 2)) && start_show == 1 && state == 0) { fprintf(fp,"\n %s\t",draw_star[show++]); state = 1; } else if ((tlen == 3) && (!str_ncmp(tag, "tr", 2)) && start_show == 1 && kind>1 && state == 0) { fprintf(fp,"\n %s\t",draw_star[show++]); state =1; } tlen = 0; word=0; continue; } if (tlen <= 128) tag[tlen - 1] = cc; tlen++; continue; } if (start_show) { if (word > LINE_WORD && cc<0 && chinese==0 && state == 0) { fprintf(fp,"\n %s\t",draw_star[show++]); state = 1; word = 0 ; } if (cc == ' ') chinese=0; else if (cc != '\r' && cc != '\n') { word++; fputc(cc, fp); state =0 ; chinese = (cc<0)?((chinese==1)?0:1):0; } else { word = 0; } } } close(sockfd); fprintf(fp,"\n %s\t资料来源为新浪星座算命网(http://mindcity.sina.com.tw/)", (show>19)?"":draw_star[show]); fclose(fp); more(fname, NULL); unlink(fname); return 0; } /* 起始点 */ int main() { char buf[128],c1,c2; char *strades[13] = { "AAries 牡羊座", "BTaurus 金牛座", "CGemini 双子座", "DCancer 巨蟹座", "ELeo 狮子座", "FVirgo 处女座", "GLibra 天秤座", "HScorpio 天蠍座", "ISagittarius 射手座", "JCapricorn 魔羯座", "KAquarius 水瓶座", "LPisces 双鱼座",NULL}; char *_kind[3] = {"AToday 今日运势","BTomorrow 明日运势",NULL}; if((c1 = popupmenu_ans(strades,"选择星座",5,18))) { if((c2 = popupmenu_ans(_kind,"选择类型",8,18))) { sprintf(buf,"GET %s/west/MC-12stars/%s%d.html HTTP/1.0\n\n",SERVER_HREF,star[c1-'a'],c2-'a'+1); http_conn(PROXY_HREF,buf,c2-'a'); } } return 0; } -- ※ Origin: 元智大学 风之塔 <bbs.yzu.edu.tw> ※ From : bbs.yzu.edu.tw







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草
伺服器连线错误,造成您的不便还请多多包涵!
「赞助商连结」






like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:iOS站内搜寻

TOP