#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 150+posin #define estac 25+posin #define linea 38+posin #define durac 12+posin #define hor 7+posin #define fech 0+posin #define tranf 0 #define numero 50+posin #define ccost 0 #define proye 0 #define cuenta 0 #define pulsos 0 #define ruta 0 #define prinum 0 #define ring 0 #define antran 0 // anexo transferido #define fofech americano char reg[300][ladat], *cuf, *duf, aux[3][ladat], lgua[lmax+3]; //aux registro auxiliar que guarda las tres líneas int t,m,j,lb,lr,i,h,cont, encuentra, pos_anexo; //lb posicion de ruta+linea de buf int primera_OK, segunda_OK, tercera_OK; t=0; m=0; lb=0; i=0; h=0; cont=0; encuentra=0; primera_OK=0; segunda_OK=0; tercera_OK=0; extern void gua_rut(char *buf); extern char rgua[]; void in_central() { rgua[0]='\0'; } void gua_buf(char *buf) { strcpy(lgua,buf); } void fi_central() { } //compara la línea del registro actual (buf) con los registros anteriores (almacenados en el arreglo bidimencional) 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,cont; int dur_val, segu, minu, hora; char seg[5]; i=strlen(buf); if (i>(vdurac) && buf[vfech]=='D') //primera línea válida { for(j=0;j<=i;j++) { aux[0][j]=' '; aux[0][j]=buf[j]; //aux registro auxiliar que guarda las tres líneas } primera_OK=1; return; } else if ( primera_OK && !segunda_OK && buf[vfech]==' ') //segunda línea válida { for(j=0;j<=i;j++) { aux[1][j]=' '; aux[1][j]=buf[j]; } segunda_OK=1; return; } else if (primera_OK && segunda_OK && !tercera_OK) //tercera línea válida { for(j=0;j<=i;j++) { aux[2][j]=' '; aux[2][j]=buf[j]; } tercera_OK=1; } if (primera_OK && segunda_OK && tercera_OK) { primera_OK=0; segunda_OK=0; tercera_OK=0; buf=aux[0]; cuf=aux[1]; duf=aux[2]; i=strlen(buf); k=0; encuentra=0; cont=0; if (isdigit(cuf[vestac+3])) { for (j=0;j<4; j++) {tel[k++]= cuf[vestac+j];} } else tel[k++]='*'; tel[k++]=' '; tel[k++]=cuf[vlinea];tel[k++]=cuf[vlinea+1]; // linea tel[k++]=' '; for(j=0;j<6;j++) seg[j]=duf[vdurac+j]; dur_val=(atoi(seg)); segu=(dur_val)%60; //segundos minu=((dur_val)%3600)/60; //minutos hora=(dur_val)/3600; //hora tel[k++]=(hora/10)+'0'; tel[k++]=(hora%10)+'0'; tel[k++]=':'; tel[k++]=(minu/10)+'0'; tel[k++]=(minu%10)+'0'; tel[k++]=':'; tel[k++]=(segu/10)+'0'; tel[k++]=(segu%10)+'0'; //tel[k++]=duf[vdurac]; tel[k++]=duf[vdurac+1]; tel[k++]=':'; //tel[k++]=duf[vdurac+2]; tel[k++]=duf[vdurac+3]; tel[k++]=':'; //tel[k++]=duf[vdurac+4]; tel[k++]=duf[vdurac+5]; // duracion tel[k++]=' '; tel[k++]=duf[vhor];tel[k++]=duf[vhor+1]; tel[k++]=':'; // hora tel[k++]=duf[vhor+2];tel[k++]=duf[vhor+3]; tel[k++]=' '; tel[k++]=duf[fech+2];tel[k++]=duf[fech+3]; tel[k++]='/'; tel[k++]=duf[fech+4];tel[k++]=duf[fech+5]; tel[k++]='/'; // fecha tel[k++]=duf[fech]; tel[k++]=duf[fech+1]; tel[k++]=' '; if isdigit(cuf[vnumero]) {tel[k++]='O';} else tel[k++]='I'; tel[k++]=' '; for (j=0;cuf[vnumero+j]!=' ' && j<20;j++) { tel[k++]= cuf[vnumero+j];cont++;} if (cont==0) {tel[k++]='*';} tel[k++]=' '; tel[k++]='*'; tel[k++]='*'; tel[k++]='*';// c costo tel[k++]=' '; tel[k++]='*'; // cod proyecto tel[k++]=' '; tel[k++]='*'; tel[k++]=' '; tel[k++]='0'; tel[k++]='0'; tel[k++]='0'; tel[k++]='0';// pulsos tel[k++]=' '; tel[k++]='*'; tel[k++]='*'; tel[k++]='*'; tel[k++]=' '; tel[k++]='*'; // 1er num tel[k++]=' '; tel[k++]='0'; tel[k++]='0'; tel[k++]=':'; tel[k++]='0'; tel[k++]='0';// ring tel[k++]=' '; tel[k++]='*'; // anexo tranf tel[k++] = ' ' ; tel[k++]='*'; // servicio tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }