#define americano 0 #define europeo 1 #define lmax 200 // 200 #define posin 18 #define ladat 82+posin #define orden 0 #define estac 56+posin // llamadas entrantes #define linea 48+posin #define durac 32+posin #define hor 16+posin #define fech 4 +posin #define tranf 36+posin #define numero 58+posin #define ccost 0 #define proye 0 #define cuenta 20+posin #define pulsos 0 #define ruta 0 #define prinum 0 #define ring 10+posin #define antran 0 // anexo transferido (pendiente) #define fofech americano // formato de fecha #define ladat 82+posin #define l_nume 16 char lgua[lmax+3]; char *cuf; extern char rgua[]; void in_central() { rgua[0]='\0'; } void fi_central() { } void gua_buf(char *buf) { strcpy(lgua,buf); } void DatCentral(char *buf, char *tel, int vestac, int vlinea,int vdurac,int vhor, int vfech, int vtranf, int vnumero, int vccost,int vproye, int vcuenta, int vpulsos, int vruta, int vprinum, int vring, int vantran, int vfofech) { int i,k,j, cont; // char *cuf; k =0; i=strlen(buf); cont=0; if (i>vestac+5 && buf[vfech+2]=='/' && isalnum(buf[vtranf])) // PRIMERA LINEA VÁLIDA { gua_buf(buf); cuf = lgua; return; } if (i>vnumero+10 && isalnum(buf[vring-4]) && isalnum(buf[vlinea+4])) // SEGUNDA LINEA VÁLIDA { k = 0 ; for (j=4;j<7;j++) { if isdigit(cuf[vestac+j]) { tel[k++] = cuf[vestac+j] ; cont++; } else tel[k++]='0'; } if (cont==0)tel[k++] = '*';cont=0; tel[k++] = ' '; for (j=0;j<3;j++) { if isdigit(cuf[vlinea+j]) {tel[k++] = cuf[vlinea+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' '; tel[k++] = '0' ; tel[k++] = buf[vdurac] ; tel[k++] = ':' ; tel[k++] = buf[vdurac+2] ; tel[k++] = buf[vdurac+3] ; tel[k++] = ':' ; tel[k++] = buf[vdurac+5] ; tel[k++] = buf[vdurac+6] ; tel[k++] = ' ' ; for (j=0;j<5;j++) { if (isdigit(cuf[vhor+j]) || cuf[vhor+j]==':') {tel[k++] = cuf[vhor+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' ' ; tel[k++] = cuf[vfech+3] ; tel[k++] = cuf[vfech+4] ; tel[k++] = '/'; tel[k++] = cuf[vfech+6] ; tel[k++] = cuf[vfech+7] ; tel[k++] = '/'; tel[k++] = cuf[vfech+0] ; ; tel[k++] = cuf[vfech+1] ; ; tel[k++] = ' ' ; if(cuf[vtranf]=='O') tel[k++] = 'O' ; else tel[k++] = 'I' ; tel[k++] = ' ' ; for (j=0;j<17;j++) { if isdigit(buf[vnumero+j]) { tel[k++] = buf[vnumero+j] ; cont++; } } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ tel[k++] = ' ' ; tel[k++] = '*' ; //codigo de proyecto tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; for (j=0;j<7;j++) //codigo de cuenta { if isdigit(buf[vcuenta+j]) {tel[k++] = buf[vcuenta+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' ' ; for (i=0;i<5;i++) tel[k++] = '0'; // tarifa o pulsos tel[k++] = ' ' ; tel[k++] = '*' ; /* ruta */ tel[k++] = ' ' ; tel[k++] = '*' ; /* primer numero */ tel[k++] = ' ' ; if isdigit(buf[vring]) /* tiempo ring */ { for(j=0;j<5;j++) { tel[k++]=buf[vring+j]; } } else { tel[k++] = '0' ;tel[k++] = '0'; tel[k++] = ':'; tel[k++] = '0' ;tel[k++] = '0' ; } tel[k++] = ' ' ; tel[k++] = '*' ; // anexo transferido tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }