Merge lp:~bkerensa/ubuntu/trusty/webalizer/merge-from-debian into lp:debian/webalizer

Proposed by Benjamin Kerensa
Status: Needs review
Proposed branch: lp:~bkerensa/ubuntu/trusty/webalizer/merge-from-debian
Merge into: lp:debian/webalizer
Diff against target: 190134 lines (+19411/-163968)
205 files modified
.pc/.quilt_patches (+0/-1)
.pc/.quilt_series (+0/-1)
.pc/.version (+0/-1)
.pc/01_symlink_vulnerability.diff/output.c (+0/-2910)
.pc/02_fix_a_spelling_error.diff/wcmgr.c (+0/-992)
.pc/05_apache_logio.diff/README.FIRST (+0/-21)
.pc/05_apache_logio.diff/graphs.c (+0/-903)
.pc/05_apache_logio.diff/graphs.h (+0/-10)
.pc/05_apache_logio.diff/hashtab.c (+0/-1254)
.pc/05_apache_logio.diff/hashtab.h (+0/-107)
.pc/05_apache_logio.diff/lang.h (+0/-182)
.pc/05_apache_logio.diff/lang/webalizer_lang.catalan (+0/-639)
.pc/05_apache_logio.diff/lang/webalizer_lang.chinese (+0/-633)
.pc/05_apache_logio.diff/lang/webalizer_lang.croatian (+0/-629)
.pc/05_apache_logio.diff/lang/webalizer_lang.czech (+0/-640)
.pc/05_apache_logio.diff/lang/webalizer_lang.danish (+0/-632)
.pc/05_apache_logio.diff/lang/webalizer_lang.dutch (+0/-651)
.pc/05_apache_logio.diff/lang/webalizer_lang.english (+0/-633)
.pc/05_apache_logio.diff/lang/webalizer_lang.estonian (+0/-632)
.pc/05_apache_logio.diff/lang/webalizer_lang.finnish (+0/-640)
.pc/05_apache_logio.diff/lang/webalizer_lang.french (+0/-676)
.pc/05_apache_logio.diff/lang/webalizer_lang.galician (+0/-639)
.pc/05_apache_logio.diff/lang/webalizer_lang.german (+0/-666)
.pc/05_apache_logio.diff/lang/webalizer_lang.greek (+0/-631)
.pc/05_apache_logio.diff/lang/webalizer_lang.hungarian (+0/-638)
.pc/05_apache_logio.diff/lang/webalizer_lang.icelandic (+0/-640)
.pc/05_apache_logio.diff/lang/webalizer_lang.indonesian (+0/-636)
.pc/05_apache_logio.diff/lang/webalizer_lang.italian (+0/-635)
.pc/05_apache_logio.diff/lang/webalizer_lang.japanese (+0/-629)
.pc/05_apache_logio.diff/lang/webalizer_lang.korean (+0/-633)
.pc/05_apache_logio.diff/lang/webalizer_lang.latvian (+0/-634)
.pc/05_apache_logio.diff/lang/webalizer_lang.malay (+0/-634)
.pc/05_apache_logio.diff/lang/webalizer_lang.norwegian (+0/-645)
.pc/05_apache_logio.diff/lang/webalizer_lang.polish (+0/-640)
.pc/05_apache_logio.diff/lang/webalizer_lang.portuguese (+0/-639)
.pc/05_apache_logio.diff/lang/webalizer_lang.portuguese_brazil (+0/-640)
.pc/05_apache_logio.diff/lang/webalizer_lang.romanian (+0/-634)
.pc/05_apache_logio.diff/lang/webalizer_lang.romanian-iso-8859-2 (+0/-635)
.pc/05_apache_logio.diff/lang/webalizer_lang.russian (+0/-646)
.pc/05_apache_logio.diff/lang/webalizer_lang.serbian (+0/-629)
.pc/05_apache_logio.diff/lang/webalizer_lang.simplified_chinese (+0/-630)
.pc/05_apache_logio.diff/lang/webalizer_lang.slovak (+0/-638)
.pc/05_apache_logio.diff/lang/webalizer_lang.slovene (+0/-629)
.pc/05_apache_logio.diff/lang/webalizer_lang.spanish (+0/-647)
.pc/05_apache_logio.diff/lang/webalizer_lang.swedish (+0/-663)
.pc/05_apache_logio.diff/lang/webalizer_lang.turkish (+0/-634)
.pc/05_apache_logio.diff/lang/webalizer_lang.ukrainian (+0/-638)
.pc/05_apache_logio.diff/output.c (+0/-2925)
.pc/05_apache_logio.diff/parser.c (+0/-740)
.pc/05_apache_logio.diff/preserve.c (+0/-859)
.pc/05_apache_logio.diff/preserve.h (+0/-28)
.pc/05_apache_logio.diff/webalizer.c (+0/-2479)
.pc/05_apache_logio.diff/webalizer.h (+0/-302)
.pc/06_apache_logio_optional.diff/graphs.c (+0/-992)
.pc/06_apache_logio_optional.diff/output.c (+0/-3101)
.pc/06_apache_logio_optional.diff/sample.conf (+0/-779)
.pc/06_apache_logio_optional.diff/webalizer.c (+0/-2498)
.pc/06_apache_logio_optional.diff/webalizer.h (+0/-312)
.pc/07_apache_logio_color_config.diff/graphs.c (+0/-1033)
.pc/07_apache_logio_color_config.diff/output.c (+0/-3273)
.pc/07_apache_logio_color_config.diff/sample.conf (+0/-790)
.pc/07_apache_logio_color_config.diff/webalizer.c (+0/-2518)
.pc/07_apache_logio_color_config.diff/webalizer.h (+0/-313)
.pc/14_add_search_engines.diff/sample.conf (+0/-792)
.pc/15_ignore_localhost.diff/sample.conf (+0/-793)
.pc/18_ttf_support_throught_libgd.diff/README.FIRST (+0/-30)
.pc/18_ttf_support_throught_libgd.diff/configure.in (+0/-322)
.pc/18_ttf_support_throught_libgd.diff/graphs.c (+0/-1038)
.pc/18_ttf_support_throught_libgd.diff/sample.conf (+0/-795)
.pc/18_ttf_support_throught_libgd.diff/webalizer.c (+0/-2524)
.pc/22_php_as_htm_in_sample.conf.diff/sample.conf (+0/-808)
.pc/23_gettext_first_part.diff/Makefile.in (+0/-116)
.pc/23_gettext_first_part.diff/configure.in (+0/-327)
.pc/23_gettext_first_part.diff/dns_resolv.c (+0/-923)
.pc/23_gettext_first_part.diff/graphs.c (+0/-1080)
.pc/23_gettext_first_part.diff/lang.h (+0/-188)
.pc/23_gettext_first_part.diff/output.c (+0/-3275)
.pc/23_gettext_first_part.diff/webalizer.c (+0/-2534)
.pc/23_gettext_first_part.diff/webalizer.h (+0/-315)
.pc/24_gettext_generated.diff/dns_resolv.c (+0/-923)
.pc/24_gettext_generated.diff/graphs.c (+0/-1080)
.pc/24_gettext_generated.diff/hashtab.c (+0/-1277)
.pc/24_gettext_generated.diff/linklist.c (+0/-305)
.pc/24_gettext_generated.diff/output.c (+0/-3275)
.pc/24_gettext_generated.diff/parser.c (+0/-758)
.pc/24_gettext_generated.diff/preserve.c (+0/-877)
.pc/24_gettext_generated.diff/webalizer.c (+0/-2571)
.pc/applied-patches (+0/-12)
Makefile (+122/-0)
Makefile.in (+7/-13)
README.FIRST (+0/-24)
autom4te.cache/output.0 (+5891/-0)
autom4te.cache/output.1 (+5891/-0)
autom4te.cache/requests (+104/-0)
autom4te.cache/traces.0 (+90/-0)
autom4te.cache/traces.1 (+304/-0)
config.log (+646/-0)
config.status (+904/-0)
configure (+2539/-4157)
configure.in (+37/-15)
debian/autoreconf.after (+241/-0)
debian/autoreconf.before (+235/-0)
debian/changelog (+18/-0)
debian/control (+3/-2)
debian/files (+1/-0)
debian/webalizer.debhelper.log (+28/-0)
debian/webalizer.postrm.debhelper (+6/-0)
debian/webalizer.substvars (+2/-0)
debian/webalizer/DEBIAN/conffiles (+2/-0)
debian/webalizer/DEBIAN/config (+86/-0)
debian/webalizer/DEBIAN/control (+21/-0)
debian/webalizer/DEBIAN/md5sums (+45/-0)
debian/webalizer/DEBIAN/postinst (+103/-0)
debian/webalizer/DEBIAN/postrm (+53/-0)
debian/webalizer/DEBIAN/templates (+264/-0)
debian/webalizer/etc/cron.daily/webalizer (+57/-0)
debian/webalizer/etc/webalizer/webalizer.conf.sample (+809/-0)
debian/webalizer/usr/share/doc/webalizer/README.FIRST (+45/-0)
debian/webalizer/usr/share/doc/webalizer/copyright (+36/-0)
dns_resolv.c (+31/-31)
graphs.c (+75/-252)
graphs.h (+1/-2)
hashtab.c (+15/-38)
hashtab.h (+3/-9)
lang.h (+170/-9)
lang/webalizer_lang.catalan (+1/-7)
lang/webalizer_lang.chinese (+2/-8)
lang/webalizer_lang.croatian (+3/-9)
lang/webalizer_lang.czech (+2/-8)
lang/webalizer_lang.danish (+3/-9)
lang/webalizer_lang.dutch (+3/-9)
lang/webalizer_lang.english (+3/-9)
lang/webalizer_lang.estonian (+3/-9)
lang/webalizer_lang.finnish (+3/-9)
lang/webalizer_lang.french (+3/-9)
lang/webalizer_lang.galician (+3/-9)
lang/webalizer_lang.german (+3/-9)
lang/webalizer_lang.greek (+3/-9)
lang/webalizer_lang.hungarian (+3/-9)
lang/webalizer_lang.icelandic (+3/-9)
lang/webalizer_lang.indonesian (+3/-9)
lang/webalizer_lang.italian (+3/-9)
lang/webalizer_lang.japanese (+1/-7)
lang/webalizer_lang.korean (+3/-9)
lang/webalizer_lang.latvian (+3/-9)
lang/webalizer_lang.malay (+3/-9)
lang/webalizer_lang.norwegian (+3/-9)
lang/webalizer_lang.polish (+3/-9)
lang/webalizer_lang.portuguese (+3/-9)
lang/webalizer_lang.portuguese_brazil (+3/-9)
lang/webalizer_lang.romanian (+3/-9)
lang/webalizer_lang.romanian-iso-8859-2 (+3/-9)
lang/webalizer_lang.russian (+2/-8)
lang/webalizer_lang.serbian (+3/-9)
lang/webalizer_lang.simplified_chinese (+1/-7)
lang/webalizer_lang.slovak (+3/-9)
lang/webalizer_lang.slovene (+3/-9)
lang/webalizer_lang.spanish (+3/-9)
lang/webalizer_lang.swedish (+3/-9)
lang/webalizer_lang.turkish (+3/-9)
lang/webalizer_lang.ukrainian (+2/-8)
lang2.h (+0/-435)
lang_po.sh (+0/-24)
linklist.c (+2/-2)
output.c (+265/-630)
parser.c (+8/-26)
po/ca.po (+0/-2455)
po/cs.po (+0/-2452)
po/da.po (+0/-2451)
po/de.po (+0/-2451)
po/el.po (+0/-2451)
po/es.po (+0/-2454)
po/et.po (+0/-2451)
po/fi.po (+0/-2451)
po/fr.po (+0/-2451)
po/gl.po (+0/-2453)
po/hr.po (+0/-2451)
po/hu.po (+0/-2452)
po/id.po (+0/-2465)
po/is.po (+0/-2451)
po/it.po (+0/-2471)
po/ja.po (+0/-2451)
po/ko.po (+0/-2451)
po/lv.po (+0/-2451)
po/ml.po (+0/-2453)
po/nl.po (+0/-2452)
po/no.po (+0/-2451)
po/pl.po (+0/-2453)
po/pt.po (+0/-2450)
po/ro.po (+0/-2452)
po/ru.po (+0/-2457)
po/sl.po (+0/-2451)
po/sr.po (+0/-2451)
po/sv.po (+0/-2451)
po/tr.po (+0/-2451)
po/uk.po (+0/-2451)
po/webalizer.pot (+0/-2361)
po/zh.po (+0/-2451)
preserve.c (+51/-69)
preserve.h (+0/-2)
sample.conf (+16/-46)
update_po.sh (+0/-9)
wcmgr.c (+2/-2)
webalizer.c (+82/-174)
webalizer.h (+2/-16)
To merge this branch: bzr merge lp:~bkerensa/ubuntu/trusty/webalizer/merge-from-debian
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+192382@code.launchpad.net

Description of the change

Merge from Debian Unstable

To post a comment you must log in.

Unmerged revisions

15. By Benjamin Kerensa

Merging from Debian

14. By Adam Conrad

Drop build-depends on the runtime libgd2-{xpm,noxpm} packages.

13. By Colin Watson

Rebuild for libgd3.

12. By Felipe Augusto van de Wiel (faw) <email address hidden>

[ Julien Viard de Galbert ]
* New upstream release. Closes: #491200, #452259, #405699, #557038, #411482,
  #411847, #558751, #400256
* Adopted package with maintainers consent.
* Acknowledge all NUMs, thanks guys!
* Repackaged using format 3.0 (quilt)
* Converted debian/copyright to DEP-5 format
* Converted patches from dpatch to quilt with DEP-3 header format
  - 01_basic_patch: dropped, most changes were integrated upstream.
    changes for consistency with previous version.
  - 02_64bit: dropped, already applied upstream.
  - 03_history: dropped, new version already have a 10 year history.
    Also this patch was not really compatible with 05_apache_logio in
    previous version, the summary page did not have the logio columns
    for the extra lines added by this history patch resulting in wrong
    array layout, as nobody complained on the BTS I assume nobody used
    the feature, so I remove it ;)
  - 04_geolizer: dropped, GeoIP already integrated upstream.
  - 05_apache_logio: ported to new version.
    Integrating fix for the total calculation. Closes: #482771
    While porting I rewrote part of code that Closes: #558749
  - 06_UserColor: dropped, already integrated upstream.
  - 07_w3c-v4: dropped, already integrated upstream.
  - 08_symlink_vulnerability: dropped, already integrated upstream.
  - 09_ipv6_support: dropped, already implemented upstream.
  - 10_remove_db1_dependence: dropped, no longer needed.
  - 11_various_buffer_overflows: dropped, already integrated upstream.
  - 12_recognize_Opera_browsers: dropped, already integrated upstream.
  - 13_add_NoFollow_feature: dropped, upstream LinkReferrer option does it.
  - 14_add_search_engines: Modified to also uncomment the SearchEngine
    directives from the sample configuration.
  - 15_ignore_localhost: refreshed.
  - 16_fix_typos_webalizer.1: dropped, already integrated upstream.
  - 18_ttf_support_throught_libgd: refreshed.
  - 19_add_PagePrefix_feature: dropped, already integrated upstream.
  - 20_fix_capital_letter_option: dropped, already implemented upstream.
  - 21_remove_-v_option: dropped, upstream changed -v to verbose.
  - 22_php_as_htm_in_sample.conf: refreshed.
  - 17_gettext: imported and converted in three patches:
    + 23_gettext_first_part, 24_gettext_generated and 25_gettext_po_files
    + Fix month translations, thanks Gerome Fournier. Closes: #520408
    + Fix some encodings: cs.po (Closes: #409454), ko.po (Closes: #461176)
    + Restored ReportTitle and -t options.
* Added new patches:
  - 01_symlink_vulnerability.diff fixing the symlink vulnerability for
    the .htaccess file (similar to previous 08_symlink_vulnerability)
  - 02_fix_a_spelling_error.diff fix a spelling error in wcmgr.c
  - 06_apache_logio_optional.diff this patch affect the apache_logio patch
    It adds a InOutKb option to make the In/Out KByte data optional.
    There are no command line option, but it can detect if logio data are
    available. So this should be fine to Closes: #399017
  - 07_apache_logio_color_config.diff this patch affect the two previous
    apache_logio patches. It adds options to configure the color for the
    new data.
* Fixed cron job script in case all .conf are removed. Closes: #419717
* Updated Catalan translation of debconf templates (Jordi Mallach).

[ Christian Perrier ]
* Fix pending l10n issues. Debconf translations:
  - Korean (강민지). Closes: #632014, #632021
  - Dutch (Jeroen Schot). Closes: #650645
  - Bokmål (Bjørn Steensrud). Closes: #654801

[ Felipe Augusto van de Wiel (faw) ]
* Fix some spell errors in doc files.
* Updated Policy to 3.9.2 without changes.

11. By Christian Perrier

* Non-maintainer upload.
* Fix typo in cron.daily script. Closes: #491198
* Bump debhelper compatibility from obsolete 4 to modern 7
* As a consequence, replace calls to "dh_clean -k" to "dh_prep"
* Add ${misc:Depends} to packages dependencies to properly
  cope with dependencies triggerred by debhelper
* No longer ignore make errors in the clean target
* Fix pending l10n issues. Debconf translations:
  - Basque (Piarres Beobide). Closes: #503919

10. By Clint Adams

* NMU
* Switch build dependency to libdb-dev (>= 4.7). closes: #517286.

9. By Stephan Rügamer

[ Ubuntu Merge-o-Matic ]
* Merge from debian unstable, remaining changes:
  - debian/control: don't use libdb*-dev but libdb-dev to catch up with latest BDB

8. By Stephan Rügamer

debian/control: don't use libdb*-dev but libdb-dev to catch up with latest BDB

7. By Stephan Rügamer

* debian/control:
  - bumbed b-d of libdb*-dev from 4.5 to 4.6
* Modify Maintainer value to match the DebianMaintainerField
  specification.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory '.pc'
2=== removed file '.pc/.quilt_patches'
3--- .pc/.quilt_patches 2012-05-08 21:58:08 +0000
4+++ .pc/.quilt_patches 1970-01-01 00:00:00 +0000
5@@ -1,1 +0,0 @@
6-debian/patches
7
8=== removed file '.pc/.quilt_series'
9--- .pc/.quilt_series 2012-05-08 21:58:08 +0000
10+++ .pc/.quilt_series 1970-01-01 00:00:00 +0000
11@@ -1,1 +0,0 @@
12-series
13
14=== removed file '.pc/.version'
15--- .pc/.version 2012-02-05 16:21:18 +0000
16+++ .pc/.version 1970-01-01 00:00:00 +0000
17@@ -1,1 +0,0 @@
18-2
19
20=== removed directory '.pc/01_symlink_vulnerability.diff'
21=== removed file '.pc/01_symlink_vulnerability.diff/output.c'
22--- .pc/01_symlink_vulnerability.diff/output.c 2012-05-08 21:58:08 +0000
23+++ .pc/01_symlink_vulnerability.diff/output.c 1970-01-01 00:00:00 +0000
24@@ -1,2910 +0,0 @@
25-/*
26- webalizer - a web server log analysis program
27-
28- Copyright (C) 1997-2013 Bradford L. Barrett
29-
30- This program is free software; you can redistribute it and/or modify
31- it under the terms of the GNU General Public License as published by
32- the Free Software Foundation; either version 2 of the License, or
33- (at your option) any later version, and provided that the above
34- copyright and permission notice is included with all distributed
35- copies of this or derived software.
36-
37- This program is distributed in the hope that it will be useful,
38- but WITHOUT ANY WARRANTY; without even the implied warranty of
39- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40- GNU General Public License for more details.
41-
42- You should have received a copy of the GNU General Public License
43- along with this program; if not, write to the Free Software
44- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
45-
46-*/
47-
48-/*********************************************/
49-/* STANDARD INCLUDES */
50-/*********************************************/
51-
52-#include <time.h>
53-#include <stdio.h>
54-#include <stdlib.h>
55-#include <string.h>
56-#include <unistd.h> /* normal stuff */
57-#include <ctype.h>
58-#include <errno.h>
59-#include <sys/stat.h>
60-#include <sys/utsname.h>
61-#ifdef USE_DNS
62-#include <db.h>
63-#endif
64-
65-/* ensure sys/types */
66-#ifndef _SYS_TYPES_H
67-#include <sys/types.h>
68-#endif
69-
70-/* need socket header? */
71-#ifdef HAVE_SYS_SOCKET_H
72-#include <sys/socket.h>
73-#endif
74-
75-/* some systems need this */
76-#ifdef HAVE_MATH_H
77-#include <math.h>
78-#endif
79-
80-#ifdef USE_GEOIP
81-#include <GeoIP.h>
82-#endif
83-
84-#include "webalizer.h" /* main header */
85-#include "lang.h"
86-#include "hashtab.h"
87-#include "preserve.h"
88-#include "linklist.h"
89-#include "graphs.h"
90-#include "output.h"
91-
92-/* internal function prototypes */
93-void write_html_head(char *, FILE *); /* head of html page */
94-void write_html_tail(FILE *); /* tail of html page */
95-void month_links(); /* Page links */
96-void month_total_table(); /* monthly total table */
97-void daily_total_table(); /* daily total table */
98-void hourly_total_table(); /* hourly total table */
99-void top_sites_table(int); /* top n sites table */
100-void top_urls_table(int); /* top n URLs table */
101-void top_entry_table(int); /* top n entry/exits */
102-void top_refs_table(); /* top n referrers "" */
103-void top_agents_table(); /* top n u-agents "" */
104-void top_ctry_table(); /* top n countries "" */
105-void top_search_table(); /* top n search strs */
106-void top_users_table(); /* top n ident table */
107-u_int64_t load_url_array( UNODEPTR *); /* load URL array */
108-u_int64_t load_site_array( HNODEPTR *); /* load Site array */
109-u_int64_t load_ref_array( RNODEPTR *); /* load Refs array */
110-u_int64_t load_agent_array(ANODEPTR *); /* load Agents array */
111-u_int64_t load_srch_array( SNODEPTR *); /* load srch str array */
112-u_int64_t load_ident_array(INODEPTR *); /* load ident array */
113-int qs_url_cmph( const void*, const void*); /* compare by hits */
114-int qs_url_cmpk( const void*, const void*); /* compare by kbytes */
115-int qs_url_cmpn( const void*, const void*); /* compare by entrys */
116-int qs_url_cmpx( const void*, const void*); /* compare by exits */
117-int qs_site_cmph(const void*, const void*); /* compare by hits */
118-int qs_site_cmpk(const void*, const void*); /* compare by kbytes */
119-int qs_ref_cmph( const void*, const void*); /* compare by hits */
120-int qs_agnt_cmph(const void*, const void*); /* compare by hits */
121-int qs_srch_cmph(const void*, const void*); /* compare by hits */
122-int qs_ident_cmph(const void*, const void*); /* compare by hits */
123-int qs_ident_cmpk(const void*, const void*); /* compare by kbytes */
124-
125-int all_sites_page(u_int64_t, u_int64_t); /* output site page */
126-int all_urls_page(u_int64_t, u_int64_t); /* output urls page */
127-int all_refs_page(u_int64_t, u_int64_t); /* output refs page */
128-int all_agents_page(u_int64_t, u_int64_t); /* output agents page */
129-int all_search_page(u_int64_t, u_int64_t); /* output search page */
130-int all_users_page(u_int64_t, u_int64_t); /* output ident page */
131-void dump_all_sites(); /* dump sites tab file */
132-void dump_all_urls(); /* dump urls tab file */
133-void dump_all_refs(); /* dump refs tab file */
134-void dump_all_agents(); /* dump agents file */
135-void dump_all_users(); /* dump usernames file */
136-void dump_all_search(); /* dump search file */
137-
138-/* define some colors for HTML */
139-#define WHITE "#FFFFFF"
140-#define BLACK "#000000"
141-#define RED "#FF0000"
142-#define ORANGE "#FF8000"
143-#define LTBLUE "#0080FF"
144-#define BLUE "#0000FF"
145-#define GREEN "#00FF00"
146-#define DKGREEN "#008040"
147-#define GREY "#C0C0C0"
148-#define LTGREY "#E8E8E8"
149-#define YELLOW "#FFFF00"
150-#define PURPLE "#FF00FF"
151-#define CYAN "#00E0FF"
152-#define GRPCOLOR "#D0D0E0"
153-
154-/* configurable html colors */
155-#define HITCOLOR hit_color
156-#define FILECOLOR file_color
157-#define SITECOLOR site_color
158-#define KBYTECOLOR kbyte_color
159-#define PAGECOLOR page_color
160-#define VISITCOLOR visit_color
161-#define MISCCOLOR misc_color
162-
163-/* sort arrays */
164-UNODEPTR *u_array = NULL; /* Sort array for URLs */
165-HNODEPTR *h_array = NULL; /* hostnames (sites) */
166-RNODEPTR *r_array = NULL; /* referrers */
167-ANODEPTR *a_array = NULL; /* user agents */
168-SNODEPTR *s_array = NULL; /* search strings */
169-INODEPTR *i_array = NULL; /* ident strings (username) */
170-u_int64_t a_ctr = 0; /* counter for sort array */
171-
172-FILE *out_fp;
173-
174-/*********************************************/
175-/* WRITE_HTML_HEAD - output top of HTML page */
176-/*********************************************/
177-
178-void write_html_head(char *period, FILE *out_fp)
179-{
180- NLISTPTR lptr; /* used for HTMLhead processing */
181-
182- /* HTMLPre code goes before all else */
183- lptr = html_pre;
184- if (lptr==NULL)
185- {
186- /* Default 'DOCTYPE' header record if none specified */
187- fprintf(out_fp,
188- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n\n");
189- }
190- else
191- {
192- while (lptr!=NULL)
193- {
194- fprintf(out_fp,"%s\n",lptr->string);
195- lptr=lptr->next;
196- }
197- }
198- /* Standard header comments */
199- fprintf(out_fp,"<!-- Generated by The Webalizer Ver. %s-%s -->\n",
200- version,editlvl);
201- fprintf(out_fp,"<!-- -->\n");
202- fprintf(out_fp,"<!-- Copyright 1997-2013 Bradford L. Barrett -->\n");
203- fprintf(out_fp,"<!-- -->\n");
204- fprintf(out_fp,"<!-- Distributed under the GNU GPL Version 2 -->\n");
205- fprintf(out_fp,"<!-- Full text may be found at: -->\n");
206- fprintf(out_fp,"<!-- http://www.webalizer.org -->\n");
207- fprintf(out_fp,"<!-- -->\n");
208- fprintf(out_fp,"<!-- Give the power back to the programmers -->\n");
209- fprintf(out_fp,"<!-- Support the Free Software Foundation -->\n");
210- fprintf(out_fp,"<!-- (http://www.fsf.org) -->\n");
211- fprintf(out_fp,"<!-- -->\n");
212- fprintf(out_fp,"<!-- *** Generated: %s *** -->\n\n",cur_time());
213-
214- fprintf(out_fp,"<HTML lang=\"%s\">\n<HEAD>\n",langcode);
215- fprintf(out_fp," <TITLE>%s %s - %s</TITLE>\n",
216- msg_title, hname, (period)?period:msg_main_per);
217- lptr=html_head;
218- while (lptr!=NULL)
219- {
220- fprintf(out_fp,"%s\n",lptr->string);
221- lptr=lptr->next;
222- }
223- fprintf(out_fp,"</HEAD>\n\n");
224-
225- lptr = html_body;
226- if (lptr==NULL)
227- fprintf(out_fp,"<BODY BGCOLOR=\"%s\" TEXT=\"%s\" " \
228- "LINK=\"%s\" VLINK=\"%s\">\n",
229- LTGREY, BLACK, BLUE, RED);
230- else
231- {
232- while (lptr!=NULL)
233- {
234- fprintf(out_fp,"%s\n",lptr->string);
235- lptr=lptr->next;
236- }
237- }
238- fprintf(out_fp,"<H2>%s %s</H2>\n",msg_title, hname);
239- if (period)
240- fprintf(out_fp,"<SMALL><STRONG>\n%s: %s<BR>\n",msg_hhdr_sp,period);
241- else
242- fprintf(out_fp,"<SMALL><STRONG>\n%s<BR>\n",msg_main_per);
243- fprintf(out_fp,"%s %s<BR>\n</STRONG></SMALL>\n",msg_hhdr_gt,cur_time());
244- lptr=html_post;
245- while (lptr!=NULL)
246- {
247- fprintf(out_fp,"%s\n",lptr->string);
248- lptr=lptr->next;
249- }
250- fprintf(out_fp,"<CENTER>\n<HR>\n<P>\n");
251-}
252-
253-/*********************************************/
254-/* WRITE_HTML_TAIL - output HTML page tail */
255-/*********************************************/
256-
257-void write_html_tail(FILE *out_fp)
258-{
259- NLISTPTR lptr;
260-
261- fprintf(out_fp,"</CENTER>\n");
262- fprintf(out_fp,"<P>\n<HR>\n");
263- fprintf(out_fp,"<TABLE WIDTH=\"100%%\" CELLPADDING=0 " \
264- "CELLSPACING=0 BORDER=0>\n");
265- fprintf(out_fp,"<TR>\n");
266- fprintf(out_fp,"<TD ALIGN=left VALIGN=top>\n");
267- fprintf(out_fp,"<SMALL>Generated by\n");
268- fprintf(out_fp,"<A HREF=\"http://www.webalizer.org/\">");
269- fprintf(out_fp,"<STRONG>Webalizer Version %s</STRONG></A>\n",version);
270- fprintf(out_fp,"</SMALL>\n</TD>\n");
271- lptr=html_tail;
272- if (lptr)
273- {
274- fprintf(out_fp,"<TD ALIGN=\"right\" VALIGN=\"top\">\n");
275- while (lptr!=NULL)
276- {
277- fprintf(out_fp,"%s\n",lptr->string);
278- lptr=lptr->next;
279- }
280- fprintf(out_fp,"</TD>\n");
281- }
282- fprintf(out_fp,"</TR>\n</TABLE>\n");
283-
284- /* wind up, this is the end of the file */
285- fprintf(out_fp,"\n<!-- Webalizer Version %s-%s (Mod: %s) -->\n",
286- version,editlvl,moddate);
287- lptr = html_end;
288- if (lptr)
289- {
290- while (lptr!=NULL)
291- {
292- fprintf(out_fp,"%s\n",lptr->string);
293- lptr=lptr->next;
294- }
295- }
296- else fprintf(out_fp,"\n</BODY>\n</HTML>\n");
297-}
298-
299-/*********************************************/
300-/* WRITE_MONTH_HTML - does what it says... */
301-/*********************************************/
302-
303-int write_month_html()
304-{
305- char html_fname[256]; /* filename storage areas... */
306- char png1_fname[32];
307- char png2_fname[32];
308-
309- char buffer[BUFSIZE]; /* scratch buffer */
310- char dtitle[256];
311- char htitle[256];
312-
313- if (verbose>1)
314- printf("%s %s %d\n",msg_gen_rpt, l_month[cur_month-1], cur_year);
315-
316- /* fill in filenames */
317- snprintf(html_fname,sizeof(html_fname),"usage_%04d%02d.%s",
318- cur_year,cur_month,html_ext);
319- sprintf(png1_fname,"daily_usage_%04d%02d.png",cur_year,cur_month);
320- sprintf(png2_fname,"hourly_usage_%04d%02d.png",cur_year,cur_month);
321-
322- /* create PNG images for web page */
323- if (daily_graph)
324- {
325- snprintf(dtitle,sizeof(dtitle),"%s %s %d",
326- msg_hmth_du,l_month[cur_month-1],cur_year);
327- month_graph6 ( png1_fname, /* filename */
328- dtitle, /* graph title */
329- cur_month, /* graph month */
330- cur_year, /* graph year */
331- tm_hit, /* data 1 (hits) */
332- tm_file, /* data 2 (files) */
333- tm_site, /* data 3 (sites) */
334- tm_xfer, /* data 4 (kbytes) */
335- tm_page, /* data 5 (pages) */
336- tm_visit); /* data 6 (visits) */
337- }
338-
339- if (hourly_graph)
340- {
341- snprintf(htitle,sizeof(htitle),"%s %s %d",
342- msg_hmth_hu,l_month[cur_month-1],cur_year);
343- day_graph3( png2_fname,
344- htitle,
345- th_hit,
346- th_file,
347- th_page );
348- }
349-
350- /* now do html stuff... */
351- /* first, open the file */
352- if ( (out_fp=open_out_file(html_fname))==NULL ) return 1;
353-
354- snprintf(buffer,sizeof(buffer),"%s %d",l_month[cur_month-1],cur_year);
355- write_html_head(buffer, out_fp);
356- month_links();
357- month_total_table();
358- if (daily_graph || daily_stats) /* Daily stuff */
359- {
360- fprintf(out_fp,"<A NAME=\"DAYSTATS\"></A>\n");
361- if (daily_graph) fprintf(out_fp,"<IMG SRC=\"%s\" ALT=\"%s\" " \
362- "HEIGHT=400 WIDTH=512><P>\n",png1_fname,dtitle);
363- if (daily_stats) daily_total_table();
364- }
365-
366- if (hourly_graph || hourly_stats) /* Hourly stuff */
367- {
368- fprintf(out_fp,"<A NAME=\"HOURSTATS\"></A>\n");
369- if (hourly_graph) fprintf(out_fp,"<IMG SRC=\"%s\" ALT=\"%s\" " \
370- "HEIGHT=256 WIDTH=512><P>\n",png2_fname,htitle);
371- if (hourly_stats) hourly_total_table();
372- }
373-
374- /* Do URL related stuff here, sorting appropriately */
375- if ( (a_ctr=load_url_array(NULL)) )
376- {
377- if ( (u_array=malloc(sizeof(UNODEPTR)*(a_ctr))) !=NULL )
378- {
379- a_ctr=load_url_array(u_array); /* load up our sort array */
380- if (ntop_urls || dump_urls)
381- {
382- qsort(u_array,a_ctr,sizeof(UNODEPTR),qs_url_cmph);
383- if (ntop_urls) top_urls_table(0); /* Top URLs (by hits) */
384- if (dump_urls) dump_all_urls(); /* Dump URLs tab file */
385- }
386- if (ntop_urlsK) /* Top URLs (by kbytes) */
387- {qsort(u_array,a_ctr,sizeof(UNODEPTR),qs_url_cmpk); top_urls_table(1); }
388- if (ntop_entry) /* Top Entry Pages */
389- {qsort(u_array,a_ctr,sizeof(UNODEPTR),qs_url_cmpn); top_entry_table(0);}
390- if (ntop_exit) /* Top Exit Pages */
391- {qsort(u_array,a_ctr,sizeof(UNODEPTR),qs_url_cmpx); top_entry_table(1);}
392- free(u_array);
393- }
394- else if (verbose) fprintf(stderr,"%s [u_array]\n",msg_nomem_tu); /* err */
395- }
396-
397- /* do hostname (sites) related stuff here, sorting appropriately... */
398- if ( (a_ctr=load_site_array(NULL)) )
399- {
400- if ( (h_array=malloc(sizeof(HNODEPTR)*(a_ctr))) !=NULL )
401- {
402- a_ctr=load_site_array(h_array); /* load up our sort array */
403- if (ntop_sites || dump_sites)
404- {
405- qsort(h_array,a_ctr,sizeof(HNODEPTR),qs_site_cmph);
406- if (ntop_sites) top_sites_table(0); /* Top sites table (by hits) */
407- if (dump_sites) dump_all_sites(); /* Dump sites tab file */
408- }
409- if (ntop_sitesK) /* Top Sites table (by kbytes) */
410- {
411- qsort(h_array,a_ctr,sizeof(HNODEPTR),qs_site_cmpk);
412- top_sites_table(1);
413- }
414- free(h_array);
415- }
416- else if (verbose) fprintf(stderr,"%s [h_array]\n",msg_nomem_ts); /* err */
417- }
418-
419- /* do referrer related stuff here, sorting appropriately... */
420- if ( (a_ctr=load_ref_array(NULL)) )
421- {
422- if ( (r_array=malloc(sizeof(RNODEPTR)*(a_ctr))) != NULL)
423- {
424- a_ctr=load_ref_array(r_array);
425- if (ntop_refs || dump_refs)
426- {
427- qsort(r_array,a_ctr,sizeof(RNODEPTR),qs_ref_cmph);
428- if (ntop_refs) top_refs_table(); /* Top referrers table */
429- if (dump_refs) dump_all_refs(); /* Dump referrers tab file */
430- }
431- free(r_array);
432- }
433- else if (verbose) fprintf(stderr,"%s [r_array]\n",msg_nomem_tr); /* err */
434- }
435-
436- /* do search string related stuff, sorting appropriately... */
437- if ( (a_ctr=load_srch_array(NULL)) )
438- {
439- if ( (s_array=malloc(sizeof(SNODEPTR)*(a_ctr))) != NULL)
440- {
441- a_ctr=load_srch_array(s_array);
442- if (ntop_search || dump_search)
443- {
444- qsort(s_array,a_ctr,sizeof(SNODEPTR),qs_srch_cmph);
445- if (ntop_search) top_search_table(); /* top search strings table */
446- if (dump_search) dump_all_search(); /* dump search string tab file */
447- }
448- free(s_array);
449- }
450- else if (verbose) fprintf(stderr,"%s [s_array]\n",msg_nomem_tsr);/* err */
451- }
452-
453- /* do ident (username) related stuff here, sorting appropriately... */
454- if ( (a_ctr=load_ident_array(NULL)) )
455- {
456- if ( (i_array=malloc(sizeof(INODEPTR)*(a_ctr))) != NULL)
457- {
458- a_ctr=load_ident_array(i_array);
459- if (ntop_users || dump_users)
460- {
461- qsort(i_array,a_ctr,sizeof(INODEPTR),qs_ident_cmph);
462- if (ntop_users) top_users_table(); /* top usernames table */
463- if (dump_users) dump_all_users(); /* dump usernames tab file */
464- }
465- free(i_array);
466- }
467- else if (verbose) fprintf(stderr,"%s [i_array]\n",msg_nomem_ti); /* err */
468- }
469-
470- /* do user agent related stuff here, sorting appropriately... */
471- if ( (a_ctr=load_agent_array(NULL)) )
472- {
473- if ( (a_array=malloc(sizeof(ANODEPTR)*(a_ctr))) != NULL)
474- {
475- a_ctr=load_agent_array(a_array);
476- if (ntop_agents || dump_agents)
477- {
478- qsort(a_array,a_ctr,sizeof(ANODEPTR),qs_agnt_cmph);
479- if (ntop_agents) top_agents_table(); /* top user agents table */
480- if (dump_agents) dump_all_agents(); /* dump user agents tab file */
481- }
482- free(a_array);
483- }
484- else if (verbose) fprintf(stderr,"%s [a_array]\n",msg_nomem_ta); /* err */
485- }
486-
487- if (ntop_ctrys ) top_ctry_table(); /* top countries table */
488-
489- write_html_tail(out_fp); /* finish up the HTML document */
490- fclose(out_fp); /* close the file */
491- return (0); /* done... */
492-}
493-
494-/*********************************************/
495-/* MONTH_LINKS - links to other page parts */
496-/*********************************************/
497-
498-void month_links()
499-{
500- fprintf(out_fp,"<SMALL>\n");
501- if (daily_stats || daily_graph)
502- fprintf(out_fp,"<A HREF=\"#DAYSTATS\">[%s]</A>\n",msg_hlnk_ds);
503- if (hourly_stats || hourly_graph)
504- fprintf(out_fp,"<A HREF=\"#HOURSTATS\">[%s]</A>\n",msg_hlnk_hs);
505- if (ntop_urls || ntop_urlsK)
506- fprintf(out_fp,"<A HREF=\"#TOPURLS\">[%s]</A>\n",msg_hlnk_u);
507- if (ntop_entry)
508- fprintf(out_fp,"<A HREF=\"#TOPENTRY\">[%s]</A>\n",msg_hlnk_en);
509- if (ntop_exit)
510- fprintf(out_fp,"<A HREF=\"#TOPEXIT\">[%s]</A>\n",msg_hlnk_ex);
511- if (ntop_sites || ntop_sitesK)
512- fprintf(out_fp,"<A HREF=\"#TOPSITES\">[%s]</A>\n",msg_hlnk_s);
513- if (ntop_refs && t_ref)
514- fprintf(out_fp,"<A HREF=\"#TOPREFS\">[%s]</A>\n",msg_hlnk_r);
515- if (ntop_search)
516- fprintf(out_fp,"<A HREF=\"#TOPSEARCH\">[%s]</A>\n",msg_hlnk_sr);
517- if (ntop_users && t_user)
518- fprintf(out_fp,"<A HREF=\"#TOPUSERS\">[%s]</A>\n",msg_hlnk_i);
519- if (ntop_agents && t_agent)
520- fprintf(out_fp,"<A HREF=\"#TOPAGENTS\">[%s]</A>\n",msg_hlnk_a);
521- if (ntop_ctrys)
522- fprintf(out_fp,"<A HREF=\"#TOPCTRYS\">[%s]</A>\n",msg_hlnk_c);
523- fprintf(out_fp,"</SMALL>\n<P>\n");
524-}
525-
526-/*********************************************/
527-/* MONTH_TOTAL_TABLE - monthly totals table */
528-/*********************************************/
529-
530-void month_total_table()
531-{
532- int i,days_in_month;
533- u_int64_t max_files=0,max_hits=0,max_visits=0,max_pages=0,max_sites=0;
534- double max_xfer=0.0;
535-
536- days_in_month=(l_day-f_day)+1;
537- for (i=0;i<31;i++)
538- { /* Get max/day values */
539- if (tm_hit[i]>max_hits) max_hits = tm_hit[i];
540- if (tm_file[i]>max_files) max_files = tm_file[i];
541- if (tm_page[i]>max_pages) max_pages = tm_page[i];
542- if (tm_visit[i]>max_visits) max_visits= tm_visit[i];
543- if (tm_site[i]>max_sites) max_sites = tm_site[i];
544- if (tm_xfer[i]>max_xfer) max_xfer = tm_xfer[i];
545- }
546-
547- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
548- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
549- fprintf(out_fp,"<TR><TH COLSPAN=3 ALIGN=center BGCOLOR=\"%s\">" \
550- "%s %s %d</TH></TR>\n",GREY,msg_mtot_ms,l_month[cur_month-1],cur_year);
551- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
552- /* Total Hits */
553- fprintf(out_fp,"<TR><TD WIDTH=380><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
554- "<TD ALIGN=right COLSPAN=2><FONT SIZE=\"-1\"><B>%llu</B>" \
555- "</FONT></TD></TR>\n",msg_mtot_th,t_hit);
556- /* Total Files */
557- fprintf(out_fp,"<TR><TD WIDTH=380><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
558- "<TD ALIGN=right COLSPAN=2><FONT SIZE=\"-1\"><B>%llu</B>" \
559- "</FONT></TD></TR>\n",msg_mtot_tf,t_file);
560- /* Total Pages */
561- fprintf(out_fp,"<TR><TD WIDTH=380><FONT SIZE=\"-1\">%s %s</FONT></TD>\n" \
562- "<TD ALIGN=right COLSPAN=2><FONT SIZE=\"-1\"><B>%llu</B>" \
563- "</FONT></TD></TR>\n",msg_h_total, msg_h_pages, t_page);
564- /* Total Visits */
565- fprintf(out_fp,"<TR><TD WIDTH=380><FONT SIZE=\"-1\">%s %s</FONT></TD>\n" \
566- "<TD ALIGN=right COLSPAN=2><FONT SIZE=\"-1\"><B>%llu</B>" \
567- "</FONT></TD></TR>\n",msg_h_total, msg_h_visits, t_visit);
568- /* Total XFer */
569- fprintf(out_fp,"<TR><TD WIDTH=380><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
570- "<TD ALIGN=right COLSPAN=2><FONT SIZE=\"-1\"><B>%.0f</B>" \
571- "</FONT></TD></TR>\n",msg_mtot_tx,t_xfer/1024);
572- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
573- /**********************************************/
574- /* Unique Sites */
575- fprintf(out_fp,"<TR>" \
576- "<TD WIDTH=380><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
577- "<TD ALIGN=right COLSPAN=2><FONT SIZE=\"-1\"><B>%llu</B>" \
578- "</FONT></TD></TR>\n",msg_mtot_us,t_site);
579- /* Unique URLs */
580- fprintf(out_fp,"<TR>" \
581- "<TD WIDTH=380><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
582- "<TD ALIGN=right COLSPAN=2><FONT SIZE=\"-1\"><B>%llu</B>" \
583- "</FONT></TD></TR>\n",msg_mtot_uu,t_url);
584- /* Unique Referrers */
585- if (t_ref != 0)
586- fprintf(out_fp,"<TR>" \
587- "<TD WIDTH=380><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
588- "<TD ALIGN=right COLSPAN=2><FONT SIZE=\"-1\"><B>%llu</B>" \
589- "</FONT></TD></TR>\n",msg_mtot_ur,t_ref);
590- /* Unique Usernames */
591- if (t_user != 0)
592- fprintf(out_fp,"<TR>" \
593- "<TD WIDTH=380><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
594- "<TD ALIGN=right COLSPAN=2><FONT SIZE=\"-1\"><B>%llu</B>" \
595- "</FONT></TD></TR>\n",msg_mtot_ui,t_user);
596- /* Unique Agents */
597- if (t_agent != 0)
598- fprintf(out_fp,"<TR>" \
599- "<TD WIDTH=380><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
600- "<TD ALIGN=right COLSPAN=2><FONT SIZE=\"-1\"><B>%llu</B>" \
601- "</FONT></TD></TR>\n",msg_mtot_ua,t_agent);
602- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
603- /**********************************************/
604- /* Hourly/Daily avg/max totals */
605- fprintf(out_fp,"<TR>" \
606- "<TH WIDTH=380 BGCOLOR=\"%s\"><FONT SIZE=-1 COLOR=\"%s\">.</FONT></TH>\n"\
607- "<TH WIDTH=65 BGCOLOR=\"%s\" ALIGN=right>" \
608- "<FONT SIZE=-1>%s </FONT></TH>\n" \
609- "<TH WIDTH=65 BGCOLOR=\"%s\" ALIGN=right>" \
610- "<FONT SIZE=-1>%s </FONT></TH></TR>\n",
611- GREY,GREY,GREY,msg_h_avg,GREY,msg_h_max);
612- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
613- /* Max/Avg Hits per Hour */
614- fprintf(out_fp,"<TR>" \
615- "<TD><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
616- "<TD ALIGN=right WIDTH=65><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
617- "<TD WIDTH=65 ALIGN=right><FONT SIZE=-1><B>%llu</B>" \
618- "</FONT></TD></TR>\n",msg_mtot_mhh, t_hit/(24*days_in_month),mh_hit);
619- /* Max/Avg Hits per Day */
620- fprintf(out_fp,"<TR>" \
621- "<TD><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
622- "<TD ALIGN=right WIDTH=65><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
623- "<TD WIDTH=65 ALIGN=right><FONT SIZE=-1><B>%llu</B>" \
624- "</FONT></TD></TR>\n",msg_mtot_mhd, t_hit/days_in_month, max_hits);
625- /* Max/Avg Files per Day */
626- fprintf(out_fp,"<TR>" \
627- "<TD><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
628- "<TD ALIGN=right WIDTH=65><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
629- "<TD WIDTH=65 ALIGN=right><FONT SIZE=-1><B>%llu</B>" \
630- "</FONT></TD></TR>\n",msg_mtot_mfd, t_file/days_in_month,max_files);
631- /* Max/Avg Pages per Day */
632- fprintf(out_fp,"<TR>" \
633- "<TD><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
634- "<TD ALIGN=right WIDTH=65><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
635- "<TD WIDTH=65 ALIGN=right><FONT SIZE=-1><B>%llu</B>" \
636- "</FONT></TD></TR>\n",msg_mtot_mpd, t_page/days_in_month,max_pages);
637- /* Max/Avg Sites per Day */
638- fprintf(out_fp,"<TR>" \
639- "<TD><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
640- "<TD ALIGN=right WIDTH=65><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
641- "<TD WIDTH=65 ALIGN=right><FONT SIZE=-1><B>%llu</B>" \
642- "</FONT></TD></TR>\n",msg_mtot_msd, t_site/days_in_month,max_sites);
643- /* Max/Avg Visits per Day */
644- fprintf(out_fp,"<TR>" \
645- "<TD><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
646- "<TD ALIGN=right WIDTH=65><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
647- "<TD WIDTH=65 ALIGN=right><FONT SIZE=-1><B>%llu</B>" \
648- "</FONT></TD></TR>\n",msg_mtot_mvd, t_visit/days_in_month,max_visits);
649- /* Max/Avg KBytes per Day */
650- fprintf(out_fp,"<TR>" \
651- "<TD><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
652- "<TD ALIGN=right WIDTH=65><FONT SIZE=\"-1\"><B>%.0f</B></FONT></TD>\n" \
653- "<TD WIDTH=65 ALIGN=right><FONT SIZE=-1><B>%.0f</B>" \
654- "</FONT></TD></TR>\n",msg_mtot_mkd,
655- (t_xfer/1024)/days_in_month,max_xfer/1024);
656- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
657- /**********************************************/
658- /* response code totals */
659- fprintf(out_fp,"<TR><TH COLSPAN=3 ALIGN=center BGCOLOR=\"%s\">\n" \
660- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",GREY,msg_mtot_rc);
661- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
662- for (i=0;i<TOTAL_RC;i++)
663- {
664- if (response[i].count != 0)
665- fprintf(out_fp,"<TR><TD><FONT SIZE=\"-1\">%s</FONT></TD>\n" \
666- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
667- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD></TR>\n",
668- response[i].desc,PCENT(response[i].count,t_hit),response[i].count);
669- }
670- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
671- /**********************************************/
672-
673- fprintf(out_fp,"</TABLE>\n");
674- fprintf(out_fp,"<P>\n");
675-}
676-
677-/*********************************************/
678-/* DAILY_TOTAL_TABLE - daily totals */
679-/*********************************************/
680-
681-void daily_total_table()
682-{
683- int i,j;
684-
685- /* Daily stats */
686- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
687- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
688- /* Daily statistics for ... */
689- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" COLSPAN=13 ALIGN=center>" \
690- "%s %s %d</TH></TR>\n",
691- GREY,msg_dtot_ds,l_month[cur_month-1], cur_year);
692- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
693- fprintf(out_fp,"<TR><TH ALIGN=center BGCOLOR=\"%s\">" \
694- "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
695- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \
696- "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
697- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \
698- "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
699- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \
700- "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
701- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \
702- "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
703- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \
704- "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
705- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \
706- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",
707- GREY, msg_h_day,
708- HITCOLOR, msg_h_hits,
709- FILECOLOR, msg_h_files,
710- PAGECOLOR, msg_h_pages,
711- VISITCOLOR, msg_h_visits,
712- SITECOLOR, msg_h_sites,
713- KBYTECOLOR, msg_h_xfer);
714- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
715-
716- /* skip beginning blank days in a month */
717- for (i=0;i<l_day;i++) if (tm_hit[i]!=0) break;
718- if (i==l_day) i=0;
719-
720- for (;i<l_day;i++)
721- {
722- j = jdate(i+1,cur_month,cur_year);
723- if ( (j%7==6) || (j%7==0) )
724- fprintf(out_fp,"<TR BGCOLOR=\"%s\"><TD ALIGN=center>",GRPCOLOR);
725- else fprintf(out_fp,"<TR><TD ALIGN=center>");
726- fprintf(out_fp,"<FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n", i+1);
727- fprintf(out_fp,"<TD ALIGN=right>" \
728- "<FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
729- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n",
730- tm_hit[i],PCENT(tm_hit[i],t_hit));
731- fprintf(out_fp,"<TD ALIGN=right>" \
732- "<FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
733- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n",
734- tm_file[i],PCENT(tm_file[i],t_file));
735- fprintf(out_fp,"<TD ALIGN=right>" \
736- "<FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
737- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n",
738- tm_page[i],PCENT(tm_page[i],t_page));
739- fprintf(out_fp,"<TD ALIGN=right>" \
740- "<FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
741- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n",
742- tm_visit[i],PCENT(tm_visit[i],t_visit));
743- fprintf(out_fp,"<TD ALIGN=right>" \
744- "<FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
745- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n",
746- tm_site[i],PCENT(tm_site[i],t_site));
747- fprintf(out_fp,"<TD ALIGN=right>" \
748- "<FONT SIZE=\"-1\"><B>%.0f</B></FONT></TD>\n" \
749- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD></TR>\n",
750- tm_xfer[i]/1024,PCENT(tm_xfer[i],t_xfer));
751- }
752- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
753- fprintf(out_fp,"</TABLE>\n");
754- fprintf(out_fp,"<P>\n");
755-}
756-
757-/*********************************************/
758-/* HOURLY_TOTAL_TABLE - hourly table */
759-/*********************************************/
760-
761-void hourly_total_table()
762-{
763- int i,days_in_month;
764- u_int64_t avg_file=0;
765- double avg_xfer=0.0;
766-
767- days_in_month=(l_day-f_day)+1;
768-
769- /* Hourly stats */
770- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
771- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
772- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" COLSPAN=13 ALIGN=center>"\
773- "%s %s %d</TH></TR>\n",
774- GREY,msg_htot_hs,l_month[cur_month-1], cur_year);
775- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
776- fprintf(out_fp,"<TR><TH ALIGN=center ROWSPAN=2 BGCOLOR=\"%s\">" \
777- "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
778- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=3>" \
779- "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
780- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=3>" \
781- "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
782- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=3>" \
783- "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \
784- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=3>" \
785- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",
786- GREY, msg_h_hour,
787- HITCOLOR, msg_h_hits,
788- FILECOLOR, msg_h_files,
789- PAGECOLOR, msg_h_pages,
790- KBYTECOLOR, msg_h_xfer);
791- fprintf(out_fp,"<TR><TH ALIGN=center BGCOLOR=\"%s\">" \
792- "<FONT SIZE=\"-2\">%s</FONT></TH>\n" \
793- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \
794- "<FONT SIZE=\"-2\">%s</FONT></TH>\n",
795- HITCOLOR, msg_h_avg, HITCOLOR, msg_h_total);
796- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
797- "<FONT SIZE=\"-2\">%s</FONT></TH>\n" \
798- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \
799- "<FONT SIZE=\"-2\">%s</FONT></TH>\n",
800- FILECOLOR, msg_h_avg, FILECOLOR, msg_h_total);
801- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
802- "<FONT SIZE=\"-2\">%s</FONT></TH>\n" \
803- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \
804- "<FONT SIZE=\"-2\">%s</FONT></TH>\n",
805- PAGECOLOR, msg_h_avg, PAGECOLOR, msg_h_total);
806- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
807- "<FONT SIZE=\"-2\">%s</FONT></TH>\n" \
808- "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \
809- "<FONT SIZE=\"-2\">%s</FONT></TH></TR>\n",
810- KBYTECOLOR, msg_h_avg, KBYTECOLOR, msg_h_total);
811-
812- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
813- for (i=0;i<24;i++)
814- {
815- fprintf(out_fp,"<TR><TD ALIGN=center>" \
816- "<FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n",i);
817- fprintf(out_fp,
818- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
819- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
820- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n",
821- th_hit[i]/days_in_month,th_hit[i],
822- PCENT(th_hit[i],t_hit));
823- fprintf(out_fp,
824- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
825- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
826- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n",
827- th_file[i]/days_in_month,th_file[i],
828- PCENT(th_file[i],t_file));
829- fprintf(out_fp,
830- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
831- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
832- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n",
833- th_page[i]/days_in_month,th_page[i],
834- PCENT(th_page[i],t_page));
835- fprintf(out_fp,
836- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%.0f</B></FONT></TD>\n" \
837- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%.0f</B></FONT></TD>\n" \
838- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD></TR>\n",
839- (th_xfer[i]/days_in_month)/1024,th_xfer[i]/1024,
840- PCENT(th_xfer[i],t_xfer));
841- avg_file += th_file[i]/days_in_month;
842- avg_xfer+= (th_xfer[i]/days_in_month)/1024;
843- }
844- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
845- fprintf(out_fp,"</TABLE>\n<P>\n");
846-}
847-
848-/*********************************************/
849-/* TOP_SITES_TABLE - generate top n table */
850-/*********************************************/
851-
852-void top_sites_table(int flag)
853-{
854- u_int64_t cnt=0, h_reg=0, h_grp=0, h_hid=0, tot_num;
855- int i;
856- HNODEPTR hptr, *pointer;
857-
858- cnt=a_ctr; pointer=h_array;
859- while(cnt--)
860- {
861- /* calculate totals */
862- switch ( (int)((HNODEPTR)(*pointer)->flag) )
863- {
864- case OBJ_REG: h_reg++; break;
865- case OBJ_GRP: h_grp++; break;
866- case OBJ_HIDE: h_hid++; break;
867- }
868- pointer++;
869- }
870-
871- if ( (tot_num=h_reg+h_grp)==0 ) return; /* split if none */
872- i=(flag)?ntop_sitesK:ntop_sites; /* Hits or KBytes?? */
873- if (tot_num > i) tot_num = i; /* get max to do... */
874-
875- if ((!flag) || (flag&&!ntop_sites)) /* now do <A> tag */
876- fprintf(out_fp,"<A NAME=\"TOPSITES\"></A>\n");
877-
878- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
879- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
880- if (flag) fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=10>" \
881- "%s %llu %s %llu %s %s %s</TH></TR>\n",
882- GREY, msg_top_top,tot_num,msg_top_of,
883- t_site,msg_top_s,msg_h_by,msg_h_xfer);
884- else fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=10>" \
885- "%s %llu %s %llu %s</TH></TR>\n",
886- GREY,msg_top_top, tot_num, msg_top_of, t_site, msg_top_s);
887- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
888- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>" \
889- "<FONT SIZE=\"-1\">#</FONT></TH>\n",GREY);
890- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
891- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",HITCOLOR,msg_h_hits);
892- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
893- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",FILECOLOR,msg_h_files);
894- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
895- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",KBYTECOLOR,msg_h_xfer);
896- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
897- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",VISITCOLOR,msg_h_visits);
898- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>" \
899- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",MISCCOLOR,msg_h_hname);
900- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
901-
902- pointer=h_array; i=0;
903- while(tot_num)
904- {
905- hptr=*pointer++;
906- if (hptr->flag != OBJ_HIDE)
907- {
908- /* shade grouping? */
909- if (shade_groups && (hptr->flag==OBJ_GRP))
910- fprintf(out_fp,"<TR BGCOLOR=\"%s\">\n", GRPCOLOR);
911- else fprintf(out_fp,"<TR>\n");
912-
913- fprintf(out_fp,
914- "<TD ALIGN=center><FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n" \
915- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
916- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
917- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
918- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
919- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%.0f</B></FONT></TD>\n" \
920- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
921- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
922- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
923- "<TD ALIGN=left NOWRAP><FONT SIZE=\"-1\">",
924- i+1,hptr->count,
925- (t_hit==0)?0:((float)hptr->count/t_hit)*100.0,hptr->files,
926- (t_file==0)?0:((float)hptr->files/t_file)*100.0,hptr->xfer/1024,
927- (t_xfer==0)?0:((float)hptr->xfer/t_xfer)*100.0,hptr->visit,
928- (t_visit==0)?0:((float)hptr->visit/t_visit)*100.0);
929-
930- if ((hptr->flag==OBJ_GRP)&&hlite_groups)
931- fprintf(out_fp,"<STRONG>%s</STRONG></FONT></TD></TR>\n",
932- hptr->string);
933- else fprintf(out_fp,"%s</FONT></TD></TR>\n",
934- hptr->string);
935- tot_num--;
936- i++;
937- }
938- }
939-
940- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
941- if ((!flag) || (flag&&!ntop_sites))
942- {
943- if ( (all_sites) && ((h_reg+h_grp)>ntop_sites) )
944- {
945- if (all_sites_page(h_reg, h_grp))
946- {
947- fprintf(out_fp,"<TR BGCOLOR=\"%s\">",GRPCOLOR);
948- fprintf(out_fp,"<TD COLSPAN=10 ALIGN=\"center\">\n");
949- fprintf(out_fp,"<FONT SIZE=\"-1\">");
950- fprintf(out_fp,"<A HREF=\"./site_%04d%02d.%s\">",
951- cur_year,cur_month,html_ext);
952- fprintf(out_fp,"%s</A></TD></TR>\n",msg_v_sites);
953- if (flag) /* do we need to sort? */
954- qsort(h_array,a_ctr,sizeof(HNODEPTR),qs_site_cmph);
955- }
956- }
957- }
958- fprintf(out_fp,"</TABLE>\n<P>\n");
959-}
960-
961-/*********************************************/
962-/* ALL_SITES_PAGE - HTML page of all sites */
963-/*********************************************/
964-
965-int all_sites_page(u_int64_t h_reg, u_int64_t h_grp)
966-{
967- HNODEPTR hptr, *pointer;
968- char site_fname[256], buffer[256];
969- FILE *out_fp;
970- int i=(h_grp)?1:0;
971-
972- /* generate file name */
973- snprintf(site_fname,sizeof(site_fname),"site_%04d%02d.%s",
974- cur_year,cur_month,html_ext);
975-
976- /* open file */
977- if ( (out_fp=open_out_file(site_fname))==NULL ) return 0;
978-
979- snprintf(buffer,sizeof(buffer),"%s %d - %s",
980- l_month[cur_month-1],cur_year,msg_h_sites);
981- write_html_head(buffer, out_fp);
982-
983- fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
984-
985- fprintf(out_fp," %12s %12s %12s %12s %s\n",
986- msg_h_hits, msg_h_files, msg_h_xfer, msg_h_visits, msg_h_hname);
987- fprintf(out_fp,"---------------- ---------------- ---------------- " \
988- "---------------- --------------------\n\n");
989-
990- /* Do groups first (if any) */
991- pointer=h_array;
992- while(h_grp)
993- {
994- hptr=*pointer++;
995- if (hptr->flag == OBJ_GRP)
996- {
997- fprintf(out_fp,
998- "%-8llu %6.02f%% %8llu %6.02f%% %8.0f %6.02f%% " \
999- "%8llu %6.02f%% %s\n",
1000- hptr->count,
1001- (t_hit==0)?0:((float)hptr->count/t_hit)*100.0,hptr->files,
1002- (t_file==0)?0:((float)hptr->files/t_file)*100.0,hptr->xfer/1024,
1003- (t_xfer==0)?0:((float)hptr->xfer/t_xfer)*100.0,hptr->visit,
1004- (t_visit==0)?0:((float)hptr->visit/t_visit)*100.0,
1005- hptr->string);
1006- h_grp--;
1007- }
1008- }
1009-
1010- if (i) fprintf(out_fp,"\n");
1011-
1012- /* Now do individual sites (if any) */
1013- pointer=h_array;
1014- if (!hide_sites) while(h_reg)
1015- {
1016- hptr=*pointer++;
1017- if (hptr->flag == OBJ_REG)
1018- {
1019- fprintf(out_fp,
1020- "%-8llu %6.02f%% %8llu %6.02f%% %8.0f %6.02f%% " \
1021- "%8llu %6.02f%% %s\n",
1022- hptr->count,
1023- (t_hit==0)?0:((float)hptr->count/t_hit)*100.0,hptr->files,
1024- (t_file==0)?0:((float)hptr->files/t_file)*100.0,hptr->xfer/1024,
1025- (t_xfer==0)?0:((float)hptr->xfer/t_xfer)*100.0,hptr->visit,
1026- (t_visit==0)?0:((float)hptr->visit/t_visit)*100.0,
1027- hptr->string);
1028- h_reg--;
1029- }
1030- }
1031-
1032- fprintf(out_fp,"</PRE></FONT>\n");
1033- write_html_tail(out_fp);
1034- fclose(out_fp);
1035- return 1;
1036-}
1037-
1038-/*********************************************/
1039-/* TOP_URLS_TABLE - generate top n table */
1040-/*********************************************/
1041-
1042-void top_urls_table(int flag)
1043-{
1044- u_int64_t cnt=0,u_reg=0,u_grp=0,u_hid=0, tot_num;
1045- int i;
1046- UNODEPTR uptr, *pointer;
1047-
1048- cnt=a_ctr; pointer=u_array;
1049- while (cnt--)
1050- {
1051- /* calculate totals */
1052- switch ( (int)((UNODEPTR)(*pointer)->flag) )
1053- {
1054- case OBJ_REG: u_reg++; break;
1055- case OBJ_GRP: u_grp++; break;
1056- case OBJ_HIDE: u_hid++; break;
1057- }
1058- pointer++;
1059- }
1060-
1061- if ( (tot_num=u_reg+u_grp)==0 ) return; /* split if none */
1062- i=(flag)?ntop_urlsK:ntop_urls; /* Hits or KBytes?? */
1063- if (tot_num > i) tot_num = i; /* get max to do... */
1064- if ((!flag) || (flag&&!ntop_urls)) /* now do <A> tag */
1065- fprintf(out_fp,"<A NAME=\"TOPURLS\"></A>\n");
1066-
1067- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
1068- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1069- if (flag) fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=6>" \
1070- "%s %llu %s %llu %s %s %s</TH></TR>\n",
1071- GREY,msg_top_top,tot_num,msg_top_of,
1072- t_url,msg_top_u,msg_h_by,msg_h_xfer);
1073- else fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=6>" \
1074- "%s %llu %s %llu %s</TH></TR>\n",
1075- GREY,msg_top_top,tot_num,msg_top_of,t_url,msg_top_u);
1076- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1077- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>" \
1078- "<FONT SIZE=\"-1\">#</FONT></TH>\n",GREY);
1079- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1080- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",
1081- HITCOLOR,msg_h_hits);
1082- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1083- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",
1084- KBYTECOLOR,msg_h_xfer);
1085- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>" \
1086- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",
1087- MISCCOLOR,msg_h_url);
1088- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1089-
1090- pointer=u_array; i=0;
1091- while (tot_num)
1092- {
1093- uptr=*pointer++; /* point to the URL node */
1094- if (uptr->flag != OBJ_HIDE)
1095- {
1096- /* shade grouping? */
1097- if (shade_groups && (uptr->flag==OBJ_GRP))
1098- fprintf(out_fp,"<TR BGCOLOR=\"%s\">\n", GRPCOLOR);
1099- else fprintf(out_fp,"<TR>\n");
1100-
1101- fprintf(out_fp,
1102- "<TD ALIGN=center><FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n" \
1103- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
1104- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1105- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%.0f</B></FONT></TD>\n"\
1106- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1107- "<TD ALIGN=left NOWRAP><FONT SIZE=\"-1\">",
1108- i+1,uptr->count,
1109- (t_hit==0)?0:((float)uptr->count/t_hit)*100.0,
1110- uptr->xfer/1024,
1111- (t_xfer==0)?0:((float)uptr->xfer/t_xfer)*100.0);
1112-
1113- if (uptr->flag==OBJ_GRP)
1114- {
1115- if (hlite_groups)
1116- fprintf(out_fp,"<STRONG>%s</STRONG></FONT></TD></TR>\n",
1117- uptr->string);
1118- else fprintf(out_fp,"%s</FONT></TD></TR>\n",uptr->string);
1119- }
1120- else
1121- {
1122- /* check for a service prefix (ie: http://) */
1123- if (strstr(uptr->string,"://")!=NULL)
1124- fprintf(out_fp,"<A HREF=\"%s\">%s</A></FONT></TD></TR>\n",
1125- uptr->string,uptr->string);
1126- else
1127- {
1128- if (log_type == LOG_FTP) /* FTP log? */
1129- fprintf(out_fp,"%s</FONT></TD></TR>\n",uptr->string);
1130- else
1131- { /* Web log */
1132- if (use_https)
1133- /* secure server mode, use https:// */
1134- fprintf(out_fp,
1135- "<A HREF=\"https://%s%s\">%s</A></FONT></TD></TR>\n",
1136- hname,uptr->string,uptr->string);
1137- else
1138- /* otherwise use standard 'http://' */
1139- fprintf(out_fp,
1140- "<A HREF=\"http://%s%s\">%s</A></FONT></TD></TR>\n",
1141- hname,uptr->string,uptr->string);
1142- }
1143- }
1144- }
1145- tot_num--;
1146- i++;
1147- }
1148- }
1149- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1150- if ((!flag) || (flag&&!ntop_urls))
1151- {
1152- if ( (all_urls) && ((u_reg+u_grp)>ntop_urls) )
1153- {
1154- if (all_urls_page(u_reg, u_grp))
1155- {
1156- fprintf(out_fp,"<TR BGCOLOR=\"%s\">",GRPCOLOR);
1157- fprintf(out_fp,"<TD COLSPAN=6 ALIGN=\"center\">\n");
1158- fprintf(out_fp,"<FONT SIZE=\"-1\">");
1159- fprintf(out_fp,"<A HREF=\"./url_%04d%02d.%s\">",
1160- cur_year,cur_month,html_ext);
1161- fprintf(out_fp,"%s</A></TD></TR>\n",msg_v_urls);
1162- if (flag) /* do we need to sort first? */
1163- qsort(u_array,a_ctr,sizeof(UNODEPTR),qs_url_cmph);
1164- }
1165- }
1166- }
1167- fprintf(out_fp,"</TABLE>\n<P>\n");
1168-}
1169-
1170-/*********************************************/
1171-/* ALL_URLS_PAGE - HTML page of all urls */
1172-/*********************************************/
1173-
1174-int all_urls_page(u_int64_t u_reg, u_int64_t u_grp)
1175-{
1176- UNODEPTR uptr, *pointer;
1177- char url_fname[256], buffer[256];
1178- FILE *out_fp;
1179- int i=(u_grp)?1:0;
1180-
1181- /* generate file name */
1182- snprintf(url_fname,sizeof(url_fname),"url_%04d%02d.%s",
1183- cur_year,cur_month,html_ext);
1184-
1185- /* open file */
1186- if ( (out_fp=open_out_file(url_fname))==NULL ) return 0;
1187-
1188- snprintf(buffer,sizeof(buffer),"%s %d - %s",
1189- l_month[cur_month-1],cur_year,msg_h_url);
1190- write_html_head(buffer, out_fp);
1191-
1192- fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1193-
1194- fprintf(out_fp," %12s %12s %s\n",
1195- msg_h_hits,msg_h_xfer,msg_h_url);
1196- fprintf(out_fp,"---------------- ---------------- " \
1197- "--------------------\n\n");
1198-
1199- /* do groups first (if any) */
1200- pointer=u_array;
1201- while (u_grp)
1202- {
1203- uptr=*pointer++;
1204- if (uptr->flag == OBJ_GRP)
1205- {
1206- fprintf(out_fp,"%-8llu %6.02f%% %8.0f %6.02f%% %s\n",
1207- uptr->count,
1208- (t_hit==0)?0:((float)uptr->count/t_hit)*100.0,
1209- uptr->xfer/1024,
1210- (t_xfer==0)?0:((float)uptr->xfer/t_xfer)*100.0,
1211- uptr->string);
1212- u_grp--;
1213- }
1214- }
1215-
1216- if (i) fprintf(out_fp,"\n");
1217-
1218- /* now do invididual sites (if any) */
1219- pointer=u_array;
1220- while (u_reg)
1221- {
1222- uptr=*pointer++;
1223- if (uptr->flag == OBJ_REG)
1224- {
1225- fprintf(out_fp,"%-8llu %6.02f%% %8.0f %6.02f%% %s\n",
1226- uptr->count,
1227- (t_hit==0)?0:((float)uptr->count/t_hit)*100.0,
1228- uptr->xfer/1024,
1229- (t_xfer==0)?0:((float)uptr->xfer/t_xfer)*100.0,
1230- uptr->string);
1231- u_reg--;
1232- }
1233- }
1234-
1235- fprintf(out_fp,"</PRE></FONT>\n");
1236- write_html_tail(out_fp);
1237- fclose(out_fp);
1238- return 1;
1239-}
1240-
1241-/*********************************************/
1242-/* TOP_ENTRY_TABLE - top n entry/exit urls */
1243-/*********************************************/
1244-
1245-void top_entry_table(int flag)
1246-{
1247- u_int64_t cnt=0, u_entry=0, u_exit=0, tot_num;
1248- u_int64_t t_entry=0, t_exit=0;
1249- int i;
1250- UNODEPTR uptr, *pointer;
1251-
1252- cnt=a_ctr; pointer=u_array;
1253- while (cnt--)
1254- {
1255- if ( (int)((UNODEPTR)(*pointer)->flag) == OBJ_REG )
1256- {
1257- if ( (u_int64_t)(((UNODEPTR)(*pointer))->entry) )
1258- { u_entry++; t_entry+=(u_int64_t)(((UNODEPTR)(*pointer))->entry); }
1259- if ( (u_int64_t)(((UNODEPTR)(*pointer))->exit) )
1260- { u_exit++; t_exit +=(u_int64_t)(((UNODEPTR)(*pointer))->exit); }
1261- }
1262- pointer++;
1263- }
1264-
1265- /* calculate how many we have */
1266- tot_num=(flag)?u_exit:u_entry;
1267- if (flag) { if (tot_num > ntop_exit ) tot_num=ntop_exit; }
1268- else { if (tot_num > ntop_entry) tot_num=ntop_entry; }
1269-
1270- /* return if none to do */
1271- if (!tot_num) return;
1272-
1273- if (flag) fprintf(out_fp,"<A NAME=\"TOPEXIT\"></A>\n"); /* do anchor tag */
1274- else fprintf(out_fp,"<A NAME=\"TOPENTRY\"></A>\n");
1275-
1276- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
1277- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1278- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=6>" \
1279- "%s %llu %s %llu %s</TH></TR>\n",
1280- GREY,msg_top_top,tot_num,msg_top_of,
1281- (flag)?u_exit:u_entry,(flag)?msg_top_ex:msg_top_en);
1282- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1283- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>" \
1284- "<FONT SIZE=\"-1\">#</FONT></TH>\n",
1285- GREY);
1286- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1287- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",
1288- HITCOLOR,msg_h_hits);
1289- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1290- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",
1291- VISITCOLOR,msg_h_visits);
1292- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>" \
1293- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",
1294- MISCCOLOR,msg_h_url);
1295- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1296-
1297- pointer=u_array; i=0;
1298- while (tot_num)
1299- {
1300- uptr=*pointer++;
1301- if (uptr->flag != OBJ_HIDE)
1302- {
1303- fprintf(out_fp,"<TR>\n");
1304- fprintf(out_fp,
1305- "<TD ALIGN=center><FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n" \
1306- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
1307- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1308- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
1309- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1310- "<TD ALIGN=left NOWRAP><FONT SIZE=\"-1\">",
1311- i+1,uptr->count,
1312- (t_hit==0)?0:((float)uptr->count/t_hit)*100.0,
1313- (flag)?uptr->exit:uptr->entry,
1314- (flag)?((t_exit==0)?0:((float)uptr->exit/t_exit)*100.0)
1315- :((t_entry==0)?0:((float)uptr->entry/t_entry)*100.0));
1316-
1317- /* check for a service prefix (ie: http://) */
1318- if (strstr(uptr->string,"://")!=NULL)
1319- fprintf(out_fp,
1320- "<A HREF=\"%s\">%s</A></FONT></TD></TR>\n",
1321- uptr->string,uptr->string);
1322- else
1323- {
1324- if (use_https)
1325- /* secure server mode, use https:// */
1326- fprintf(out_fp,
1327- "<A HREF=\"https://%s%s\">%s</A></FONT></TD></TR>\n",
1328- hname,uptr->string,uptr->string);
1329- else
1330- /* otherwise use standard 'http://' */
1331- fprintf(out_fp,
1332- "<A HREF=\"http://%s%s\">%s</A></FONT></TD></TR>\n",
1333- hname,uptr->string,uptr->string);
1334- }
1335- tot_num--;
1336- i++;
1337- }
1338- }
1339- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1340- fprintf(out_fp,"</TABLE>\n<P>\n");
1341-}
1342-
1343-/*********************************************/
1344-/* TOP_REFS_TABLE - generate top n table */
1345-/*********************************************/
1346-
1347-void top_refs_table()
1348-{
1349- u_int64_t cnt=0, r_reg=0, r_grp=0, r_hid=0, tot_num;
1350- int i;
1351- RNODEPTR rptr, *pointer;
1352-
1353- if (t_ref==0) return; /* return if none to process */
1354-
1355- cnt=a_ctr; pointer=r_array;
1356- while(cnt--)
1357- {
1358- /* calculate totals */
1359- switch ( (int)((RNODEPTR)(*pointer)->flag) )
1360- {
1361- case OBJ_REG: r_reg++; break;
1362- case OBJ_HIDE: r_hid++; break;
1363- case OBJ_GRP: r_grp++; break;
1364- }
1365- pointer++;
1366- }
1367-
1368- if ( (tot_num=r_reg+r_grp)==0 ) return; /* split if none */
1369- if (tot_num > ntop_refs) tot_num=ntop_refs; /* get max to do... */
1370-
1371- fprintf(out_fp,"<A NAME=\"TOPREFS\"></A>\n");
1372- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
1373- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1374- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=4>" \
1375- "%s %llu %s %llu %s</TH></TR>\n",
1376- GREY, msg_top_top, tot_num, msg_top_of, t_ref, msg_top_r);
1377- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1378- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>" \
1379- "<FONT SIZE=\"-1\">#</FONT></TH>\n",
1380- GREY);
1381- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1382- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",
1383- HITCOLOR,msg_h_hits);
1384- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>" \
1385- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",
1386- MISCCOLOR,msg_h_ref);
1387- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1388-
1389- pointer=r_array; i=0;
1390- while(tot_num)
1391- {
1392- rptr=*pointer++;
1393- if (rptr->flag != OBJ_HIDE)
1394- {
1395- /* shade grouping? */
1396- if (shade_groups && (rptr->flag==OBJ_GRP))
1397- fprintf(out_fp,"<TR BGCOLOR=\"%s\">\n", GRPCOLOR);
1398- else fprintf(out_fp,"<TR>\n");
1399-
1400- fprintf(out_fp,
1401- "<TD ALIGN=center><FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n" \
1402- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
1403- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1404- "<TD ALIGN=left NOWRAP><FONT SIZE=\"-1\">",
1405- i+1,rptr->count,
1406- (t_hit==0)?0:((float)rptr->count/t_hit)*100.0);
1407-
1408- if (rptr->flag==OBJ_GRP)
1409- {
1410- if (hlite_groups)
1411- fprintf(out_fp,"<STRONG>%s</STRONG>",rptr->string);
1412- else fprintf(out_fp,"%s",rptr->string);
1413- }
1414- else
1415- {
1416- /* only link if enabled and has a service prefix */
1417- if ( (strstr(rptr->string,"://")!=NULL) && link_referrer )
1418- fprintf(out_fp,"<A HREF=\"%s\" rel=\"nofollow\">%s</A>",
1419- rptr->string, rptr->string);
1420- else
1421- fprintf(out_fp,"%s", rptr->string);
1422- }
1423- fprintf(out_fp,"</FONT></TD></TR>\n");
1424- tot_num--;
1425- i++;
1426- }
1427- }
1428- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1429- if ( (all_refs) && ((r_reg+r_grp)>ntop_refs) )
1430- {
1431- if (all_refs_page(r_reg, r_grp))
1432- {
1433- fprintf(out_fp,"<TR BGCOLOR=\"%s\">",GRPCOLOR);
1434- fprintf(out_fp,"<TD COLSPAN=4 ALIGN=\"center\">\n");
1435- fprintf(out_fp,"<FONT SIZE=\"-1\">");
1436- fprintf(out_fp,"<A HREF=\"./ref_%04d%02d.%s\">",
1437- cur_year,cur_month,html_ext);
1438- fprintf(out_fp,"%s</A></TD></TR>\n",msg_v_refs);
1439- }
1440- }
1441- fprintf(out_fp,"</TABLE>\n<P>\n");
1442-}
1443-
1444-/*********************************************/
1445-/* ALL_REFS_PAGE - HTML page of all refs */
1446-/*********************************************/
1447-
1448-int all_refs_page(u_int64_t r_reg, u_int64_t r_grp)
1449-{
1450- RNODEPTR rptr, *pointer;
1451- char ref_fname[256], buffer[256];
1452- FILE *out_fp;
1453- int i=(r_grp)?1:0;
1454-
1455- /* generate file name */
1456- snprintf(ref_fname,sizeof(ref_fname),"ref_%04d%02d.%s",
1457- cur_year,cur_month,html_ext);
1458-
1459- /* open file */
1460- if ( (out_fp=open_out_file(ref_fname))==NULL ) return 0;
1461-
1462- snprintf(buffer,sizeof(buffer),"%s %d - %s",
1463- l_month[cur_month-1],cur_year,msg_h_ref);
1464- write_html_head(buffer, out_fp);
1465-
1466- fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1467-
1468- fprintf(out_fp," %12s %s\n",msg_h_hits,msg_h_ref);
1469- fprintf(out_fp,"---------------- --------------------\n\n");
1470-
1471- /* do groups first (if any) */
1472- pointer=r_array;
1473- while(r_grp)
1474- {
1475- rptr=*pointer++;
1476- if (rptr->flag == OBJ_GRP)
1477- {
1478- fprintf(out_fp,"%-8llu %6.02f%% %s\n",
1479- rptr->count,
1480- (t_hit==0)?0:((float)rptr->count/t_hit)*100.0,
1481- rptr->string);
1482- r_grp--;
1483- }
1484- }
1485-
1486- if (i) fprintf(out_fp,"\n");
1487-
1488- pointer=r_array;
1489- while(r_reg)
1490- {
1491- rptr=*pointer++;
1492- if (rptr->flag == OBJ_REG)
1493- {
1494- fprintf(out_fp,"%-8llu %6.02f%% %s\n",
1495- rptr->count,
1496- (t_hit==0)?0:((float)rptr->count/t_hit)*100.0,
1497- rptr->string);
1498- r_reg--;
1499- }
1500- }
1501-
1502- fprintf(out_fp,"</PRE></FONT>\n");
1503- write_html_tail(out_fp);
1504- fclose(out_fp);
1505- return 1;
1506-}
1507-
1508-/*********************************************/
1509-/* TOP_AGENTS_TABLE - generate top n table */
1510-/*********************************************/
1511-
1512-void top_agents_table()
1513-{
1514- u_int64_t cnt, a_reg=0, a_grp=0, a_hid=0, tot_num;
1515- int i;
1516- ANODEPTR aptr, *pointer;
1517-
1518- if (t_agent == 0) return; /* don't bother if we don't have any */
1519-
1520- cnt=a_ctr; pointer=a_array;
1521- while(cnt--)
1522- {
1523- /* calculate totals */
1524- switch ( (int)((ANODEPTR)(*pointer)->flag) )
1525- {
1526- case OBJ_REG: a_reg++; break;
1527- case OBJ_GRP: a_grp++; break;
1528- case OBJ_HIDE: a_hid++; break;
1529- }
1530- pointer++;
1531- }
1532-
1533- if ( (tot_num=a_reg+a_grp)==0 ) return; /* split if none */
1534- if (tot_num > ntop_agents) tot_num=ntop_agents; /* get max to do... */
1535-
1536- fprintf(out_fp,"<A NAME=\"TOPAGENTS\"></A>\n");
1537- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
1538- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1539- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=4>" \
1540- "%s %llu %s %llu %s</TH></TR>\n",
1541- GREY, msg_top_top, tot_num, msg_top_of, t_agent, msg_top_a);
1542- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1543- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>" \
1544- "<FONT SIZE=\"-1\">#</FONT></TH>\n",
1545- GREY);
1546- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1547- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",
1548- HITCOLOR,msg_h_hits);
1549- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>" \
1550- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",
1551- MISCCOLOR,msg_h_agent);
1552- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1553-
1554- pointer=a_array; i=0;
1555- while(tot_num)
1556- {
1557- aptr=*pointer++;
1558- if (aptr->flag != OBJ_HIDE)
1559- {
1560- /* shade grouping? */
1561- if (shade_groups && (aptr->flag==OBJ_GRP))
1562- fprintf(out_fp,"<TR BGCOLOR=\"%s\">\n", GRPCOLOR);
1563- else fprintf(out_fp,"<TR>\n");
1564-
1565- fprintf(out_fp,
1566- "<TD ALIGN=center><FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n" \
1567- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
1568- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1569- "<TD ALIGN=left NOWRAP><FONT SIZE=\"-1\">",
1570- i+1,aptr->count,
1571- (t_hit==0)?0:((float)aptr->count/t_hit)*100.0);
1572-
1573- if ((aptr->flag==OBJ_GRP)&&hlite_groups)
1574- fprintf(out_fp,"<STRONG>%s</STRONG></FONT></TD></TR>\n",
1575- aptr->string);
1576- else fprintf(out_fp,"%s</FONT></TD></TR>\n",
1577- aptr->string);
1578- tot_num--;
1579- i++;
1580- }
1581- }
1582- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1583- if ( (all_agents) && ((a_reg+a_grp)>ntop_agents) )
1584- {
1585- if (all_agents_page(a_reg, a_grp))
1586- {
1587- fprintf(out_fp,"<TR BGCOLOR=\"%s\">",GRPCOLOR);
1588- fprintf(out_fp,"<TD COLSPAN=4 ALIGN=\"center\">\n");
1589- fprintf(out_fp,"<FONT SIZE=\"-1\">");
1590- fprintf(out_fp,"<A HREF=\"./agent_%04d%02d.%s\">",
1591- cur_year,cur_month,html_ext);
1592- fprintf(out_fp,"%s</A></TD></TR>\n",msg_v_agents);
1593- }
1594- }
1595- fprintf(out_fp,"</TABLE>\n<P>\n");
1596-}
1597-
1598-/*********************************************/
1599-/* ALL_AGENTS_PAGE - HTML user agent page */
1600-/*********************************************/
1601-
1602-int all_agents_page(u_int64_t a_reg, u_int64_t a_grp)
1603-{
1604- ANODEPTR aptr, *pointer;
1605- char agent_fname[256], buffer[256];
1606- FILE *out_fp;
1607- int i=(a_grp)?1:0;
1608-
1609- /* generate file name */
1610- snprintf(agent_fname,sizeof(agent_fname),"agent_%04d%02d.%s",
1611- cur_year,cur_month,html_ext);
1612-
1613- /* open file */
1614- if ( (out_fp=open_out_file(agent_fname))==NULL ) return 0;
1615-
1616- snprintf(buffer,sizeof(buffer),"%s %d - %s",
1617- l_month[cur_month-1],cur_year,msg_h_agent);
1618- write_html_head(buffer, out_fp);
1619-
1620- fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1621-
1622- fprintf(out_fp," %12s %s\n",msg_h_hits,msg_h_agent);
1623- fprintf(out_fp,"---------------- ----------------------\n\n");
1624-
1625- /* do groups first (if any) */
1626- pointer=a_array;
1627- while(a_grp)
1628- {
1629- aptr=*pointer++;
1630- if (aptr->flag == OBJ_GRP)
1631- {
1632- fprintf(out_fp,"%-8llu %6.02f%% %s\n",
1633- aptr->count,
1634- (t_hit==0)?0:((float)aptr->count/t_hit)*100.0,
1635- aptr->string);
1636- a_grp--;
1637- }
1638- }
1639-
1640- if (i) fprintf(out_fp,"\n");
1641-
1642- pointer=a_array;
1643- while(a_reg)
1644- {
1645- aptr=*pointer++;
1646- if (aptr->flag == OBJ_REG)
1647- {
1648- fprintf(out_fp,"%-8llu %6.02f%% %s\n",
1649- aptr->count,
1650- (t_hit==0)?0:((float)aptr->count/t_hit)*100.0,
1651- aptr->string);
1652- a_reg--;
1653- }
1654- }
1655-
1656- fprintf(out_fp,"</PRE></FONT>\n");
1657- write_html_tail(out_fp);
1658- fclose(out_fp);
1659- return 1;
1660-}
1661-
1662-/*********************************************/
1663-/* TOP_SEARCH_TABLE - generate top n table */
1664-/*********************************************/
1665-
1666-void top_search_table()
1667-{
1668- u_int64_t cnt,t_val=0, tot_num;
1669- int i;
1670- SNODEPTR sptr, *pointer;
1671-
1672- if (a_ctr==0) return; /* don't bother if none to do */
1673-
1674- cnt=tot_num=a_ctr; pointer=s_array;
1675- while(cnt--)
1676- {
1677- t_val+=(u_int64_t)(((SNODEPTR)(*pointer))->count);
1678- pointer++;
1679- }
1680-
1681- if ( tot_num > ntop_search) tot_num=ntop_search;
1682-
1683- fprintf(out_fp,"<A NAME=\"TOPSEARCH\"></A>\n");
1684- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
1685- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1686- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=4>" \
1687- "%s %llu %s %llu %s</TH></TR>\n",
1688- GREY, msg_top_top, tot_num, msg_top_of, a_ctr, msg_top_sr);
1689- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1690- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>" \
1691- "<FONT SIZE=\"-1\">#</FONT></TH>\n",
1692- GREY);
1693- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1694- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",
1695- HITCOLOR,msg_h_hits);
1696- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>" \
1697- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",
1698- MISCCOLOR,msg_h_search);
1699- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1700-
1701- pointer=s_array; i=0;
1702- while(tot_num)
1703- {
1704- sptr=*pointer++;
1705- fprintf(out_fp,
1706- "<TR>\n" \
1707- "<TD ALIGN=center><FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n" \
1708- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
1709- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1710- "<TD ALIGN=left NOWRAP><FONT SIZE=\"-1\">",
1711- i+1,sptr->count,
1712- (t_val==0)?0:((float)sptr->count/t_val)*100.0);
1713- fprintf(out_fp,"%s</FONT></TD></TR>\n",sptr->string);
1714- tot_num--;
1715- i++;
1716- }
1717- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1718- if ( (all_search) && (a_ctr>ntop_search) )
1719- {
1720- if (all_search_page(a_ctr, t_val))
1721- {
1722- fprintf(out_fp,"<TR BGCOLOR=\"%s\">",GRPCOLOR);
1723- fprintf(out_fp,"<TD COLSPAN=4 ALIGN=\"center\">\n");
1724- fprintf(out_fp,"<FONT SIZE=\"-1\">");
1725- fprintf(out_fp,"<A HREF=\"./search_%04d%02d.%s\">",
1726- cur_year,cur_month,html_ext);
1727- fprintf(out_fp,"%s</A></TD></TR>\n",msg_v_search);
1728- }
1729- }
1730- fprintf(out_fp,"</TABLE>\n<P>\n");
1731-}
1732-
1733-/*********************************************/
1734-/* ALL_SEARCH_PAGE - HTML for search strings */
1735-/*********************************************/
1736-
1737-int all_search_page(u_int64_t tot_num, u_int64_t t_val)
1738-{
1739- SNODEPTR sptr, *pointer;
1740- char search_fname[256], buffer[256];
1741- FILE *out_fp;
1742-
1743- if (!tot_num) return 0;
1744-
1745- /* generate file name */
1746- snprintf(search_fname,sizeof(search_fname),"search_%04d%02d.%s",
1747- cur_year,cur_month,html_ext);
1748-
1749- /* open file */
1750- if ( (out_fp=open_out_file(search_fname))==NULL ) return 0;
1751-
1752- snprintf(buffer,sizeof(buffer),"%s %d - %s",
1753- l_month[cur_month-1],cur_year,msg_h_search);
1754- write_html_head(buffer, out_fp);
1755-
1756- fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1757-
1758- fprintf(out_fp," %12s %s\n",msg_h_hits,msg_h_search);
1759- fprintf(out_fp,"---------------- ----------------------\n\n");
1760-
1761- pointer=s_array;
1762- while(tot_num)
1763- {
1764- sptr=*pointer++;
1765- fprintf(out_fp,"%-8llu %6.02f%% %s\n",
1766- sptr->count,
1767- (t_val==0)?0:((float)sptr->count/t_val)*100.0,
1768- sptr->string);
1769- tot_num--;
1770- }
1771- fprintf(out_fp,"</PRE></FONT>\n");
1772- write_html_tail(out_fp);
1773- fclose(out_fp);
1774- return 1;
1775-}
1776-
1777-/*********************************************/
1778-/* TOP_USERS_TABLE - generate top n table */
1779-/*********************************************/
1780-
1781-void top_users_table()
1782-{
1783- u_int64_t cnt=0, i_reg=0, i_grp=0, i_hid=0, tot_num;
1784- int i;
1785- INODEPTR iptr, *pointer;
1786-
1787- cnt=a_ctr; pointer=i_array;
1788- while(cnt--)
1789- {
1790- /* calculate totals */
1791- switch ( (int)((INODEPTR)(*pointer)->flag) )
1792- {
1793- case OBJ_REG: i_reg++; break;
1794- case OBJ_GRP: i_grp++; break;
1795- case OBJ_HIDE: i_hid++; break;
1796- }
1797- pointer++;
1798- }
1799-
1800- if ( (tot_num=i_reg+i_grp)==0 ) return; /* split if none */
1801- if (tot_num > ntop_users) tot_num = ntop_users;
1802-
1803- fprintf(out_fp,"<A NAME=\"TOPUSERS\"></A>\n"); /* now do <A> tag */
1804-
1805- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
1806- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1807- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=10>" \
1808- "%s %llu %s %llu %s</TH></TR>\n",
1809- GREY,msg_top_top, tot_num, msg_top_of, t_user, msg_top_i);
1810- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1811- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>" \
1812- "<FONT SIZE=\"-1\">#</FONT></TH>\n",GREY);
1813- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1814- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",HITCOLOR,msg_h_hits);
1815- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1816- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",FILECOLOR,msg_h_files);
1817- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1818- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",KBYTECOLOR,msg_h_xfer);
1819- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
1820- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",VISITCOLOR,msg_h_visits);
1821- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>" \
1822- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",MISCCOLOR,msg_h_uname);
1823- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1824-
1825- pointer=i_array; i=0;
1826- while(tot_num)
1827- {
1828- iptr=*pointer++;
1829- if (iptr->flag != OBJ_HIDE)
1830- {
1831- /* shade grouping? */
1832- if (shade_groups && (iptr->flag==OBJ_GRP))
1833- fprintf(out_fp,"<TR BGCOLOR=\"%s\">\n", GRPCOLOR);
1834- else fprintf(out_fp,"<TR>\n");
1835-
1836- fprintf(out_fp,
1837- "<TD ALIGN=center><FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n" \
1838- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
1839- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1840- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
1841- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1842- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%.0f</B></FONT></TD>\n" \
1843- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1844- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n" \
1845- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
1846- "<TD ALIGN=left NOWRAP><FONT SIZE=\"-1\">",
1847- i+1,iptr->count,
1848- (t_hit==0)?0:((float)iptr->count/t_hit)*100.0,iptr->files,
1849- (t_file==0)?0:((float)iptr->files/t_file)*100.0,iptr->xfer/1024,
1850- (t_xfer==0)?0:((float)iptr->xfer/t_xfer)*100.0,iptr->visit,
1851- (t_visit==0)?0:((float)iptr->visit/t_visit)*100.0);
1852-
1853- if ((iptr->flag==OBJ_GRP)&&hlite_groups)
1854- fprintf(out_fp,"<STRONG>%s</STRONG></FONT></TD></TR>\n",
1855- iptr->string);
1856- else fprintf(out_fp,"%s</FONT></TD></TR>\n",
1857- iptr->string);
1858- tot_num--;
1859- i++;
1860- }
1861- }
1862-
1863- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
1864- if ( (all_users) && ((i_reg+i_grp)>ntop_users) )
1865- {
1866- if (all_users_page(i_reg, i_grp))
1867- {
1868- fprintf(out_fp,"<TR BGCOLOR=\"%s\">",GRPCOLOR);
1869- fprintf(out_fp,"<TD COLSPAN=10 ALIGN=\"center\">\n");
1870- fprintf(out_fp,"<FONT SIZE=\"-1\">");
1871- fprintf(out_fp,"<A HREF=\"./user_%04d%02d.%s\">",
1872- cur_year,cur_month,html_ext);
1873- fprintf(out_fp,"%s</A></TD></TR>\n",msg_v_users);
1874- }
1875- }
1876- fprintf(out_fp,"</TABLE>\n<P>\n");
1877-}
1878-
1879-/*********************************************/
1880-/* ALL_USERS_PAGE - HTML of all usernames */
1881-/*********************************************/
1882-
1883-int all_users_page(u_int64_t i_reg, u_int64_t i_grp)
1884-{
1885- INODEPTR iptr, *pointer;
1886- char user_fname[256], buffer[256];
1887- FILE *out_fp;
1888- int i=(i_grp)?1:0;
1889-
1890- /* generate file name */
1891- snprintf(user_fname,sizeof(user_fname),"user_%04d%02d.%s",
1892- cur_year,cur_month,html_ext);
1893-
1894- /* open file */
1895- if ( (out_fp=open_out_file(user_fname))==NULL ) return 0;
1896-
1897- snprintf(buffer,sizeof(buffer),"%s %d - %s",
1898- l_month[cur_month-1],cur_year,msg_h_uname);
1899- write_html_head(buffer, out_fp);
1900-
1901- fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
1902-
1903- fprintf(out_fp," %12s %12s %12s %12s %s\n",
1904- msg_h_hits, msg_h_files, msg_h_xfer, msg_h_visits, msg_h_uname);
1905- fprintf(out_fp,"---------------- ---------------- ---------------- " \
1906- "---------------- --------------------\n\n");
1907-
1908- /* Do groups first (if any) */
1909- pointer=i_array;
1910- while(i_grp)
1911- {
1912- iptr=*pointer++;
1913- if (iptr->flag == OBJ_GRP)
1914- {
1915- fprintf(out_fp,
1916- "%-8llu %6.02f%% %8llu %6.02f%% %8.0f %6.02f%% %8llu %6.02f%% %s\n",
1917- iptr->count,
1918- (t_hit==0)?0:((float)iptr->count/t_hit)*100.0,iptr->files,
1919- (t_file==0)?0:((float)iptr->files/t_file)*100.0,iptr->xfer/1024,
1920- (t_xfer==0)?0:((float)iptr->xfer/t_xfer)*100.0,iptr->visit,
1921- (t_visit==0)?0:((float)iptr->visit/t_visit)*100.0,
1922- iptr->string);
1923- i_grp--;
1924- }
1925- }
1926-
1927- if (i) fprintf(out_fp,"\n");
1928-
1929- /* Now do individual users (if any) */
1930- pointer=i_array;
1931- while(i_reg)
1932- {
1933- iptr=*pointer++;
1934- if (iptr->flag == OBJ_REG)
1935- {
1936- fprintf(out_fp,
1937- "%-8llu %6.02f%% %8llu %6.02f%% %8.0f %6.02f%% %8llu %6.02f%% %s\n",
1938- iptr->count,
1939- (t_hit==0)?0:((float)iptr->count/t_hit)*100.0,iptr->files,
1940- (t_file==0)?0:((float)iptr->files/t_file)*100.0,iptr->xfer/1024,
1941- (t_xfer==0)?0:((float)iptr->xfer/t_xfer)*100.0,iptr->visit,
1942- (t_visit==0)?0:((float)iptr->visit/t_visit)*100.0,
1943- iptr->string);
1944- i_reg--;
1945- }
1946- }
1947-
1948- fprintf(out_fp,"</PRE></FONT>\n");
1949- write_html_tail(out_fp);
1950- fclose(out_fp);
1951- return 1;
1952-}
1953-
1954-/*********************************************/
1955-/* TOP_CTRY_TABLE - top countries table */
1956-/*********************************************/
1957-
1958-void top_ctry_table()
1959-{
1960- int i,j,x,tot_num=0,tot_ctry=0;
1961- int ctry_fnd=0;
1962- u_int64_t idx;
1963- HNODEPTR hptr;
1964- char *domain;
1965- u_int64_t pie_data[10];
1966- char *pie_legend[10];
1967- char pie_title[48];
1968- char pie_fname[48];
1969- char flag_buf[256];
1970-
1971- extern int ctry_graph; /* include external flag */
1972-
1973-#ifdef USE_GEOIP
1974- extern int geoip;
1975- extern GeoIP *geo_fp;
1976- const char *geo_rc=NULL;
1977-#endif
1978- char geo_ctry[3]="--";
1979-
1980- /* scan hash table adding up domain totals */
1981- for (i=0;i<MAXHASH;i++)
1982- {
1983- hptr=sm_htab[i];
1984- while (hptr!=NULL)
1985- {
1986- if (hptr->flag != OBJ_GRP) /* ignore group totals */
1987- {
1988- if (isipaddr(hptr->string)>0)
1989- {
1990- idx=0; /* unresolved/unknown */
1991-#ifdef USE_DNS
1992- if (geodb)
1993- {
1994- /* Lookup IP address here, turn into idx */
1995- geodb_get_cc(geo_db, hptr->string, geo_ctry);
1996- if (geo_ctry[0]=='-')
1997- {
1998- if (debug_mode)
1999- fprintf(stderr,"GeoDB: %s unknown!\n",hptr->string);
2000- }
2001- else idx=ctry_idx(geo_ctry);
2002- }
2003-#endif
2004-#ifdef USE_GEOIP
2005- if (geoip)
2006- {
2007- /* Lookup IP address here, turn into idx */
2008- geo_rc=GeoIP_country_code_by_addr(geo_fp, hptr->string);
2009- if (geo_rc==NULL||geo_rc[0]=='\0'||geo_rc[0]=='-')
2010- {
2011- if (debug_mode)
2012- fprintf(stderr,"GeoIP: %s unknown (returns '%s')\n",
2013- hptr->string,(geo_rc==NULL)?"null":geo_rc);
2014- }
2015- else
2016- {
2017- /* index returned geo_ctry */
2018- geo_ctry[0]=tolower(geo_rc[0]);
2019- geo_ctry[1]=tolower(geo_rc[1]);
2020- idx=ctry_idx(geo_ctry);
2021- }
2022- }
2023-#endif /* USE_GEOIP */
2024- }
2025- else
2026- {
2027- /* resolved hostname.. try to get TLD */
2028- domain = hptr->string+strlen(hptr->string)-1;
2029- while ( (*domain!='.')&&(domain!=hptr->string)) domain--;
2030- if (domain++==hptr->string) idx=0;
2031- else idx=ctry_idx(domain);
2032- }
2033- if (idx!=0)
2034- {
2035- ctry_fnd=0;
2036- for (j=0;ctry[j].desc;j++)
2037- {
2038- if (idx==ctry[j].idx)
2039- {
2040- ctry[j].count+=hptr->count;
2041- ctry[j].files+=hptr->files;
2042- ctry[j].xfer +=hptr->xfer;
2043- ctry_fnd=1;
2044- break;
2045- }
2046- }
2047- }
2048- if (!ctry_fnd || idx==0)
2049- {
2050- ctry[0].count+=hptr->count;
2051- ctry[0].files+=hptr->files;
2052- ctry[0].xfer +=hptr->xfer;
2053- }
2054- }
2055- hptr=hptr->next;
2056- }
2057- }
2058-
2059- for (i=0;ctry[i].desc;i++)
2060- {
2061- if (ctry[i].count!=0) tot_ctry++;
2062- for (j=0;j<ntop_ctrys;j++)
2063- {
2064- if (top_ctrys[j]==NULL) { top_ctrys[j]=&ctry[i]; break; }
2065- else
2066- {
2067- if (ctry[i].count > top_ctrys[j]->count)
2068- {
2069- for (x=ntop_ctrys-1;x>j;x--)
2070- top_ctrys[x]=top_ctrys[x-1];
2071- top_ctrys[x]=&ctry[i];
2072- break;
2073- }
2074- }
2075- }
2076- }
2077-
2078- /* put our anchor tag first... */
2079- fprintf(out_fp,"<A NAME=\"TOPCTRYS\"></A>\n");
2080-
2081- /* generate pie chart if needed */
2082- if (ctry_graph)
2083- {
2084- for (i=0;i<10;i++) pie_data[i]=0; /* init data array */
2085- if (ntop_ctrys<10) j=ntop_ctrys; else j=10; /* ensure data size */
2086-
2087- for (i=0;i<j;i++)
2088- {
2089- pie_data[i]=top_ctrys[i]->count; /* load the array */
2090- pie_legend[i]=top_ctrys[i]->desc;
2091- }
2092- snprintf(pie_title,sizeof(pie_title),"%s %s %d",
2093- msg_ctry_use,l_month[cur_month-1],cur_year);
2094- sprintf(pie_fname,"ctry_usage_%04d%02d.png",cur_year,cur_month);
2095-
2096- pie_chart(pie_fname,pie_title,t_hit,pie_data,pie_legend); /* do it */
2097-
2098- /* put the image tag in the page */
2099- fprintf(out_fp,"<IMG SRC=\"%s\" ALT=\"%s\" " \
2100- "HEIGHT=300 WIDTH=512><P>\n",pie_fname,pie_title);
2101- }
2102-
2103- /* Now do the table */
2104-
2105- for (i=0;i<ntop_ctrys;i++) if (top_ctrys[i]->count!=0) tot_num++;
2106- fprintf(out_fp,"<TABLE WIDTH=510 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
2107- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
2108- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=CENTER COLSPAN=8>" \
2109- "%s %d %s %d %s</TH></TR>\n",
2110- GREY,msg_top_top,tot_num,msg_top_of,tot_ctry,msg_top_c);
2111- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
2112- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" ALIGN=center>" \
2113- "<FONT SIZE=\"-1\">#</FONT></TH>\n",GREY);
2114- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
2115- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",HITCOLOR,msg_h_hits);
2116- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
2117- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",FILECOLOR,msg_h_files);
2118- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \
2119- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",KBYTECOLOR,msg_h_xfer);
2120- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>" \
2121- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",MISCCOLOR,msg_h_ctry);
2122- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
2123- for (i=0;i<ntop_ctrys;i++)
2124- {
2125- flag_buf[0]=0;
2126- if (use_flags)
2127- {
2128- domain=un_idx((idx=top_ctrys[i]->idx));
2129- if (strlen(domain)<3 && idx!=0) /* only to ccTLDs */
2130- {
2131- if ( domain[0]!='a'||domain[1]!='p' ) /* all but 'ap' */
2132- snprintf(flag_buf,sizeof(flag_buf),
2133- "<IMG SRC=\"%s/%s.png\" ALT=\"%s\" WIDTH=18 HEIGHT=12> ",
2134- flag_dir,domain,top_ctrys[i]->desc);
2135- }
2136- }
2137-
2138- if (top_ctrys[i]->count!=0)
2139- fprintf(out_fp,"<TR>" \
2140- "<TD ALIGN=center><FONT SIZE=\"-1\"><B>%d</B></FONT></TD>\n" \
2141- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
2142- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
2143- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%llu</B></FONT></TD>\n"\
2144- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
2145- "<TD ALIGN=right><FONT SIZE=\"-1\"><B>%.0f</B></FONT></TD>\n"\
2146- "<TD ALIGN=right><FONT SIZE=\"-2\">%3.02f%%</FONT></TD>\n" \
2147- "<TD ALIGN=left NOWRAP>%s<FONT SIZE=\"-1\">%s</FONT>" \
2148- "</TD></TR>\n",
2149- i+1,top_ctrys[i]->count,
2150- (t_hit==0)?0:((float)top_ctrys[i]->count/t_hit)*100.0,
2151- top_ctrys[i]->files,
2152- (t_file==0)?0:((float)top_ctrys[i]->files/t_file)*100.0,
2153- top_ctrys[i]->xfer/1024,
2154- (t_xfer==0)?0:((float)top_ctrys[i]->xfer/t_xfer)*100.0,
2155- flag_buf,top_ctrys[i]->desc);
2156- }
2157- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
2158- fprintf(out_fp,"</TABLE>\n<P>\n");
2159-}
2160-
2161-/*********************************************/
2162-/* DUMP_ALL_SITES - dump sites to tab file */
2163-/*********************************************/
2164-
2165-void dump_all_sites()
2166-{
2167- HNODEPTR hptr, *pointer;
2168- FILE *out_fp;
2169- char filename[256];
2170- u_int64_t cnt=a_ctr;
2171-
2172- /* generate file name */
2173- snprintf(filename,sizeof(filename),"%s/site_%04d%02d.%s",
2174- (dump_path)?dump_path:".",cur_year,cur_month,dump_ext);
2175-
2176- /* open file */
2177- if ( (out_fp=open_out_file(filename))==NULL ) return;
2178-
2179- /* need a header? */
2180- if (dump_header)
2181- {
2182- fprintf(out_fp,"%s\t%s\t%s\t%s\t%s\n",
2183- msg_h_hits,msg_h_files,msg_h_xfer,msg_h_visits,msg_h_hname);
2184- }
2185-
2186- /* dump 'em */
2187- pointer=h_array;
2188- while (cnt)
2189- {
2190- hptr=*pointer++;
2191- if (hptr->flag != OBJ_GRP)
2192- {
2193- fprintf(out_fp,
2194- "%llu\t%llu\t%.0f\t%llu\t%s\n",
2195- hptr->count,hptr->files,hptr->xfer/1024,
2196- hptr->visit,hptr->string);
2197- }
2198- cnt--;
2199- }
2200- fclose(out_fp);
2201- return;
2202-}
2203-
2204-/*********************************************/
2205-/* DUMP_ALL_URLS - dump all urls to tab file */
2206-/*********************************************/
2207-
2208-void dump_all_urls()
2209-{
2210- UNODEPTR uptr, *pointer;
2211- FILE *out_fp;
2212- char filename[256];
2213- u_int64_t cnt=a_ctr;
2214-
2215- /* generate file name */
2216- snprintf(filename,sizeof(filename),"%s/url_%04d%02d.%s",
2217- (dump_path)?dump_path:".",cur_year,cur_month,dump_ext);
2218-
2219- /* open file */
2220- if ( (out_fp=open_out_file(filename))==NULL ) return;
2221-
2222- /* need a header? */
2223- if (dump_header)
2224- {
2225- fprintf(out_fp,"%s\t%s\t%s\n",msg_h_hits,msg_h_xfer,msg_h_url);
2226- }
2227-
2228- /* dump 'em */
2229- pointer=u_array;
2230- while (cnt)
2231- {
2232- uptr=*pointer++;
2233- if (uptr->flag != OBJ_GRP)
2234- {
2235- fprintf(out_fp,"%llu\t%.0f\t%s\n",
2236- uptr->count,uptr->xfer/1024,uptr->string);
2237- }
2238- cnt--;
2239- }
2240- fclose(out_fp);
2241- return;
2242-}
2243-
2244-/*********************************************/
2245-/* DUMP_ALL_REFS - dump all refs to tab file */
2246-/*********************************************/
2247-
2248-void dump_all_refs()
2249-{
2250- RNODEPTR rptr, *pointer;
2251- FILE *out_fp;
2252- char filename[256];
2253- u_int64_t cnt=a_ctr;
2254-
2255- /* generate file name */
2256- snprintf(filename,sizeof(filename),"%s/ref_%04d%02d.%s",
2257- (dump_path)?dump_path:".",cur_year,cur_month,dump_ext);
2258-
2259- /* open file */
2260- if ( (out_fp=open_out_file(filename))==NULL ) return;
2261-
2262- /* need a header? */
2263- if (dump_header)
2264- {
2265- fprintf(out_fp,"%s\t%s\n",msg_h_hits,msg_h_ref);
2266- }
2267-
2268- /* dump 'em */
2269- pointer=r_array;
2270- while(cnt)
2271- {
2272- rptr=*pointer++;
2273- if (rptr->flag != OBJ_GRP)
2274- {
2275- fprintf(out_fp,"%llu\t%s\n",rptr->count, rptr->string);
2276- }
2277- cnt--;
2278- }
2279- fclose(out_fp);
2280- return;
2281-}
2282-
2283-/*********************************************/
2284-/* DUMP_ALL_AGENTS - dump agents htab file */
2285-/*********************************************/
2286-
2287-void dump_all_agents()
2288-{
2289- ANODEPTR aptr, *pointer;
2290- FILE *out_fp;
2291- char filename[256];
2292- u_int64_t cnt=a_ctr;
2293-
2294- /* generate file name */
2295- snprintf(filename,sizeof(filename),"%s/agent_%04d%02d.%s",
2296- (dump_path)?dump_path:".",cur_year,cur_month,dump_ext);
2297-
2298- /* open file */
2299- if ( (out_fp=open_out_file(filename))==NULL ) return;
2300-
2301- /* need a header? */
2302- if (dump_header)
2303- {
2304- fprintf(out_fp,"%s\t%s\n",msg_h_hits,msg_h_agent);
2305- }
2306-
2307- /* dump 'em */
2308- pointer=a_array;
2309- while(cnt)
2310- {
2311- aptr=*pointer++;
2312- if (aptr->flag != OBJ_GRP)
2313- {
2314- fprintf(out_fp,"%llu\t%s\n",aptr->count,aptr->string);
2315- }
2316- cnt--;
2317- }
2318- fclose(out_fp);
2319- return;
2320-}
2321-
2322-/*********************************************/
2323-/* DUMP_ALL_USERS - dump username tab file */
2324-/*********************************************/
2325-
2326-void dump_all_users()
2327-{
2328- INODEPTR iptr, *pointer;
2329- FILE *out_fp;
2330- char filename[256];
2331- u_int64_t cnt=a_ctr;
2332-
2333- /* generate file name */
2334- snprintf(filename,sizeof(filename),"%s/user_%04d%02d.%s",
2335- (dump_path)?dump_path:".",cur_year,cur_month,dump_ext);
2336-
2337- /* open file */
2338- if ( (out_fp=open_out_file(filename))==NULL ) return;
2339-
2340- /* need a header? */
2341- if (dump_header)
2342- {
2343- fprintf(out_fp,"%s\t%s\t%s\t%s\t%s\n",
2344- msg_h_hits,msg_h_files,msg_h_xfer,msg_h_visits,msg_h_uname);
2345- }
2346-
2347- /* dump 'em */
2348- pointer=i_array;
2349- while(cnt)
2350- {
2351- iptr=*pointer++;
2352- if (iptr->flag != OBJ_GRP)
2353- {
2354- fprintf(out_fp,
2355- "%llu\t%llu\t%.0f\t%llu\t%s\n",
2356- iptr->count,iptr->files,iptr->xfer/1024,
2357- iptr->visit,iptr->string);
2358- }
2359- cnt--;
2360- }
2361- fclose(out_fp);
2362- return;
2363-}
2364-
2365-/*********************************************/
2366-/* DUMP_ALL_SEARCH - dump search htab file */
2367-/*********************************************/
2368-
2369-void dump_all_search()
2370-{
2371- SNODEPTR sptr, *pointer;
2372- FILE *out_fp;
2373- char filename[256];
2374- u_int64_t cnt=a_ctr;
2375-
2376- /* generate file name */
2377- snprintf(filename,sizeof(filename),"%s/search_%04d%02d.%s",
2378- (dump_path)?dump_path:".",cur_year,cur_month,dump_ext);
2379-
2380- /* open file */
2381- if ( (out_fp=open_out_file(filename))==NULL ) return;
2382-
2383- /* need a header? */
2384- if (dump_header)
2385- {
2386- fprintf(out_fp,"%s\t%s\n",msg_h_hits,msg_h_search);
2387- }
2388-
2389- /* dump 'em */
2390- pointer=s_array;
2391- while(cnt)
2392- {
2393- sptr=*pointer++;
2394- fprintf(out_fp,"%llu\t%s\n",sptr->count,sptr->string);
2395- cnt--;
2396- }
2397- fclose(out_fp);
2398- return;
2399-}
2400-
2401-/*********************************************/
2402-/* WRITE_MAIN_INDEX - main index.html file */
2403-/*********************************************/
2404-
2405-int write_main_index()
2406-{
2407- /* create main index file */
2408-
2409- int i,j,days_in_month;
2410- int s_year=hist[HISTSIZE-1].year;
2411- char index_fname[256];
2412- char buffer[BUFSIZE];
2413- u_int64_t m_hit=0;
2414- u_int64_t m_files=0;
2415- u_int64_t m_pages=0;
2416- u_int64_t m_visits=0;
2417- double m_xfer=0.0;
2418- double gt_hit=0.0;
2419- double gt_files=0.0;
2420- double gt_pages=0.0;
2421- double gt_xfer=0.0;
2422- double gt_visits=0.0;
2423-
2424- if (verbose>1) printf("%s\n",msg_gen_sum);
2425-
2426- snprintf(buffer,sizeof(buffer),"%s %s",msg_main_us,hname);
2427- year_graph6x("usage.png", buffer, hist);
2428-
2429- /* now do html stuff... */
2430- snprintf(index_fname,sizeof(index_fname),"index.%s",html_ext);
2431-
2432- /* .htaccess file needed? */
2433- if (htaccess)
2434- {
2435- if ((out_fp=fopen(".htaccess","wx")) != NULL)
2436- {
2437- fprintf(out_fp,"DirectoryIndex %s\n",index_fname);
2438- fclose(out_fp);
2439- }
2440- else
2441- {
2442- if (errno!=EEXIST && verbose)
2443- fprintf(stderr,"Error: Failed to create .htaccess file: %s\n",
2444- strerror(errno));
2445- }
2446- }
2447-
2448- if ( (out_fp=open_out_file(index_fname)) == NULL)
2449- {
2450- if (verbose)
2451- fprintf(stderr,"%s %s!\n",msg_no_open,index_fname);
2452- return 1;
2453- }
2454- write_html_head(NULL, out_fp);
2455-
2456- /* year graph */
2457- fprintf(out_fp,"<IMG SRC=\"usage.png\" ALT=\"%s\" " \
2458- "HEIGHT=256 WIDTH=512><P>\n",buffer);
2459- /* month table */
2460- fprintf(out_fp,"<TABLE WIDTH=600 BORDER=2 CELLSPACING=1 CELLPADDING=1>\n");
2461- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
2462- fprintf(out_fp,"<TR><TH COLSPAN=11 BGCOLOR=\"%s\" ALIGN=center>",GREY);
2463- fprintf(out_fp,"%s</TH></TR>\n",msg_main_sum);
2464- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
2465- fprintf(out_fp,"<TR><TH ALIGN=left ROWSPAN=2 BGCOLOR=\"%s\">" \
2466- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",GREY,msg_h_mth);
2467- fprintf(out_fp,"<TH ALIGN=center COLSPAN=4 BGCOLOR=\"%s\">" \
2468- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",GREY,msg_main_da);
2469- fprintf(out_fp,"<TH ALIGN=center COLSPAN=6 BGCOLOR=\"%s\">" \
2470- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",GREY,msg_main_mt);
2471- fprintf(out_fp,"<TR><TH ALIGN=center BGCOLOR=\"%s\">" \
2472- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",HITCOLOR,msg_h_hits);
2473- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
2474- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",FILECOLOR,msg_h_files);
2475- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
2476- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",PAGECOLOR,msg_h_pages);
2477- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
2478- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",VISITCOLOR,msg_h_visits);
2479- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
2480- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",SITECOLOR,msg_h_sites);
2481- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
2482- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",KBYTECOLOR,msg_h_xfer);
2483- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
2484- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",VISITCOLOR,msg_h_visits);
2485- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
2486- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",PAGECOLOR,msg_h_pages);
2487- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
2488- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",FILECOLOR,msg_h_files);
2489- fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \
2490- "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",HITCOLOR,msg_h_hits);
2491- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
2492- for (i=HISTSIZE-1;i>=HISTSIZE-index_mths;i--)
2493- {
2494- if (hist[i].hit==0)
2495- {
2496- days_in_month=1;
2497- for (j=i;j>=0;j--) if (hist[j].hit!=0) break;
2498- if (j<0) break;
2499- }
2500- else days_in_month=(hist[i].lday-hist[i].fday)+1;
2501-
2502- /* Check for year change */
2503- if (s_year!=hist[i].year)
2504- {
2505- /* Year Totals */
2506- if (index_mths>16 && year_totals)
2507- {
2508- fprintf(out_fp,"<TR><TH COLSPAN=6 BGCOLOR=\"%s\" " \
2509- "ALIGN=left><FONT SIZE=\"-1\"><STRONG>%04d</TH>\n",
2510- GRPCOLOR,s_year);
2511- fprintf(out_fp,"<TH ALIGN=\"right\" BGCOLOR=\"%s\">" \
2512- "<FONT SIZE=\"-1\">%.0f</TH>", GRPCOLOR, m_xfer);
2513- fprintf(out_fp,"<TH ALIGN=\"right\" BGCOLOR=\"%s\">" \
2514- "<FONT SIZE=\"-1\">%0llu</TH>", GRPCOLOR, m_visits);
2515- fprintf(out_fp,"<TH ALIGN=\"right\" BGCOLOR=\"%s\">" \
2516- "<FONT SIZE=\"-1\">%0llu</TH>", GRPCOLOR, m_pages);
2517- fprintf(out_fp,"<TH ALIGN=\"right\" BGCOLOR=\"%s\">" \
2518- "<FONT SIZE=\"-1\">%0llu</TH>", GRPCOLOR, m_files);
2519- fprintf(out_fp,"<TH ALIGN=\"right\" BGCOLOR=\"%s\">" \
2520- "<FONT SIZE=\"-1\">%0llu</TH>", GRPCOLOR, m_hit);
2521- m_xfer=0; m_visits=0; m_pages=0; m_files=0; m_hit=0;
2522- }
2523-
2524- /* Year Header */
2525- s_year=hist[i].year;
2526- if (index_mths>16 && year_hdrs)
2527- fprintf(out_fp,"<TR><TH COLSPAN=11 BGCOLOR=\"%s\" " \
2528- "ALIGN=center>%04d</TH></TR>\n", GREY, s_year);
2529- }
2530-
2531- fprintf(out_fp,"<TR><TD NOWRAP>");
2532- if (hist[i].hit!=0)
2533- fprintf(out_fp,"<A HREF=\"usage_%04d%02d.%s\">" \
2534- "<FONT SIZE=\"-1\">%s %d</FONT></A></TD>\n",
2535- hist[i].year, hist[i].month, html_ext,
2536- s_month[hist[i].month-1], hist[i].year);
2537- else
2538- fprintf(out_fp,"<FONT SIZE=\"-1\">%s %d</FONT></A></TD>\n", \
2539- s_month[hist[i].month-1], hist[i].year);
2540-
2541- fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%llu</FONT></TD>\n",
2542- hist[i].hit/days_in_month);
2543- fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%llu</FONT></TD>\n",
2544- hist[i].files/days_in_month);
2545- fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%llu</FONT></TD>\n",
2546- hist[i].page/days_in_month);
2547- fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%llu</FONT></TD>\n",
2548- hist[i].visit/days_in_month);
2549- fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%llu</FONT></TD>\n",
2550- hist[i].site);
2551- fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%.0f</FONT></TD>\n",
2552- hist[i].xfer);
2553- fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%llu</FONT></TD>\n",
2554- hist[i].visit);
2555- fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%llu</FONT></TD>\n",
2556- hist[i].page);
2557- fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%llu</FONT></TD>\n",
2558- hist[i].files);
2559- fprintf(out_fp,"<TD ALIGN=right><FONT SIZE=\"-1\">%llu</FONT></TD>",
2560- hist[i].hit);
2561- fprintf(out_fp,"</TR>\n");
2562- gt_hit += hist[i].hit;
2563- gt_files += hist[i].files;
2564- gt_pages += hist[i].page;
2565- gt_xfer += hist[i].xfer;
2566- gt_visits+= hist[i].visit;
2567- m_hit += hist[i].hit;
2568- m_files += hist[i].files;
2569- m_pages += hist[i].page;
2570- m_visits+= hist[i].visit;
2571- m_xfer += hist[i].xfer;
2572- }
2573-
2574- if (index_mths>16 && year_totals)
2575- {
2576- fprintf(out_fp,"<TR><TH COLSPAN=6 BGCOLOR=\"%s\" " \
2577- "ALIGN=left><FONT SIZE=\"-1\"><STRONG>%04d</TH>\n",
2578- GRPCOLOR,s_year);
2579- fprintf(out_fp,"<TH ALIGN=\"right\" BGCOLOR=\"%s\">" \
2580- "<FONT SIZE=\"-1\">%.0f</TH>", GRPCOLOR, m_xfer);
2581- fprintf(out_fp,"<TH ALIGN=\"right\" BGCOLOR=\"%s\">" \
2582- "<FONT SIZE=\"-1\">%0llu</TH>", GRPCOLOR, m_visits);
2583- fprintf(out_fp,"<TH ALIGN=\"right\" BGCOLOR=\"%s\">" \
2584- "<FONT SIZE=\"-1\">%0llu</TH>", GRPCOLOR, m_pages);
2585- fprintf(out_fp,"<TH ALIGN=\"right\" BGCOLOR=\"%s\">" \
2586- "<FONT SIZE=\"-1\">%0llu</TH>", GRPCOLOR, m_files);
2587- fprintf(out_fp,"<TH ALIGN=\"right\" BGCOLOR=\"%s\">" \
2588- "<FONT SIZE=\"-1\">%0llu</TH>", GRPCOLOR, m_hit);
2589- }
2590- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
2591- fprintf(out_fp,"<TR><TH BGCOLOR=\"%s\" COLSPAN=6 ALIGN=left>" \
2592- "<FONT SIZE=\"-1\">%s</FONT></TH>\n",GREY,msg_h_totals);
2593- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=right>" \
2594- "<FONT SIZE=\"-1\">%.0f</FONT></TH>\n",GREY,gt_xfer);
2595- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=right>" \
2596- "<FONT SIZE=\"-1\">%.0f</FONT></TH>\n",GREY,gt_visits);
2597- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=right>" \
2598- "<FONT SIZE=\"-1\">%.0f</FONT></TH>\n",GREY,gt_pages);
2599- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=right>" \
2600- "<FONT SIZE=\"-1\">%.0f</FONT></TH>\n",GREY,gt_files);
2601- fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=right>" \
2602- "<FONT SIZE=\"-1\">%.0f</FONT></TH></TR>\n",GREY,gt_hit);
2603- fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n");
2604- fprintf(out_fp,"</TABLE>\n");
2605- write_html_tail(out_fp);
2606- fclose(out_fp);
2607- return 0;
2608-}
2609-
2610-/*********************************************/
2611-/* QS_SITE_CMPH - QSort compare site by hits */
2612-/*********************************************/
2613-
2614-int qs_site_cmph(const void *cp1, const void *cp2)
2615-{
2616- u_int64_t t1, t2;
2617- t1=(*(HNODEPTR *)cp1)->count;
2618- t2=(*(HNODEPTR *)cp2)->count;
2619- if (t1!=t2) return (t2<t1)?-1:1;
2620- /* if hits are the same, we sort by hostname instead */
2621- return strcmp( (*(HNODEPTR *)cp1)->string,
2622- (*(HNODEPTR *)cp2)->string );
2623-}
2624-
2625-/*********************************************/
2626-/* QS_SITE_CMPK - QSort cmp site by bytes */
2627-/*********************************************/
2628-
2629-int qs_site_cmpk(const void *cp1, const void *cp2)
2630-{
2631- double t1, t2;
2632- t1=(*(HNODEPTR *)cp1)->xfer;
2633- t2=(*(HNODEPTR *)cp2)->xfer;
2634- if (t1!=t2) return (t2<t1)?-1:1;
2635- /* if xfer bytes are the same, we sort by hostname instead */
2636- return strcmp( (*(HNODEPTR *)cp1)->string,
2637- (*(HNODEPTR *)cp2)->string );
2638-}
2639-
2640-/*********************************************/
2641-/* QS_URL_CMPH - QSort compare URL by hits */
2642-/*********************************************/
2643-
2644-int qs_url_cmph(const void *cp1, const void *cp2)
2645-{
2646- u_int64_t t1, t2;
2647- t1=(*(UNODEPTR *)cp1)->count;
2648- t2=(*(UNODEPTR *)cp2)->count;
2649- if (t1!=t2) return (t2<t1)?-1:1;
2650- /* if hits are the same, we sort by url instead */
2651- return strcmp( (*(UNODEPTR *)cp1)->string,
2652- (*(UNODEPTR *)cp2)->string );
2653-}
2654-
2655-/*********************************************/
2656-/* QS_URL_CMPK - QSort compare URL by bytes */
2657-/*********************************************/
2658-
2659-int qs_url_cmpk(const void *cp1, const void *cp2)
2660-{
2661- double t1, t2;
2662- t1=(*(UNODEPTR *)cp1)->xfer;
2663- t2=(*(UNODEPTR *)cp2)->xfer;
2664- if (t1!=t2) return (t2<t1)?-1:1;
2665- /* if xfer bytes are the same, we sort by url instead */
2666- return strcmp( (*(UNODEPTR *)cp1)->string,
2667- (*(UNODEPTR *)cp2)->string );
2668-}
2669-
2670-/*********************************************/
2671-/* QS_URL_CMPN - QSort compare URL by entry */
2672-/*********************************************/
2673-
2674-int qs_url_cmpn(const void *cp1, const void *cp2)
2675-{
2676- double t1, t2;
2677- t1=(*(UNODEPTR *)cp1)->entry;
2678- t2=(*(UNODEPTR *)cp2)->entry;
2679- if (t1!=t2) return (t2<t1)?-1:1;
2680- /* if xfer bytes are the same, we sort by url instead */
2681- return strcmp( (*(UNODEPTR *)cp1)->string,
2682- (*(UNODEPTR *)cp2)->string );
2683-}
2684-
2685-/*********************************************/
2686-/* QS_URL_CMPX - QSort compare URL by exit */
2687-/*********************************************/
2688-
2689-int qs_url_cmpx(const void *cp1, const void *cp2)
2690-{
2691- double t1, t2;
2692- t1=(*(UNODEPTR *)cp1)->exit;
2693- t2=(*(UNODEPTR *)cp2)->exit;
2694- if (t1!=t2) return (t2<t1)?-1:1;
2695- /* if xfer bytes are the same, we sort by url instead */
2696- return strcmp( (*(UNODEPTR *)cp1)->string,
2697- (*(UNODEPTR *)cp2)->string );
2698-}
2699-
2700-/*********************************************/
2701-/* QS_REF_CMPH - QSort compare Refs by hits */
2702-/*********************************************/
2703-
2704-int qs_ref_cmph(const void *cp1, const void *cp2)
2705-{
2706- u_int64_t t1, t2;
2707- t1=(*(RNODEPTR *)cp1)->count;
2708- t2=(*(RNODEPTR *)cp2)->count;
2709- if (t1!=t2) return (t2<t1)?-1:1;
2710- /* if hits are the same, we sort by referrer URL instead */
2711- return strcmp( (*(RNODEPTR *)cp1)->string,
2712- (*(RNODEPTR *)cp2)->string );
2713-}
2714-
2715-/*********************************************/
2716-/* QS_AGNT_CMPH - QSort cmp Agents by hits */
2717-/*********************************************/
2718-
2719-int qs_agnt_cmph(const void *cp1, const void *cp2)
2720-{
2721- u_int64_t t1, t2;
2722- t1=(*(ANODEPTR *)cp1)->count;
2723- t2=(*(ANODEPTR *)cp2)->count;
2724- if (t1!=t2) return (t2<t1)?-1:1;
2725- /* if hits are the same, we sort by agent string instead */
2726- return strcmp( (*(ANODEPTR *)cp1)->string,
2727- (*(ANODEPTR *)cp2)->string );
2728-}
2729-
2730-/*********************************************/
2731-/* QS_SRCH_CMPH - QSort cmp srch str by hits */
2732-/*********************************************/
2733-
2734-int qs_srch_cmph(const void *cp1, const void *cp2)
2735-{
2736- u_int64_t t1, t2;
2737- t1=(*(SNODEPTR *)cp1)->count;
2738- t2=(*(SNODEPTR *)cp2)->count;
2739- if (t1!=t2) return (t2<t1)?-1:1;
2740- /* if hits are the same, we sort by search string instead */
2741- return strcmp( (*(SNODEPTR *)cp1)->string,
2742- (*(SNODEPTR *)cp2)->string );
2743-}
2744-
2745-/*********************************************/
2746-/* QS_IDENT_CMPH - QSort cmp ident by hits */
2747-/*********************************************/
2748-
2749-int qs_ident_cmph(const void *cp1, const void *cp2)
2750-{
2751- u_int64_t t1, t2;
2752- t1=(*(INODEPTR *)cp1)->count;
2753- t2=(*(INODEPTR *)cp2)->count;
2754- if (t1!=t2) return (t2<t1)?-1:1;
2755- /* if hits are the same, sort by ident (username) string instead */
2756- return strcmp( (*(INODEPTR *)cp1)->string,
2757- (*(INODEPTR *)cp2)->string );
2758-}
2759-
2760-/*********************************************/
2761-/* LOAD_SITE_ARRAY - load up the sort array */
2762-/*********************************************/
2763-
2764-u_int64_t load_site_array(HNODEPTR *pointer)
2765-{
2766- HNODEPTR hptr;
2767- int i;
2768- u_int64_t ctr = 0;
2769-
2770- /* load the array */
2771- for (i=0;i<MAXHASH;i++)
2772- {
2773- hptr=sm_htab[i];
2774- while (hptr!=NULL)
2775- {
2776- if (pointer==NULL) ctr++; /* fancy way to just count 'em */
2777- else *(pointer+ctr++)=hptr; /* otherwise, really do the load */
2778- hptr=hptr->next;
2779- }
2780- }
2781- return ctr; /* return number loaded */
2782-}
2783-
2784-/*********************************************/
2785-/* LOAD_URL_ARRAY - load up the sort array */
2786-/*********************************************/
2787-
2788-u_int64_t load_url_array(UNODEPTR *pointer)
2789-{
2790- UNODEPTR uptr;
2791- int i;
2792- u_int64_t ctr = 0;
2793-
2794- /* load the array */
2795- for (i=0;i<MAXHASH;i++)
2796- {
2797- uptr=um_htab[i];
2798- while (uptr!=NULL)
2799- {
2800- if (pointer==NULL) ctr++; /* fancy way to just count 'em */
2801- else *(pointer+ctr++)=uptr; /* otherwise, really do the load */
2802- uptr=uptr->next;
2803- }
2804- }
2805- return ctr; /* return number loaded */
2806-}
2807-
2808-/*********************************************/
2809-/* LOAD_REF_ARRAY - load up the sort array */
2810-/*********************************************/
2811-
2812-u_int64_t load_ref_array(RNODEPTR *pointer)
2813-{
2814- RNODEPTR rptr;
2815- int i;
2816- u_int64_t ctr = 0;
2817-
2818- /* load the array */
2819- for (i=0;i<MAXHASH;i++)
2820- {
2821- rptr=rm_htab[i];
2822- while (rptr!=NULL)
2823- {
2824- if (pointer==NULL) ctr++; /* fancy way to just count 'em */
2825- else *(pointer+ctr++)=rptr; /* otherwise, really do the load */
2826- rptr=rptr->next;
2827- }
2828- }
2829- return ctr; /* return number loaded */
2830-}
2831-
2832-/*********************************************/
2833-/* LOAD_AGENT_ARRAY - load up the sort array */
2834-/*********************************************/
2835-
2836-u_int64_t load_agent_array(ANODEPTR *pointer)
2837-{
2838- ANODEPTR aptr;
2839- int i;
2840- u_int64_t ctr = 0;
2841-
2842- /* load the array */
2843- for (i=0;i<MAXHASH;i++)
2844- {
2845- aptr=am_htab[i];
2846- while (aptr!=NULL)
2847- {
2848- if (pointer==NULL) ctr++; /* fancy way to just count 'em */
2849- else *(pointer+ctr++)=aptr; /* otherwise, really do the load */
2850- aptr=aptr->next;
2851- }
2852- }
2853- return ctr; /* return number loaded */
2854-}
2855-
2856-/*********************************************/
2857-/* LOAD_SRCH_ARRAY - load up the sort array */
2858-/*********************************************/
2859-
2860-u_int64_t load_srch_array(SNODEPTR *pointer)
2861-{
2862- SNODEPTR sptr;
2863- int i;
2864- u_int64_t ctr = 0;
2865-
2866- /* load the array */
2867- for (i=0;i<MAXHASH;i++)
2868- {
2869- sptr=sr_htab[i];
2870- while (sptr!=NULL)
2871- {
2872- if (pointer==NULL) ctr++; /* fancy way to just count 'em */
2873- else *(pointer+ctr++)=sptr; /* otherwise, really do the load */
2874- sptr=sptr->next;
2875- }
2876- }
2877- return ctr; /* return number loaded */
2878-}
2879-
2880-/*********************************************/
2881-/* LOAD_IDENT_ARRAY - load up the sort array */
2882-/*********************************************/
2883-
2884-u_int64_t load_ident_array(INODEPTR *pointer)
2885-{
2886- INODEPTR iptr;
2887- int i;
2888- u_int64_t ctr = 0;
2889-
2890- /* load the array */
2891- for (i=0;i<MAXHASH;i++)
2892- {
2893- iptr=im_htab[i];
2894- while (iptr!=NULL)
2895- {
2896- if (pointer==NULL) ctr++; /* fancy way to just count 'em */
2897- else *(pointer+ctr++)=iptr; /* otherwise, really do the load */
2898- iptr=iptr->next;
2899- }
2900- }
2901- return ctr; /* return number loaded */
2902-}
2903-
2904-/*********************************************/
2905-/* OPEN_OUT_FILE - Open file for output */
2906-/*********************************************/
2907-
2908-FILE *open_out_file(char *filename)
2909-{
2910- struct stat out_stat;
2911- FILE *out_fp;
2912-
2913- /* stat the file */
2914- if ( !(lstat(filename, &out_stat)) )
2915- {
2916- /* check if the file a symlink */
2917- if ( S_ISLNK(out_stat.st_mode) )
2918- {
2919- if (verbose)
2920- fprintf(stderr,"%s %s (symlink)\n",msg_no_open,filename);
2921- return NULL;
2922- }
2923- }
2924-
2925- /* open the file... */
2926- if ( (out_fp=fopen(filename,"w")) == NULL)
2927- {
2928- if (verbose)
2929- fprintf(stderr,"%s %s!\n",msg_no_open,filename);
2930- return NULL;
2931- }
2932- return out_fp;
2933-}
2934-
2935
2936=== removed directory '.pc/02_fix_a_spelling_error.diff'
2937=== removed file '.pc/02_fix_a_spelling_error.diff/wcmgr.c'
2938--- .pc/02_fix_a_spelling_error.diff/wcmgr.c 2012-05-08 21:58:08 +0000
2939+++ .pc/02_fix_a_spelling_error.diff/wcmgr.c 1970-01-01 00:00:00 +0000
2940@@ -1,992 +0,0 @@
2941-/*
2942- wcmgr - Webalizer (DNS) Cache file Manager
2943-
2944- webalizer - a web server log analysis program
2945-
2946- Copyright (C) 1997-2013 Bradford L. Barrett
2947-
2948- This program is free software; you can redistribute it and/or modify
2949- it under the terms of the GNU General Public License as published by
2950- the Free Software Foundation; either version 2 of the License, or
2951- (at your option) any later version, and provided that the above
2952- copyright and permission notice is included with all distributed
2953- copies of this or derived software.
2954-
2955- This program is distributed in the hope that it will be useful,
2956- but WITHOUT ANY WARRANTY; without even the implied warranty of
2957- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2958- GNU General Public License for more details.
2959-
2960- You should have received a copy of the GNU General Public License
2961- along with this program; if not, write to the Free Software
2962- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
2963-
2964-*/
2965-
2966-/*********************************************/
2967-/* STANDARD INCLUDES */
2968-/*********************************************/
2969-
2970-#include <time.h>
2971-#include <stdio.h>
2972-#include <stdlib.h>
2973-#include <string.h>
2974-#include <locale.h>
2975-
2976-#ifndef USE_DNS
2977-
2978-/* ********************************************************** */
2979-/* If DNS support is not enabled, then we just compile a stub */
2980-/* program that displays an appropriate warning when run. */
2981-/* ********************************************************** */
2982-
2983-int main()
2984-{
2985- printf("********************* NOTICE!! *********************\n");
2986- printf("This version of the Webalizer was not compiled with\n");
2987- printf("DNS support. In order to use this program, you must\n");
2988- printf("configure the Webalizer at build time with the DNS\n");
2989- printf("support enabled (--enable-dns configure option).\n");
2990- printf("****************************************************\n\n");
2991- exit(1); /* exit with error code */
2992-}
2993-
2994-#else /* USE_DNS defined */
2995-
2996-#include <errno.h>
2997-#include <unistd.h> /* normal stuff */
2998-#include <fcntl.h>
2999-#include <ctype.h>
3000-#include <sys/utsname.h>
3001-#include <sys/stat.h>
3002-
3003-/* ensure getopt */
3004-#ifdef HAVE_GETOPT_H
3005-#include <getopt.h>
3006-#endif
3007-
3008-/* ensure sys/types */
3009-#ifndef _SYS_TYPES_H
3010-#include <sys/types.h>
3011-#endif
3012-
3013-#include <db.h>
3014-#include "webalizer.h"
3015-
3016-/* Stupid pre-processor tricks */
3017-#define xstr(x) #x
3018-#define str(x) xstr(x)
3019-#define SMAXHOST str(MAXHOST) /* String version of MAXHOST value */
3020-
3021-/*********************************************/
3022-/* Forward reference local functions */
3023-/*********************************************/
3024-
3025-void list_cache(void);
3026-void stat_cache(void);
3027-void export_cache(void);
3028-void import_cache(void);
3029-void find_rec(void);
3030-void add_rec(void);
3031-void del_rec(void);
3032-void purge_cache(void);
3033-void create_cache(void);
3034-static int db_put(char *, char *, int, time_t);
3035-
3036-/*********************************************/
3037-/* GLOBAL VARIABLES */
3038-/*********************************************/
3039-
3040-char *pname = "WCMGR - Webalizer (DNS) Cache file Manager";
3041-char *version = "1.00"; /* program version */
3042-char *editlvl = "04"; /* edit level */
3043-char *moddate = "26-Aug-2013"; /* modification date */
3044-char *copyright = "Copyright 2007-2013 by Bradford L. Barrett";
3045-
3046-int action = 'l'; /* action flag (default=list) */
3047-int create = 0; /* cache creation flag */
3048-int verbose = 0; /* Verbose flag (1=be verbose) */
3049-int rec_ttl = 7; /* purge TTL in days */
3050-DB *dns_db = NULL; /* DNS cache database */
3051-DB *out_db = NULL; /* output cache db if needed */
3052-DBC *cursorp = NULL; /* database cursor */
3053-DBT q, r; /* query/reply structures */
3054-char *in_file = NULL; /* input cache filename */
3055-char out_file[MAXHOST+4]; /* output cache filename */
3056-int dns_fd = 0; /* database file descriptor */
3057-time_t runtime; /* runtime for TTL calcs */
3058-char addr[129]; /* buffer for IP search addr */
3059-char name[MAXHOST+1]; /* buffer for name value */
3060-
3061-extern char *optarg; /* command line processing */
3062-extern int optind;
3063-extern int opterr;
3064-
3065-/* dnsRecord structure used in wcmgr */
3066-struct dnsRec
3067- {
3068- time_t timeStamp; /* Timestamp of resolv data */
3069- int numeric; /* 0: Name, 1: IP-address */
3070- char hostName[MAXHOST+1]; /* Hostname buffer (variable) */
3071- } dns_rec;
3072-
3073-#define DNSZ sizeof(struct dnsRec) /* define static record size */
3074-
3075-/*********************************************/
3076-/* PRINT_VER - display version information */
3077-/*********************************************/
3078-
3079-void print_ver()
3080-{
3081- int v,r,l;
3082- struct utsname system_info;
3083- uname(&system_info);
3084- printf("%s V%s-%s\n%s\n",pname,version,editlvl,copyright);
3085- if (verbose)
3086- {
3087- db_version(&v,&r,&l);
3088- printf("System : %s %s (%s)\n",
3089- system_info.sysname,
3090- system_info.release,
3091- system_info.machine);
3092- printf("DB Ver. : V%d.%d.%d\n",v,r,l);
3093- printf("Mod Date: %s\n",moddate);
3094- }
3095- printf("\n");
3096- exit(0);
3097-}
3098-
3099-/*********************************************/
3100-/* PRINT_HELP - Command help display */
3101-/*********************************************/
3102-
3103-void print_help(void)
3104-{
3105- printf("Usage: wcmgr [options] cache-file\n\n");
3106- printf("Options:\n");
3107- printf(" -h This help display\n");
3108- printf(" -V Version information\n");
3109- printf(" -v be verbose\n");
3110- printf(" -a addr Add DNS record\n");
3111- printf(" -c Create new cache file\n");
3112- printf(" -d addr Delete DNS record\n");
3113- printf(" -f addr Find DNS record\n");
3114- printf(" -i name Import cache from file\n");
3115- printf(" -l List cache file contents\n");
3116- printf(" -n name hostname (used for add)\n");
3117- printf(" -p num Purge after num days\n");
3118- printf(" -s Display cache file stats/info\n");
3119- printf(" -t num TTL value (for add and stats)\n");
3120- printf(" -x name Export cache to tab file\n");
3121- printf("\n");
3122- printf("If no options are specified, the default\n");
3123- printf("action is to list the cache file contents.\n\n");
3124- exit(0);
3125-}
3126-
3127-/*********************************************/
3128-/* TTL_AGE - format TTL age for printing */
3129-/*********************************************/
3130-
3131-const char *ttl_age(time_t now, time_t then)
3132-{
3133- static char our_buffer[32]; /* string return buffer */
3134- time_t age; /* age value in seconds */
3135- int days, hours, mins; /* day/hour/min counters */
3136-
3137- /* get age in seconds */
3138- age=now-then;
3139-
3140- /* now calc days/hours/min */
3141- days=age/86400; age=age-(days*86400);
3142- hours=age/3600; age=age-(hours*3600);
3143- mins=age/60;
3144-
3145- /* format the string */
3146- sprintf(our_buffer,"%02dd:%02dh:%02dm",days, hours, mins);
3147-
3148- /* and return to caller */
3149- return our_buffer;
3150-}
3151-
3152-/*********************************************/
3153-/* MAIN entry point here */
3154-/*********************************************/
3155-
3156-int main(int argc, char *argv[])
3157-{
3158- int i; /* gotta have one of these :-) */
3159-
3160- /* some systems need this */
3161- setlocale(LC_CTYPE,"");
3162-
3163- /* initalize name/addr */
3164- memset(addr, 0, sizeof(addr));
3165- memset(name, 0, sizeof(name));
3166- memset(out_file,0,sizeof(out_file));
3167-
3168- /* Get our command line arguments */
3169- opterr = 0;
3170- while ((i=getopt(argc,argv,"a:cd:f:hi:ln:p::st:vVx:"))!=EOF)
3171- {
3172- switch (i)
3173- {
3174- case 'a': action='a'; strncpy(addr,optarg,sizeof(addr)-1); break;
3175- case 'c': if (action!='i') action='c'; create=1; break;
3176- case 'd': action='d'; strncpy(addr,optarg,sizeof(addr)-1); break;
3177- case 'f': action='f'; strncpy(addr,optarg,sizeof(addr)-1); break;
3178- case 'i': action='i'; strncpy(out_file,optarg,sizeof(out_file)-1);
3179- break;
3180- case 'h': print_help(); break;
3181- case 'n': strncpy(name,optarg,sizeof(name)-1); break;
3182- case 'p': action='p'; if (optarg!=NULL) rec_ttl=atoi(optarg); break;
3183- case 's': action='s'; break;
3184- case 't': rec_ttl=atoi(optarg); break;
3185- case 'v': verbose=1; break;
3186- case 'V': print_ver(); break;
3187- case 'x': action='x'; strncpy(out_file,optarg,sizeof(out_file)-1);
3188- break;
3189- case ':': /* catch invalid options here */
3190- case '?': break;
3191- case 'l': /* This is the default action */
3192- default: action='l'; break;
3193- }
3194- }
3195-
3196- /* Get cache filename if specified */
3197- if (argc - optind == 0) print_help(); /* gots to have a filename!! */
3198- in_file = argv[optind];
3199-
3200- /* Try to create our DB handle */
3201- if ( db_create(&dns_db, NULL, 0) )
3202- {
3203- fprintf(stderr,"Error: unable to create db handle!\n");
3204- exit(1);
3205- }
3206-
3207- /* force sane TTL value */
3208- if (rec_ttl > 99) rec_ttl=99;
3209- if (rec_ttl < 0 ) rec_ttl=7;
3210-
3211- /* Branch on 'action' specified */
3212- switch (action)
3213- {
3214- case 'a': add_rec(); break;
3215- case 'c': create_cache(); break;
3216- case 'd': del_rec(); break;
3217- case 'f': find_rec(); break;
3218- case 'i': import_cache(); break;
3219- case 's': stat_cache(); break;
3220- case 'p': purge_cache(); break;
3221- case 'x': export_cache(); break;
3222- case 'l':
3223- default: list_cache(); break;
3224- }
3225- exit(0);
3226-}
3227-
3228-/*********************************************/
3229-/* LIST_CACHE - Dump out cache contents */
3230-/*********************************************/
3231-
3232-void list_cache()
3233-{
3234- int i;
3235- char ip_buf[48];
3236- u_int64_t t_rec=0;
3237- u_int64_t t_num=0;
3238-
3239- /* open the database (read-only) */
3240- if ((i=dns_db->open(dns_db, NULL, in_file, NULL, DB_HASH, DB_RDONLY, 0)))
3241- {
3242- /* Error opening the cache file.. tell user and exit */
3243- fprintf(stderr,"Error: %s: %s\n",in_file,db_strerror(i));
3244- exit(1);
3245- }
3246-
3247- /* Create a cursor */
3248- if ( dns_db->cursor(dns_db, NULL, &cursorp, 0) )
3249- {
3250- fprintf(stderr,"Error: Unable to create cursor!\n");
3251- exit(1);
3252- }
3253-
3254- /* get our runtime for TTL calculations */
3255- time(&runtime);
3256-
3257- if (verbose)
3258- {
3259- printf("Webalizer DNS Cache file listing generated %s\n",ctime(&runtime));
3260- printf("IP Address TTL Age Hostname\n");
3261- printf("--------------- ------------- ------------------------" \
3262- "-----------------------\n");
3263- }
3264-
3265- /* initalize data areas */
3266- memset(&q, 0, sizeof(DBT));
3267- memset(&r, 0, sizeof(DBT));
3268- memset(&dns_rec, 0, sizeof(struct dnsRec));
3269-
3270- /* Loop through database */
3271- while (!cursorp->c_get(cursorp, &q, &r, DB_NEXT))
3272- {
3273- /* got a record */
3274- t_rec++;
3275- memset(ip_buf, 0, sizeof(ip_buf));
3276- strncpy(ip_buf, q.data, (q.size>47)?47:q.size); /* save IP address */
3277- memcpy(&dns_rec, r.data, (r.size>DNSZ)?DNSZ:r.size);
3278-
3279- if (dns_rec.numeric) t_num++;
3280- printf("%-15s [%s] %s\n",ip_buf,
3281- (dns_rec.timeStamp)?
3282- ttl_age(runtime, dns_rec.timeStamp):
3283- "-permanent-",
3284- dns_rec.hostName);
3285-
3286- /* done, clear for next rec */
3287- memset(&q, 0, sizeof(DBT));
3288- memset(&r, 0, sizeof(DBT));
3289- }
3290-
3291- if (verbose)
3292- {
3293- printf("------------------------------------------------------" \
3294- "-----------------------\n");
3295- printf("Filename: %s (%llu records)\n",in_file, t_rec);
3296- }
3297-}
3298-
3299-/*********************************************/
3300-/* PURGE_CACHE - Purge cache of expired recs */
3301-/*********************************************/
3302-
3303-void purge_cache()
3304-{
3305- int i;
3306- char ip_buf[48];
3307- u_int64_t age=0;
3308- u_int64_t t_in=0;
3309- u_int64_t t_out=0;
3310- u_int64_t t_exp=0;
3311-
3312- /* file control struct */
3313- struct flock our_flock;
3314-
3315- if (verbose) printf("Purging records over %d days from '%s'\n",
3316- rec_ttl, in_file);
3317-
3318- /* open the input database (read-write) */
3319- if ((i=dns_db->open(dns_db, NULL, in_file, NULL, DB_HASH, 0, 0)))
3320- {
3321- /* Error opening the cache file.. tell user and exit */
3322- fprintf(stderr,"Error: %s: %s\n",in_file,db_strerror(i));
3323- exit(1);
3324- }
3325-
3326- /* get file descriptor */
3327- dns_db->fd(dns_db, &dns_fd);
3328-
3329- /* Try to lock the file */
3330- our_flock.l_whence=SEEK_SET;
3331- our_flock.l_start=0;
3332- our_flock.l_len=0;
3333- our_flock.l_type=F_WRLCK;
3334-
3335- if (fcntl(dns_fd,F_SETLK,&our_flock) <0)
3336- {
3337- /* Error - can't lock file */
3338- printf("Error: Unable to lock cache file: %s\n",strerror(errno));
3339- exit(1);
3340- }
3341-
3342- /* Create a cursor */
3343- if ( dns_db->cursor(dns_db, NULL, &cursorp, 0) )
3344- {
3345- fprintf(stderr,"Error: Unable to create cursor!\n");
3346- exit(1);
3347- }
3348-
3349- /* Try to create our output DB handle */
3350- if ( db_create(&out_db, NULL, 0) )
3351- {
3352- fprintf(stderr,"Error: unable to create output db handle!\n");
3353- exit(1);
3354- }
3355-
3356- /* generate output filename */
3357- memset(out_file, 0, sizeof(out_file));
3358- sprintf(out_file, "%s.new", in_file);
3359-
3360- /* open the output database (read-write) */
3361- if ((i=out_db->open(out_db, NULL, out_file, NULL,
3362- DB_HASH, DB_CREATE|DB_EXCL, 0644)))
3363- {
3364- /* Error opening the cache file.. tell user and exit */
3365- fprintf(stderr,"Error: %s: %s\n",out_file,db_strerror(i));
3366- exit(1);
3367- }
3368-
3369- /* get our runtime for TTL calculations */
3370- time(&runtime);
3371-
3372- /* initalize data areas */
3373- memset(&q, 0, sizeof(DBT));
3374- memset(&r, 0, sizeof(DBT));
3375-
3376- /* Loop through database */
3377- while (!cursorp->c_get(cursorp, &q, &r, DB_NEXT))
3378- {
3379- /* got a record */
3380- t_in++;
3381- memcpy(&dns_rec, r.data, (r.size>DNSZ)?DNSZ:r.size);
3382-
3383- /* get record ttl age */
3384- if (dns_rec.timeStamp==0) age=0;
3385- else age = runtime - dns_rec.timeStamp;
3386-
3387- if ( age <= (rec_ttl*86400) )
3388- {
3389- /* Good record.. insert into new cache file */
3390- if ( (i=out_db->put(out_db, NULL, &q, &r, 0)) != 0 )
3391- {
3392- fprintf(stderr,"Error: db_put fail: %s!\n",db_strerror(i));
3393- exit(1);
3394- }
3395- else t_out++;
3396- }
3397- else
3398- {
3399- /* Expired record */
3400- t_exp++;
3401- if (verbose)
3402- {
3403- memset(ip_buf, 0, sizeof(ip_buf));
3404- strncpy(ip_buf, q.data, (q.size>47)?47:q.size);
3405- printf("Purging %-16s [%s]\n",ip_buf,
3406- ttl_age(runtime,dns_rec.timeStamp));
3407- }
3408- }
3409-
3410- /* done, clear for next rec */
3411- memset(&q, 0, sizeof(DBT));
3412- memset(&r, 0, sizeof(DBT));
3413- }
3414-
3415- /* Successful exit! */
3416- our_flock.l_type=F_UNLCK;
3417- fcntl(dns_fd, F_SETLK, &our_flock);
3418- dns_db->close(dns_db, 0);
3419- out_db->close(out_db, 0);
3420-
3421- /* rename files */
3422- if (rename(out_file, in_file))
3423- {
3424- fprintf(stderr,"Error renaming file: %s\n",strerror(errno));
3425- exit(1);
3426- }
3427-
3428- if (verbose)
3429- printf("%llu of %llu records purged from '%s'\n",t_exp,t_in,in_file);
3430-}
3431-
3432-/*********************************************/
3433-/* STAT_CACHE - Display cache stats/info */
3434-/*********************************************/
3435-
3436-void stat_cache()
3437-{
3438- /* Define some variables */
3439- int i;
3440- time_t min_age=0; /* min/max TTL age in cache */
3441- time_t max_age=0;
3442- u_int64_t t_rec=0; /* Various record totals */
3443- u_int64_t t_err=0;
3444- u_int64_t t_name=0;
3445- u_int64_t t_num=0;
3446- u_int64_t t_perm=0;
3447- u_int64_t t_old=0;
3448- time_t age;
3449-
3450- /* open the database (read-only) */
3451- if ((i=dns_db->open(dns_db, NULL, in_file, NULL, DB_HASH, DB_RDONLY, 0)))
3452- {
3453- /* Error opening the cache file.. tell user and exit */
3454- fprintf(stderr,"Error: %s: %s\n",in_file,db_strerror(i));
3455- exit(1);
3456- }
3457-
3458- /* Create a cursor */
3459- if ( dns_db->cursor(dns_db, NULL, &cursorp, 0) )
3460- {
3461- fprintf(stderr,"Error: Unable to create cursor!\n");
3462- exit(1);
3463- }
3464-
3465- /* get our runtime for TTL calculations */
3466- time(&runtime);
3467-
3468- /* initalize data areas */
3469- memset(&q, 0, sizeof(DBT));
3470- memset(&r, 0, sizeof(DBT));
3471- memset(&dns_rec, 0, sizeof(struct dnsRec));
3472-
3473- /* Loop through database */
3474- while (!cursorp->c_get(cursorp, &q, &r, DB_NEXT))
3475- {
3476- t_rec++; /* add to total */
3477- if (r.size >= sizeof(dns_rec)) { t_err++; continue; } /* size error? */
3478- memcpy(&dns_rec, r.data, r.size); /* get record */
3479- if (dns_rec.numeric) t_num++; else t_name++; /* resolved? */
3480-
3481- if (dns_rec.timeStamp!=0) /* permanent? */
3482- {
3483- age=runtime-dns_rec.timeStamp; /* calc age */
3484- if ((age < min_age) || (t_rec==1) ) min_age=age; /* min/max age */
3485- if ( age > max_age ) max_age=age; /* if not perm */
3486- if ( age > (rec_ttl*86400)) t_old++; /* purgable? */
3487- }
3488- else t_perm++; /* inc counter */
3489-
3490- /* done, clear for next rec */
3491- memset(&q, 0, sizeof(DBT));
3492- memset(&r, 0, sizeof(DBT));
3493- }
3494-
3495- /* Print actual record counts */
3496- printf("Report generated on: %s",ctime(&runtime));
3497- printf("DNS Cache Filename : %s\n",in_file);
3498-
3499- printf("Total Records : %llu\n",t_rec);
3500- printf("Total Resolved : %llu\n",t_name);
3501- printf("Total Unresolved : %llu\n",t_num);
3502- printf("Total Permanent : %llu\n",t_perm);
3503- printf("Newest Record age : %s\n",ttl_age(min_age,0));
3504- printf("Oldest Record age : %s\n",ttl_age(max_age,0));
3505- printf("Total over %02d days : %llu\n",rec_ttl,t_old);
3506- if (t_err) printf("Record Size Errors : %llu\n",t_err);
3507- printf("\n");
3508-}
3509-
3510-/*********************************************/
3511-/* FIND_REC - Find IP record in cache */
3512-/*********************************************/
3513-
3514-void find_rec()
3515-{
3516- int i;
3517- char ip_buf[48];
3518-
3519- /* open the database (read-only) */
3520- if ((i=dns_db->open(dns_db, NULL, in_file, NULL, DB_HASH, DB_RDONLY, 0)))
3521- {
3522- /* Error opening the cache file.. tell user and exit */
3523- fprintf(stderr,"Error: %s: %s\n",in_file,db_strerror(i));
3524- exit(1);
3525- }
3526-
3527- /* get our runtime for TTL calculations */
3528- time(&runtime);
3529-
3530- /* initalize data areas */
3531- memset(&q, 0, sizeof(DBT));
3532- memset(&r, 0, sizeof(DBT));
3533- memset(&dns_rec, 0, sizeof(struct dnsRec));
3534-
3535- /* search the cache */
3536- q.data = &addr;
3537- q.size = strlen(addr);
3538- if ( (i=dns_db->get(dns_db, NULL, &q, &r, 0)) == 0)
3539- {
3540- /* We found it! display info */
3541- memset(ip_buf, 0, sizeof(ip_buf));
3542- strncpy(ip_buf, q.data, (q.size>47)?47:q.size); /* save IP address */
3543- memcpy(&dns_rec, r.data, (r.size>DNSZ)?DNSZ:r.size);
3544-
3545- if (verbose)
3546- {
3547- /* Verbose display */
3548- printf("Address : %s\n",ip_buf);
3549- printf("Hostname : %s\n",dns_rec.hostName);
3550- printf("Resolved : %s\n",(dns_rec.numeric)?"No":"Yes");
3551- if (dns_rec.timeStamp)
3552- {
3553- /* Not Permanent */
3554- printf("Timestamp: %s",ctime(&dns_rec.timeStamp));
3555- printf("TTL age : %s\n\n",ttl_age(runtime, dns_rec.timeStamp));
3556- }
3557- else
3558- {
3559- printf("Timestamp: N/A\n");
3560- printf("TTL age : Permanent\n");
3561- }
3562- }
3563- else
3564- {
3565- /* Standard 1 line display */
3566- printf("%-15s [%s] %s\n",ip_buf,
3567- (dns_rec.timeStamp)?
3568- ttl_age(runtime, dns_rec.timeStamp):
3569- "-permanent-",
3570- dns_rec.hostName);
3571- }
3572- }
3573- else
3574- {
3575- if (i==DB_NOTFOUND)
3576- printf("%s not found!\n",addr);
3577- else
3578- printf("Error: %s\n",db_strerror(i));
3579- }
3580-}
3581-
3582-/*********************************************/
3583-/* DEL_REC - Delete record from cache file */
3584-/*********************************************/
3585-
3586-void del_rec()
3587-{
3588- int i;
3589- char *cp;
3590-
3591- /* ensure we have addr string */
3592- if (addr[0]!='\0') cp=addr;
3593- else
3594- {
3595- fprintf(stderr,"Error: No IP address specified!\n");
3596- exit(1);
3597- }
3598-
3599- /* ensure IPv6 addresses are lowercase */
3600- cp=addr; while (*cp!='\0') *cp++=tolower(*cp);
3601-
3602- /* open the database (read-write) */
3603- if ((i=dns_db->open(dns_db, NULL, in_file, NULL, DB_HASH, 0, 0)))
3604- {
3605- /* Error opening the cache file.. tell user and exit */
3606- fprintf(stderr,"Error: %s: %s\n",in_file,db_strerror(i));
3607- exit(1);
3608- }
3609-
3610- /* initalize data areas */
3611- memset(&q, 0, sizeof(DBT));
3612- memset(&r, 0, sizeof(DBT));
3613- memset(&dns_rec, 0, sizeof(struct dnsRec));
3614-
3615- /* search the cache */
3616- q.data = &addr;
3617- q.size = strlen(addr);
3618-
3619- /* Try to delete the record */
3620- if ( (i=dns_db->del(dns_db, NULL, &q, 0)) )
3621- {
3622- if (i==DB_NOTFOUND)
3623- {
3624- printf("%s not found in cache!\n",addr);
3625- exit(1);
3626- }
3627- else
3628- {
3629- fprintf(stderr,"Error: %s\n",db_strerror(i));
3630- exit(1);
3631- }
3632- }
3633- dns_db->close(dns_db, 0);
3634- if (verbose)
3635- printf("%s sucessfully deleted from cache file\n",addr);
3636-}
3637-
3638-/*********************************************/
3639-/* ADD_REC - Add record to cache file */
3640-/*********************************************/
3641-
3642-void add_rec()
3643-{
3644- int i;
3645- char *cp;
3646-
3647- /* ensure we have addr string */
3648- if (addr[0]!='\0') cp=addr;
3649- else
3650- {
3651- fprintf(stderr,"Error: No IP address specified!\n");
3652- exit(1);
3653- }
3654-
3655- /* and check size */
3656- if (strlen(addr)>47)
3657- {
3658- fprintf(stderr,"Error: IP address too long!\n");
3659- exit(1);
3660- }
3661-
3662- /* ensure everything is lowercase */
3663- cp=addr; while (*cp!='\0') *cp++=tolower(*cp);
3664- if (name[0]!='\0')
3665- {
3666- cp=name; while (*cp!='\0') *cp++=tolower(*cp);
3667- }
3668-
3669- /* open the database (read-write) */
3670- if ((i=dns_db->open(dns_db, NULL, in_file, NULL, DB_HASH, 0, 0)))
3671- {
3672- /* Error opening the cache file.. tell user and exit */
3673- fprintf(stderr,"Error: %s: %s\n",in_file,db_strerror(i));
3674- exit(1);
3675- }
3676-
3677- /* get our runtime for TTL calculations */
3678- time(&runtime);
3679-
3680- /* initalize data areas */
3681- memset(&q, 0, sizeof(DBT));
3682- memset(&r, 0, sizeof(DBT));
3683- memset(&dns_rec, 0, sizeof(struct dnsRec));
3684-
3685- /* search the cache */
3686- q.data = &addr;
3687- q.size = strlen(addr);
3688- if ( (i=dns_db->get(dns_db, NULL, &q, &r, 0)) == 0)
3689- {
3690- fprintf(stderr,"Error: %s already exists in cache!\n",addr);
3691- exit(1);
3692- }
3693- else
3694- {
3695- if (i!=DB_NOTFOUND)
3696- {
3697- fprintf(stderr,"Error: %s\n",db_strerror(i));
3698- exit(1);
3699- }
3700- else
3701- {
3702- /* check hostname */
3703- if (name[0]=='\0')
3704- strncpy(name,addr,strlen(addr));
3705-
3706- /* check if perm */
3707- if (rec_ttl==0) runtime=0;
3708-
3709- /* put it in the database */
3710- if (db_put(addr, name, (strcmp(name,addr))?0:1, runtime)==0)
3711- dns_db->close(dns_db,0);
3712- if (verbose)
3713- printf("%s sucessfully added to cache file\n",addr);
3714- }
3715- }
3716-}
3717-
3718-/*********************************************/
3719-/* CREATE_CACHE - Create a new cache file */
3720-/*********************************************/
3721-
3722-void create_cache()
3723-{
3724- int i;
3725-
3726- /* create the database */
3727- if ((i=dns_db->open(dns_db,NULL,in_file,NULL,
3728- DB_HASH,DB_CREATE|DB_EXCL,0644)))
3729- {
3730- /* Error opening the cache file.. tell user and exit */
3731- fprintf(stderr,"Error: %s: %s\n",in_file,db_strerror(i));
3732- exit(1);
3733- }
3734- dns_db->close(dns_db,0);
3735- if (verbose) printf("Cache file %s created successfully\n",in_file);
3736-}
3737-
3738-/*********************************************/
3739-/* IMPORT_CACHE - import cache from tab file */
3740-/*********************************************/
3741-
3742-void import_cache()
3743-{
3744- int i, flag=0;
3745- u_int64_t t_rec=0;
3746- FILE *in_fp;
3747- char ip_buf[48];
3748- char buffer[4096];
3749-
3750- /* open the database (read-write) */
3751- if (create) flag=DB_CREATE|DB_EXCL;
3752- if ((i=dns_db->open(dns_db, NULL, in_file, NULL, DB_HASH, flag, 0644)))
3753- {
3754- /* Error opening the cache file.. tell user and exit */
3755- fprintf(stderr,"Error: %s: %s\n",in_file,db_strerror(i));
3756- exit(1);
3757- }
3758-
3759- /* open our import file */
3760- in_fp=fopen(out_file,"r");
3761- if (in_fp)
3762- {
3763- while ((fgets(buffer,4096,in_fp)) != NULL)
3764- {
3765- memset(&dns_rec, 0, sizeof(dns_rec));
3766- memset(&ip_buf, 0, sizeof(ip_buf));
3767- i = sscanf(buffer,"%47s\t%lu\t%d\t%" SMAXHOST "s",
3768- ip_buf,
3769- &dns_rec.timeStamp,
3770- &dns_rec.numeric,
3771- dns_rec.hostName);
3772-
3773- if (ip_buf[0]=='#') continue; /* skip comments */
3774-
3775- if (i!=4)
3776- {
3777- fprintf(stderr,"Error reading tab file %s\n",out_file);
3778- exit(1);
3779- }
3780-
3781- t_rec++; /* bump totals */
3782-
3783- /* put it in the database */
3784- if (db_put(ip_buf, dns_rec.hostName,
3785- dns_rec.numeric, dns_rec.timeStamp)!=0)
3786- {
3787- fprintf(stderr,"Error inserting cache record:\n%s\n",buffer);
3788- exit(1);
3789- }
3790- }
3791- }
3792- else fprintf(stderr,"Error: File not found: %s\n",out_file);
3793- dns_db->close(dns_db,0);
3794-
3795- if (verbose) printf("%llu records imported into '%s' from file '%s'\n",
3796- t_rec, in_file, out_file);
3797-}
3798-
3799-/*********************************************/
3800-/* EXPORT_CACHE - export cache to tab file */
3801-/*********************************************/
3802-
3803-void export_cache()
3804-{
3805- int i;
3806- u_int64_t t_rec=0;
3807- char ip_buf[48];
3808- FILE *out_fp;
3809- struct stat out_stat;
3810-
3811- /* make sure files are different! */
3812- if (!strcmp(in_file,out_file))
3813- {
3814- fprintf(stderr,"Error: Bad export filename: %s\n",out_file);
3815- exit(1);
3816- }
3817-
3818- /* open the database (read-only) */
3819- if ((i=dns_db->open(dns_db, NULL, in_file, NULL, DB_HASH, DB_RDONLY, 0)))
3820- {
3821- /* Error opening the cache file.. tell user and exit */
3822- fprintf(stderr,"Error: %s: %s\n",in_file,db_strerror(i));
3823- exit(1);
3824- }
3825-
3826- /* Create a cursor */
3827- if ( dns_db->cursor(dns_db, NULL, &cursorp, 0) )
3828- {
3829- fprintf(stderr,"Error: Unable to create cursor!\n");
3830- exit(1);
3831- }
3832-
3833- /* stat output file */
3834- if ( !(lstat(out_file, &out_stat)) )
3835- {
3836- /* check if the file is a symlink */
3837- if ( S_ISLNK(out_stat.st_mode) )
3838- {
3839- fprintf(stderr,"%s %s\n","Error: File is a symlink:",out_file);
3840- exit(1);
3841- }
3842- }
3843-
3844- /* open output file */
3845- if ( (out_fp=fopen(out_file,"w")) == NULL)
3846- {
3847- fprintf(stderr,"%s %s\n","Error: Cannot create file:",out_file);
3848- exit(1);
3849- }
3850-
3851- /* initalize data areas */
3852- memset(&q, 0, sizeof(DBT));
3853- memset(&r, 0, sizeof(DBT));
3854- memset(&dns_rec, 0, sizeof(struct dnsRec));
3855-
3856- /* Loop through database */
3857- while (!cursorp->c_get(cursorp, &q, &r, DB_NEXT))
3858- {
3859- /* got a record */
3860- t_rec++;
3861- memset(ip_buf, 0, sizeof(ip_buf));
3862- strncpy(ip_buf, q.data, (q.size>47)?47:q.size); /* save IP address */
3863- memcpy(&dns_rec, r.data, (r.size>DNSZ)?DNSZ:r.size);
3864-
3865- /* Print out tab delimited line */
3866- /* Format: IP timestamp numeric hostname */
3867- fprintf(out_fp,"%s\t%lu\t%d\t%s\n",
3868- ip_buf,dns_rec.timeStamp,
3869- dns_rec.numeric,
3870- dns_rec.hostName);
3871-
3872- /* done, clear for next rec */
3873- memset(&q, 0, sizeof(DBT));
3874- memset(&r, 0, sizeof(DBT));
3875- }
3876- dns_db->close(dns_db,0);
3877- fclose(out_fp);
3878-
3879- if (verbose) printf("%llu records exported from '%s' to file '%s'\n",
3880- t_rec, in_file, out_file);
3881-}
3882-
3883-/*********************************************/
3884-/* DB_PUT - put key/val in the cache db */
3885-/*********************************************/
3886-
3887-static int db_put(char *key, char *value, int numeric, time_t ttl)
3888-{
3889-
3890- /* dnsRecord structure used in database */
3891- struct dnsRecord
3892- {
3893- time_t timeStamp; /* Timestamp of resolv data */
3894- int numeric; /* 0: Name, 1: IP-address */
3895- char hostName[1]; /* Hostname buffer (variable) */
3896- };
3897-
3898- int i;
3899- DBT k, v;
3900- struct dnsRecord *recPtr = NULL;
3901- int nameLen = strlen(value)+1;
3902-
3903- /* Align to multiple of eight bytes */
3904- int recSize = (sizeof(struct dnsRecord)+nameLen+7) & ~0x7;
3905-
3906- /* make sure we have a db ;) */
3907- if(dns_db)
3908- {
3909- if((recPtr = calloc(1, recSize)))
3910- {
3911- recPtr->timeStamp = ttl;
3912- recPtr->numeric = numeric;
3913- memcpy(&recPtr->hostName, value, nameLen);
3914- memset(&k, 0, sizeof(k));
3915- memset(&v, 0, sizeof(v));
3916-
3917- k.data = key;
3918- k.size = strlen(key);
3919-
3920- v.size = recSize;
3921- v.data = recPtr;
3922-
3923- if ( (i=dns_db->put(dns_db, NULL, &k, &v, 0)) != 0 )
3924- fprintf(stderr,"Error: db_put fail: %s!\n",db_strerror(i));
3925- free(recPtr);
3926- }
3927- else return 1;
3928- }
3929- else return 1;
3930- return i;
3931-}
3932-#endif /* USE_DNS */
3933
3934=== removed directory '.pc/05_apache_logio.diff'
3935=== removed file '.pc/05_apache_logio.diff/README.FIRST'
3936--- .pc/05_apache_logio.diff/README.FIRST 2012-02-05 16:21:18 +0000
3937+++ .pc/05_apache_logio.diff/README.FIRST 1970-01-01 00:00:00 +0000
3938@@ -1,21 +0,0 @@
3939-Upgrade information for the Webalizer Version 2.2x
3940-
3941-This release is, for the most part, a drop-in replacement for all
3942-installations currently running 2.01, and all users are encouraged
3943-to upgrade. See the 'CHANGES' file for a full list of changes
3944-since version 2.01-10.
3945-
3946-Note: The history file format has changed in v2.20 in order to keep
3947-more than 12 months. Existing history files will be automatically
3948-converted to the new format the first time they are read.
3949-
3950-Note: This version redefines the '-v' command line switch to mean
3951-'verbose', which will cause the program to display additional
3952-informational and debugging messages at run-time. This should not
3953-cause any major problems, as previously it would simply cause the
3954-program to display its version information and then exit.
3955-
3956-Report bugs to 'brad at mrunix dot net' with "Webalizer" somewhere
3957-in the subject. Please do not send HTML formatted e-mails or e-mail
3958-containing HTML tags as my mail server will reject them. Thanks!
3959-
3960
3961=== removed file '.pc/05_apache_logio.diff/graphs.c'
3962--- .pc/05_apache_logio.diff/graphs.c 2012-05-08 21:58:08 +0000
3963+++ .pc/05_apache_logio.diff/graphs.c 1970-01-01 00:00:00 +0000
3964@@ -1,903 +0,0 @@
3965-/*
3966- graphs.c - produces graphs used by the Webalizer
3967-
3968- Copyright (C) 1997-2013 Bradford L. Barrett
3969-
3970- This program is free software; you can redistribute it and/or modify
3971- it under the terms of the GNU General Public License as published by
3972- the Free Software Foundation; either version 2 of the License, or
3973- (at your option) any later version, and provided that the above
3974- copyright and permission notice is included with all distributed
3975- copies of this or derived software.
3976-
3977- This program is distributed in the hope that it will be useful,
3978- but WITHOUT ANY WARRANTY; without even the implied warranty of
3979- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3980- GNU General Public License for more details.
3981-
3982- You should have received a copy of the GNU General Public License
3983- along with this program; if not, write to the Free Software
3984- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
3985-
3986-*/
3987-
3988-#include <math.h>
3989-#include <stdio.h>
3990-#include <string.h>
3991-#include <sys/types.h>
3992-#include <errno.h>
3993-#include <sys/stat.h>
3994-#include <gd.h>
3995-#include <gdfontt.h>
3996-#include <gdfonts.h>
3997-#include <gdfontmb.h>
3998-
3999-/* need socket header? */
4000-#ifdef HAVE_SYS_SOCKET_H
4001-#include <sys/socket.h>
4002-#endif
4003-
4004-#include "webalizer.h"
4005-#include "preserve.h"
4006-#include "lang.h"
4007-#include "graphs.h"
4008-
4009-/* Some systems don't define this */
4010-#ifndef PI
4011-#define PI 3.14159265358979323846
4012-#endif
4013-
4014-#define HITCOLOR hit_or_green /* graph color - hits */
4015-#define FILECOLOR file_or_blue /* files */
4016-#define SITECOLOR site_or_orange /* sites */
4017-#define KBYTECOLOR kbyte_or_red /* KBytes */
4018-#define PAGECOLOR page_or_cyan /* Files */
4019-#define VISITCOLOR visit_or_yellow /* Visits */
4020-
4021-/* shortcuts to convert ASCII hex color for gdImageColorAllocate() */
4022-
4023-#define getred(s) (ashex2int((s[0] == '#')?s+1:s))
4024-/* returns the red base-10 integer value from a html color */
4025-
4026-#define getgreen(s) (ashex2int((s[0] == '#')?s+3:s+2))
4027-/* returns the green base-10 integer value from a html color */
4028-
4029-#define getblue(s) (ashex2int((s[0] == '#')?s+5:s+4))
4030-/* returns the blue base-10 integer value from a html color */
4031-
4032-#define CX 156 /* center x (for pie) */
4033-#define CY 150 /* center y (chart) */
4034-#define XRAD 240 /* X-axis radius */
4035-#define YRAD 200 /* Y-axis radius */
4036-
4037-/* forward reference internal routines */
4038-
4039-void init_graph(char *, int, int);
4040-struct pie_data *calc_arc(float, float);
4041-int ashex2int(char *);
4042-
4043-/* common public declarations */
4044-
4045-char *numchar[] = { " 0"," 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"," 9","10",
4046- "11","12","13","14","15","16","17","18","19","20",
4047- "21","22","23","24","25","26","27","28","29","30","31"};
4048-
4049-gdImagePtr im; /* image buffer */
4050-FILE *out; /* output file for PNG */
4051-struct stat out_stat; /* stat struct for PNG */
4052-char maxvaltxt[32]; /* graph values */
4053-float percent; /* percent storage */
4054-u_int64_t julday; /* julday value */
4055-
4056-struct pie_data { int x; int y; /* line x,y */
4057- int mx; int my; }; /* midpoint x,y */
4058-/* colors */
4059-int black, white, grey, dkgrey, kbyte_or_red,
4060- file_or_blue, site_or_orange, hit_or_green,
4061- page_or_cyan, visit_or_yellow, blue;
4062-
4063-/*****************************************************************/
4064-/* */
4065-/* YEAR_GRAPH6x - Year graph from array of hist_rec structs */
4066-/* */
4067-/*****************************************************************/
4068-
4069-int year_graph6x(char *fname, char *title, struct hist_rec data[HISTSIZE])
4070-{
4071-
4072- /* local variables */
4073- int i,j,x1,y1,x2;
4074- int s_mth,s_year=0;
4075- float cw,cs,co,ci;
4076-
4077- u_int64_t maxval=1;
4078- double fmaxval=0.0;
4079-
4080- /* initalize the graph */
4081- init_graph(title,512,256); /* init as 512 x 256 */
4082-
4083- gdImageLine(im, 305,25,305,233,black); /* draw section lines */
4084- gdImageLine(im, 304,25,304,233,white);
4085- gdImageLine(im, 305,130,490,130,black);
4086- gdImageLine(im, 305,129,490,129,white);
4087-
4088- /* index lines? */
4089- if (graph_lines)
4090- {
4091- y1=210/(graph_lines+1);
4092- for (i=0;i<graph_lines;i++)
4093- gdImageLine(im,21,((i+1)*y1)+25,303,((i+1)*y1)+25,dkgrey);
4094- y1=105/(graph_lines+1);
4095- for (i=0;i<graph_lines;i++)
4096- gdImageLine(im,306,((i+1)*y1)+25,489,((i+1)*y1)+25,dkgrey);
4097- for (i=0;i<graph_lines;i++)
4098- gdImageLine(im,306,((i+1)*y1)+130,489,((i+1)*y1)+130,dkgrey);
4099- }
4100-
4101- /* color coded legends? */
4102- if (graph_legend)
4103- {
4104- /* Kbytes Legend */
4105- i = (strlen(msg_h_xfer)*6);
4106- gdImageString(im,gdFontSmall,491-i,237,
4107- (unsigned char *)msg_h_xfer,dkgrey);
4108- gdImageString(im,gdFontSmall,490-i,236,
4109- (unsigned char *)msg_h_xfer,KBYTECOLOR);
4110-
4111- /* Sites/Visits Legend */
4112- i = (strlen(msg_h_visits)*6);
4113- j = (strlen(msg_h_sites)*6);
4114- gdImageString(im,gdFontSmall,491-i-j-12,11,
4115- (unsigned char *)msg_h_visits,dkgrey);
4116- gdImageString(im,gdFontSmall,490-i-j-12,10,
4117- (unsigned char *)msg_h_visits,VISITCOLOR);
4118- gdImageString(im,gdFontSmall,491-j-9,11,(unsigned char *)"/",dkgrey);
4119- gdImageString(im,gdFontSmall,490-j-9,10,(unsigned char *)"/",black);
4120- gdImageString(im,gdFontSmall,491-j,11,
4121- (unsigned char *)msg_h_sites,dkgrey);
4122- gdImageString(im,gdFontSmall,490-j,10,
4123- (unsigned char *)msg_h_sites,SITECOLOR);
4124-
4125- /* Hits/Files/Pages Legend */
4126- i = (strlen(msg_h_pages)*6);
4127- j = (strlen(msg_h_files)*6);
4128- gdImageStringUp(im,gdFontSmall,6,231,
4129- (unsigned char *)msg_h_pages,dkgrey);
4130- gdImageStringUp(im,gdFontSmall,5,230,
4131- (unsigned char *)msg_h_pages,PAGECOLOR);
4132- gdImageStringUp(im,gdFontSmall,6,231-i-3,(unsigned char *)"/",dkgrey);
4133- gdImageStringUp(im,gdFontSmall,5,230-i-3,(unsigned char *)"/",black);
4134- gdImageStringUp(im,gdFontSmall,6,231-i-12,
4135- (unsigned char *)msg_h_files,dkgrey);
4136- gdImageStringUp(im,gdFontSmall,5,230-i-12,
4137- (unsigned char *)msg_h_files,FILECOLOR);
4138- gdImageStringUp(im,gdFontSmall,6,231-i-j-15,(unsigned char *)"/",dkgrey);
4139- gdImageStringUp(im,gdFontSmall,5,230-i-j-15,(unsigned char *)"/",black);
4140- gdImageStringUp(im,gdFontSmall,6,231-i-j-24,
4141- (unsigned char *)msg_h_hits,dkgrey);
4142- gdImageStringUp(im,gdFontSmall,5,230-i-j-24,
4143- (unsigned char *)msg_h_hits,HITCOLOR);
4144- }
4145-
4146- /* Now draw data areas */
4147- s_mth = HISTSIZE-graph_mths;
4148- cs = 280.0/graph_mths; cw = cs/2;
4149- co = (48/graph_mths<1)?1:48/graph_mths;
4150- ci = 22+((cw-co)/2);
4151-
4152- /* x-axis legend */
4153- for (i=s_mth;i<HISTSIZE;i++)
4154- {
4155- if (graph_mths<16)
4156- {
4157- gdImageString(im,gdFontSmall,ci+((i-s_mth)*cs)+(((cw+co+co)-18)/2)+1,
4158- 236,(unsigned char *)s_month[data[i].month-1],black);
4159- }
4160- else if (graph_mths<36)
4161- {
4162- gdImageChar(im,gdFontSmall,ci+((i-s_mth)*cs)+(((cw+co+co)-6)/2)+1,
4163- 236,s_month[data[i].month-1][0],
4164- (data[i].month==1)?blue:black);
4165- }
4166- else
4167- {
4168- if (s_year!=data[i].year) /* year change only */
4169- {
4170- if (data[i].month==1 && (i-s_mth)!=0)
4171- gdImageChar(im,gdFontSmall, ci+((i-s_mth)*cs)-3,236,'|',blue);
4172- j=(12-data[i].month+1)*cs;
4173- if ((HISTSIZE-i)*cs < j) j=(HISTSIZE-i)*cs;
4174- if (j>28)
4175- {
4176- /* format the year string */
4177- sprintf(maxvaltxt, "%04d", data[i].year);
4178- gdImageString(im,gdFontSmall,ci+((i-s_mth)*cs)+(j/2)-12,
4179- 236, (unsigned char *)maxvaltxt, black);
4180- }
4181- s_year=data[i].year;
4182- }
4183- }
4184-
4185- if (data[i].hit > maxval) maxval = data[i].hit;
4186- if (data[i].files > maxval) maxval = data[i].files;
4187- if (data[i].page > maxval) maxval = data[i].page;
4188- }
4189- if (maxval <= 0) maxval = 1;
4190- sprintf(maxvaltxt, "%llu", maxval);
4191- gdImageStringUp(im,gdFontSmall,6,26+(strlen(maxvaltxt)*6),
4192- (unsigned char *)maxvaltxt,black);
4193-
4194- /* hits */
4195- for (i=s_mth; i<HISTSIZE; i++)
4196- {
4197- percent = ((float)data[i].hit / (float)maxval);
4198- if (percent <= 0.0) continue;
4199- x1 = ci + ((i-s_mth)*cs);
4200- x2 = x1 + cw;
4201- y1 = 232 - (percent * 203);
4202- gdImageFilledRectangle(im, x1, y1, x2, 232, HITCOLOR);
4203- if (cw>2) gdImageRectangle(im, x1, y1, x2, 232, black);
4204- }
4205-
4206- /* files */
4207- for (i=s_mth; i<HISTSIZE; i++)
4208- {
4209- percent = ((float)data[i].files / (float)maxval);
4210- if (percent <= 0.0) continue;
4211- x1 = ci + co + ((i-s_mth)*cs);
4212- x2 = x1 + cw;
4213- y1 = 232 - (percent * 203);
4214- gdImageFilledRectangle(im, x1, y1, x2, 232, FILECOLOR);
4215- if (cw>2) gdImageRectangle(im, x1, y1, x2, 232, black);
4216- }
4217-
4218- /* pages */
4219- for (i=s_mth; i<HISTSIZE; i++)
4220- {
4221- percent = ((float)data[i].page / (float)maxval);
4222- if (percent <= 0.0) continue;
4223- x1 = ci + co + co + ((i-s_mth)*cs);
4224- x2 = x1 + cw;
4225- y1 = 232 - (percent * 203);
4226- gdImageFilledRectangle(im, x1, y1, x2, 232, PAGECOLOR);
4227- if (cw>2) gdImageRectangle(im, x1, y1, x2, 232, black);
4228- }
4229-
4230- maxval=0;
4231- for (i=s_mth; i<HISTSIZE; i++)
4232- {
4233- if (data[i].site > maxval) maxval = data[i].site;
4234- if (data[i].visit > maxval) maxval = data[i].visit;
4235- }
4236- if (maxval <= 0) maxval = 1;
4237- sprintf(maxvaltxt, "%llu", maxval);
4238- gdImageStringUp(im, gdFontSmall,493,26+(strlen(maxvaltxt)*6),
4239- (unsigned char *)maxvaltxt, black);
4240-
4241- cs = 180.0/graph_mths; cw = cs/2;
4242- co = (48/graph_mths<1)?1:48/graph_mths;
4243- ci = 308+((cw-co)/2);
4244-
4245- /* visits */
4246- for (i=s_mth; i<HISTSIZE; i++)
4247- {
4248- percent = ((float)data[i].visit / (float)maxval);
4249- if (percent <= 0.0) continue;
4250- x1 = ci + ((i-s_mth)*cs);
4251- x2 = x1 + cw;
4252- y1 = 127 - (percent * 98);
4253- gdImageFilledRectangle(im, x1, y1, x2, 127, VISITCOLOR);
4254- if (cw>2) gdImageRectangle(im, x1, y1, x2, 127, black);
4255- }
4256-
4257- /* sites */
4258- for (i=s_mth; i<HISTSIZE; i++)
4259- {
4260- percent = ((float)data[i].site / (float)maxval);
4261- if (percent <= 0.0) continue;
4262- x1 = ci + co + ((i-s_mth)*cs);
4263- x2 = x1 + cw;
4264- y1 = 127 - (percent * 98);
4265- gdImageFilledRectangle(im, x1, y1, x2, 127, SITECOLOR);
4266- if (cw>2) gdImageRectangle(im, x1, y1, x2, 127, black);
4267- }
4268-
4269- fmaxval=0.0;
4270- for (i=s_mth; i<HISTSIZE; i++)
4271- if (data[i].xfer > fmaxval) fmaxval = data[i].xfer;
4272- if (fmaxval <= 0.0) fmaxval = 1.0;
4273- sprintf(maxvaltxt, "%.0f", fmaxval);
4274- gdImageStringUp(im, gdFontSmall,493,130+(strlen(maxvaltxt)*6),
4275- (unsigned char *)maxvaltxt,black);
4276-
4277- cs = 180.0/graph_mths; cw = (cs/2)+(co/2);
4278- ci = 308+((cw-co)/2);
4279-
4280- /* xfer */
4281- for (i=s_mth; i<HISTSIZE; i++)
4282- {
4283- percent = ((float)data[i].xfer / (float)fmaxval);
4284- if (percent <= 0.0) continue;
4285- x1 = ci+ ((i-s_mth)*cs);
4286- x2 = x1 + cw;
4287- y1 = 232 - (percent * 98);
4288- gdImageFilledRectangle(im, x1, y1, x2, 232, KBYTECOLOR);
4289- if (cw>2) gdImageRectangle(im, x1, y1, x2, 232, black);
4290- }
4291-
4292- /* stat the file */
4293- if ( !(lstat(fname, &out_stat)) )
4294- {
4295- /* check if the file a symlink */
4296- if ( S_ISLNK(out_stat.st_mode) )
4297- {
4298- if (verbose)
4299- fprintf(stderr,"%s %s (symlink)\n",msg_no_open,fname);
4300- return(EBADF);
4301- }
4302- }
4303-
4304- /* save PNG image */
4305- if ((out = fopen(fname, "wb")) != NULL)
4306- {
4307- gdImagePng(im, out);
4308- fclose(out);
4309- }
4310- /* deallocate memory */
4311- gdImageDestroy(im);
4312-
4313- return (0);
4314-}
4315-
4316-/*****************************************************************/
4317-/* */
4318-/* MONTH_GRAPH6 - Month graph with six data sets */
4319-/* */
4320-/*****************************************************************/
4321-
4322-#define YSIZE 400
4323-
4324-int month_graph6( char *fname, /* filename */
4325- char *title, /* graph title */
4326- int month, /* graph month */
4327- int year, /* graph year */
4328- u_int64_t data1[31], /* data1 (hits) */
4329- u_int64_t data2[31], /* data2 (files) */
4330- u_int64_t data3[31], /* data3 (sites) */
4331- double data4[31], /* data4 (kbytes) */
4332- u_int64_t data5[31], /* data5 (views) */
4333- u_int64_t data6[31]) /* data6 (visits) */
4334-{
4335-
4336- /* local variables */
4337- int i,j,s,x1,y1,x2;
4338- u_int64_t maxval=0;
4339- double fmaxval=0.0;
4340-
4341- /* calc julian date for month */
4342- julday = (jdate(1, month,year) % 7);
4343-
4344- /* initalize the graph */
4345- init_graph(title,512,400);
4346-
4347- gdImageLine(im, 21, 180, 490, 180, black); /* draw section lines */
4348- gdImageLine(im, 21, 179, 490, 179, white);
4349- gdImageLine(im, 21, 280, 490, 280, black);
4350- gdImageLine(im, 21, 279, 490, 279, white);
4351-
4352- /* index lines? */
4353- if (graph_lines)
4354- {
4355- y1=154/(graph_lines+1);
4356- for (i=0;i<graph_lines;i++)
4357- gdImageLine(im,21,((i+1)*y1)+25,489,((i+1)*y1)+25,dkgrey);
4358- y1=100/(graph_lines+1);
4359- for (i=0;i<graph_lines;i++)
4360- gdImageLine(im,21,((i+1)*y1)+180,489,((i+1)*y1)+180,dkgrey);
4361- for (i=0;i<graph_lines;i++)
4362- gdImageLine(im,21,((i+1)*y1)+280,489,((i+1)*y1)+280,dkgrey);
4363- }
4364-
4365- /* x-axis legend */
4366- for (i=0;i<31;i++)
4367- {
4368- if ((julday % 7 == 6) || (julday % 7 == 0))
4369- gdImageString(im,gdFontSmall,25+(i*15),382,
4370- (unsigned char *)numchar[i+1],HITCOLOR);
4371- else
4372- gdImageString(im,gdFontSmall,25+(i*15),382,
4373- (unsigned char *)numchar[i+1],black);
4374- julday++;
4375- }
4376-
4377- /* y-axis legend */
4378- for (i=0; i<31; i++)
4379- {
4380- if (data1[i] > maxval) maxval = data1[i]; /* get max val */
4381- if (data2[i] > maxval) maxval = data2[i];
4382- if (data5[i] > maxval) maxval = data5[i];
4383- }
4384- if (maxval <= 0) maxval = 1;
4385- sprintf(maxvaltxt, "%llu", maxval);
4386- gdImageStringUp(im, gdFontSmall,8,26+(strlen(maxvaltxt)*6),
4387- (unsigned char *)maxvaltxt,black);
4388-
4389- if (graph_legend) /* Print color coded legends? */
4390- {
4391- /* Kbytes Legend */
4392- gdImageStringUp(im,gdFontSmall,494,376,
4393- (unsigned char *)msg_h_xfer,dkgrey);
4394- gdImageStringUp(im,gdFontSmall,493,375,
4395- (unsigned char *)msg_h_xfer,KBYTECOLOR);
4396-
4397- /* Sites/Visits Legend */
4398- i = (strlen(msg_h_sites)*6);
4399- gdImageStringUp(im,gdFontSmall,494,276,
4400- (unsigned char *)msg_h_sites,dkgrey);
4401- gdImageStringUp(im,gdFontSmall,493,275,
4402- (unsigned char *)msg_h_sites,SITECOLOR);
4403- gdImageStringUp(im,gdFontSmall,494,276-i-3,(unsigned char *)"/",dkgrey);
4404- gdImageStringUp(im,gdFontSmall,493,275-i-3,(unsigned char *)"/",black);
4405- gdImageStringUp(im,gdFontSmall,494,276-i-12,
4406- (unsigned char *)msg_h_visits,dkgrey);
4407- gdImageStringUp(im,gdFontSmall,493,275-i-12,
4408- (unsigned char *)msg_h_visits,VISITCOLOR);
4409-
4410- /* Pages/Files/Hits Legend */
4411- s = ( i=(strlen(msg_h_pages)*6) )+
4412- ( j=(strlen(msg_h_files)*6) )+
4413- ( strlen(msg_h_hits)*6 )+ 52;
4414- gdImageStringUp(im,gdFontSmall,494,s,
4415- (unsigned char *)msg_h_pages,dkgrey);
4416- gdImageStringUp(im,gdFontSmall,493,s-1,
4417- (unsigned char *)msg_h_pages,PAGECOLOR);
4418- gdImageStringUp(im,gdFontSmall,494,s-i-3,(unsigned char *)"/",dkgrey);
4419- gdImageStringUp(im,gdFontSmall,493,s-i-4,(unsigned char *)"/",black);
4420- gdImageStringUp(im,gdFontSmall,494,s-i-12,
4421- (unsigned char *)msg_h_files,dkgrey);
4422- gdImageStringUp(im,gdFontSmall,493,s-i-13,
4423- (unsigned char *)msg_h_files,FILECOLOR);
4424- gdImageStringUp(im,gdFontSmall,494,s-i-j-15,(unsigned char *)"/",dkgrey);
4425- gdImageStringUp(im,gdFontSmall,493,s-i-j-16,(unsigned char *)"/",black);
4426- gdImageStringUp(im,gdFontSmall,494,s-i-j-24,
4427- (unsigned char *)msg_h_hits,dkgrey);
4428- gdImageStringUp(im,gdFontSmall,493,s-i-j-25,
4429- (unsigned char *)msg_h_hits,HITCOLOR);
4430- }
4431-
4432- /* data1 */
4433- for (i=0; i<31; i++)
4434- {
4435- percent = ((float)data1[i] / (float)maxval);
4436- if (percent <= 0.0) continue;
4437- x1 = 25 + (i*15);
4438- x2 = x1 + 7;
4439- y1 = 176 - (percent * 147);
4440- gdImageFilledRectangle(im, x1, y1, x2, 176, HITCOLOR);
4441- gdImageRectangle(im, x1, y1, x2, 176, black);
4442- }
4443-
4444- /* data2 */
4445- for (i=0; i<31; i++)
4446- {
4447- percent = ((float)data2[i] / (float)maxval);
4448- if (percent <= 0.0) continue;
4449- x1 = 27 + (i*15);
4450- x2 = x1 + 7;
4451- y1 = 176 - (percent * 147);
4452- gdImageFilledRectangle(im, x1, y1, x2, 176, FILECOLOR);
4453- gdImageRectangle(im, x1, y1, x2, 176, black);
4454- }
4455-
4456- /* data5 */
4457- for (i=0; i<31; i++)
4458- {
4459- if (data5[i]==0) continue;
4460- percent = ((float)data5[i] / (float)maxval);
4461- if (percent <= 0.0) continue;
4462- x1 = 29 + (i*15);
4463- x2 = x1 + 7;
4464- y1 = 176 - (percent * 147);
4465- gdImageFilledRectangle(im, x1, y1, x2, 176, PAGECOLOR);
4466- gdImageRectangle(im, x1, y1, x2, 176, black);
4467- }
4468-
4469- /* sites / visits */
4470- maxval=0;
4471- for (i=0; i<31; i++)
4472- {
4473- if (data3[i]>maxval) maxval = data3[i];
4474- if (data6[i]>maxval) maxval = data6[i];
4475- }
4476- if (maxval <= 0) maxval = 1;
4477- sprintf(maxvaltxt, "%llu", maxval);
4478- gdImageStringUp(im, gdFontSmall,8,180+(strlen(maxvaltxt)*6),
4479- (unsigned char *)maxvaltxt, black);
4480-
4481- /* data 6 */
4482- for (i=0; i<31; i++)
4483- {
4484- percent = ((float)data6[i] / (float)maxval);
4485- if (percent <= 0.0) continue;
4486- x1 = 25 + (i*15);
4487- x2 = x1 + 8;
4488- y1 = 276 - (percent * 92);
4489- gdImageFilledRectangle(im, x1, y1, x2, 276, VISITCOLOR);
4490- gdImageRectangle(im, x1, y1, x2, 276, black);
4491- }
4492-
4493- /* data 3 */
4494- for (i=0; i<31; i++)
4495- {
4496- percent = ((float)data3[i] / (float)maxval);
4497- if (percent <= 0.0) continue;
4498- x1 = 29 + (i*15);
4499- x2 = x1 + 7;
4500- y1 = 276 - (percent * 92);
4501- gdImageFilledRectangle(im, x1, y1, x2, 276, SITECOLOR);
4502- gdImageRectangle(im, x1, y1, x2, 276, black);
4503- }
4504-
4505- /* data4 */
4506- fmaxval=0.0;
4507- for (i=0; i<31; i++)
4508- if (data4[i]>fmaxval) fmaxval = data4[i];
4509- if (fmaxval <= 0.0) fmaxval = 1.0;
4510- sprintf(maxvaltxt, "%.0f", fmaxval/1024);
4511- gdImageStringUp(im, gdFontSmall,8,280+(strlen(maxvaltxt)*6),
4512- (unsigned char *)maxvaltxt, black);
4513-
4514- for (i=0; i<31; i++)
4515- {
4516- percent = data4[i] / fmaxval;
4517- if (percent <= 0.0) continue;
4518- x1 = 26 + (i*15);
4519- x2 = x1 + 10;
4520- y1 = 375 - ( percent * 91 );
4521- gdImageFilledRectangle(im, x1, y1, x2, 375, KBYTECOLOR);
4522- gdImageRectangle(im, x1, y1, x2, 375, black);
4523- }
4524-
4525- /* stat the file */
4526- if ( !(lstat(fname, &out_stat)) )
4527- {
4528- /* check if the file a symlink */
4529- if ( S_ISLNK(out_stat.st_mode) )
4530- {
4531- if (verbose)
4532- fprintf(stderr,"%s %s (symlink)\n",msg_no_open,fname);
4533- return(EBADF);
4534- }
4535- }
4536-
4537- /* save PNG image */
4538- if ((out = fopen(fname, "wb")) != NULL)
4539- {
4540- gdImagePng(im, out);
4541- fclose(out);
4542- }
4543- /* deallocate memory */
4544- gdImageDestroy(im);
4545-
4546- return (0);
4547-}
4548-
4549-/*****************************************************************/
4550-/* */
4551-/* DAY_GRAPH3 - Day graph with three data sets */
4552-/* */
4553-/*****************************************************************/
4554-
4555-int day_graph3( char *fname,
4556- char *title,
4557- u_int64_t data1[24],
4558- u_int64_t data2[24],
4559- u_int64_t data3[24])
4560-{
4561-
4562- /* local variables */
4563- int i,j,s,x1,y1,x2;
4564- u_int64_t maxval=0;
4565-
4566- /* initalize the graph */
4567- init_graph(title,512,256);
4568-
4569- /* index lines? */
4570- if (graph_lines)
4571- {
4572- y1=210/(graph_lines+1);
4573- for (i=0;i<graph_lines;i++)
4574- gdImageLine(im,21,((i+1)*y1)+25,489,((i+1)*y1)+25,dkgrey);
4575- }
4576-
4577- /* x-axis legend */
4578- for (i=0;i<24;i++)
4579- {
4580- gdImageString(im,gdFontSmall,33+(i*19),238,
4581- (unsigned char *)numchar[i],black);
4582- if (data1[i] > maxval) maxval = data1[i]; /* get max val */
4583- if (data2[i] > maxval) maxval = data2[i];
4584- if (data3[i] > maxval) maxval = data3[i];
4585- }
4586- if (maxval <= 0) maxval = 1;
4587- sprintf(maxvaltxt, "%llu", maxval);
4588- gdImageStringUp(im, gdFontSmall, 8, 26+(strlen(maxvaltxt)*6),
4589- (unsigned char *)maxvaltxt, black);
4590-
4591- if (graph_legend) /* print color coded legends? */
4592- {
4593- /* Pages/Files/Hits Legend */
4594- s = ( i=(strlen(msg_h_pages)*6) )+
4595- ( j=(strlen(msg_h_files)*6) )+
4596- ( strlen(msg_h_hits)*6 )+ 52;
4597- gdImageStringUp(im,gdFontSmall,494,s,
4598- (unsigned char *)msg_h_pages,dkgrey);
4599- gdImageStringUp(im,gdFontSmall,493,s-1,
4600- (unsigned char *)msg_h_pages,PAGECOLOR);
4601- gdImageStringUp(im,gdFontSmall,494,s-i-3,(unsigned char *)"/",dkgrey);
4602- gdImageStringUp(im,gdFontSmall,493,s-i-4,(unsigned char *)"/",black);
4603- gdImageStringUp(im,gdFontSmall,494,s-i-12,
4604- (unsigned char *)msg_h_files,dkgrey);
4605- gdImageStringUp(im,gdFontSmall,493,s-i-13,
4606- (unsigned char *)msg_h_files,FILECOLOR);
4607- gdImageStringUp(im,gdFontSmall,494,s-i-j-15,(unsigned char *)"/",dkgrey);
4608- gdImageStringUp(im,gdFontSmall,493,s-i-j-16,(unsigned char *)"/",black);
4609- gdImageStringUp(im,gdFontSmall,494,s-i-j-24,
4610- (unsigned char *)msg_h_hits,dkgrey);
4611- gdImageStringUp(im,gdFontSmall,493,s-i-j-25,
4612- (unsigned char *)msg_h_hits,HITCOLOR);
4613- }
4614-
4615- /* data1 */
4616- for (i=0; i<24; i++)
4617- {
4618- percent = ((float)data1[i] / (float)maxval); /* percent of 100% */
4619- if (percent <= 0.0) continue;
4620- x1 = 29 + (i*19);
4621- x2 = x1 + 10;
4622- y1 = 232 - (percent * 203);
4623- gdImageFilledRectangle(im, x1, y1, x2, 232, HITCOLOR);
4624- gdImageRectangle(im, x1, y1, x2, 232, black);
4625- }
4626-
4627- /* data2 */
4628- for (i=0; i<24; i++)
4629- {
4630- percent = ((float)data2[i] / (float)maxval); /* percent of 100% */
4631- if (percent <= 0.0) continue;
4632- x1 = 32 + (i*19);
4633- x2 = x1 + 10;
4634- y1 = 232 - (percent * 203);
4635- gdImageFilledRectangle(im, x1, y1, x2, 232, FILECOLOR);
4636- gdImageRectangle(im, x1, y1, x2, 232, black);
4637- }
4638-
4639- /* data3 */
4640- for (i=0; i<24; i++)
4641- {
4642- percent = ((float)data3[i] / (float)maxval); /* percent of 100% */
4643- if (percent <= 0.0) continue;
4644- x1 = 35 + (i*19);
4645- x2 = x1 + 10;
4646- y1 = 232 - (percent * 203);
4647- gdImageFilledRectangle(im, x1, y1, x2, 232, PAGECOLOR);
4648- gdImageRectangle(im, x1, y1, x2, 232, black);
4649- }
4650-
4651- /* stat the file */
4652- if ( !(lstat(fname, &out_stat)) )
4653- {
4654- /* check if the file a symlink */
4655- if ( S_ISLNK(out_stat.st_mode) )
4656- {
4657- if (verbose)
4658- fprintf(stderr,"%s %s (symlink)\n",msg_no_open,fname);
4659- return(EBADF);
4660- }
4661- }
4662-
4663- /* save PNG image */
4664- if ((out = fopen(fname, "wb")) != NULL)
4665- {
4666- gdImagePng(im, out);
4667- fclose(out);
4668- }
4669- /* deallocate memory */
4670- gdImageDestroy(im);
4671-
4672- return (0);
4673-}
4674-
4675-/*****************************************************************/
4676-/* */
4677-/* PIE_CHART - draw a pie chart (10 data items max) */
4678-/* */
4679-/*****************************************************************/
4680-
4681-int pie_chart(char *fname, char *title, u_int64_t t_val,
4682- u_int64_t data1[], char *legend[])
4683-{
4684- int i,x,percent,y=47;
4685- double s_arc=0.0;
4686- int purple_or_pie1, ltgreen_or_pie2, ltpurple_or_pie3, brown_or_pie4;
4687- int r, g, b;
4688- char buffer[128];
4689-
4690- struct pie_data gdata;
4691-
4692- /* init graph and colors */
4693- init_graph(title,512,300);
4694- r=getred(pie_color1); g=getgreen(pie_color1); b=getblue(pie_color1);
4695- purple_or_pie1 = gdImageColorAllocate(im, r, g, b);
4696- r=getred(pie_color2); g=getgreen(pie_color2); b=getblue(pie_color2);
4697- ltgreen_or_pie2 = gdImageColorAllocate(im, r, g, b);
4698- r=getred(pie_color3); g=getgreen(pie_color3); b=getblue(pie_color3);
4699- ltpurple_or_pie3= gdImageColorAllocate(im, r, g, b);
4700- r=getred(pie_color4); g=getgreen(pie_color4); b=getblue(pie_color4);
4701- brown_or_pie4 = gdImageColorAllocate(im, r, g, b);
4702-
4703- /* do the circle... */
4704- gdImageArc(im, CX, CY, XRAD, YRAD, 0, 360, black);
4705- gdImageArc(im, CX, CY+10, XRAD-2, YRAD-2, 2, 178, black);
4706- gdImageFillToBorder(im, CX, CY+(YRAD/2)+1, black, black);
4707-
4708- /* slice the pie */
4709- gdata=*calc_arc(0.0,0.0);
4710- gdImageLine(im,CX,CY,gdata.x,gdata.y,black); /* inital line */
4711-
4712- for (i=0;i<10;i++) /* run through data array */
4713- {
4714- if ((data1[i]!=0)&&(s_arc<1.0)) /* make sure valid slice */
4715- {
4716- percent=(((double)data1[i]/t_val)+0.005)*100.0;
4717- if (percent<1) break;
4718-
4719- if (s_arc+((double)percent/100.0)>=1.0)
4720- {
4721- gdata=*calc_arc(s_arc,1.0);
4722- s_arc=1.0;
4723- }
4724- else
4725- {
4726- gdata=*calc_arc(s_arc,s_arc+((double)percent/100.0));
4727- s_arc+=(double)percent/100.0;
4728- }
4729-
4730- gdImageLine(im, CX, CY, gdata.x, gdata.y, black);
4731- gdImageFill(im, gdata.mx, gdata.my, i+5);
4732-
4733- snprintf(buffer,sizeof(buffer),"%s (%d%%)",legend[i], percent);
4734- x=480-(strlen(buffer)*7);
4735- gdImageString(im,gdFontMediumBold, x+1, y+1,
4736- (unsigned char *)buffer, black);
4737- gdImageString(im,gdFontMediumBold, x, y,
4738- (unsigned char *)buffer, i+5);
4739- y+=20;
4740- }
4741- }
4742-
4743- if (s_arc < 1.0) /* anything left over? */
4744- {
4745- gdata=*calc_arc(s_arc,1.0);
4746-
4747- gdImageFill(im, gdata.mx, gdata.my, white);
4748- snprintf(buffer,sizeof(buffer),"%s (%d%%)",
4749- msg_h_other,100-(int)(s_arc*100));
4750- x=480-(strlen(buffer)*7);
4751- gdImageString(im,gdFontMediumBold, x+1, y+1,
4752- (unsigned char *)buffer, black);
4753- gdImageString(im,gdFontMediumBold, x, y,
4754- (unsigned char *)buffer, white);
4755- }
4756-
4757- /* stat the file */
4758- if ( !(lstat(fname, &out_stat)) )
4759- {
4760- /* check if the file a symlink */
4761- if ( S_ISLNK(out_stat.st_mode) )
4762- {
4763- if (verbose)
4764- fprintf(stderr,"%s %s (symlink)\n",msg_no_open,fname);
4765- return(EBADF);
4766- }
4767- }
4768-
4769- /* save PNG image */
4770- if ((out = fopen(fname, "wb")) != NULL)
4771- {
4772- gdImagePng(im, out);
4773- fclose(out);
4774- }
4775- /* deallocate memory */
4776- gdImageDestroy(im);
4777-
4778- return (0);
4779-}
4780-
4781-/*****************************************************************/
4782-/* */
4783-/* CALC_ARC - generate x,y coordinates for pie chart */
4784-/* */
4785-/*****************************************************************/
4786-
4787-struct pie_data *calc_arc(float min, float max)
4788-{
4789- static struct pie_data data;
4790- double d;
4791-
4792- /* Calculate max line */
4793- d=max;
4794- data.x=cos(d*(2*PI))*((XRAD-2)/2)+CX;
4795- data.y=sin(d*(2*PI))*((YRAD-2)/2)+CY;
4796- /* Now get mid-point */
4797- d=((min+max)/2);
4798- data.mx=cos(d*(2*PI))*(XRAD/3)+CX;
4799- data.my=sin(d*(2*PI))*(YRAD/3)+CY;
4800- return &data;
4801-}
4802-
4803-/*****************************************************************/
4804-/* */
4805-/* INIT_GRAPH - initalize graph and draw borders */
4806-/* */
4807-/*****************************************************************/
4808-
4809-void init_graph(char *title, int xsize, int ysize)
4810-{
4811- int i, r, g, b;
4812-
4813- im = gdImageCreate(xsize,ysize);
4814-
4815- /* allocate color maps, background color first (grey) */
4816- grey = gdImageColorAllocate(im, 192, 192, 192);
4817- dkgrey = gdImageColorAllocate(im, 128, 128, 128);
4818- black = gdImageColorAllocate(im, 0, 0, 0);
4819- white = gdImageColorAllocate(im, 255, 255, 255);
4820- blue = gdImageColorAllocate(im, 0, 0, 255);
4821- r=getred(hit_color); g=getgreen(hit_color); b=getblue(hit_color);
4822- hit_or_green = gdImageColorAllocate(im, r, g, b);
4823- r=getred(site_color); g=getgreen(site_color); b=getblue(site_color);
4824- site_or_orange = gdImageColorAllocate(im, r, g, b);
4825- r=getred(file_color); g=getgreen(file_color); b=getblue(file_color);
4826- file_or_blue = gdImageColorAllocate(im, r, g, b);
4827- r=getred(kbyte_color); g=getgreen(kbyte_color); b=getblue(kbyte_color);
4828- kbyte_or_red = gdImageColorAllocate(im, r, g, b);
4829- r=getred(page_color); g=getgreen(page_color); b=getblue(page_color);
4830- page_or_cyan = gdImageColorAllocate(im, r, g, b);
4831- r=getred(visit_color); g=getgreen(visit_color); b=getblue(visit_color);
4832- visit_or_yellow = gdImageColorAllocate(im, r, g, b);
4833-
4834- /* black outside border */
4835- gdImageRectangle(im, 0, 0, xsize-1, ysize-1, black);
4836-
4837- /* do shadow effect (bevel) border */
4838- for (i=1; i<5 ;i++)
4839- {
4840- gdImageLine(im, i, i, xsize-i-2, i, white);
4841- gdImageLine(im, i, i, i, ysize-i-2, white);
4842- gdImageLine(im, i+1, ysize-i-1, xsize-i-1, ysize-i-1, dkgrey);
4843- gdImageLine(im, xsize-i-1, i+1, xsize-i-1, ysize-i-1, dkgrey);
4844- }
4845-
4846- /* generic inside shadow box */
4847- gdImageRectangle(im, 20, 25, xsize-21, ysize-21, black);
4848- gdImageRectangle(im, 19, 24, xsize-22, ysize-22, white);
4849-
4850- /* display the graph title */
4851- gdImageString(im, gdFontMediumBold, 20, 8,
4852- (unsigned char *)title, blue);
4853-
4854- return;
4855-}
4856-
4857-/****************************************************************/
4858-/* */
4859-/* ASHEX2INT - ASCII HEX TO INT CONVERTER */
4860-/* */
4861-/****************************************************************/
4862-
4863-int ashex2int(char *str)
4864-{
4865- /* returns base-10 integer value from a 2 ASCII hex number */
4866- return from_hex(str[1])+(from_hex(str[0])*16);
4867-}
4868
4869=== removed file '.pc/05_apache_logio.diff/graphs.h'
4870--- .pc/05_apache_logio.diff/graphs.h 2012-02-05 16:21:18 +0000
4871+++ .pc/05_apache_logio.diff/graphs.h 1970-01-01 00:00:00 +0000
4872@@ -1,10 +0,0 @@
4873-#ifndef _GRAPHS_H
4874-#define _GRAPHS_H
4875-
4876-extern int month_graph6(char *, char *, int, int, u_int64_t *,
4877- u_int64_t *, u_int64_t *, double *, u_int64_t *, u_int64_t *);
4878-extern int year_graph6x(char *, char *, struct hist_rec *);
4879-extern int day_graph3(char *, char *, u_int64_t *, u_int64_t *, u_int64_t *);
4880-extern int pie_chart(char *, char *, u_int64_t, u_int64_t *, char **);
4881-
4882-#endif /* _GRAPHS_H */
4883
4884=== removed file '.pc/05_apache_logio.diff/hashtab.c'
4885--- .pc/05_apache_logio.diff/hashtab.c 2012-05-08 21:58:08 +0000
4886+++ .pc/05_apache_logio.diff/hashtab.c 1970-01-01 00:00:00 +0000
4887@@ -1,1254 +0,0 @@
4888-/*
4889- webalizer - a web server log analysis program
4890-
4891- Copyright (C) 1997-2013 Bradford L. Barrett
4892-
4893- This program is free software; you can redistribute it and/or modify
4894- it under the terms of the GNU General Public License as published by
4895- the Free Software Foundation; either version 2 of the License, or
4896- (at your option) any later version, and provided that the above
4897- copyright and permission notice is included with all distributed
4898- copies of this or derived software.
4899-
4900- This program is distributed in the hope that it will be useful,
4901- but WITHOUT ANY WARRANTY; without even the implied warranty of
4902- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4903- GNU General Public License for more details.
4904-
4905- You should have received a copy of the GNU General Public License
4906- along with this program; if not, write to the Free Software
4907- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
4908-
4909-*/
4910-
4911-/*********************************************/
4912-/* STANDARD INCLUDES */
4913-/*********************************************/
4914-
4915-#include <time.h>
4916-#include <stdio.h>
4917-#include <stdlib.h>
4918-#include <string.h>
4919-#include <unistd.h> /* normal stuff */
4920-#include <ctype.h>
4921-#include <sys/utsname.h>
4922-
4923-/* ensure sys/types */
4924-#ifndef _SYS_TYPES_H
4925-#include <sys/types.h>
4926-#endif
4927-
4928-/* some need for uint* */
4929-#ifdef HAVE_STDINT_H
4930-#include <stdint.h>
4931-#endif
4932-
4933-/* need socket header? */
4934-#ifdef HAVE_SYS_SOCKET_H
4935-#include <sys/socket.h>
4936-#endif
4937-
4938-/* some systems need this */
4939-#ifdef HAVE_MATH_H
4940-#include <math.h>
4941-#endif
4942-
4943-#include "webalizer.h" /* main header */
4944-#include "lang.h"
4945-#include "linklist.h"
4946-#include "hashtab.h"
4947-
4948-/* internal function prototypes */
4949-
4950-HNODEPTR new_hnode(char *); /* new host node */
4951-UNODEPTR new_unode(char *); /* new url node */
4952-RNODEPTR new_rnode(char *); /* new referrer node */
4953-ANODEPTR new_anode(char *); /* new user agent node */
4954-SNODEPTR new_snode(char *); /* new search string.. */
4955-INODEPTR new_inode(char *); /* new ident node */
4956-#ifdef USE_DNS
4957-DNODEPTR new_dnode(char *); /* new DNS node */
4958-#endif /* USE_DNS */
4959-
4960-void update_entry(char *); /* update entry/exit */
4961-void update_exit(char *); /* page totals */
4962-
4963-unsigned int hash(char *); /* hash function */
4964-
4965-/* local data */
4966-
4967-HNODEPTR sm_htab[MAXHASH]; /* hash tables */
4968-HNODEPTR sd_htab[MAXHASH];
4969-UNODEPTR um_htab[MAXHASH]; /* for hits, sites, */
4970-RNODEPTR rm_htab[MAXHASH]; /* referrers and agents... */
4971-ANODEPTR am_htab[MAXHASH];
4972-SNODEPTR sr_htab[MAXHASH]; /* search string table */
4973-INODEPTR im_htab[MAXHASH]; /* ident table (username) */
4974-#ifdef USE_DNS
4975-DNODEPTR host_table[MAXHASH]; /* DNS hash table */
4976-#endif /* USE_DNS */
4977-
4978-/*********************************************/
4979-/* DEL_HTABS - clear out our hash tables */
4980-/*********************************************/
4981-
4982-void del_htabs()
4983-{
4984- del_hlist(sd_htab); /* Clear out our various */
4985- del_ulist(um_htab); /* hash tables here by */
4986- del_hlist(sm_htab); /* calling the appropriate */
4987- del_rlist(rm_htab); /* del_* fuction for each */
4988- del_alist(am_htab);
4989- del_slist(sr_htab);
4990- del_ilist(im_htab);
4991-#ifdef USE_DNS
4992-/* del_dlist(host_table); */ /* delete DNS hash table */
4993-#endif /* USE_DNS */
4994-}
4995-
4996-/*********************************************/
4997-/* NEW_HNODE - create host node */
4998-/*********************************************/
4999-
5000-HNODEPTR new_hnode(char *str)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: