--- ../webalizer-2.01.10-orig/graphs.c 2001-06-15 17:34:24 +0900
+++ graphs.c 2007-12-18 05:33:44 +0900
@@ -177,7 +177,7 @@
for (i=0; i<12; i++)
{
if (s_mth > 12) s_mth = 1;
- percent = ((float)data1[s_mth++ -1] / (float)maxval);
+ percent = ((float)data1[i] / (float)maxval);
if (percent <= 0.0) continue;
x1 = 26 + (i*23);
x2 = x1 + 13;
@@ -191,7 +191,7 @@
for (i=0; i<12; i++)
{
if (s_mth > 12) s_mth = 1;
- percent = ((float)data2[s_mth++ -1] / (float)maxval);
+ percent = ((float)data2[i] / (float)maxval);
if (percent <= 0.0) continue;
x1 = 29 + (i*23);
x2 = x1 + 13;
@@ -205,7 +205,7 @@
for (i=0; i<12; i++)
{
if (s_mth > 12) s_mth = 1;
- percent = ((float)data5[s_mth++ -1] / (float)maxval);
+ percent = ((float)data5[i] / (float)maxval);
if (percent <= 0.0) continue;
x1 = 32 + (i*23);
x2 = x1 + 13;
@@ -230,7 +230,7 @@
for (i=0; i<12; i++)
{
if (s_mth > 12) s_mth = 1;
- percent = ((float)data6[s_mth++ -1] / (float)maxval);
+ percent = ((float)data6[i] / (float)maxval);
if (percent <= 0.0) continue;
x1 = 310 + (i*15);
x2 = x1 + 8;
@@ -244,7 +244,7 @@
for (i=0; i<12; i++)
{
if (s_mth > 12) s_mth = 1;
- percent = ((float)data3[s_mth++ -1] / (float)maxval);
+ percent = ((float)data3[i] / (float)maxval);
if (percent <= 0.0) continue;
x1 = 314 + (i*15);
x2 = x1 + 7;
@@ -266,7 +266,7 @@
for (i=0; i<12; i++)
{
if (s_mth > 12) s_mth = 1;
- percent = ((float)data4[s_mth++ -1] / (float)fmaxval);
+ percent = ((float)data4[i] / (float)fmaxval);
if (percent <= 0.0) continue;
x1 = 311 + (i*15);
x2 = x1 + 9;
--- ../webalizer-2.01.10-orig/output.c 2001-06-15 17:34:24 +0900
+++ output.c 2007-12-18 05:34:04 +0900
@@ -282,7 +282,7 @@
printf("%s %s %d\n",msg_gen_rpt, l_month[cur_month-1], cur_year);
/* update history */
- i=cur_month-1;
+ i=hist_count++;
hist_month[i] = cur_month;
hist_year[i] = cur_year;
hist_hit[i] = t_hit;
@@ -685,10 +685,10 @@
fprintf(out_fp,"
|
\n");
/* skip beginning blank days in a month */
- for (i=0;i" \
"%d | \n", i+1);
@@ -2302,6 +2302,7 @@
int i,days_in_month;
int lyear=0;
int s_mth=0;
+ int entry=0;
double gt_hit=0.0;
double gt_files=0.0;
double gt_pages=0.0;
@@ -2314,14 +2315,16 @@
sprintf(buffer,"%s %s",msg_main_us,hname);
- for (i=0;i<12;i++) /* get last month in history */
+ for (i=0;ilyear)
{ lyear=hist_year[i]; s_mth=hist_month[i]; }
if (hist_year[i]==lyear)
{
- if (hist_month[i]>=s_mth)
+ if (hist_month[i]>=s_mth) {
s_mth=hist_month[i];
+ entry=i;
+ }
}
}
@@ -2330,12 +2333,12 @@
year_graph6x( "usage.png", /* filename */
buffer, /* graph title */
i, /* last month */
- hist_hit, /* data set 1 */
- hist_files, /* data set 2 */
- hist_site, /* data set 3 */
- hist_xfer, /* data set 4 */
- hist_page, /* data set 5 */
- hist_visit); /* data set 6 */
+ hist_hit+hist_count-12,/* data set 1 */
+ hist_files+hist_count-12,/* data set 2 */
+ hist_site+hist_count-12,/* data set 3 */
+ hist_xfer+hist_count-12,/* data set 4 */
+ hist_page+hist_count-12,/* data set 5 */
+ hist_visit+hist_count-12);/* data set 6 */
/* now do html stuff... */
sprintf(index_fname,"index.%s",html_ext);
@@ -2383,40 +2386,41 @@
fprintf(out_fp,"" \
"%s | \n",DKGREEN,msg_h_hits);
fprintf(out_fp," |
\n");
- for (i=0;i<12;i++)
+ for (i=0;i" \
"%s %d | \n",
- hist_year[s_mth], hist_month[s_mth], html_ext,
- s_month[hist_month[s_mth]-1], hist_year[s_mth]);
+ hist_year[entry], hist_month[entry], html_ext,
+ s_month[hist_month[entry]-1], hist_year[entry]);
fprintf(out_fp,"%lu | \n",
- hist_hit[s_mth]/days_in_month);
+ hist_hit[entry]/days_in_month);
fprintf(out_fp,"%lu | \n",
- hist_files[s_mth]/days_in_month);
+ hist_files[entry]/days_in_month);
fprintf(out_fp,"%lu | \n",
- hist_page[s_mth]/days_in_month);
+ hist_page[entry]/days_in_month);
fprintf(out_fp,"%lu | \n",
- hist_visit[s_mth]/days_in_month);
+ hist_visit[entry]/days_in_month);
fprintf(out_fp,"%lu | \n",
- hist_site[s_mth]);
+ hist_site[entry]);
fprintf(out_fp,"%.0f | \n",
- hist_xfer[s_mth]);
+ hist_xfer[entry]);
fprintf(out_fp,"%lu | \n",
- hist_visit[s_mth]);
+ hist_visit[entry]);
fprintf(out_fp,"%lu | \n",
- hist_page[s_mth]);
+ hist_page[entry]);
fprintf(out_fp,"%lu | \n",
- hist_files[s_mth]);
+ hist_files[entry]);
fprintf(out_fp,"%lu | \n",
- hist_hit[s_mth]);
- gt_hit += hist_hit[s_mth];
- gt_files += hist_files[s_mth];
- gt_pages += hist_page[s_mth];
- gt_xfer += hist_xfer[s_mth];
- gt_visits+= hist_visit[s_mth];
+ hist_hit[entry]);
+ gt_hit += hist_hit[entry];
+ gt_files += hist_files[entry];
+ gt_pages += hist_page[entry];
+ gt_xfer += hist_xfer[entry];
+ gt_visits+= hist_visit[entry];
+ if (--entry < 0)
+ break;
}
fprintf(out_fp," |
\n");
fprintf(out_fp,"| " \
--- ../webalizer-2.01.10-orig/preserve.c 2001-10-24 15:22:42 +0900
+++ preserve.c 2007-12-18 05:33:44 +0900
@@ -66,15 +66,19 @@
#include "preserve.h"
/* local variables */
-int hist_month[12], hist_year[12]; /* arrays for monthly total */
-u_long hist_hit[12]; /* calculations: used to */
-u_long hist_files[12]; /* produce index.html */
-u_long hist_site[12]; /* these are read and saved */
-double hist_xfer[12]; /* in the history file */
-u_long hist_page[12];
-u_long hist_visit[12];
+int hist_month[HIST_SIZE]; /* arrays for monthly total */
+int hist_year[HIST_SIZE];
+u_long hist_hit[HIST_SIZE]; /* calculations: used to */
+u_long hist_files[HIST_SIZE]; /* produce index.html */
+u_long hist_site[HIST_SIZE]; /* these are read and saved */
+double hist_xfer[HIST_SIZE]; /* in the history file */
+u_long hist_page[HIST_SIZE];
+u_long hist_visit[HIST_SIZE];
-int hist_fday[12], hist_lday[12]; /* first/last day arrays */
+int hist_fday[HIST_SIZE]; /* first/last day arrays */
+int hist_lday[HIST_SIZE];
+
+int hist_count; /* number of entries */
/*********************************************/
/* GET_HISTORY - load in history file */
@@ -87,7 +91,7 @@
char buffer[BUFSIZE];
/* first initalize internal array */
- for (i=0;i<12;i++)
+ for (i=0;iHIST_SIZE) {
+ printf("%s '%s' (%s)\n",msg_bad_key,keyword,fname);
+ num_months=12;
+ }
+ break;
}
}
fclose(fp);
--- ../webalizer-2.01.10-orig/webalizer.h 2001-02-10 09:58:18 +0900
+++ webalizer.h 2007-12-18 05:33:44 +0900
@@ -219,6 +219,8 @@
extern int dump_header ; /* Dump header as first rec */
extern char *dump_path ; /* Path for dump files */
+extern int num_months ; /* # of months in index */
+
extern u_long cur_tstamp; /* Current timestamp */
extern u_long epoch; /* used for timestamp adj. */
extern int check_dup; /* check for dups flag */
|
|---|