#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define estac 23+posin #define linea 62+posin #define durac 14+posin #define hor 7+posin #define fech 1+posin #define tranf 30+posin #define numero 33+posin #define ccost 0 #define proye 72+posin #define cuenta 0 #define pulsos 54+posin #define ruta 0 #define prinum 0 #define ring 29+posin #define antran 67+posin // anexo transferido #define fofech americano #define anoa 6 extern char rgua[]; void in_central() { rgua[0]='\0'; } void fi_central() { } 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 largo = strlen(buf); strcat(buf," "); if (largo>vnumero && buf[vfech+2]=='/' && buf[vhor+2]==':' && buf[vdurac+2]==':' && buf[vdurac+5]==':') { int k = 0,ka,it ; k = 0 ; if (isdigit(buf[vestac]) || buf[vestac]=='*' || buf[vestac]=='#' || (!isdigit(buf[vestac+1]))) { tel[k++] = buf[vestac] ; tel[k++] = buf[vestac+1] ; tel[k++] = buf[vestac+2] ; tel[k++] = buf[vestac+3] ; tel[k++] = ' ' ; tel[k++] = buf[vlinea] ; tel[k++] = buf[vlinea+1] ; tel[k++] = buf[vlinea+2] ; } else { if ((vantran+4)>largo || (buf[vantran]==' ' && buf[vantran+1]==' ' && buf[vantran+2]==' ')) { if (buf[vlinea-1]!=' ' || buf[vlinea]!=' ' || buf[vlinea+1]!=' ' || buf[vlinea+2]!=' ') { tel[k++] = buf[vlinea-1] ; tel[k++] = buf[vlinea] ; tel[k++] = buf[vlinea+1] ; tel[k++] = buf[vlinea+2] ; } else tel[k++] = '*'; } else { if ((vantran+4)<=largo) { tel[k++] = buf[vantran+0] ; tel[k++] = buf[vantran+1] ; tel[k++] = buf[vantran+2] ; tel[k++] = buf[vantran+3] ; } else tel[k++] = '*'; } tel[k++] = ' ' ; tel[k++] = buf[vestac+1] ; tel[k++] = buf[vestac+2] ; tel[k++] = buf[vestac+3] ; } tel[k++] = ' ' ; if (buf[vdurac+0]!=' ') tel[k++]=buf[vdurac+0] ; else tel[k++]='0' ; if (buf[vdurac+1]!=' ') tel[k++]=buf[vdurac+1] ; else tel[k++]='0' ; tel[k++] = ':' ; if (buf[vdurac+3]!=' ') tel[k++]=buf[vdurac+3] ; else tel[k++]='0' ; if (buf[vdurac+4]!=' ') tel[k++]=buf[vdurac+4] ; else tel[k++]='0' ; tel[k++] = ':' ; if (buf[vdurac+6]!=' ') tel[k++]=buf[vdurac+6] ; else tel[k++]='0' ; if (buf[vdurac+7]!=' ') tel[k++]=buf[vdurac+7] ; else tel[k++]='0' ; tel[k++] = ' ' ; ka = k ; tel[k++] = buf[vhor] ; tel[k++] = buf[vhor+1] ; if (tel[ka]==' ') tel[ka]='0' ; tel[k++] = ':' ; tel[k++] = buf[vhor+3] ; tel[k++] = buf[vhor+4] ; tel[k++] = ' ' ; 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[anoa] ; tel[k++] = buf[anoa+1] ; tel[k++] = ' ' ; if (buf[vlinea-1]=='T' && isdigit(buf[vnumero])) tel[k++]='O' ; else tel[k++] = 'I' ; tel[k++] = ' ' ; if (buf[vnumero]==' ' && buf[vnumero+1]==' ') tel[k++]='3' ; else { for (it=vnumero; it<(vnumero+17) && isdigit(buf[it]) ; it++) tel[k++] = buf[it] ; } tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ tel[k++] = ' ' ; if isdigit(buf[vproye]) { for(it=0;it<4;it++) tel[k++]=buf[vproye+it]; } else tel[k++]='*'; tel[k++] = ' ' ; for (it=0 ; it<5 && buf[vpulsos+it]==' ' ; it++); if (it==5) { for (it=0 ; it<5 ; it++) tel[k++]='0' ; /* tarifa */ } else { for (it=0 ; it<5 ; it++) tel[k++]=buf[vpulsos+it] ; /* tarifa */ } tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* ruta */ tel[k++] = ' ' ; tel[k++] = '*' ; /* primer numero */ tel[k++] = ' ' ; if (buf[vlinea-1]=='T' && isdigit(buf[vnumero])) { tel[k++] = '0' ; tel[k++] = '0' ; tel[k++] = ':' ; tel[k++] = '0' ; tel[k++] = '0' ; /* tiempo ring */ } else { char cring[5], cmring[5], csring[5]; int iring, imring, isring; for (it=0;it<3;it++) cring[it] = buf[vring+it] ; cring[it] = '\0'; iring = atoi(cring) ; imring = iring/60 ; isring = iring%60 ; itoa(imring,cmring,10); itoa(isring,csring,10); if (imring>9) { tel[k++] = cmring[0]; tel[k++] = cmring[1]; } else { tel[k++] = '0'; tel[k++] = cmring[0]; } tel[k++] = ':'; if (isring>9) { tel[k++] = csring[0]; tel[k++] = csring[1]; } else { tel[k++] = '0'; tel[k++] = csring[0]; } } tel[k++] = ' '; if (isdigit(buf[vestac]) || (!isdigit(buf[vestac+1]))) { if ((vantran+4)<=largo && buf[vantran] != ' ' && buf[vantran+1] != ' ') { tel[k++] = buf[vantran+0] ; tel[k++] = buf[vantran+1] ; tel[k++] = buf[vantran+2] ; tel[k++] = buf[vantran+3] ; } else tel[k++] = '*' ; } else { if (!((vantran+4)>largo || (buf[vantran]==' ' && buf[vantran+1]==' ' && buf[vantran+2]==' '))) { tel[k++] = buf[vlinea-1] ; tel[k++] = buf[vlinea] ; tel[k++] = buf[vlinea+1] ; tel[k++] = buf[vlinea+2] ; } else { tel[k++] = '*' ; } } tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }