📄 cx170.c
字号:
DL_MNUOPTS menu1121_opts[] = { {"1",mxthmon,&menu_bottom}, {"2",mxlsmon,&menu_bottom}, {"3",dymx1125,&menu_bottom}, {"4",dqmx1122,&menu_bottom}, {"7",NULL,NULL}, {"8",NULL,NULL}, {"9",NULL,NULL}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_1121 = { menu1121_opts, DM_CURR, val_menu, "bm_menu1121", "keyerr", goodby, &data_1 };/* Menu 1122 */DL_MNUOPTS menu1122_opts[] = { {"1",now_cost, &menu_bottom}, {"2",lst_cost, &menu_bottom}, {"3",mon_cost, &menu_bottom}, {"4",yer_cost, &menu_bottom}, {"7",NULL,NULL}, {"8",NULL,NULL}, {"9",NULL,NULL}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_1122 = { menu1122_opts, DM_CURR, val_menu, "bm_menu1122", "keyerr", goodby, &data_1 };/* Menu 1123 */DL_MNUOPTS menu1123_opts[] = { {"1",now_168, &menu_bottom}, {"2",lst_168, &menu_bottom}, {"3",mon_168, &menu_bottom}, {"4",dmd_168, &menu_bottom}, {"7",NULL,NULL}, {"8",NULL,NULL}, {"9",NULL,NULL}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_1123 = { menu1123_opts, DM_CURR, val_menu, "bm_menu1121", "keyerr", goodby, &data_1 };/* Menu 1323 */DL_MNUOPTS menu1323_opts[] = { {"1",now_myd, &menu_bottom}, {"2",lst_myd, &menu_bottom}, {"3",mon_myd, &menu_bottom}, {"4",dmd_myd, &menu_bottom}, {"7",NULL,NULL}, {"8",NULL,NULL}, {"9",NULL,NULL}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_1323 = { menu1323_opts, DM_CURR, val_menu, "bm_menu1121", "keyerr", goodby, &data_1 };/* Menu 1131 */DL_MNUOPTS menu1131_opts[] = { {"1",gjqhdy,&menu_bottom}, {"2",gjqhsy,&menu_bottom}, {"3",gjqhdn,&menu_bottom}, {"4",gjqhdq,&menu_bottom}, {"7",NULL,NULL}, {"8",NULL,NULL}, {"9",NULL,NULL}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_1131 = { menu1131_opts, /* Pointer to option table for menu */ DM_CURR, /* Default next menu is current men */ val_menu, /* Ptr to input valid fnc for menu */ "bm_menu1121", /* Pointer to prompt message */ "keyerr", /* Pointer to retry message */ goodby, /* Pointer to fatal error function */ &data_1 /* Pointer to Data table for menu */};/* Menu 1132 */DL_MNUOPTS menu1132_opts[] = { {"1",gnqhdy,&menu_bottom}, {"2",gnqhsy,&menu_bottom}, {"3",gnqhdn,&menu_bottom}, {"4",gnqhdq,&menu_bottom}, {"7",NULL,NULL}, {"8",NULL,NULL}, {"9",NULL,NULL}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_1132 = { menu1132_opts, /* Pointer to option table for menu */ DM_CURR, /* Default next menu is current men */ val_menu, /* Ptr to input valid fnc for menu */ "bm_menu1121", /* Pointer to prompt message */ "keyerr", /* Pointer to retry message */ goodby, /* Pointer to fatal error function */ &data_1 /* Pointer to Data table for menu */};/* Menu 1133 */DL_MNUOPTS menu1133_opts[] = { {"1",dfhmdy,&menu_bottom}, {"2",dfhmsy,&menu_bottom}, {"3",dfhmdn,&menu_bottom}, {"4",dfhmdq,&menu_bottom}, {"7",NULL,NULL}, {"8",NULL,NULL}, {"9",NULL,NULL}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_1133 = { menu1133_opts, /* Pointer to option table for menu */ DM_CURR, /* Default next menu is current men */ val_menu, /* Ptr to input valid fnc for menu */ "bm_menu1121", /* Pointer to prompt message */ "keyerr", /* Pointer to retry message */ goodby, /* Pointer to fatal error function */ &data_1 /* Pointer to Data table for menu */};/* Menu 113 */DL_MNUOPTS menu113_opts[] = { {"1",ingnqh,&menu_1132}, {"2",ingjqh,&menu_1131}, {"3",inphone,&menu_1133}, {"7",NULL,NULL}, {"8",NULL,NULL}, {"9",NULL,NULL}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_113 = { menu113_opts, /* Pointer to option table for menu */ DM_CURR, /* Default next menu is current men */ val_menu, /* Ptr to input valid fnc for menu */ "bm_menu113", /* Pointer to prompt message */ "keyerr", /* Pointer to retry message */ goodby, /* Pointer to fatal error function */ &data_1 /* Pointer to Data table for menu */};/* Menu 1 */DL_MNUOPTS menu1_opts[] = { {"1",paymoney,&menu_bottom}, {"2",NULL,&menu_1122}, {"3",NULL,NULL}, {"4",NULL,&menu_113}, {"5",NULL,&menu_1112}, {"6",srv_sct,&menu_bottom}, {"7",NULL,NULL}, {"0",qwer,&menu_bottom}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_1 = { menu1_opts, /* Pointer to option table for menu */ DM_CURR, /* Default next menu is current men */ val_menu, /* Ptr to input valid fnc for menu */ "bm_menu1", /* Pointer to prompt message */ "keyerr", /* Pointer to retry message */ goodby, /* Pointer to fatal error function */ &data_1 /* Pointer to Data table for menu */};/* Menu 131 */DL_MNUOPTS menu131_opts[] = { {"1",NULL,&menu_1121}, {"2",no168,NULL},// {"2",NULL,&menu_1123}, {"7",NULL,NULL}, {"8",NULL,NULL}, {"9",NULL,NULL}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_131 = { menu131_opts, /* Pointer to option table for menu */ DM_CURR, /* Default next menu is current men */ val_menu, /* Ptr to input valid fnc for menu */ "sl_menu1", /* Pointer to prompt message */ "keyerr", /* Pointer to retry message */ goodby, /* Pointer to fatal error function */ &data_1 /* Pointer to Data table for menu */};/* Menu 132 */DL_MNUOPTS menu132_opts[] = { {"1",NULL,&menu_1121}, {"2",no168,NULL},// {"2",NULL,&menu_1123}, {"3",NULL,&menu_1323},// {"4",NULL,&menu_1333}, {"7",NULL,NULL}, {"8",NULL,NULL}, {"9",NULL,NULL}, {"*",bye_bye,NULL}, {NULL,NULL,NULL}};DL_MENU menu_132 = { menu132_opts, /* Pointer to option table for menu */ DM_CURR, /* Default next menu is current men */ val_menu, /* Ptr to input valid fnc for menu */ "sl_menu2", /* Pointer to prompt message */ "keyerr", /* Pointer to retry message */ goodby, /* Pointer to fatal error function */ &data_1 /* Pointer to Data table for menu */};/*************************************************************************** * NAME: void goodby() * DESCRIPTION: This function plays the goodby prompt and goes back * to the idle state. * INPUTS: none. * OUTPUTS: none. * RETURNS: none. * CALLS: disperr() playmsg() longjmp() * CAUTIONS: none. *************************************************************************/void goodby(){ unsigned short recvdig;// recvdig = def_rp_tpt[DX_MAXDTMF-1].tp_length; /* Save max. digit setting */// def_rp_tpt[DX_MAXDTMF-1].tp_length = 0; /* Don't terminate on any digit */ playmsg("mltkyerr");// def_rp_tpt[DX_MAXDTMF-1].tp_length = recvdig; /* Restore max. digit set */// etime () ; duration(); tb_offhkdti () ; longjmp(idlestate,1);}/*************************************************************************** * Data Base Managment Routines **************************************************************************//* * Change the menu-driven control program for usage */void ltb_menu_engine(){ DL_MNUOPTS *rspentry ; DL_MENU *tmp ; char digbuf[4] ; int tmpint ; long tsbits, arcv, brcv ; while (1) { if ((tsbits=ATDT_TSSGBIT(dtidev)) == AT_FAILURE) { do_error ("ATDT_TSSGBIT()") ; longjmp (idlestate, 1) ;// exit (1) ; } arcv = (tsbits & DTSG_RCVA) ? 1 : 0 ; brcv = (tsbits & DTSG_RCVB) ? 1 : 0 ; if ((arcv == 1) && (brcv == 0)) longjmp (idlestate, 1) ; rspentry = (DL_MNUOPTS *) gt_data (digbuf, cur_menu->me_validfnc, cur_menu->me_prompt, cur_menu->me_retry, cur_menu->me_error, cur_menu->me_data) ; if (digbuf[0] == '7') { if (cur_menu == &menu_bottom) { if (pre_menu->me_opttbl[tmpint-1].mo_fcnt != NULL) { (void) (*pre_menu->me_opttbl[tmpint-1].mo_fcnt) () ; } } } else { glb1 = 0 ; if (digbuf[0] == '8') { numptr -- ; cur_menu = ptrbuf [numptr-1] ; if (numptr > 1) pre_menu = ptrbuf [numptr-2] ; else pre_menu = NULL ; } else if (digbuf[0] == '9') { numptr = 1 ; pre_menu = NULL ; cur_menu = &menu_1 ; } else { tmpint = atoi (digbuf) ; if (tmpint == 0) tmpint = 8 ; if (rspentry->mo_fcnt != NULL) (void) (*rspentry->mo_fcnt) () ; if (rspentry->mo_nxtmenu !=NULL) {/* if ((cur_menu != &menu_1) || (digbuf[0] != '1')) {*/ numptr ++ ; pre_menu = cur_menu ; cur_menu = rspentry->mo_nxtmenu ; ptrbuf [numptr-1] = cur_menu ;/* } else { numptr ++ ; pre_menu = cur_menu ; cur_menu = &menu_1122 ; ptrbuf[numptr-1] = cur_menu ; }*/ } else { if ((cur_menu == &menu_1) && (digbuf[0] == '3')) { numptr ++ ; pre_menu = cur_menu ; if (phonenum[0] == '9' || phonenum[0] == '1') cur_menu = &menu_132 ; else cur_menu = &menu_131 ; ptrbuf [numptr-1] = cur_menu ; } else { switch ((int) cur_menu->me_defmenu) {/* case (int)NULL: (void) fprintf (stdout, "missing default menu. Menu system error\n"); offhkdti () ; exit (1) ;*/ case (int)DM_PREV: tmp = pre_menu ; pre_menu = cur_menu ; cur_menu = tmp ; break; case (int)DM_CURR: numptr ++ ; ptrbuf [numptr-1] = cur_menu ; break ; default: pre_menu = cur_menu ; cur_menu = cur_menu->me_defmenu ; numptr++ ; ptrbuf [numptr-1] = cur_menu ; break ; } } } } } }}void srv_sct(){ char scrtbuf2[16], tmp[16] ; static char scrtbuf1[16] ; int repeat, len, lenad, i, j, rptflg, wrtflg, nnnflg ; DV_DIGIT digit ; DV_TPT dattpt[MAXTERMS] ; FILE *handle ; char tmp2[40], str1[16], strphn[16] ; int hle, bufsz, kk, chglen ; sprintf (routnm, "srv_sct") ;printf("longphone=%s, maincall=%s\n", longphone, &digch[4]); if (gsmbill) len = 10; else len = 7; for (i = 0; i < len; i++) if (longphone[i] != digch[i+4]) { playmsg ("notchgsct") ; return ; } writefifo(1, "Update Password"); repeat = 3 ; rptflg = 0 ; if (glb1 == 0) { rptflg = 1 ; (void) memcpy(dattpt, def_dg_tpt, (MAXTERMS*sizeof(DV_TPT))) ; dattpt[DX_MAXDTMF-1].tp_length = 6 ; dattpt[DX_MAXTIME-1].tp_length = 150 ; dattpt[DX_DIGMASK-1].tp_length = bld_tdig_msk ("#") ; do {/* tsonhk () ;*/ if (repeat == 3) playmsg ("nwsctin") ; if (dx_getdig(devhandle, (DV_TPT *)dattpt, &digit, EV_SYNC) == -1)// (void) fprintf (stdout, "dx_getdig failed\n") ; writefifo(2, "dx_getdig failed"); strcpy (tmp, digit.dg_value) ; check_term(); if (tmp[strlen(tmp)-1] == '#') tmp[strlen(tmp)-1] = '\0' ; len = strlen(tmp) ; lenad = len ; if (len < 6) { scrtbuf1[6] = '\0' ; for (i=5;i>=6-lenad;i--,len--) scrtbuf1[i] = tmp[len-1] ; for (j=0;j<=i;j++) scrtbuf1[j] = ' ' ; } else strcpy (scrtbuf1, tmp) ; j = 0 ; for (i=0;i<6;i++) { if (scrtbuf1[i] == '*') { j = 1 ; break ; } } if (strcmp (scrtbuf1, " ") == 0) j = 1 ; if (j == 1) { if (repeat > 1) playmsg ("nwscterr") ; } else { playmsg ("rptnwsct") ; if (dx_getdig(devhandle, (DV_TPT *)dattpt, &digit, EV_SYNC) == -1)// (void) fprintf (stdout, "dx_getdig failed\n") ; writefifo(2, "dx_getdig failed"); strcpy (tmp, digit.dg_value) ; check_term(); if (tmp[strlen(tmp)-1] == '#') tmp[strlen(tmp)-1] = '\0' ; len = strlen(tmp) ; lenad = len ; if (len < 6) { scrtbuf2[6] = '\0' ; for (i=5;i>=6-lenad;i--,len--) scrtbuf2[i] = tmp[len-1] ; for (j=0;j<=i;j++) scrtbuf2[j] = ' ' ; } else strcpy (scrtbuf2, tmp) ; if (strcmp (scrtbuf1, scrtbuf2) == 0) break ; else if (repeat > 1) playmsg ("nwscterr") ; } } while (--repeat) ; } glb1 = 1 ; wrtflg = 0 ; nnnflg = 0 ; chglen = 0 ; strcpy (strphn, longphone) ; if (! gsmbill) { strphn[7] = strphn[8] = strphn[9] = ' '; strphn[10] = '\0'; } if (repeat == 0) errnwsct () ; else { playmsg ("sctcmp") ; if (rptflg == 0) return ; if ((hle = open ("passwd", O_RDWR)) == -1) {// printf ("Error: can not open passwd\n") ; writefifo(2, "Error: can not open passwd") ; return ; } else { lockf (hle, 1, 0) ;// printf ("lock success\n") ; while (1) { bufsz = read(hle, tmp2, 18); tmp2[18] = '\0' ; if (bufsz == 0) { if (chglen == 1) write(hle, tmp2, 18);// printf("tmp=%s, file end\n", tmp2) ; break ; } else if (bufsz < 0) {// printf ("read passwd error\n") ; writefifo(2, "read passwd error"); break ; } else { kk = strncmp(tmp2, strphn, 10); if (kk == 0) { lseek(hle,-7,1); write(hle,scrtbuf1,6); break ; } else if (kk > 0) { chglen = 1 ; lseek(hle, -18, 1); strcat(strphn, " "); strcat(scrtbuf1, "\n"); write(hle,strphn,11); write(hle,scrtbuf1,7); strncpy(strphn,tmp2,10); strphn[10] = '\0'; for (i=0;i<6;i++) scrtbuf1[i]=tmp2[i+11]; scrtbuf1[6] = '\0'; }// printf ("tmp=%s", tmp2); } } lockf (hle, 0, 0) ;// printf ("unlock success\n") ; close (hle) ; return ; }/* if ((handle = fopen ("passwd", "rt+")) == NULL) handle = fopen ("passwd", "wt") ; else { while (!feof(handle)) { fgets (tmp2, 30, handle) ; strncpy (str1, tmp2, 7) ; str1[7] = '\0' ; if ((strcmp (strphn, str1) == 0) && (wrtflg == 0)) { fseek (handle, -7L, 1) ; fputs (scrtbuf1, handle) ; fclose (handle) ; return ; } else if (strcmp(strphn, str1) < 0) { nnnflg = 1 ; wrtflg = 1 ; fseek (handle, -15L, 1) ; strcat (strphn, " ") ; fputs (strphn, handle) ; fputs (scrtbuf1, handle) ; strcpy (strphn, str1) ; for (i=0;i<7;i++) scrtbuf1[i] = tmp2[8+i] ; scrtbuf1[7] = '\0' ; fseek (handle, 1, 1) ; } } if (nnnflg == 0) strcpy (str1, longphone) ; fseek (handle, 0, 2) ; fprintf (handle, "%s %s", str1, scrtbuf1) ; fclose (handle) ; return ; } fclose (handle) ; return ;*/ }}void bgn(){ playmsg ("xtnihao") ; strcpy(phonenum,&digch[4]); sprintf(dispbuf, "%s %s", "Inquired No is", phonenum); writefifo(1, dispbuf); if (phonenum[0]=='5'&&phonenum[1]=='5'&&phonenum[2]=='6'&&phonenum[3]=='5') return ; if (phonenum[0]=='1'&&phonenum[1]=='3') gsmbill=1; else gsmbill=0; strcpy(longphone, phonenum); if (! gsmbill) { lgphone = atol(longphone); newbtreval(lgphone); } return ;}void *val_phn1 (digbufp)char *digbufp ;{ int len, i ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -