#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define estac 5+posin #define linea 0 #define durac 62+posin #define hor 47+posin #define fech 41+posin #define tranf 0 #define numero 14+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 void cames(int fece,char *mese, char *buf) { char cmes[4] ; cmes[0]=buf[fece] ; cmes[1]=buf[fece+1] ; cmes[2]=buf[fece+2] ; cmes[3]='\0' ; if (!strcmp(cmes,"JAN")) strcpy(mese,"01") ; if (!strcmp(cmes,"FEB")) strcpy(mese,"02") ; if (!strcmp(cmes,"MAR")) strcpy(mese,"03") ; if (!strcmp(cmes,"APR")) strcpy(mese,"04") ; if (!strcmp(cmes,"MAY")) strcpy(mese,"05") ; if (!strcmp(cmes,"JUN")) strcpy(mese,"06") ; if (!strcmp(cmes,"JUL")) strcpy(mese,"07") ; if (!strcmp(cmes,"AUG")) strcpy(mese,"08") ; if (!strcmp(cmes,"SEP")) strcpy(mese,"09") ; if (!strcmp(cmes,"OCT")) strcpy(mese,"10") ; if (!strcmp(cmes,"NOV")) strcpy(mese,"11") ; if (!strcmp(cmes,"DEC")) strcpy(mese,"12") ; } void cadur(int pfech0, int phor0, int pfech1, int phor1, char *buf, char *durll) { char shora[3], mesa0[3], mesa1[3] ; int mesi,mesf,diai,diaf,hori,horf,mini,minf,segi,segf ; cames(pfech0,mesa0,buf) ; cames(pfech1,mesa1,buf) ; mesi = atoi(mesa0) ; shora[0] = buf[pfech0+3] ; shora[1] = buf[pfech0+4] ; shora[2] = '\0' ; diai = atoi(shora) ; shora[0] = buf[phor0] ; shora[1] = buf[phor0+1] ; shora[2] = '\0' ; hori = atoi(shora) ; shora[0] = buf[phor0+3] ; shora[1] = buf[phor0+4] ; shora[2] = '\0' ; mini = atoi(shora) ; shora[0] = buf[phor0+6] ; shora[1] = buf[phor0+7] ; shora[2] = '\0' ; segi = atoi(shora) ; mesf = atoi(mesa1) ; shora[0] = buf[pfech1+3] ; shora[1] = buf[pfech1+4] ; shora[2] = '\0' ; diaf = atoi(shora) ; shora[0] = buf[phor1] ; shora[1] = buf[phor1+1] ; shora[2] = '\0' ; horf = atoi(shora) ; shora[0] = buf[phor1+3] ; shora[1] = buf[phor1+4] ; shora[2] = '\0' ; minf = atoi(shora) ; shora[0] = buf[phor1+6] ; shora[1] = buf[phor1+7] ; shora[2] = '\0' ; segf = atoi(shora) ; if (segf(vdurac+13) && buf[vestac+4]=='D' && buf[vnumero+21]=='S' && buf[vhor+9]=='E') { int k = 0,ka,it ; char durll[6], mesll[3]; tel[k++] = buf[vestac] ; tel[k++] = buf[vestac+1] ; tel[k++] = buf[vestac+2] ; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = ' ' ; cadur(vfech,vhor,vdurac,vdurac+6,buf,durll) ; cames(vfech,mesll,buf); tel[k++] = durll[0] ; tel[k++] = durll[1] ; tel[k++] = ':' ; tel[k++] = durll[2] ; tel[k++] = durll[3] ; tel[k++] = ':' ; tel[k++] = durll[4] ; tel[k++] = durll[5] ; tel[k++] = ' ' ; ka = k ; tel[k++] = buf[vhor] ; tel[k++] = buf[vhor+1] ; tel[k++] = ':' ; tel[k++] = buf[vhor+3] ; tel[k++] = buf[vhor+4] ; tel[k++] = ' ' ; tel[k++] = mesll[0] ; tel[k++] = mesll[1] ; tel[k++] = '/'; tel[k++] = buf[vfech+3] ; tel[k++] = buf[vfech+4] ; tel[k++] = '/'; tel[k++] = buf[6] ; tel[k++] = buf[7] ; tel[k++] = ' ' ; tel[k++] = 'O' ; tel[k++] = ' ' ; for (it=vnumero; it<(vnumero+21) ; it++) if(isdigit(buf[it])) tel[k++] = buf[it] ; tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* centro de costo */ tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; tel[k++] = '*' ; /* proyecto */ tel[k++] = ' ' ; tel[k++] = '*' ; tel[k++] = ' ' ; for (it=0 ; it<4 ; it++) tel[k++]='0' ; /* pulsos */ 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' ; } }