#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 5+posin #define linea 1+posin #define durac 28+posin #define hor 46+posin #define fech 37+posin #define tranf 0 #define numero 11+posin #define ccost 0 #define proye 61+posin #define cuenta 0 #define pulsos 56+posin #define ruta 0 #define prinum 0 #define ring 0 #define antran 0 // anexo transferido #define fofech europeo #define larnum 17 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) { char feco,horo,duro ; int i=strlen(buf),k,ka,it,siga; siga = i>(vnumero+2) && i>(vestac+3) && i>(vlinea+2) && i>(vdurac+5) && i>(vhor+4) && i>(vfech+4) && i>(vnumero+3); feco = isdigit(buf[vfech]) && isdigit(buf[vfech+1]) && isdigit(buf[vfech+3]) && isdigit(buf[vfech+4]) && isdigit(buf[vfech+6]) && isdigit(buf[vfech+7]) ; horo = isdigit(buf[vhor]) && isdigit(buf[vhor+1]) && buf[vhor+2]==':' && isdigit(buf[vhor+3]) && isdigit(buf[vhor+4]) ; duro = isdigit(buf[vdurac]) && isdigit(buf[vdurac+1]) && buf[vdurac+2]==':' && isdigit(buf[vdurac+3]) && isdigit(buf[vdurac+4]) ; if (siga && feco && horo && duro) { k = 0 ; tel[k++] = buf[vestac] ; tel[k++] = buf[vestac+1] ; tel[k++] = buf[vestac+2] ; tel[k++] = buf[vestac+3] ; tel[k++] = buf[vestac+4] ; tel[k++] = ' ' ; tel[k++] = buf[vlinea] ; tel[k++] = buf[vlinea+1] ; tel[k++] = buf[vlinea+2] ; tel[k++] = buf[vlinea+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++] = ' ' ; 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++] = ' ' ; if (isdigit(buf[vnumero+2])) { tel[k++] = 'O' ; tel[k++] = ' ' ; for (it=vnumero; it<(vnumero+larnum) && it<(i-1) && buf[it]!=' ' ; it++) tel[k++] = buf[it] ; } else { tel[k++] = 'I' ; tel[k++] = ' ' ; tel[k++] = '*' ; } 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] ; /* proyecto */ } else { for (it=0 ; it<4 ; it++) tel[k++]='*' ; /* proyecto */ } tel[k++] = ' ' ; tel[k++] = '*' ; //cuenta tel[k++] = ' ' ; if (isdigit(buf[vpulsos])) { for (it=0 ; it<4 ; it++) tel[k++]=buf[vpulsos+it] ; /* tarifa */ } else { for (it=0 ; it<4 ; it++) tel[k++]='0' ; /* tarifa */ } 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++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }