#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 132+posin #define estac 0+posin #define linea 4+posin #define durac 7+posin #define hor 16+posin//15+posin #define fech 22+posin//21+posin #define tranf 31+posin//30+posin #define numero 32+posin #define ccost 57+posin //#define ccost 58+posin #define proye 0 #define cuenta 0 #define pulsos 0 #define ruta 0 #define prinum 0 #define ring 45+posin #define antran 0 // anexo transferido #define fofech americano char reg[200][ladat]; int aux=0,t=0,m=0,j,lb,i; extern char rgua[]; void in_central() { rgua[0]='\0'; } void fi_central() { } //compara la línea del registro actual (buf) con los registros anteriores (almacenados en el arreglo bidimencional) busca_lin(char *buf) { for(m=t;m>=0;m--) { if(reg[m][lb]==buf[lb] && reg[m][lb+1]==buf[lb+1]) break;//lineas iguales? } } //almacena las llamadas con lineas distintas en un arreglo bidimencional (sobreescribe los registros de líneas iguales) add_reg(char *buf) { busca_lin(buf); if (m<1) { m=t;t++; } for(j=0;j<=i;j++) reg[m][j]=buf[j]; } 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 k,ka,it,cont; char tipo; k=0;cont=0; i=strlen(buf); lb=vlinea; //posicion de la línea buscada if (i>(vtranf-1) && buf[vfech+2]=='/' && buf[vhor+2]==':' && buf[vdurac+2]==':' && isalnum(buf[vtranf])) { k = 0 ; if (buf[vtranf]=='O') tipo = 'O' ; else if (buf[vtranf]=='I') tipo = 'I' ; else if (buf[vtranf]=='t' || buf[vtranf]=='T') tipo = 'T' ; if (tipo =='T') busca_lin(buf); //transferncias: busca por linea el anexo desde donde se transfirió else add_reg(buf); for (j=0;j<3;j++) { if (isdigit(buf[vestac+j])) {tel[k++] = buf[vestac+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; tel[k++] = ' ' ; tel[k++] = buf[vlinea] ; tel[k++] = buf[vlinea+1] ; tel[k++] = ' ' ; for(it=0;it<8;it++) { tel[k++]=buf[vdurac+it] ; } tel[k++] = ' ' ; ka = k ; tel[k++] = buf[vhor] ; tel[k++] = buf[vhor+1] ; tel[k++] = buf[vhor+2] ; tel[k++] = buf[vhor+3] ; tel[k++] = buf[vhor+4] ; tel[k++] = ' ' ; if (vfofech==europeo) { tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; tel[k++] = '/'; tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; } else { tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; tel[k++] = '/'; tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; } tel[k++] = '/'; tel[k++] = buf[vfech+6] ; tel[k++] = buf[vfech+7] ; tel[k++] = ' ' ; tel[k++] = tipo ; tel[k++] = ' ' ; if (tipo=='T') { tel[k++]=reg[m][vestac]; tel[k++]=reg[m][vestac+1]; tel[k++]=reg[m][vestac+2]; } else { for (j=0;j<25;j++) { if (buf[vnumero+j]!=' ') {tel[k++] = buf[vnumero+j] ; cont++;} } if(cont==0)tel[k++] = '*';cont=0; } tel[k++] = ' ' ; if ((buf[vccost]==' ' && buf[vccost+1]==' ') || i<(vccost+3)) { tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ } else { tel[k++] = buf[vccost] ; tel[k++] = buf[vccost+1] ; } tel[k++] = ' ' ; tel[k++] = '*' ; /* proyecto */ tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = ' ' ; for (it=0 ; it<4 ; it++) tel[k++]='0' ; /* pulsos */ tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* ruta */ tel[k++] = ' ' ; tel[k++] = '*' ; /* primer numero */ tel[k++] = ' ' ; tel[k++] = '0' ;tel[k++] = '0' ;tel[k++] = ':' ;tel[k++] = '0' ;tel[k++] = '0' ; /* tiempo ring */ tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }