#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 150+posin #define tranf 4+posin #define ccost 0 #define proye 40+posin #define cuenta 0 #define pulsos 0 #define ruta 5+posin #define prinum 98+posin //nodo de la planta #define ring 0 #define fech 20+posin #define hor 24+posin #define linea 8+posin #define estac 14+posin // llamadas entrantes #define durac 34+posin #define numero 62+posin #define antran 0 // anexo transferido (pendiente) #define fofech europeo // formato de fecha char reg[500][ladat]; int t,m,j,i,h, k, encuentra; extern char rgua[]; void in_central() { rgua[0]='\0'; } void fi_central() { } resta_horas(char *buf, char *tel, int pos_fin) { int a, b, dur_val, hora, minu, segu; a= (buf[pos_fin+0]-'0')*36000; //hora final en segundos a=a+(buf[pos_fin+1]-'0')*3600; a=a+(buf[pos_fin+2]-'0')*600; a=a+(buf[pos_fin+3]-'0')*60; a=a+(buf[pos_fin+4]-'0')*10; a=a+(buf[pos_fin+5]-'0'); b= (buf[pos_fin-10+0]-'0')*36000; //hora inicial en segundos b=b+(buf[pos_fin-10+1]-'0')*3600; b=b+(buf[pos_fin-10+2]-'0')*600; b=b+(buf[pos_fin-10+3]-'0')*60; b=b+(buf[pos_fin-10+4]-'0')*10; b=b+(buf[pos_fin-10+5]-'0'); if (a=0;m--) { /* for(j=0; j<6 && (reg[m][vruta+j]==buf[vruta+j] || reg[m][vruta+j]==buf[vruta+j+9]); j++){} //compara linea+ruta if (j==6) lineas_ok=1; for(j=0; j<10 && (reg[m][vfech+j+10]==buf[vfech+j]); j++){} //compara fecha+hora if (j==6) fechas_ok=1; if (lineas_ok && fechas_ok){encuentra=1; h=strlen(reg[m]); return;} //lineas+rutas+fecha+horas iguales */ for(j=0; j<6 && (reg[m][vruta+j]==buf[vruta+j] || reg[m][vruta+j]==buf[vruta+j+9]); j++){} //compara linea+ruta if (j==6) {encuentra=1; h=strlen(reg[m]); return;} //lineas+rutas iguales } } //almacena las llamadas con lineas distintas en un arreglo bidimencional (sobreescribe los registros de líneas iguales) void add_reg(char *buf, int vruta)// int vfech) { busca_lin(buf, vruta); //, vfech); if (t==500) t=0; //cuando llega a los 500 registros guardados, reemplaza en el registro 0 if (!encuentra) {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) { tel[0]='\0'; i=strlen(buf); if (i>vnumero && isalnum(buf[vtranf]) && isdigit(buf[vhor])) { k=0; encuentra=0; //TRANSFERENCIAS if (buf[vlinea+3]=='2') busca_lin(buf, vruta);//, vfech); //transferencias: busca por linea el anexo desde donde se transfirió else add_reg (buf, vruta);//, vfech); if (encuentra) //anexo { for(j=0;j<5;j++) tel[k++]=reg[m][vestac+j]; } else { for(j=0;j<5;j++) tel[k++]=buf[vestac+j]; } tel[k++] = ' '; tel[k++]=buf[vlinea+0]; tel[k++]=buf[vlinea+1]; tel[k++]=buf[vlinea+2]; //linea /* if (buf[vlinea+3]!='2') { tel[k++]=buf[vlinea+0]; tel[k++]=buf[vlinea+1]; tel[k++]=buf[vlinea+2]; } else if isdigit(buf[vestac+5]) { tel[k++]=buf[vlinea+9]; tel[k++]=buf[vlinea+10]; tel[k++]=buf[vlinea+11]; } else tel[k++]='*';*/ tel[k++]=' '; resta_horas(buf, tel, vdurac); tel[k++] = ' '; tel[k++]=buf[vhor+0]; tel[k++]=buf[vhor+1]; tel[k++]=':'; tel[k++]=buf[vhor+2]; tel[k++]=buf[vhor+3]; tel[k++] = ' '; tel[k++]=buf[vfech+0]; tel[k++]=buf[vfech+1]; tel[k++]='/'; tel[k++]=buf[vfech+2]; tel[k++]=buf[vfech+3]; tel[k++]='/'; tel[k++]='0'; tel[k++]='2'; tel[k++] = ' ' ; // if ((buf[vtranf]=='t' || buf[vtranf]=='T') && encuentra) tel[k++]=reg[m][vtranf]; if (buf[vtranf]=='A') tel[k++]='O'; else tel[k++]='I'; tel[k++] = ' ' ; /* if (encuentra && isdigit(reg[m][vnumero])) { for(j=0;reg[m][vnumero+j]!=' ' && (vnumero+j