⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 output.c

📁 统计日志的工具
💻 C
📖 第 1 页 / 共 5 页
字号:
      switch ( (int)((RNODEPTR)(*pointer)->flag) )      {         case OBJ_REG:  r_reg++;  break;         case OBJ_HIDE: r_hid++;  break;         case OBJ_GRP:  r_grp++;  break;      }      pointer++;   }   if ( (tot_num=r_reg+r_grp)==0 ) return;              /* split if none    */   if (tot_num > ntop_refs) tot_num=ntop_refs;          /* get max to do... */   fprintf(out_fp,"<A NAME=\"TOPREFS\"></A>\n");   fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");   fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");   fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=4>"         \           "%s %lu %s %lu %s</TH></TR>\n",           GREY, msg_top_top, tot_num, msg_top_of, t_ref, msg_top_r);   fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");   fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>"                   \          "<FONT SIZE=\"-1\">#</FONT></TH>\n",          GREY);   fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>"             \          "<FONT SIZE=\"-1\">%s</FONT></TH>\n",          DKGREEN,msg_h_hits);   fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>"                       \          "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",          CYAN,msg_h_ref);   fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");   pointer=r_array; i=0;   while(tot_num)   {      rptr=*pointer++;      if (rptr->flag != OBJ_HIDE)      {         /* shade grouping? */         if (shade_groups && (rptr->flag==OBJ_GRP))            fprintf(out_fp,"<TR BGCOLOR=\"%s\">\n", GRPCOLOR);         else fprintf(out_fp,"<TR>\n");         fprintf(out_fp,             "<TD ALIGN=center><FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n"  \             "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%lu</B></FONT></TD>\n"  \             "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n"    \             "<TD ALIGN=left NOWRAP><FONT SIZE=\"-1\">",             i+1,rptr->count,             (t_hit==0)?0:((float)rptr->count/t_hit)*100.0);         if (rptr->flag==OBJ_GRP)         {            if (hlite_groups)               fprintf(out_fp,"<STRONG>%s</STRONG>",rptr->string);            else fprintf(out_fp,"%s",rptr->string);         }         else         {            if (rptr->string[0] != '-')            fprintf(out_fp,"<A HREF=\"%s\">%s</A>",                rptr->string, rptr->string);            else            fprintf(out_fp,"%s", rptr->string);         }         fprintf(out_fp,"</FONT></TD></TR>\n");         tot_num--;         i++;      }   }   fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");   if ( (all_refs) && ((r_reg+r_grp)>ntop_refs) )   {      if (all_refs_page(r_reg, r_grp))      {         fprintf(out_fp,"<TR BGCOLOR=\"%s\">",GRPCOLOR);         fprintf(out_fp,"<TD COLSPAN=4 ALIGN=\"center\">\n");         fprintf(out_fp,"<FONT SIZE=\"-1\">");         fprintf(out_fp,"<A HREF=\"./ref_%04d%02d.%s\">",                 cur_year,cur_month,html_ext);         fprintf(out_fp,"%s</A></TD></TR>\n",msg_v_refs);      }   }   fprintf(out_fp,"</TABLE>\n<P>\n");}/*********************************************//* ALL_REFS_PAGE - HTML page of all refs     *//*********************************************/int all_refs_page(u_long r_reg, u_long r_grp){   RNODEPTR rptr, *pointer;   char     ref_fname[256], buffer[256];   FILE     *out_fp;   int      i=(r_grp)?1:0;   /* generate file name */   sprintf(ref_fname,"ref_%04d%02d.%s",cur_year,cur_month,html_ext);   /* open file */   if ( (out_fp=open_out_file(ref_fname))==NULL ) return 0;   sprintf(buffer,"%s %d - %s",l_month[cur_month-1],cur_year,msg_h_ref);   write_html_head(buffer, out_fp);   fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");   fprintf(out_fp," %12s      %s\n",msg_h_hits,msg_h_ref);   fprintf(out_fp,"----------------  --------------------\n\n");   /* do groups first (if any) */   pointer=r_array;   while(r_grp)   {      rptr=*pointer++;      if (rptr->flag == OBJ_GRP)      {         fprintf(out_fp,"%-8lu %6.02f%%  %s\n",            rptr->count,            (t_hit==0)?0:((float)rptr->count/t_hit)*100.0,            rptr->string);         r_grp--;      }   }   if (i) fprintf(out_fp,"\n");   pointer=r_array;   while(r_reg)   {      rptr=*pointer++;      if (rptr->flag == OBJ_REG)      {         fprintf(out_fp,"%-8lu %6.02f%%  %s\n",            rptr->count,            (t_hit==0)?0:((float)rptr->count/t_hit)*100.0,            rptr->string);         r_reg--;      }   }   fprintf(out_fp,"</PRE></FONT>\n");   write_html_tail(out_fp);   fclose(out_fp);   return 1;}/*********************************************//* TOP_AGENTS_TABLE - generate top n table   *//*********************************************/void top_agents_table(){   u_long cnt, a_reg=0, a_grp=0, a_hid=0, tot_num;   int i;   ANODEPTR aptr, *pointer;   if (t_agent == 0) return;    /* don't bother if we don't have any */   cnt=a_ctr; pointer=a_array;   while(cnt--)   {      /* calculate totals */      switch ( (int)((ANODEPTR)(*pointer)->flag) )      {         case OBJ_REG:   a_reg++;  break;         case OBJ_GRP:   a_grp++;  break;         case OBJ_HIDE:  a_hid++;  break;      }      pointer++;   }   if ( (tot_num=a_reg+a_grp)==0 ) return;              /* split if none    */   if (tot_num > ntop_agents) tot_num=ntop_agents;      /* get max to do... */   fprintf(out_fp,"<A NAME=\"TOPAGENTS\"></A>\n");   fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");   fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");   fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=4>"        \          "%s %lu %s %lu %s</TH></TR>\n",          GREY, msg_top_top, tot_num, msg_top_of, t_agent, msg_top_a);   fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");   fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>"                  \          "<FONT SIZE=\"-1\">#</FONT></TH>\n",          GREY);   fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>"            \          "<FONT SIZE=\"-1\">%s</FONT></TH>\n",          DKGREEN,msg_h_hits);   fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>"                      \          "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",          CYAN,msg_h_agent);   fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");   pointer=a_array; i=0;   while(tot_num)   {      aptr=*pointer++;      if (aptr->flag != OBJ_HIDE)      {         /* shade grouping? */         if (shade_groups && (aptr->flag==OBJ_GRP))            fprintf(out_fp,"<TR BGCOLOR=\"%s\">\n", GRPCOLOR);         else fprintf(out_fp,"<TR>\n");         fprintf(out_fp,             "<TD ALIGN=center><FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n" \             "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%lu</B></FONT></TD>\n" \             "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n"   \             "<TD ALIGN=left NOWRAP><FONT SIZE=\"-1\">",             i+1,aptr->count,             (t_hit==0)?0:((float)aptr->count/t_hit)*100.0);         if ((aptr->flag==OBJ_GRP)&&hlite_groups)            fprintf(out_fp,"<STRONG>%s</STRONG></FONT></TD></TR>\n",               aptr->string);         else fprintf(out_fp,"%s</FONT></TD></TR>\n",               aptr->string);         tot_num--;         i++;      }   }   fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");   if ( (all_agents) && ((a_reg+a_grp)>ntop_agents) )   {      if (all_agents_page(a_reg, a_grp))      {         fprintf(out_fp,"<TR BGCOLOR=\"%s\">",GRPCOLOR);         fprintf(out_fp,"<TD COLSPAN=4 ALIGN=\"center\">\n");         fprintf(out_fp,"<FONT SIZE=\"-1\">");         fprintf(out_fp,"<A HREF=\"./agent_%04d%02d.%s\">",                 cur_year,cur_month,html_ext);         fprintf(out_fp,"%s</A></TD></TR>\n",msg_v_agents);      }   }   fprintf(out_fp,"</TABLE>\n<P>\n");}/*********************************************//* ALL_AGENTS_PAGE - HTML user agent page    *//*********************************************/int all_agents_page(u_long a_reg, u_long a_grp){   ANODEPTR aptr, *pointer;   char     agent_fname[256], buffer[256];   FILE     *out_fp;   int      i=(a_grp)?1:0;   /* generate file name */   sprintf(agent_fname,"agent_%04d%02d.%s",cur_year,cur_month,html_ext);   /* open file */   if ( (out_fp=open_out_file(agent_fname))==NULL ) return 0;   sprintf(buffer,"%s %d - %s",l_month[cur_month-1],cur_year,msg_h_agent);   write_html_head(buffer, out_fp);   fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");   fprintf(out_fp," %12s      %s\n",msg_h_hits,msg_h_agent);   fprintf(out_fp,"----------------  ----------------------\n\n");   /* do groups first (if any) */   pointer=a_array;   while(a_grp)   {      aptr=*pointer++;      if (aptr->flag == OBJ_GRP)      {         fprintf(out_fp,"%-8lu %6.02f%%  %s\n",             aptr->count,             (t_hit==0)?0:((float)aptr->count/t_hit)*100.0,             aptr->string);         a_grp--;      }   }   if (i) fprintf(out_fp,"\n");   pointer=a_array;   while(a_reg)   {      aptr=*pointer++;      if (aptr->flag == OBJ_REG)      {         fprintf(out_fp,"%-8lu %6.02f%%  %s\n",             aptr->count,             (t_hit==0)?0:((float)aptr->count/t_hit)*100.0,             aptr->string);         a_reg--;      }   }   fprintf(out_fp,"</PRE></FONT>\n");   write_html_tail(out_fp);   fclose(out_fp);   return 1;}/*********************************************//* TOP_SEARCH_TABLE - generate top n table   *//*********************************************/void top_search_table(){   u_long   cnt,t_val=0, tot_num;   int      i;   SNODEPTR sptr, *pointer;   if ( (t_ref==0)||(a_ctr==0)) return;   /* don't bother if none to do    */   cnt=tot_num=a_ctr; pointer=s_array;   while(cnt--)   {      t_val+=(u_long)((SNODEPTR)(*pointer)->count);      pointer++;   }   if ( tot_num > ntop_search) tot_num=ntop_search;   fprintf(out_fp,"<A NAME=\"TOPSEARCH\"></A>\n");   fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");   fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");   fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=4>"        \          "%s %lu %s %lu %s</TH></TR>\n",          GREY, msg_top_top, tot_num, msg_top_of, a_ctr, msg_top_sr);   fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");   fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>"                  \          "<FONT

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -