#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 82+posin #define estac 1 +posin // llamadas entrantes #define linea 15+posin #define durac 39+posin #define hor 51+posin #define fech 59+posin #define tranf 70+posin #define numero 19+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 (pendiente) #define fofech europeo // formato de fecha #define larnum 17 extern void gua_rut(char *buf); char ruanex[(lmax+1)*2][7] ; /* Rutas Consideradas como Anexos */ extern char rgua[]; // Procesos Inicialiales (Inicializar Variables, Abrir // Archivos especiales, etc) void in_central() { rgua[0] = '\0'; } // Procesos de Finalización (Cerrar Archivos especiales, etc) void fi_central() { } // Driver Propiamente tal. Las posiciones de los campos se // ingresan como parámetros, lo que permite modificar desde // Aplicación de Tarificación la posición de estos en el // Registro de Llamados. 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 siga ; char shrs[1],smin[2],shora[8],aux ; int i=strlen(buf),it,k,ka,ihrs,imin,haux,maux; ka = 0; siga = i>(vnumero+2) && i>(vestac+3) && i>(vlinea+2) && i>(vdurac+5) && i>(vhor+4) && i>(vfech+4) && i>(vnumero+larnum); aux = buf[vfech+2]; aux = buf[vhor+2]; if (siga && buf[vfech+2]=='.' && buf[vfech+5]=='.' && buf[vhor+2]==':' && isdigit(buf[vestac])) { k = 0 ; tel[k++] = buf[vestac] ; tel[k++] = buf[vestac+1] ; tel[k++] = buf[vestac+2] ; tel[k++] = buf[vestac+3] ; if (tel[0]==' ' && tel[1]==' ' && tel[2]==' ' && tel[3]==' ') tel[0]='*' ; tel[k++] = ' ' ; if (buf[vlinea]==' ') { tel[k++]='0'; tel[k++]= buf[vlinea+1] ; } else { tel[k++] = buf[vlinea] ; tel[k++] = buf[vlinea+1] ; } tel[k++] = ' ' ; shrs[0] = buf[vdurac]; shrs[1] = '\0'; smin[0] = buf[vdurac+2]; smin[1] = buf[vdurac+3]; smin[2] = '\0'; ihrs = atoi(shrs); imin = atoi(smin); haux = imin/60; if (haux>0) { maux = imin-(haux*60); ihrs = ihrs+haux; } else maux = imin; itoa(ihrs,shora,10); itoa(maux,smin,10); if (ihrs<10) { tel[k++] = '0'; tel[k++] = shora[0]; } else { tel[k++] = shora[0]; tel[k++] = shora[1]; } tel[k++] = ':'; if (maux<10) { tel[k++] = '0'; tel[k++] = smin[0]; } else { tel[k++] = smin[0]; tel[k++] = smin[1]; } tel[k++] = ':'; tel[k++] = buf[vdurac+5]; tel[k++] = buf[vdurac+6]; tel[k++] = ' '; tel[k++] = buf[vhor+0]; 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] ; if (tel[ka]==' ') tel[ka] = '0' ; tel[k++] = '/' ; ka=k ; tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; } else { tel[k++] = buf[vfech+0] ; tel[k++] = buf[vfech+1] ; if (tel[ka]==' ') tel[ka] = '0' ; tel[k++] = '/' ; ka=k ; tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; } if (tel[ka]==' ') tel[ka] = '0' ; tel[k++] = '/' ; tel[k++] = buf[6] ; tel[k++] = buf[7] ; tel[k++] = ' ' ; tel[k++] = 'O' ; tel[k++] = ' ' ; ka = k; for (it=vnumero ; it<(vnumero+larnum) && buf[it]==' ' ; it++); for (; it<(vnumero+larnum) && buf[it]!=' ' ; it++) tel[k++] = buf[it] ; if (ka==k) tel[k++] = '*'; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; // proyecto tel[k++] = ' ' ; tel[k++] = '*' ; /* código de cuenta */ tel[k++] = ' ' ; for (it=0 ; it<4 ; it++) tel[k++]= '0' ; 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++] = '*' ; /* anexo tranferido */ tel[k++] = '\r' ; tel[k++] = '\n' ; tel[k++] = '\0' ; } }