char warea[MAXLEN];
char totuser[8];
char tmp6[MAXLEN];
+ char *user_url;
long long int tnacc=0, ttnacc=0, unacc=0;
double perc=0, perc2=0, ouperc=0, inperc=0;
int count;
exit(EXIT_FAILURE);
}
while((buf=longline_read(fp_ip,line1))!=NULL) {
- if(strstr(buf,url) != 0) {
- fprintf(fp_ip2,"%s\n",buf);
+ getword_start(&gwarea,buf);
+ if (getword(user_ip,sizeof(user_ip),&gwarea,'\t')<0) {
+ debuga(_("Maybe you have a broken user IP in your %s file\n"),tmp3);
+ exit(EXIT_FAILURE);
+ }
+ if (getword_ptr(buf,&user_url,&gwarea,'\t')<0) {
+ debuga(_("Maybe you have a broken url in your %s file\n"),tmp3);
+ exit(EXIT_FAILURE);
+ }
+ if (strncmp(user_url,url,strlen(url))!=0) continue;
+ if (getword_skip(15,&gwarea,'\t')<0) {
+ debuga(_("Maybe you have a broken day in your %s file\n"),tmp3);
+ exit(EXIT_FAILURE);
+ }
+ if (getword_skip(15,&gwarea,'\t')<0) {
+ debuga(_("Maybe you have a broken time in your %s file\n"),tmp3);
+ exit(EXIT_FAILURE);
+ }
+ if (getword_atoll(&userbytes,&gwarea,'\t')<0) {
+ debuga(_("Maybe you have a broken size in your %s file\n"),tmp3);
+ exit(EXIT_FAILURE);
}
+ if (getword_atoll(&userelap,&gwarea,'\0')<0) {
+ debuga(_("Maybe you have a broken elapsed time in your %s file\n"),tmp3);
+ exit(EXIT_FAILURE);
+ }
+ fprintf(fp_ip2,"%s\t%"PRIu64"\t%"PRIu64"\n",user_ip,(uint64_t)userbytes,(uint64_t)userelap);
}
longline_destroy(&line1);
fclose(fp_ip);
fclose(fp_ip2);
- sprintf(csort,"sort -n -T \"%s\" -k 1,1 -k 5,5 -o \"%s\" \"%s\"",tmp,tmp3,tmp2);
+ sprintf(csort,"sort -n -T \"%s\" -k 1,1 -k 2,2 -o \"%s\" \"%s\"",tmp,tmp3,tmp2);
cstatus=system(csort);
if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
debuga(_("sort command return status %d\n"),WEXITSTATUS(cstatus));
debuga(_("Maybe you have a broken user IP in your %s file\n"),tmp3);
exit(EXIT_FAILURE);
}
- if (getword_ptr(NULL,NULL,&gwarea,'\t')<0) {
- debuga(_("Maybe you have a broken url in your %s file\n"),tmp3);
- exit(EXIT_FAILURE);
- }
- if (getword_skip(15,&gwarea,'\t')<0) {
- debuga(_("Maybe you have a broken day in your %s file\n"),tmp3);
- exit(EXIT_FAILURE);
- }
- if (getword_skip(15,&gwarea,'\t')<0) {
- debuga(_("Maybe you have a broken time in your %s file\n"),tmp3);
- exit(EXIT_FAILURE);
- }
if (getword_atoll(&userbytes,&gwarea,'\t')<0) {
debuga(_("Maybe you have a broken size in your %s file\n"),tmp3);
exit(EXIT_FAILURE);