Exemplo n.º 1
0
static void user_login(void)
{
	char fname[STRLEN];

	// SYSOP gets all permission bits when login.
	if (strcmp(currentuser.userid, "SYSOP") == 0) {
		currentuser.userlevel = ~0;
		substitut_record(PASSFILE, &currentuser, sizeof(currentuser),
				usernum);
	}
	fromhost[sizeof(fromhost) - 1] = 0; //added by iamfat 2004.01.05 to avoid overflow
	log_usies("ENTER", fromhost, &currentuser);

	SpecialID(currentuser.userid, fromhost, sizeof(fromhost));

	u_enter();
	report("Enter", currentuser.userid);

#ifdef USE_NOTEPAD
	notepad_init();
	if (strcmp(currentuser.userid, "guest") != 0) {
		if (DEFINE(DEF_NOTEPAD)) {
			int noteln;

			if (lastnote> currentuser.notedate)
			currentuser.noteline = 0;
			noteln = countln("etc/notepad");
			if (currentuser.noteline == 0) {
				shownotepad();
			} else if ((noteln - currentuser.noteline)> 0) {
				screen_move(0, 0);
				ansimore2("etc/notepad", NA, 0, noteln - currentuser.noteline + 1);
				terminal_getchar();
				screen_clear();
			}
			currentuser.noteline = noteln;
			write_defnotepad();
		}
	}
#endif

	if (show_statshm("etc/hotspot", 0)) {
		screen_flush();
		pressanykey();
	}

	if ((vote_flag(NULL, '\0', 2 /* 检查读过新的Welcome 没 */) == 0)) {
		if (dashf("Welcome")) {
			ansimore("Welcome", YEA);
			vote_flag(NULL, 'R', 2 /* 写入读过新的Welcome */);
		}
	} else {
		ansimore("Welcome2", YEA);
	}
	show_statshm("0Announce/bbslist/day", 1);
	screen_flush();
	screen_move_clear(-2);
	if (currentuser.numlogins < 1) {
		currentuser.numlogins = 0;
		//% prints("\033[1;36m☆ 这是您第 \033[33m1\033[36m 次拜访本站,请记住今天吧。\n");
		prints("\033[1;36m\xa1\xee \xd5\xe2\xca\xc7\xc4\xfa\xb5\xda \033[33m1\033[36m \xb4\xce\xb0\xdd\xb7\xc3\xb1\xbe\xd5\xbe\xa3\xac\xc7\xeb\xbc\xc7\xd7\xa1\xbd\xf1\xcc\xec\xb0\xc9\xa1\xa3\n");
		//% prints("☆ 您第一次连入本站的时间为 \033[33m%s\033[m ", format_time(time(NULL), TIME_FORMAT_ZH));
		prints("\xa1\xee \xc4\xfa\xb5\xda\xd2\xbb\xb4\xce\xc1\xac\xc8\xeb\xb1\xbe\xd5\xbe\xb5\xc4\xca\xb1\xbc\xe4\xce\xaa \033[33m%s\033[m ", format_time(fb_time(), TIME_FORMAT_ZH));
	} else {
		prints(
				//% "\033[1;36m☆ 这是您第 \033[33m%d\033[36m 次拜访本站,上次您是从 \033[33m%s\033[36m 连往本站。\n",
				"\033[1;36m\xa1\xee \xd5\xe2\xca\xc7\xc4\xfa\xb5\xda \033[33m%d\033[36m \xb4\xce\xb0\xdd\xb7\xc3\xb1\xbe\xd5\xbe\xa3\xac\xc9\xcf\xb4\xce\xc4\xfa\xca\xc7\xb4\xd3 \033[33m%s\033[36m \xc1\xac\xcd\xf9\xb1\xbe\xd5\xbe\xa1\xa3\n",
				currentuser.numlogins + 1, currentuser.lasthost);
		//% prints("☆ 上次连线时间为 \033[33m%s\033[m ", format_time(currentuser.lastlogin, TIME_FORMAT_ZH));
		prints("\xa1\xee \xc9\xcf\xb4\xce\xc1\xac\xcf\xdf\xca\xb1\xbc\xe4\xce\xaa \033[33m%s\033[m ", format_time(currentuser.lastlogin, TIME_FORMAT_ZH));
	}
	terminal_getchar();
	setuserfile(fname, BADLOGINFILE);
	if (ansimore(fname, NA) != -1) {
		//% if (askyn("您要删除以上密码输入错误的记录吗", NA, NA) == YEA)
		if (askyn("\xc4\xfa\xd2\xaa\xc9\xbe\xb3\xfd\xd2\xd4\xc9\xcf\xc3\xdc\xc2\xeb\xca\xe4\xc8\xeb\xb4\xed\xce\xf3\xb5\xc4\xbc\xc7\xc2\xbc\xc2\xf0", NA, NA) == YEA)
			unlink(fname);
	}

	set_safe_record();
	tui_check_uinfo(&currentuser);
	strlcpy(currentuser.lasthost, fromhost, sizeof(currentuser.lasthost));
	if (login_start_time - currentuser.lastlogin >= 20 * 60
			|| !strcmp(currentuser.userid, "guest")
			|| currentuser.numlogins < 100) {
		currentuser.numlogins++;
	}

	session_basic_info_t *res = get_my_sessions();
	update_user_stay(&currentuser, true, session_basic_info_count(res) > 1);
	session_basic_info_clear(res);

#ifdef ALLOWGAME
	if (currentuser.money> 1000000) {
		currentuser.nummedals += currentuser.money / 10000;
		currentuser.money %= 1000000;
	}
	if ((signed int) (currentuser.money - currentuser.bet) < -4990
			&& currentuser.numlogins < 10 && currentuser.numposts < 10
			&& currentuser.nummedals == 0)
	currentuser.money += 1000;
#endif
	if (currentuser.firstlogin == 0) {
		currentuser.firstlogin = time(NULL) - 7 * 86400;
	}
	substitut_record(PASSFILE, &currentuser, sizeof(currentuser), usernum);
	extern char currmaildir[];
	setmdir(currmaildir, currentuser.userid);
	check_register_info();
}
Exemplo n.º 2
0
int main(int argc, char **argv)
#endif
{
    char fname[256];
    char defname[] = "game.dat";
    Boolean b_play;
    int dir;
    int inch;
    int num_step;
    int num;
    unsigned char steplog[MaxSteps];

#ifdef ENABLE_DL
    char buf[10];
    struct high_record high;

    while (1) {
        num = 0;
        clear();
        ansimore2("game/worker/welcome", false, 0, 0);
        while (num <= 0 || num > MAXDATA) {
	    buf[0]=0;
            getdata(5, 61, "", buf, 5, 1, NULL, true);
            if (buf[0] == 0)
                return 0;
            num = atoi(buf);
        }
        sprintf(fname, "game/worker/%s.%d", defname, num);
	clear();
#else
    {
        if (argc > 2) {
            sprintf(fname, "%s/%s.%s", argv[1], defname, argv[2]);
            num=atoi(argv[2]);
        } else if (2 == argc) {
            if (strlen(argv[1]) > 255)
                exit(1);
            sprintf(fname, "%s.%s", defname, argv[1]);
            num=atoi(argv[1]);
        } else {
            strcpy(fname, defname);
            num==-1;
        }
#endif
        num_step=0;
        load_highrecord(num, &high, -1);
        if (TRUE == InitData(fname)) {
            if (TRUE == InitPad()) {
                b_play = TRUE;
                DrawPad();
                update_endline1(&high,num_step);
                inch = 0;
                while (b_play) {
                    if (inch) {
                        showdiff();
                        cleardiff();
                        move(scr_lns-1, scr_cols - 1);
                        refresh();
                    }
                    if (wingame()) {
                    	   int newrecord;
			   char buf[100];
                    	   newrecord=0;
                    	   if (num_step<high.shortest||high.shortest==0) 
                    	   	newrecord=load_highrecord(num, &high, num_step);
                    	   clear();
                    	   move(12,15);
                    	   prints("祝贺你,你成功的完成了这一关");
                    	   move(13,15);
                    	   if (newrecord==1) {
                    	       sprintf(buf,"你也创造了本关使用步数的纪录(%d步)!好厉害~",num_step);
			   } else
                    	   if (newrecord!=0) {
                    	       sprintf(buf,"你也创造了本关使用步数的纪录(%d步)!",num_step);
			       prints(buf);
                    	       move(14,15);
			       sprintf(buf,"不过,让点创纪录机会给别人吧~你都有%d个记录了:P\n",newrecord);
                    	   } else {
			       sprintf(buf,"你用了%d步,纪录是%d步。",num_step,high.shortest);
			   }
			   prints(buf);
                        move(23, 0);
                        clrtoeol();
                        prints("\x1b[m                                \x1b[5;1;33m按任何键继续 ..\x1b[m");
                        igetkey();
                        break;
                    }
                    if (num_step>MaxSteps) {
			    char askbuf[100];
                    	    clear();
                    	    sprintf(askbuf,"你已经用了%d步还没有成功,重来么?(Y/N)",num_step);
                    	    getdata(12,0,askbuf,buf,2,1,NULL,true);
                    	    if (toupper(buf[0])=='N')
                    	    	break;
                         b_play = InitPad();
                         DrawPad();
                         num_step=0;
                    	}
                    inch = igetkey();
                    if ((' ' == inch)||(inch == '\n')||(inch=='\r'))
                        break;
                    dir = NullDir;
                    switch (inch) {
                    case 'i':
                    case 'I':
                    case KEY_UP:
                        dir = North;
                        break;
                    case 'j':
                    case 'J':
                    case KEY_LEFT:
                        dir = West;
                        break;
                    case 'l':
                    case 'L':
                    case KEY_RIGHT:
                        dir = East;
                        break;
                    case 'k':
                    case 'K':
                    case KEY_DOWN:
                        dir = South;
                        break;
                    case 12:   //      Ctrl-L
                    case 'R':   //      Ctrl-L
                        clear();
                        DrawPad();
                        break;
                    case '\t':
                        b_play = InitPad();
                        DrawPad();
                        num_step=0;
                        update_endline1(&high,num_step);
                        break;
	            case Ctrl('H'):
                    case '\177':
                    case KEY_DEL:
                    	  if (num_step!=0) {
                    	  	num_step--;
                    	       regretmove(steplog[num_step]);
                            update_endline1(&high,num_step);
                    	  }
                    	  break;
                    default:
                        break;
                    }
                    if (NullDir != dir) {
                    	    int ret;
                         if ((ret=workermove(dir))!=0) {
                         	if (ret==2)
                                 steplog[num_step]=dir+8;
                         	else
                                 steplog[num_step]=dir;
                             num_step++;
                             update_endline1(&high,num_step);
                	    }
                    }
                }
            }
            DestroyPad();
        }
        DestroyData();
    }
    return 0;
}
Exemplo n.º 3
0
static int login_query(void)
{
#ifndef ENABLE_SSH
	char uname[IDLEN + 2];
	char passbuf[PASSLEN];
	int attempts;
	int recover; // For giveupBBS
	bool auth = false;
#endif // ENABLE_SSH

	// Deny new logins if too many users online.
	int online = session_count_online();
#ifndef ENABLE_SSH
	if (online >= MAXACTIVE) {
		ansimore("etc/loginfull", NA);
		return -1;
	}
#endif // ENABLE_SSH

	ansimore2("etc/issue", false, 0, 0);
	screen_printf("\033[1;35m欢迎光临\033[1;40;33m【 %s 】 \033[m"
			"[\033[1;33;41m Add '.' after YourID to login for BIG5 \033[m]\n",
			BBSNAME_UTF8);

	int peak = session_get_online_record();
	if (peak < online) {
		session_set_online_record(online);
		peak = online;
	}

	screen_printf("\033[1;32m目前已有帐号: [\033[1;36m%d\033[32m/\033[36m%d\033[32m] "
			"\033[32m目前站上人数: [\033[36m%d\033[32m/\033[36m%d\033[1;32m]\n",
			get_user_count(), MAXUSERS, online, MAXACTIVE);
	visitlog(peak);

#ifndef ENABLE_SSH
	attempts = 0;
	while (!auth) {
		if (attempts++ >= LOGINATTEMPTS) {
			ansimore("etc/goodbye", NA);
			return -1;
		}
		//% getdata(0, 0, "\033[1;33m请输入帐号\033[m"
		getdata(0, 0, "\033[1;33m\xc7\xeb\xca\xe4\xc8\xeb\xd5\xca\xba\xc5\033[m"
				//% "(试用请输入'\033[1;36mguest\033[m', "
				"(\xca\xd4\xd3\xc3\xc7\xeb\xca\xe4\xc8\xeb'\033[1;36mguest\033[m', "
				//% "注册请输入'\033[1;31mnew\033[m'): ",
				"\xd7\xa2\xb2\xe1\xc7\xeb\xca\xe4\xc8\xeb'\033[1;31mnew\033[m'): ",
				uname, IDLEN + 1, DOECHO, YEA);
		if (strcaseeq(uname, "guest") && (online > MAXACTIVE - 10)) {
			ansimore("etc/loginfull", NA);
			return -1;
		}
		if (strcaseeq(uname, "new")) {
			memset(&currentuser, 0, sizeof(currentuser));
			new_register();
			terminal_flush();
			exit(1);
		} else if (*uname == '\0')
			;
		else if (!dosearchuser(uname, &currentuser, &usernum)) {
			screen_printf("\033[1;31m经查证,无此 ID。\033[m\n");
		} else if (strcaseeq(uname, "guest")) {
			currentuser.userlevel = 0;
			break;
		} else {
			//% getdata(0, 0, "\033[1;37m请输入密码: \033[m", passbuf, PASSLEN,
			getdata(0, 0, "\033[1;37m\xc7\xeb\xca\xe4\xc8\xeb\xc3\xdc\xc2\xeb: \033[m", passbuf, PASSLEN,
					NOECHO, YEA);
			passbuf[8] = '\0';
			switch (bbs_auth(uname, passbuf)) {
				case BBS_EWPSWD:
					screen_printf("\033[1;31m密码输入错误...\033[m\n");
					break;
				case BBS_EGIVEUP:
					recover = chk_giveupbbs();
					screen_printf("\033[33m您正在戒网,离戒网结束还有%d天\033[m\n",
							recover - fb_time() / 3600 / 24);
					return -1;
				case BBS_ESUICIDE:
					screen_printf("\033[32m您已经自杀\033[m\n");
					return -1;
				case BBS_EBANNED:
					screen_printf("\033[32m本帐号已停机。请到 "
							"\033[36mNotice\033[32m版 查询原因\033[m\n");
					return -1;
				case BBS_ELFREQ:
					screen_printf("登录过于频繁,请稍候再来\n");
					return -1;
				case 0:
					auth = true;
					break;
				default:
					auth = false;
					break;
			}
			memset(passbuf, 0, PASSLEN - 1);
		}
	}
#else // ENABLE_SSH
	//% 欢迎使用ssh方式访问本站,请按任意键继续
	presskeyfor("\033[1;33m\xbb\xb6\xd3\xad\xca\xb9\xd3\xc3ssh\xb7\xbd\xca\xbd\xb7\xc3\xce\xca\xb1\xbe\xd5\xbe\xa3\xac\xc7\xeb\xb0\xb4\xc8\xce\xd2\xe2\xbc\xfc\xbc\xcc\xd0\xf8", -1);
#endif // ENABLE_SSH

	if (multi_user_check() == -1)
		return -1;

	sethomepath(genbuf, currentuser.userid);
	mkdir(genbuf, 0755);
	login_start_time = time(NULL);
	return 0;
}
Exemplo n.º 4
0
Arquivo: tmpl.c Projeto: zhouqt/kbs
static int choose_tmpl_post(char * title, char *fname)
{

    FILE *fp;
    FILE *fpsrc;
    char filepath[STRLEN];
    int i, ret=1;
    int write_ok = 0;
    char * tmp[ MAX_CONTENT ];
    char newtitle[STRLEN], oldtitle[STRLEN];
    int oldmode = uinfo.mode;
    bool modifying=false, loop=true;

    if (t_now <= 0 || t_now > MAX_TEMPLATE)
        return -1;

    if (ptemplate[t_now-1].tmpl->content_num <= 0)
        return -1;

    strncpy(oldtitle, title, STRLEN);
    while (loop) {

        if ((fp = fopen(fname, "w"))==NULL) {
            return -1;
        }

        modify_user_mode(POSTTMPL);
        for (i=0; i< ptemplate[t_now-1].tmpl->content_num; i++) {
            char *ans;

            if (modifying)
                ans = tmp[i];
            else {
                ans = (char *)malloc(ptemplate[t_now-1].cont[i].length + 2);
                ans[0] = '\0';
            }
            if (ans == NULL) {
                modify_user_mode(oldmode);
                fclose(fp);
                return -1;
            }
            clear();
            move(1,0);
            prints("Ctrl+Q 换行, ENTER 发送");
            move(3,0);
            prints("模板问题:%s",ptemplate[t_now-1].cont[i].text);
            move(4,0);
            prints("模板回答(最长%d字符):",ptemplate[t_now-1].cont[i].length);
            multi_getdata(6, 0, 79, NULL, ans, ptemplate[t_now-1].cont[i].length+1, 11, false, 0);
            tmp[i] = ans;
        }
        modify_user_mode(oldmode);

        if (ptemplate[t_now-1].tmpl->filename[0]) {
            struct stat st;
            setbfile(filepath,currboard->filename, ptemplate[t_now-1].tmpl->filename);
            if (stat(filepath, &st) == 0 && S_ISREG(st.st_mode) && st.st_size>2) {
                if ((fpsrc = fopen(filepath,"r"))!=NULL) {
                    char buf[256];

                    while (fgets(buf,255,fpsrc)) {
                        int l;
                        int linex = 0;
                        char *pn,*pe;
#ifdef ENHANCED_TEMPLATE
                        int sign, fmtlen, sysdef;
                        char tmpbuf[STRLEN];
#endif

                        for (pn = buf; *pn!='\0'; pn++) {
                            if (*pn != '[' || *(pn+1)!='$') {
                                fputc(*pn, fp);
                                linex++;
                            } else {
                                pe = strchr(pn,']');
                                if (pe == NULL) {
                                    fputc(*pn, fp);
                                    continue;
                                }
#ifdef ENHANCED_TEMPLATE
                                /* 获得[]中间的内容 */
                                strncpy(tmpbuf, pn+2, pe-pn-2);
                                tmpbuf[pe-pn-2]='\0';
                                sysdef = 0;
                                sign = get_parameter_index_len(tmpbuf, &l, &fmtlen, &sysdef);
#else
                                l = atoi(pn+2);
#endif
                                if (l<=0 || l > ptemplate[t_now-1].tmpl->content_num) {
                                    fputc('[', fp);
                                    continue;
                                }
#ifdef ENHANCED_TEMPLATE
                                char *p;
                                if (sysdef == 0) {
                                    p = malloc(strlen(tmp[l-1])+1);
                                    strcpy(p, tmp[l-1]);
                                } else {
                                    p = malloc(STRLEN);
                                    if (!strcmp(tmpbuf, "USER"))
                                        strcpy(p, getCurrentUser()->userid);
                                    else if (!strcmp(tmpbuf, "BOARD"))
                                        strcpy(p, currboard->filename);
                                    else if (!strcmp(tmpbuf, "BNAME"))
                                        strcpy(p, currboard->title+13);
                                    else if (!strcmp(tmpbuf, "BMS"))
                                        strcpy(p, currboard->BM);
                                    else if (!strcmp(tmpbuf, "DATE")) {
                                        time_t t=time(0);
                                        struct tm *mytm;
                                        mytm = localtime(&t);
                                        sprintf(p, "%d-%02d-%02d", mytm->tm_year + 1900, mytm->tm_mon+1, mytm->tm_mday);
                                    }
                                    else
                                        strcpy(p, "未定义");
                                }
                                if (fmtlen>0) {
                                    int t1, t2;
                                    t1=strlen(p);
                                    if (t1 >= fmtlen)
                                        fprintf(fp,"%s",p);
                                    else {
                                        if (sign == -1) { /* 左对齐 */
                                            fprintf(fp, "%-*s", fmtlen, p);
                                        } else if (sign == 1) { /* 右对齐 */
                                            fprintf(fp, "%*s", fmtlen, p);
                                        } else { /* 居中对齐 */
                                            t2 = (fmtlen - t1)/2;
                                            fprintf(fp,"%*s%*s",t2+t1,p,t2 + t1%2, "");
                                        }
                                    }
                                } else
                                    fprintf(fp,"%s",p);
                                free(p);
#else
                                fprintf(fp,"%s",tmp[l-1]);
#endif
                                pn = pe;
                                continue;
                            }
                        }
                    }
                    fclose(fpsrc);

                    write_ok = 1;
                }
            }
        }
        if (write_ok == 0) {
            for (i=0; i< ptemplate[t_now-1].tmpl->content_num; i++)
                fprintf(fp,"\033[1;32m%s:\033[m\n%s\n\n",ptemplate[t_now-1].cont[i].text, tmp[i]);
        }
        fclose(fp);

        if (ptemplate[t_now-1].tmpl->title_tmpl[0]) {
            char *pn,*pe;
            char *buf;
            int l;
            int newl = 0;
#ifdef ENHANCED_TEMPLATE
            int sysdef;
            char tmpbuf[STRLEN];
#endif

            newtitle[0]='\0';
            buf = ptemplate[t_now-1].tmpl->title_tmpl;

            for (pn = buf; *pn!='\0' && newl < STRLEN-1; pn++) {
                if (*pn != '[' || *(pn+1)!='$') {
                    if (newl < STRLEN - 1) {
                        newtitle[newl] = *pn ;
                        newtitle[newl+1]='\0';
                        newl ++;
                    }
                } else {
                    pe = strchr(pn,']');
                    if (pe == NULL) {
                        if (newl < STRLEN - 1) {
                            newtitle[newl] = *pn ;
                            newtitle[newl+1]='\0';
                            newl ++;
                        }
                        continue;
                    }
#ifdef ENHANCED_TEMPLATE
                    /* 获得[]中间的内容 */
                    strncpy(tmpbuf, pn+2, pe-pn-2);
                    tmpbuf[pe-pn-2]='\0';
                    sysdef = 0;
                    get_parameter_index_len(tmpbuf, &l, NULL, &sysdef);
#else
                    l = atoi(pn+2);
#endif
                    if (l<0 || l > ptemplate[t_now-1].tmpl->content_num) {
                        if (newl < STRLEN - 1) {
                            newtitle[newl] = *pn ;
                            newtitle[newl+1]='\0';
                            newl ++;
                        }
                        continue;
                    }
                    if (l == 0) {
                        int ti;
                        for (ti=0; oldtitle[ti]!='\0' && newl < STRLEN - 1; ti++, newl++) {
                            newtitle[newl] = oldtitle[ti] ;
                            newtitle[newl+1]='\0';
                        }
                    } else {
                        int ti;
#ifdef ENHANCED_TEMPLATE
                        char *p;
                        if (sysdef == 0) {
                            p = malloc(strlen(tmp[l-1])+1);
                            strcpy(p, tmp[l-1]);
                        } else {
                            p = malloc(STRLEN);
                            if (!strcmp(tmpbuf, "USER"))
                                strcpy(p, getCurrentUser()->userid);
                            else if (!strcmp(tmpbuf, "BOARD"))
                                strcpy(p, currboard->filename);
                            else if (!strcmp(tmpbuf, "BNAME"))
                                strcpy(p, currboard->title+13);
                            else if (!strcmp(tmpbuf, "BMS"))
                                strcpy(p, currboard->BM);
                            else if (!strcmp(tmpbuf, "DATE")) {
                                time_t t=time(0);
                                struct tm *mytm;
                                mytm = localtime(&t);
                                sprintf(p, "%d-%02d-%02d", mytm->tm_year + 1900, mytm->tm_mon+1, mytm->tm_mday);
                            } else
                                strcpy(p, "未定义");
                        }
                        for (ti=0; p[ti]!='\0' && p[ti]!='\n' && p[ti]!='\r' && newl < STRLEN - 1; ti++, newl++) {
                            newtitle[newl] = p[ti] ;
                            newtitle[newl+1]='\0';
                        }
                        free(p);
#else
                        for (ti=0; tmp[l-1][ti]!='\0' && tmp[l-1][ti]!='\n' && tmp[l-1][ti]!='\r' && newl < STRLEN - 1; ti++, newl++) {
                            newtitle[newl] = tmp[l-1][ti] ;
                            newtitle[newl+1]='\0';
                        }
#endif
                    }
                    pn = pe;
                    continue;
                }
            }
            strncpy(title, newtitle, STRLEN);
            title[STRLEN-1]='\0';
        }

        do {
            char ans[4];
            clear();
            ansimore2(fname,false,0,19);
            move(21,0);
            clrtobot();
            prints("标题: %s",title);
            getdata(t_lines-1,0,"确认发表 (Y)发表 (N)退出 (E)重新编辑 [Y]: ",ans,2,DOECHO,NULL,true);
            switch (toupper(ans[0])) {
                case 'N':
                    loop=false;
                    ret=-1;
                    break;
                case 'E':
                    modifying=true;
                    break;
                default:
                    loop=false;
                    ret=1;
                    break;
            }
        } while (0);

    }

    for (i=0; i< ptemplate[t_now-1].tmpl->content_num; i++)
        free(tmp[i]);

    return ret;
}