MOUSEEVENT * getmouseevent(void) { static MOUSEEVENT m; if (mouse == EMACSTERM) { switch (mygetch()) { case ctrl('_'): /* click */ if ((m.button = mygetch()) == '0') { /* if scroll bar */ m.percent = getpercent(); } else { m.x1 = getcoordinate(); m.y1 = getcoordinate(); m.x2 = m.y2 = -1; } break; case ctrl(']'): /* sweep */ m.button = mygetch(); m.x1 = getcoordinate(); m.y1 = getcoordinate(); m.x2 = getcoordinate(); m.y2 = getcoordinate(); break; default: return (NULL); } return (&m); } return (NULL); }
short move() { char mv=mygetch(); if(mv=='w'||mv=='s'||mv=='a'||mv=='d') { switch(mv) { case 'w':xp=x_pot-1;yp=y_pot;ww++;break; case 's':xp=x_pot+1,yp=y_pot;ss++;break; case 'a':xp=x_pot;yp=y_pot-1;aa++;break; case 'd':xp=x_pot;yp=y_pot+1;dd++;break; } short num=graphs[curlevel].read(xp,yp); if(num==0||num>=250) { x_pot=xp; y_pot=yp; } return num; } else { if(mv=='m'||mv=='f'||mv=='c') { switch(mv) { case 'm':usemymap();break; case 'f':usemyfly();break; case 'c':usemycheck();break; } return 0; } else { if(mv=='q') { ifend=3;//结束标志 return 0; } else if(mv=='h') { CLEAR; cout<<BLUE<<" 操作: "<<endl <<" 按w向上,s向下,a向左,d向右,h帮助,q退出. "<<endl <<" m使用地图,c使用查看怪物属性工具,f使用飞行工具. "<<endl <<GREEN<<" 命名规则: "<<endl <<" 字母+数字为普通怪物,JK和DF是护卫,BS是boss. "<<endl <<" HH为墙壁,XX为栅栏,[]为门,><是入口,<>是出口. "<<endl <<" ky,kb,kr,kg,ki分别是黄、蓝、红、绿、铁钥匙. "<<endl <<" #为加life,$为加money,!为加attack,&为加defence;S是小瓶,M是大瓶,L是特大奖励. "<<endl <<" SS,SM,SL,OM,OL,OB是商店.AN,TE是帮助者,提供道具和游戏信息. "<<endl <<" FY,KN是道具,具体使用请看操作. "<<COLEND<<endl; cout<<endl<<endl<<"Press anykey to continue... "<<endl; mygetch(); return 1; } else return 0; } } }
short asklarshop() { short chkend=0; CLEAR; cout<<BLUE<<"Large shop--Welcome to my shop!"<<endl; cout<<"Enter the number you want..."<<endl; cout<<"1.Get somthing... "<<endl<<"Sale my keys... "<<endl; short cho;cin>>cho;mygetch(); if(cho==1) do{ CLEAR; cout<<"1.Pay 800 coin to add 4000 life;"<<endl<<"2.Pay 800 coin to add 600 attack;"<<endl<<"3.Pay 800 coin to add 600 defence;"<<endl<<"4.quit"<<COLEND<<endl; short ans; cin>>ans;mygetch(); if(ans>=1&&ans<=3) { int money=herobrine.chkatt('m'); if(money>=800) { herobrine.chgatt('m',-800); switch(ans) { case 1:herobrine.chgatt('l',4000);break; case 2:herobrine.chgatt('a',600);break; case 3:herobrine.chgatt('d',600);break; } cout<<"Successed!Press anykey to continue..."<<endl; mygetch(); } else { chkend=1; cout<<"You dont have enough money!"<<endl<<"Press anykey to continue..."<<endl; mygetch(); } } else { switch(ans) { case 4:chkend=1;break; default:break; } } }while(chkend==0); else do{
//xoa key tren btree1 void delete_key() { printf("\nNhap tu muon xoa:");scanf("%*c");gets(key); if(btdel(bt1,key)!=0) { printf("\n\033[31m=>Khong co tu nay\033[0m"); mygetch(); } else { printf("\n=>Da xoa"); mygetch(); } mygetch(); }
//tim` kiem tren btree1 void search() { printf("\nNhap tu can tim kiem:");scanf("%*c");gets(key); if(btsel(bt1,key,(char*)p1,sizeof(dict1),&rsize1)!=0) { printf("\n\033[31mKhong co tu nay\033[0m"); mygetch(); } else { printf("\n%s:\t%s",p1->key,p1->value); mygetch(); } mygetch(); }
/* * Actual heavy lifting. Reads a copied block of memory from target process * looks through the copied memory for the username string if it finds that * parses the string and pulls out the username and password values. Prints * them and asks the user if they want to look for more. */ void checkit(char *mem, int size) { char *username = "******"; char *search; int i; char *user; char *pass; char more = 'Y'; for (i = 0; i <= size - sizeof(username); ++i) { search = (mem + i); /* there has to be a more elegant way to do this. */ if (!strncmp(search, username, sizeof(username) + 1)) { printf("[+] Found Credentials!\n"); //printf("[+] Full String: \"%s\"\n", search); //uncomment for full query string user = strtok(search, "&"); pass = strtok(NULL, "&"); user = strtok(user, "="); user = strtok(NULL, "="); pass = strtok(pass, "="); pass = strtok(NULL, "="); printf("[+] Username: %s\tPassword: %s\n", user, pass); printf("[?] Look for more (Y/n)?"); more = mygetch(); printf("\n"); if (more == 'n') { printf("[+] Exiting on user request\n"); exit(0); } } } }
void editall(void) { char file[PATHLEN + 1]; /* file name */ char linenum[NUMLEN + 1]; /* line number */ int c; /* verify that there is a references found file */ if (refsfound == NULL) { return; } /* get the first line */ seekline(1); /* get each file name and line number */ while (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]", file, linenum) == 2) { edit(file, linenum); /* edit it */ if (editallprompt == YES) { addstr("Type ^D to stop editing all lines, or any other character to continue: "); if ((c = mygetch()) == EOF || c == ctrl('D') || c == ctrl('Z')) { break; } } } seekline(topline); }
int getcoordinate(void) { int c, next; c = mygetch(); next = 0; if (c == ctrl('A')) { next = 95; c = mygetch(); } if (c < ' ') { return (0); } return (next + c - ' '); }
int getline(char s[], size_t size, int firstchar, BOOL iscaseless) { int c, i = 0; int j; /* if a character already has been typed */ if (firstchar != '\0') { if (iscaseless == YES) { firstchar = tolower(firstchar); } (void) addch((unsigned)firstchar); /* display it */ s[i++] = firstchar; /* save it */ } /* until the end of the line is reached */ while ((c = mygetch()) != '\r' && c != '\n' && c != KEY_ENTER && c != '\003' && c != KEY_BREAK) { if (c == erasechar() || c == '\b' || /* erase */ c == KEY_BACKSPACE) { if (i > 0) { (void) addstr("\b \b"); --i; } } else if (c == killchar()) { /* kill */ for (j = 0; j < i; ++j) { (void) addch('\b'); } for (j = 0; j < i; ++j) { (void) addch(' '); } for (j = 0; j < i; ++j) { (void) addch('\b'); } i = 0; } else if (isprint(c) || c == '\t') { /* printable */ if (iscaseless == YES) { c = tolower(c); } /* if it will fit on the line */ if (i < size) { (void) addch((unsigned)c); /* display it */ s[i++] = c; /* save it */ } } else if (c == ctrl('X')) { /* mouse */ (void) getmouseevent(); /* ignore it */ } else if (c == EOF) { /* end-of-file */ break; } /* return on an empty line to allow a command to be entered */ if (firstchar != '\0' && i == 0) { break; } } s[i] = '\0'; return (i); }
short asksmashop() { short chkend=0; do{ CLEAR; cout<<BLUE<<"Small shop--Welcome to my shop!"<<endl; cout<<"Enter the number you want..."<<endl; cout<<endl<<"1.Pay 100 coin to add 200 life;"<<endl<<"2.Pay 100 coin to add 50 attack;"<<endl<<"3.Pay 100 coin to add 50 defence;"<<endl<<"4.quit"<<COLEND<<endl; short ans; cin>>ans;mygetch();//抵消回车 if(ans>=1&&ans<=3) { int money=herobrine.chkatt('m'); if(money>=100) { herobrine.chgatt('m',-100); switch(ans) { case 1:herobrine.chgatt('l',200);break; case 2:herobrine.chgatt('a',50);break; case 3:herobrine.chgatt('d',50);break; } cout<<"Successed!Press anykey to continue..."<<endl; mygetch(); } else { chkend=1; cout<<"You dont have enough money!"<<endl<<"Press anykey to continue..."<<endl; mygetch(); } } else { switch(ans) { case 4:chkend=1;break; default:break; } } }while(chkend==0); return 1; }
static void main_loop() { GSList * teste = get_all_files_dir(TEST_ABS_PATH); /* g_slist_foreach(teste,foreach_is_match,"a"); */ gchar * current_re = (gchar*)malloc(sizeof(gchar)*MAX_SIZE_RE); guint pos = 0; gushort pressedKey; printf("%c",START_CHAR); while(1) { pressedKey = mygetch(); switch(pressedKey) { case 127: if(pos) { current_re[pos--] = ' '; printf("%c", 8); printf(" "); printf("%c", 8); current_re[pos] = '\0'; } break; default : current_re[pos++] = pressedKey; printf("%c",current_re[pos-1]); current_re[pos] = '\0'; } if(isBalanced(current_re)) { g_slist_foreach(teste,foreach_is_match,current_re); if(flag_found) printf("\n%c%s",START_CHAR,current_re); else { printf("\nNo Match!"); printf("\n%c%s",START_CHAR,current_re); } flag_found = FALSE; }else { printf("\nMalformed Regular Expression!"); printf("\n%c%s",START_CHAR,current_re); } } }
int main(int argc, char **argv) { printf("Library version: %s\n", rp_GetVersion()); ECHECK(rp_Init()); puts("---Calibration application---\n"); puts("Calibration proces started."); puts("Connect CH1 to ground. Press any key to continue."); mygetch(); ECHECK(rp_CalibrateFrontEndOffset(RP_CH_1, NULL)); puts("Connect CH1 to 5V and set jumpers to HV. Press any key to continue."); mygetch(); ECHECK(rp_CalibrateFrontEndScaleHV(RP_CH_1, 5.0, NULL)); puts("Connect CH1 to 1V and set jumpers to LV. Press any key to continue."); mygetch(); ECHECK(rp_CalibrateFrontEndScaleLV(RP_CH_1, 1.0, NULL)); puts("Connect CH2 to ground. Press any key to continue.\n"); mygetch(); ECHECK(rp_CalibrateFrontEndOffset(RP_CH_2, NULL)); puts("Connect CH2 to 5V and set jumpers to HV. Press any key to continue."); mygetch(); ECHECK(rp_CalibrateFrontEndScaleHV(RP_CH_2, 5.0, NULL)); puts("Connect CH2 to 1V and set jumpers to LV. Press any key to continue."); mygetch(); ECHECK(rp_CalibrateFrontEndScaleLV(RP_CH_2, 1.0, NULL)); puts("Connect CH1 Outout to CH1 Input. Press any key to continue."); mygetch(); ECHECK(rp_CalibrateBackEndOffset(RP_CH_1)); ECHECK(rp_CalibrateBackEndScale(RP_CH_1)); puts("Connect CH2 Outout to CH2 Input. Press any key to continue."); mygetch(); ECHECK(rp_CalibrateBackEndOffset(RP_CH_2)); ECHECK(rp_CalibrateBackEndScale(RP_CH_2)); ECHECK(rp_Release()); return 0; }
void *teclado(void *) { while(1) { pthread_mutex_lock(&emgetch); get_getch=mygetch(); pthread_mutex_unlock(&emgetch); usleep(1000); } return 0; }
void check_control() { int c; c = mygetch(); if(c == 'a' && current_direction != DIRECTION_RIGHT) current_direction = DIRECTION_LEFT; if(c == 'd' && current_direction != DIRECTION_LEFT) current_direction = DIRECTION_RIGHT; if(c == 'w' && current_direction != DIRECTION_DOWN) current_direction = DIRECTION_UP; if(c == 's' && current_direction != DIRECTION_UP) current_direction = DIRECTION_DOWN; }
int main() { int num,oldnum; char ch = 0; char *buf = NULL; buf = (char *)malloc(sizeof(char)*4); // get_charnumber(num,4,buf); // printf("%s\n",buf); while(1) { do { // sleep(1); oldnum = num; srand((uint)time(NULL)); num = rand(); }while(num < 1000); get_charnumber(num,4,buf); printf(">>>>>欢迎进行猜字游戏<<<<<\n"); printf("-----按1 进入游戏\n"); printf("-----按2 查看规则\n"); printf("-----按0 退出游戏\n"); ch = mygetch(); switch(ch) { case '1': { start_game(buf,4); break; } case '2': { show_rule(); break; } case '0': goto exit; } } exit: free(buf); return 0; }
//thay doi thong tin tren key void edit() { char xau[20]; p1=(dict1*)malloc(sizeof(dict1)); printf("\nNhap tu muon them:"); scanf("%*c");gets(xau); strcpy(p1->key,xau); if (btsel(bt1,p1->key,(char*)p1,sizeof(dict1),&rsize1)!=0) { mygetch(); printf("\nNhap y nghia:");gets(p1->value); btins(bt1,p1->key,(char*)p1,sizeof(dict1)); printf("\nDa cap nhat"); mygetch(); } else { mygetch(); printf("\nNhap vao nghia tu:");gets(p1->value); btupd(bt1,p1->key,(char*)p1,sizeof(dict1)); printf("\nNghia da duoc thay doi"); mygetch(); } }
int getpercent(void) { int c; c = mygetch(); if (c < 16) { return (0); } if (c > 120) { return (100); } return (c - 16); }
int main(int argc, char **argv) { int fd_mouse = -1; int fd_kbd = -1; int i = 0; pid_t pid; if (signal(SIGCHLD, handler1) == SIG_ERR) { fprintf(stderr, "signal error.\n"); exit(0); } fd_kbd = open("/dev/tty", O_RDWR); if (fd_kbd <= 0) { fprintf(stderr, "can not open keyboard input file.\n"); return -1; } fd_mouse = open("/dev/input/event4", O_RDWR); if (fd_mouse <= 0) { fprintf(stderr, "can not open mouse input file.\n"); return -1; } if ((pid = fork()) == 0) { int key; while (key = mygetch()) { if (key == 'q') exit(0); printf("key %c pressed.\n", key); } } char w = 'f'; for (i = 0; i < 10; i++) { write(fd_kbd, &w, 1); sleep(3); } w = 'q'; for (i = 0; i < 5; i++) { write(fd_kbd, &w, 1); sleep(3); } close(fd_kbd); close(fd_mouse); return 0; }
int getch::GetKey() const { #ifdef DEBUG D.Debug("getch::GetKey()", ENTER); #endif int temp = 0; do{ temp = mygetch(); } while(temp == 27 || temp == 91); #ifdef DEBUG D.Debug("temp", IS, temp); D.Debug("int(temp)", IS, int(temp)); #endif #ifdef DEBUG D.Debug("getch::GetKey()", EXIT, temp); #endif return temp; }
int showHelp() { system("clear"); printf("ASCIISKI by Artur Skonecki\n\n\n" ":==:==:==:==:==:HELP:==:==:==:==:==:\n\n" "You are an adventurous skier.\n" "Your mission: survive as long as possible\n\n" "WARNING: game recognizes only lower-case letters\n\n" "CONTROLS:\n" "a - move left\n" "d - move right\n" "h - show this help\n" "m - return to menu\n" "q - exit\n\n" "You can now:\n" "M - return to menu\n" "R - return to game\n\n" ); if(inputok==0) printf("There is no such option. Try again.\n"); printf(">> "); int ch= mygetch(); switch(ch) { case 113: setState(STATE_EXITING); inputok=1; break; case 'm': setState(STATE_MENU); inputok=1; break; case 114: setState(STATE_ALIVE); inputok=1; break; default: inputok=0; break; } return 0; }
//tim` kiem void search2() { int j,kt=0,c,i=0; char key1[40]; p2=(dict2*)malloc(sizeof(dict2)); printf("\nNhap tu ban muon tim:");mygetch(); do { c = mygetch();printf("%c",c); key[i]=c; i++; } while((c!='\t')&&(c!='\n')); key[i-1]='\0'; /*scanf("%*c");gets(key); if(btsel(bt1,key,(char*)p1,sizeof(dict1),&rsize1)!=0) { printf("\n\033[31m=>Khong co tu nay\033[0m"); mygetch(); }*/ soundex(s1,key,1,1); if(btsel(bt2,s1,(char*)p2,sizeof(dict2),&rsize2)!=0) { printf("\n=>\033[31mKhong co tu nay\033[0m"); mygetch(); } else { printf("\nTim kiem nang cao(bang thu vien soundex):\n"); for(j=0;j<=p2->i;j++) { printf("%s=>\t",p2->key[j]); } mygetch(); printf("\n\n=>Nhap vao y nghia:");scanf("%s",key1); for(j=0;j<=p2->i;j++) { if(strcmp(key1,p2->key[j])==0) { printf("\n%s\t%s",key1,p2->value[j]); kt=1; break; } } if (kt==0) printf("\n\n\033[31mKhong co tu nay\033[0m"); mygetch(); } // } mygetch(); }
void about() { system("clear"); printf("======================================\n"); printf("|| ||\n"); printf("|| \033[1;33m 版权所有 \033[0m ||\n"); printf("|| 作者: \033[4m周宇涛\033[0m ||\n"); printf("|| 时间: [2016/7/5] ||\n"); printf("|| ||\n"); printf("======================================\n"); printf("按Esc键退回\n"); while (1) { if (mygetch() == 27) { break ; } } init(4); }
int main(int argc, char **argv) { ros::init(argc, argv, "wheel manual instruction"); ros::NodeHandle nHandle; ros::ServiceClient sendinstClient = nHandle.serviceClient <wheels::cmd_send_manual_instruction>("send_manual_instruction"); wheels::cmd_send_manual_instruction srv; uint32_t nInput = 0; //printf("Input instruction (0: disable all navigator engine, 1: line-follower, o: manual stop, k: manual restart, u: forward, d: backward, l: left, r: right, w: right-backward, z: left-backward, p: stop, i: wheel status\n"); while ((nInput = mygetch()) != 27) { srv.request.nManualInstruction = nInput; if (sendinstClient.call(srv) == false) { printf("Fail to send manual instruction\n"); } } return 0; }
int showMenu() { system("clear"); printf("ASCIISKI by Artur Skonecki\n\n\n" ":==:==:==:==:==:MAIN MENU:==:==:==:==:==:\n\n" "WARNING: game recognizes only lower-case letters\n\n" "You can now:\n" "S - start game\n" "C - continue game\n" "H - show help\n" "Q - exit game\n\n" ); if(inputok==0) printf("There is no such option. Try again.\n"); printf(">> "); int ch= mygetch(); switch(ch) { case 113: setState(STATE_EXITING); inputok=1; break; case 'h'://showHelp setState(STATE_HELP); inputok=1; break; case 'c': setState(STATE_ALIVE); break; case 115://start game setState(STATE_RESTART); inputok=1; break; default: inputok=0; break; } return 0; }
//tim` kiem su dung TAB void search_tab() { char c,keyc[40]; int i=0,kt; p1 = (dict1*) malloc(sizeof(dict1)); fflush(stdin); printf("Nhap tu ban muon tim kiem(TAB):");mygetch(); do { c = mygetch();printf("%c",c); keyc[i]=c; i++; } while((c!='\t')&&(c!='\n')); keyc[i-1]='\0'; kt=btsel(bt1,keyc,(char*)p1,sizeof(dict1),&rsize1); if(c=='\n') { if(kt==0) { printf("\n%s%s ",p1->key,p1->value); mygetch(); } else { printf("\n\033[31mKhong the tim\033[0m"); mygetch(); } } while(c=='\t') { btseln(bt1,key,(char*)p1,sizeof(dict1),&rsize1); if(check(keyc,key)==0) { printf("\n\nKet thuc"); mygetch(); break; } else { printf("\n\n%s\t%s ",p1->key,p1->value); mygetch(); } } free(p1); }
//extern poinscounter; int showDead() { system("clear"); printf("ASCIISKI by Artur Skonecki\n\n\n" ":==:==:==:==:==:YOU ARE DEAD:==:==:==:==:==:\n\n" "Your score: %d points\n\n" "You can now:\n" "Q - exit game\n" "C - continue playing\n" "R - restart game\n\n" , getSavedPoints() ); if(inputok==0) printf("There is no such option. Try again.\n"); printf(">> "); int ch= mygetch(); switch(ch) { case 113: setState(STATE_EXITING); inputok=1; break; case 'c'://continue playing setState(STATE_ALIVE); inputok=1; break; case 114://restartgame setState(STATE_RESTART); inputok=1; break; default: inputok=0; break; } return 0; }
void setStone(int arr[6][6]) { int status=0; int key = 0; stone_paint(status); while ((key=mygetch()) != 10) { switch(key) { case 49: // 左 status = 1; break; case 51: // 右 status = 0; break; } stone_paint(status); } int i,j; // 重置数组 score = 0; for (i=0; i<6; i++) { for (j=0; j<6; j++) { arr[i][j] = 0; } } srand(time(NULL)); i = rand() % 6; j = rand() % 6; if(status == 1) { arr[i][j] = -3; // 为石头 } init(2); }
void level() { system("clear"); int i=0; FILE * p_r = fopen(".rank", "r"); char name[11]; char scores[100]; int scoreNum = 0; fscanf(p_r, "%s%s", name, scores); // 读取数据 i = 0; for (; i<strlen(scores); i++) { scoreNum = scoreNum*10+(scores[i]-48); } if (scoreNum >= score) { printf(" \033[1;31m最强王者\033[0m\n"); printf("Player: %s, Score: %d\n", name, scoreNum); } else { FILE * p_w = fopen(".rank", "w"); fprintf(p_w, "%s %d\n", buf, score); fclose(p_w); } fclose(p_r); printf("请按Esc返回\n"); while (1) { if (mygetch() == 27) { break; } } init(3); }
int main(int argc,char *argv[]) { int rtn; openlog("yktbu",LOG_PID|LOG_CONS|LOG_NDELAY,LOG_LOCAL0); g_pSvrLink = BUPubInitialize(g_XBDefines,CallBDFunc,WriteAppInfo,&g_LogFile); SetLogShowLevel(0); sprintf(g_szVerNo,"%s %s (%s)",argv[0],YKT_VERSION,__DATE__); if(argc==2) { if(strncmp(argv[1],"-v",2)==0||strncmp(argv[1],"-V",2)==0) { printf("%s\n",g_szVerNo); closelog(); return 0; } } if (argc<2) ReadIni("ksbu.ini"); else ReadIni(argv[1]); ResetBPFunctions(); if (argc>2) { ListBPFunctions(argv[2]); } // 初始化数据库连接: SQLInitialize(); if (SQLConnectToServer()!=0) { DEBUG_RUNTIME_MSGOUT("不能正常建立数据库连接, 检查配置和数据库服务器!\n"); return(-100); } DEBUG_RUNTIME_MSGOUT("连接数据库成功!\n"); CAccTrans& ats=CAccTrans::GetInst(); if(ats.LoadCfg()!=0) { DEBUG_RUNTIME_MSGOUT("加载系统参数失败!\n"); //RAISE_RUNTIME_ERROR("加载数据库账务配置参数失败!\n"); return(-200); } DEBUG_RUNTIME_MSGOUT("加载系统参数成功!\n"); // 初始化与BCC连接: do { rtn = g_pSvrLink->ToLink(&g_BUnit); if (rtn==1) { DEBUG_RUNTIME_MSGOUT("与业务调度中心(BCC)的连接成功!\n"); break; } else if (rtn==-100) { DEBUG_RUNTIME_MSGOUT("估计业务调度中心(BCC)尚未正式启动,或者检查配置中的[SERVER]项参数\n"); mysleep(g_BUnit.iHBInterval); } else { // 应该属于故障,或对方并不是BCC return(rtn); } } while (1); #ifdef WIN32 setnoblockgetch(); #endif while (g_pSvrLink->LinkOK()) { #ifdef WIN32 switch (mygetch()) { case '?': case 'h': case 'H': printf("\nCommand List:\n"); printf("\t ? or h: display this Help informations!\n"); printf("\t x: To eXit this business unit.\n"); printf("\t d: Display functions status.\n"); printf("\t l: List functions status into <function.lst>.\n"); printf("Enter command to select:"); break; case 'x': case 'X': g_pSvrLink->bExit = true; continue; break; case 'd': case 'D': ListBPFunctions(NULL); break; case 'l': case 'L': ListBPFunctions("function.lst"); break; } #endif if (!SQLIsConnectOK()) { mysleep(1000); if (!g_pSvrLink->CheckLink()) break; // BCC exit (可能用户发现数据库连接断开,需要维护系统,导致手工将BCC退出同时也需要BU退出) if (SQLConnectToServer()!=0) { // SQL Link error: DEBUG_RUNTIME_MSGOUT("不能正常建立数据库连接, 检查配置和数据库服务器!\n"); } else { DEBUG_RUNTIME_MSGOUT("与数据库连接成功!\n"); } continue; } else g_pSvrLink->Processing(&g_BUnit); if (g_pSvrLink->bExit) break; } /* ****** Updated by CHENYH at 2004-4-14 11:07:19 ****** 经过测试后,CheckLink()工作正常,测试环境为:BCC(WIN)+BU(WIN),BCC(LINUX)+BU(WIN),BCC(LINUX)+BU(LINUX) while (1) { mysleep(1000); if (!g_SvrLink.CheckLink()) { printf("TEST CHECK LINK return <false>!\n"); break; } } */ g_pSvrLink->Close(); SQLExit(); DEBUG_RUNTIME_MSGOUT("业务处理单元BU系统正常退出!\n"); g_LogFile.Close(); closelog(); return(0); }
void askforchar(void) { addstr("Type any character to continue: "); mygetch(); }