]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
This commit was generated by cvs2svn to compensate for changes in r2,
authorGuido Serassio <serassio@users.sourceforge.net>
Sun, 17 Jul 2005 19:30:28 +0000 (19:30 +0000)
committerGuido Serassio <serassio@users.sourceforge.net>
Sun, 17 Jul 2005 19:30:28 +0000 (19:30 +0000)
which included commits to RCS files with non-trunk default branches.

104 files changed:
BETA-TESTERS [new file with mode: 0644]
CONTRIBUTORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
DONATIONS [new file with mode: 0644]
LICENSE [new file with mode: 0644]
Makefile.in [new file with mode: 0644]
README [new file with mode: 0644]
auth.c [new file with mode: 0644]
authfail.c [new file with mode: 0644]
cfgaux/config.guess [new file with mode: 0755]
cfgaux/config.sub [new file with mode: 0755]
cfgaux/install-sh [new file with mode: 0755]
cfgaux/ll.novo [new file with mode: 0755]
charset.c [new file with mode: 0644]
configure [new file with mode: 0755]
configure.in [new file with mode: 0644]
convlog.c [new file with mode: 0644]
css.c [new file with mode: 0644]
css.tpl [new file with mode: 0644]
dansguardian_log.c [new file with mode: 0644]
dansguardian_report.c [new file with mode: 0644]
datafile.c [new file with mode: 0644]
decomp.c [new file with mode: 0644]
denied.c [new file with mode: 0644]
download.c [new file with mode: 0644]
email.c [new file with mode: 0644]
exclude.c [new file with mode: 0644]
exclude_codes [new file with mode: 0644]
fonts/FreeSans.ttf [new file with mode: 0644]
fonts/README [new file with mode: 0644]
fonts/license [new file with mode: 0644]
getconf.c [new file with mode: 0644]
grepday.c [new file with mode: 0644]
htaccess [new file with mode: 0644]
html.c [new file with mode: 0644]
images/datetime.png [new file with mode: 0644]
images/graph.png [new file with mode: 0644]
images/sarg-squidguard-block.png [new file with mode: 0644]
images/sarg.png [new file with mode: 0644]
include/conf.h [new file with mode: 0755]
include/defs.h [new file with mode: 0755]
include/extern.h [new file with mode: 0755]
include/info.h [new file with mode: 0755]
index.c [new file with mode: 0644]
indexonly.c [new file with mode: 0644]
ip2name.c [new file with mode: 0644]
language.c [new file with mode: 0644]
languages/.new [new file with mode: 0755]
languages/Bulgarian_windows1251 [new file with mode: 0644]
languages/Catalan [new file with mode: 0644]
languages/Czech [new file with mode: 0644]
languages/Dutch [new file with mode: 0644]
languages/English [new file with mode: 0644]
languages/French [new file with mode: 0644]
languages/German [new file with mode: 0644]
languages/Greek [new file with mode: 0644]
languages/Hungarian [new file with mode: 0644]
languages/Indonesian [new file with mode: 0644]
languages/Italian [new file with mode: 0644]
languages/Japanese [new file with mode: 0644]
languages/Latvian [new file with mode: 0644]
languages/Polish [new file with mode: 0644]
languages/Portuguese [new file with mode: 0644]
languages/Romanian [new file with mode: 0644]
languages/Russian_koi8 [new file with mode: 0644]
languages/Russian_windows1251 [new file with mode: 0644]
languages/Serbian [new file with mode: 0644]
languages/Slovak [new file with mode: 0644]
languages/Spanish [new file with mode: 0644]
languages/Turkish [new file with mode: 0644]
languages/Ukrainian_windows1251 [new file with mode: 0644]
lastlog.c [new file with mode: 0644]
log.c [new file with mode: 0644]
patches/oleg [new file with mode: 0644]
patches/oleg1 [new file with mode: 0644]
patches/oleg2 [new file with mode: 0644]
patches/oleg4 [new file with mode: 0644]
repday.c [new file with mode: 0644]
report.c [new file with mode: 0644]
sarg-php/COPYING [new file with mode: 0644]
sarg-php/INSTALL [new file with mode: 0644]
sarg-php/LANGUAGES [new file with mode: 0644]
sarg-php/language.php [new file with mode: 0755]
sarg-php/sarg-block-it.php [new file with mode: 0755]
sarg-php/sarg-squidguard-block.php [new file with mode: 0755]
sarg-php/sarg-squidguard-block2.php [new file with mode: 0755]
sarg-php/style.php [new file with mode: 0755]
sarg-php/translate.this [new file with mode: 0644]
sarg.1 [new file with mode: 0644]
sarg.conf [new file with mode: 0644]
siteuser.c [new file with mode: 0644]
smartfilter.c [new file with mode: 0644]
sort.c [new file with mode: 0644]
splitlog.c [new file with mode: 0644]
squidguard_log.c [new file with mode: 0644]
squidguard_report.c [new file with mode: 0644]
topsites.c [new file with mode: 0644]
topuser.c [new file with mode: 0644]
totday.c [new file with mode: 0644]
totger.c [new file with mode: 0644]
usage.c [new file with mode: 0644]
useragent.c [new file with mode: 0644]
util.c [new file with mode: 0644]

diff --git a/BETA-TESTERS b/BETA-TESTERS
new file mode 100644 (file)
index 0000000..4fdd88e
--- /dev/null
@@ -0,0 +1,6 @@
+Special thanks to this friends that have spent time to test sarg before the final release:
+
+Francesco Collini <collini@colliniconsulting.it>
+Renato Leon <rl_sita@hotmail.com>
+Guilherme Veloso Neves Oliveira <velosologan@gmail.com>
+Michael da Silva Pereira <michael@tradepage.co.za>
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
new file mode 100644 (file)
index 0000000..225739a
--- /dev/null
@@ -0,0 +1,51 @@
+Francesco Collini <collini@colliniconsulting.it>
+Renato Leon <rl_sita@hotmail.com>
+Alp <support@x5.net>
+Andreas Piesk <a.piesk@gmx.net>
+Andrew <andrew@extrim.ru>
+Andrew Barnes <a.barnes@kaldor.com.au>
+Carlos Canau <canau@ionia.EUnet.pt>
+Carlos Santillana <carlos@los-fresnos-cons.k12.tx.us>
+Csaba Kabai <ckabai@icnpharm.com>
+Dima I. Allaverdov <allav@ur.rags.ru>
+Eugeny Kuzakov <CoreDumped@CoreDumped.null.ru>
+Evren Yurtesen <yurtesen@ispro.net.tr>
+Hanni Daniel <daniel.haenni@softlab.ch>
+Ilya V. Komarov <mur@mur.lynx.ru>
+Jose Luiz <jluiz@projesom.com.br>
+Lee Shakespeare <lee@webfoundry.co.uk>
+Leonardo A. D'Angelo <ldangelo@san-cayetano.com>
+Manon Goo <manon@manon.de>
+Matteo Colombo <matteo@calcol.it>
+Maxim Berlin <mak@unesco.mitht.rssi.ru>
+Palamarchuk Eugen <eugen@cit.od.ukrtel.net>
+Patrick Darden <darden@server2.armc.org>
+Rick_Barzilli@xircom.com
+Ryan Roehrich <ryanscott@mindless.com>
+Steve Chan <Steve.Chan@lucasfilm.com>
+Tony Lorimes <alorimes@csc.com>
+Wayne Bastow <wbastow@ccahs.health.nsw.gov.au>
+drdivano@mail.axon.ru
+Seth Mos <stimpy@stimpy.multiweb.nl>
+Carlo Marcelo Arenas Belon <carenas@chasqui.lared.net.pe>
+Milos Prudek <prudek@nembv.cz>
+Pavel Jezek <Pavel.Jezek@i.cz>
+Kenneth Ingham <ingham@i-pi.com>
+Schlosser, Carsten ECOFIS <c.schlosser@ecofis.de>
+Andrew Katkov <askat@crimea.net>
+Andy Parfenov <andy@nursat.net>
+Bernd Kossmann <bko@shd.de>
+Ivan Minchev <vanko@uni-svishtov.bg>
+Olivier Rousselot <olivier.rousselot@ssti.fr>
+Akira Kitamura <click@anet.ne.jp> Takamatsu-City Kagawa Japan.
+Radovan Drobnjakovic <admin.rts@rts.co.yu>
+Brad Guillory <proxyadm@baileylink.net>
+Andrew Okhmat <andy@crgu.com>
+Nikolai V. Ivanyushin <koko@infocenter.bryansk.ru>
+Wszebor Boksa <Wszebor_Boksa@koncept.pl>
+Adi Cretu <adi@usv.ro>
+Roman Vynar <rvynar@icqmail.com>
+Andreu Sanchez <tanis@lleida.com>
+Joe Cooper <joe@swelltech.com>
+Guilherme Veloso Neves Oliveira <velosologan@gmail.com>
+Filippo Grassilli
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..a43ea21
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+       Appendix: How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..7c1c55a
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,753 @@
+SARG ChangeLog
+
+May/29/2005    version 2.0.8
+               - verdana.ttf font removed to avoid patent infringement issues.
+                 Now sarg uses a GPL FreeSans font from http://savannah.gnu.org
+               - ISA report with wrong date in date/time report.
+                       Thanks to Richard Berndt
+               - connect records ignored when using emulate_http_log on in squid.conf file.
+                       Thanks to Dusan Woletz
+               - bug that prevents the correct usage of switch -d <date1-date2> when using
+                       an "emulate_httpd_log on" logfile and some performance improvements
+                       added.
+                       Thanks to Filippo Grassilli
+               - Spanish language fixed by José Luis Hernández López. Thanks.
+               - url variable size changed to acomodate big urls with coded symbols and some
+                 minor changes in util.c file.
+                       Thanks to Oleg <xsov@mail.ru>
+               - download suffixes improved by Oleg <xsov@mail.ru>. Thanks.
+                       Now sarg uses these suffixes:
+                          7z,ace,arj,avi,bat,bin,bz2,bzip,cab,com,cpio,dll,doc,dot,exe,gz,iso,
+                          lha,lzh,mdb,mov,mp3,mpeg,mpg,mso,nrg,ogg,ppt,rar,rtf,shs,src,sys,tar,
+                          tgz,vcd,vob,wma,wmv,zip
+
+May/02/2005    version 2.0.7
+               - DansGuardian report added.
+                       Thanks to Adolfas Kupliauskas for the access.log
+               - Slovak language added by Dusan Woletz
+                       Thank you               
+               - wrong usertab user on topuser report.
+                       Thanks to Marcos Favoretto
+               - ntlm_user_format added to sarg.conf. Now you can choose the following formats
+                 for the username on reports: user|domainname+user
+                       Suggested by Roger Favero
+               - exclude_users ignored in some situations.
+               - Fixes by Sapon Oleg from Russia:
+                  . there are two equal lines about Evren Yurtesen in CONTRIBUTORS file.
+                  . Internationalisation of SARG user graph added, using iconv function, which
+                    is presented only in Linux, so I add required #ifdef and other stuff to clean
+                    compile code on other platforms.
+                  . Fixed two issues:
+                       - '?' symbol problems for apache and other cgi-supporting web server which
+                         doesn't support '?' symbol in links (all of them interprete this like 
+                         parameter to cgi script);
+                       - some good optimization to all three similar cicles in these files by 
+                         reducing false checks in 'if ...' strings.
+                  . Fixes segfault, produced by inproper use of strncpy functions, look - strncpy 
+                    doesn't copy leading '\0' symbol!
+                  . Just localisation support for repday report.
+                  . Support usertab IP->USERNAME change in siteuser report.
+                  . Just proper Russian koi8 localisation.
+
+Apr/22/2005    version 2.0.6
+               - Greek language by Antonis Maglaras <vegos@magla.gr>
+                       Thank you.
+               - time period added to -t option. Now you can use -t HH-HH, HH:MM-HH:MM
+               - support to isa proxy 2004 log added.
+                       Thanks to William da Rocha Lima <wrochal@linuxit.com.br>
+               - French language fixed by Alexey Znamerovskiy <alexz@everys.com>
+                       Thanks
+               - internal LC_ALL=C removed to avoid errors on Solaris.
+                       Thanks to Hraska, Frantisek <frantisek.hraska@hupro.sk>
+               - non authenticated records removed from Topuser report.
+                       Thanks to Brian <brian@reginachristianschool.org>
+               - Compilation error on FreeBSD > 5 - log.c:645: error: `RLIMIT_OFILE' undeclared
+               - Sarg abbreviation values improved.
+
+Mar/21/2005    version 2.0.5
+               - fixed: some changes to avoid segmentation fault.
+               - fixed: some changes to avoid compilation errors on freeBSD.
+               - fixed: exclude_hosts not excluding correctly.
+
+Feb/17/2005    version 2.0.4
+               - exclude hosts not excluding correctly.
+                       Thanks to Oleg
+               - download report showing jpeg files.
+               - support to Microsoft isa proxy log files added.
+                       Thanks to Trankov Vladislav <vtrankov@kb-obibank.ru>
+               - fixed: error when using relative paths in -o and -w options. Just absolute paths
+                       can be used now.
+                       Thanks to Andreas Grosse <andi@majestyk.de>
+               - fixed: segfault fix in vrfydir() in util.c
+                        Prevent buffer overflow in subs(); replace one constant with sizeof() in my_lltoa().
+                        vrfydir(): fix segfault if sub-directory "images" is not exists
+                        function builddia() don't check the parameters. Result: segmentation fault in some cases.
+                       Thanks to Stas Degteff stas_degteff@users.sourceforge.net for the fixes.
+               - fixed: wrond date period in squidguard_log when using european date format.
+                       Thanks to Guenther Mair <gunnyst@users.sourceforge.net>
+               - ulimit tag added on sarg.conf to avoid "Too many open files" error.
+                       Thanks to Paulo Pires <paulo.pires@vodafone.pt>
+
+
+Feb/02/2005    verion 2.0.3
+               - squidguard parse logs method changed.
+                       Thanks to Joao Mendes <jmendes@credibom.pt>
+                       Thanks to Guenther Mair <gunnyst@users.sourceforge.net>
+               - wrong results in -v option.
+               - fixed: error when using -u (include user)
+                       Thanks to Bochkarev Vladimi <bochkarev@expocentr.ru>
+               - export LC_ALL=C will be issued before sort to avoid high cpu usage
+
+Nov/22/2004:    version 2.0.2
+               - grepday with invalid font path.
+                       Thanks to Marcelo Ricardo Leitner <mrl@conectiva.com.br>
+               - -v option added to display Sarg version on console
+               - Segmenation fault caused by an unclosed file.
+                       Thanks to Pustovalov Leonid
+               - SquidGuard log formats added.
+                       Thanks to Kolotov Alexandr
+               - time field added to topsites report
+                       Thanks to Miles Roper <mroper@westcoastdhb.org.nz>
+               - fixtime function with wrong definition, changed to long long
+                       Thanks to Valery from Russia
+               - Solaris 9 compiling error: error: conflicting types for 'my_mkdir'
+                       Thanks to Brad Larden <Brad.Larden@alphawest.com.au>
+               - segfaults if the denied report is disabled in sarg.conf.
+                       Thanks to Filippo Carletti <filippo.carletti@nethesis.it>
+               - reading performance improved by Francesco Perrillo <fperillo@totalfax.it>
+                       Thanks
+               - Russian sarg-php translation added.
+                       Thanks to Michael Stepanenko <mistic@ecolines.ru>
+
+
+Oct/04/2004:    version 2.0.1   
+               - configure error with no gd installed.
+               - graph with no text when using --enable-sysconfdir
+               - graph day incorrect when using dd/mm/yy date format
+               - show_sarg_logo yes|no added
+               - site_user_time_date with wrong patch. 
+                       Thanks to Ricardo R. Hoffmann <hoffmann@uninet.com.br>
+
+
+Sep/29/2004: -  version 2.0
+                       - Internal/External css implemented
+                       - User authentication access (htaccess) implemented
+                       - large file support added
+                       - Report limits implemented
+                       - Download report implemented
+                       - Sarg logo by Osamu Matsuzaki <matsu_o@robata.org> added.
+                       - Internal mkdir added to easy port to various plataform.
+                       - long url now show only accessed site and module name.
+                       - now you can add a user report url to a flat file to be blocked
+                         by some Squid acl. 
+                               Request by Francesco Collini <collini@colliniconsulting.it>
+                       - remove temporary files, if already exist, to avoid conflits with a 
+                         previous sarg process..
+                               Thanks to Renato Leon <rl_sita@hotmail.com>
+                       - squidGuard improved
+                               - now only records with the same period from access.log
+                                 will be in squidGuard report.
+                               - squidGuard limit report
+                               - now you can save some urls in squidGuard db using
+                                 sarg-squidguard PHP utility.
+
+               bug fixed: fault caused by rewinddir after closedir. 
+                       Thanks to Lucas Bocchi <challado@ibocchi.com.br>
+                          and to Freek
+                Fixed:  - missing </body> tags in all HTML pages
+                        - missing </html> tag in some HTML pages
+                        - missing DOCTYPE in all HTML pages
+                        - grammar in man page
+                        - URL Links to SourceForge http://sarg.sourceforge.net/
+                Added:  - Included more detailed information in man the page
+                           Thanks to Billy Newsom of U.S.
+                To Do:  - There are still major validation problems in the HTML generated
+
+
+Apr/25/2003: -  fixed:  - link error to denied site in squidGuard report 
+                        - resolve name error in squidGuard report 
+                        - some fixes to HPUX. Thanks to Miles Roper <mroper@westcoastdhb.org.nz>
+                        - index_sort_order tag don't work correctly.
+                        - too many open files fixed. Thanks to Francesco Perrillo <fperillo@totalfax.it>
+                        - Ukrainian_windows1251 included in sarg.conf file
+                        - exclude_string don´t work correctly. Thanks to Modric Kristijan 
+                                       <Kristijan.Modric@pliva.hr>
+                             
+Mar/17/2003: -  Release 1.4
+               Added:  Now you can choose the fields that will be in User Reports.
+                       Look at user_report_fields tag in sarg.conf file
+                       Implementation requested by Daniel T. Joye <daniel@dragontail.com>
+
+                Added:         Now sarg saves the processed log in a sarg format after parsing
+                       the squid log file. This allow futures sarg reprocess and data 
+                       will be smaller than Squid the log files
+                        Look at parsed_output_log directory and
+                               parsed_output_log_compress tags in sarg.conf file
+                       Implementation requested by Joe Cooper <joe@swelltech.com>.
+                               Many thanks for the donation.
+
+                Added:  Now sarg can display the report values in abbreviation format.
+                       Look at displayed_values in sarg.conf
+
+               Added:  Ukrainian_windows1251 language by Roman Vynar <rvynar@icqmail.com>
+                       Thank you.
+
+               Added:  Catalan language by Andreu Sanchez <tanis@lleida.com>
+                       Thank you.
+
+Nov/16/2002: -  Fixed: squidGuard report fail with non authenticated users.
+                       Thanks to Dan Ratzlaff <norb@norbysoft.com>
+                Fixed: Turkish language by Evren Yurtesen 
+                               <yurtesen@ispro.net.tr>. Thanks
+                Fixed: English language by Luigi Gangitano
+                       <gangitano@lugroma3.org>. Thanks
+                Fixed: "CONNECT" average values are incorrectly calculated.
+                        Arvids <arvids@vendomar.lv>. Thanks
+
+Oct/15/2002: -  Added: sarg man page created by Luigi Gangitano 
+                       <gangitano@lugroma3.org>
+               Added: Reading statistics, show_read_statistics tag
+                Added: Index sort order. See index_sort_order tag
+               Added: squidGuard report - squidguard_log_path tag
+               Added: show_sarg_info on report bottom optional - show_sarg_info tag
+               Changed: gzipped file will be decompressed using zcat
+                        bzipped file will be decompressed using bzcat
+                Changed: new sort routine added.
+               Changed: strsep changed to getnumlist function by Robert Tiismus
+
+Jun/02/2002: -  Added: save the results in a flat file to use to populate some
+                      database. Look at these tags in sarg.conf file:
+                         TAG: datafile file
+                        TAG: datafile_delimiter ";"
+                         TAG: datafile_fields all
+               Added: logic to detect a broken record in access.log file
+                      and ignore it.
+               Added: now you can select the records to be processed by
+                      week and/or time using these tags in sarg.conf file:
+                        TAG: weekdays
+                        TAG: hours
+                      Thanks to Robert Tiismus from Institute of Physics, 
+                             University of Tartu, Estonia. 
+                             <robert@fi.tartu.ee>, and for the repday.c
+                             improvements.
+
+Apr/03/2002: -  bug fixed: cannot create temporary file when url contain '/'
+                   and using long_url
+                  Thanks to Enrico Sorge <enrico.sorge@activevr.it>
+
+Dez/10/2001: -  Added: sarg now shows statistics when readding the log file
+                      if running with -x option
+
+Dez/05/2001: -  bug fixed: - loop proccess when using "tmp" chars in usernames
+                  Thanks to Jasper vd Heijden <extern@midkemia.nl>
+               new tag added: show_successful_message yes
+                  Show "Successful report generated on dir" message at end of process.
+                       Requested by: Wendell Schubert <wendell@webeworld.com>
+                                     Mauricio Felizardo dos Santos <mfelizardo@ansett.com.br>
+               bug fixed: core dump when removing auth_failures report from
+                          report_type tag.
+                  Thanks to Leonardo Rodrigues <coelho@persogo.com.br>
+               bug fixed: core dump with a big number of users.
+                  Thanks to Zverev, Alexandr V. <AVZverev@rtc.tnk.ru>
+               new tags added: topuser_fields
+                                topuser_num
+                  Now you can choose which fields must be in Topuser report and how many users.
+                  Requested by Hidde Beumer <Hidde.Beumer@cmg.nl>
+               bug fiexed: auth_failures report missing
+                  Thanks to Clary Harridge <clary@csee.uq.edu.au>
+               Polish language added by Wszebor Boksa <Wszebor_Boksa@koncept.pl>
+                  Thank you.
+               Romanian language added by Adi Cretu <adi@usv.ro>
+                  Thank you.
+
+Jul/03/2001: -  new report added: site/user/date/time
+                  Now report_type tag has the following default setup:
+                   report_type topsites sites_users date_time denied auth_failures site_user_date_time
+             -  bug fixed - error when using squid-ntlm authenticator (domain\user)
+                               Thanks to Jakob Curdes <jc@info-systems.de>
+                         - ignoring changes in report_type tag
+                         - Site&Users report with users shifted down one row.
+                               Thanks to Jason Urkow <jaque@telusplanet.net>
+                         - some temporary files not removed.
+                         - site/user/date/time report without </table> and </html>
+
+May/30/2001: - bug fixed: - user table garbage
+                         - chmod 644 removed from makefile
+                         - ignoring first user in usertable
+                         - ignoring users names with dots (".")
+                               Thanks to Daniel Malmgren <daniel@leeloo.lund.se>
+                         - same values for connect and bytes fields in reports on Solaris 8
+                               Thanks to Craig Brockmeier <craig@ppco.com>
+              New tag added: user_invalid_char "&/"
+                         To avoid core dumps, records that contain invalid characters 
+                         in userid will be ignored by Sarg.
+              New tag added: privacy yes|no
+                             privacy_string "***.***.***.***"
+                             privacy_string_color blue
+                         In some countries the sysadm cannot see the visited sites by a restrictive law.
+                         Using privacy yes the visited url will be changed by privacy_string and 
+                         the link will be removed from reports.
+                            Requested by Diaolin <diaolin@diaolin.com> (Natali Giuliano) 
+               New tag added: include_users "user1:user2:...:usern"
+                         Reports will be generated only for listed users.
+                            exclude_string "string1:string2:...:stringn"
+                         Records from access.log file that contain one of listed strings will be ignored.
+                            Requested by Michael Koptyaev <mk@aney.ru>
+
+
+Apr/02/2001: - implementation of --enable-bindir and --enable-sysconfdir in configure script.
+                       Thanks to Sergei Dushenkov <dusha@dnttm.ru>
+            - bug fixed: getword excessive long string detection function fixed.
+                       Thanks to Junghausz Norbert <nigga@nigga.hu>
+            - bug fixed: wrong charset for windows-1251 and koi8 Russian languages.
+                       Thanks to Alexey Zhigayev <murphy@fio.samara.ru>
+            - bug fixed: - Help page (-h) is empty because at start (log.c) program doesn't
+                           load definitions to text[][] array.
+                         - Definitions for Russian language doesn't have last 2 lines.
+                          - Definitions of Charset field for Russian language is not so correct.
+                            Better is 'windows-1251' or 'koi8-r'
+                         - I think in topuser.c the definition of wheader[] is too short for words
+                           on some languages
+                         - Initialization and use of variables TopuserSortField and
+                            TopuserSortOrder is mismatch
+                       Thanks to Alex Voronin <al_vg@mail.ru>
+             - bug fixed: core dump with big user table.
+                       Thanks to Jorge Cuellar Martinez <jorge.cuellar@sat.gob.mx>
+            - Latvian languages by Juris Valdovskis <juris@auce.lv>
+                       Thank you
+
+Mar/22/2001: - Now te user can choose the language using the language TAG in /usr/local/sarg/sarg.conf file.
+               There is no more --enable-language in configure script.
+             - New report added: Autentication Failures
+                       Requested by Sergei Dushenkov <dusha@dnttm.ru>
+             - NONE/400 (bad request) is excluded by default (/usr/local/sarg/exclude_codes)
+             - Now sarg support big numbers (64 bits) in any platform.
+             - Date/Time report now use bytes or elapsed time as specified in date_time_by tag in sarg.conf
+                               Requested by Inters <inters@mailbox.riga.lv>
+            - bug fixed: sites&users report sorted on the User field rather than the Site field
+                       Thanks to Simon Bryan <sbryan@olmc.nsw.edu.au>
+             - sites&users report was changed.
+             - Russian_windows125 language fixed.
+                       Thanks to Dima I. Allaverdov <allav@ur.rags.ru>  (rasa)
+             - bug fixed: getconf was catching a wrong value in replace_index tag
+                       Thanks to vrush_22@softhome.net
+             - bug fixed: per_user_limit file with duplicate users.
+             - Russian languages fixed by Nikolai V. Ivanyushin <koko@infocenter.bryansk.ru>. Thank you.
+             - charset TAG added to sarg.conf file. The following charsets are avaiable:
+                       Latin1 (West European), Latin2 (East European), Latin3 (South European)
+                       Latin4 (North European), Cyrillic, Arabic, Greek, Hebrew
+                       Latin5 (Turkish), Latin6 (Nordic)
+                   Requested by Nikolai V. Ivanyushin <koko@infocenter.bryansk.ru>
+             - configure now accept only two options:
+                       --enable-bindir     - where sarg binary will be saved
+                       --enable-sysconfdir - where the configuration directory is
+
+Mar/09/2001: Sqmgrlog has gained a new name: SARG - Squid Analysis Report Generator.
+             Many people have asked me about why sqmgrlog. I really don´t know.
+             No inspiration I think.
+             SARG was suggested by an user from Philippines, but, I lost his email
+             and don´t remember his name.
+
+             Thank you anyway.
+
+
+
+sqmgrlog ChangeLog
+
+Feb/06/2001: Version 3.0 released:
+             - Denied report added.
+                       Request by Jason Staudenmayer <JasonS@NJAQUARIUM.ORG>
+            - User table added. You can override your userid or IP Address with
+              a real user name.
+                       TAG usertab added to sqmgrlog.conf
+             - Now you can have the long url in reports
+                       TAG long_url added to sqmgrlog.conf
+             - Now you can choose the report types
+                       TAG report_type added to sqmgrlog.conf
+            - sqmgrlog.conf file now will be in 644 mod.
+                       Request by Michail Vidiassov <master@iaas.msu.ru>
+            - sqmgrlog coredumps if there is a very long line in the config file.
+                       Thank you to Michail Vidiassov <master@iaas.msu.ru>
+             - Url parser changed to get connect records from a better way
+                       Thanks to Sergey Erokhin <esl@vechnost.com>
+            - Michail Vidiassov <master@iaas.msu.ru> made gcc -Wall ... happy on FreeBSD 4.1
+                       Thank you
+             - Russian_Koi8 language fixed by 
+                       Andrew Okhmat <andy@crgu.com>. Thank you.
+                       Maks Nefedchenko <maks@viaduk.net>. Thank you.
+             - Russian and Bulgarian language fixed by 
+                       Nikolai V. Ivanyushin <koko@infocenter.bryansk.ru> 
+
+
+
+Nov/09/2000: Two patches form Brad Guillory <proxyadm@baileylink.net> added:
+              1. max-elapsed tag added to sqmgrlog.conf file:
+                 # TAG: max_elapsed milliseconds
+                #      If elapsed time is recorded in log is greater than max_elapsed use 0 for elapsed time.
+                #      Use 0 for no checking
+                 #
+                 #max_elapsed 0
+                 # 8 Hours
+                 max_elapsed 28800000
+              2. day report (the one that looks like a calendar) changed:
+                Every minute that a request is logged your time is incremented by the smaller
+                 of 1 minute or the total time for the requests.
+                
+                 Thank you Brad. Brad Guillory is the newest sqmgrlog contributor.
+
+              Changed: sort now compare according to arithmetic value.
+               
+Jul/11/2000: Dutch language fixed by Pieter Kooistra <pkooistra@hr.nl>
+                       Thank you.
+             Changed: Russian_koi8 changed to Russian_Koi8.
+               Thank you to Eugene AKA Kevin Kevin <kevin@id.ru> 
+             Slightly changed Czech language
+             Added: TAG: replace_index
+                Replace "index.html" in the main index file with this string
+                Vladimir Smelhaus <smelhaus@atlas.cz>
+             Bug fixed: For some reason, Squid occasionally logs a blank line. Running sqmgrlog
+               against a log containing a blank line causes sqmgrlog to take 99+% CPU
+               Thanks to Giese, Bill <bill@gieses.com> 
+            Added: now every squid code that contain the MISS word will be counted as out cache.
+               Thanks to Kostya Panov <twin@beep.ru> 
+
+Jun/09/2000: Bug fixed: abnormal end if userid contain ';'
+               Thanks to Victor Feoktistov <feoktist@triniti.ru>
+             Japanese language fixed by
+                Akira Kitamura <click@anet.ne.jp> Takamatsu-City Kagawa Japan
+             Bug fixed: Wrong date when setting date_format u in sqmgrlog.conf file
+                Thanks to Dale Perkel <dale@think.co.za, Nuno Almeida <nalm@vanguarda.com>, 
+                         Marcio Rodrigo Bordignon <mrbordignon@uol.com.br> 
+
+Mar/15/2000: Japanese language added by 
+               Akira Kitamura <click@anet.ne.jp> Takamatsu-City Kagawa Japan
+                Thank you.
+             Serbian language added by 
+               Radovan Drobnjakovic <admin.rts@rts.co.yu>
+                Thank you.
+             Bug fixed: wrong sort field when lower case used in
+               sort tags.
+               Thaks to Scott Larsen <slarsen@cascorp.com>
+                  and to WOLETZ, Dusan <woletz@globtel.sk>
+             Abuse report removed.
+             Changed: report1_sort_field TAG in sqmgrlog.conf 
+                       changed to topuser_sort_field
+             Changed: report2_sort_field TAG in sqmgrlog.conf 
+                       changed to user_sort_field
+             Added: topsites sort field options added:
+               # TAG: topsites_sort_order CONNECT|BYTES A|D
+               #      Sort for topsites report, where A=Ascendent, D=Descendent
+               #
+               #topsite_sort_oder CONNECT D
+             Implementation requested by
+                Michael G. Koch <Michael.G.Koch@globalknowledge.de>
+
+Feb/26/2000: Bulgarian-windows1251 language added by
+             Ivan Minchev <vanko@uni-svishtov.bg>.
+               Thank you.
+             French language updated by 
+             Olivier Rousselot <olivier.rousselot@ssti.fr>
+               Thank you.
+
+Feb/15/2000: SmarfFilter report added.
+               Implementation requested by Andrew Bradshaw <andyb@excite.co.uk>
+             Bug fixed: files created with 09Feb2000-09022000 instead 09Feb2000-09Feb2000
+               Thanks to Andy Parfenov <andy@nursat.net>
+             Changed: ignore records with HTTP/0.0 string.
+               Implementation requested by Bernd Kossmann <bko@shd.de>
+             Changed: some code added to ignore broken records in access.log file
+             Bug fixed: removing old file with lastlog dont work.
+               Thanks to Evren Yurtesen <yurtesen@ispro.net.tr>
+
+Jan/20/2000: Indonesian language added by V Gatut Harijoso  <gatut@student.unpar.ac.id>
+              Thank you.
+             Fixed: change in conf.h to compile on OpenBSD 2.6 system.
+              Thanks to Kenneth Ingham <ingham@i-pi.com>
+             Fixed: small bug, which fills the "periodo" with 
+                   "01Jan2000-20000101" instead of "01Jan2000-01Jan2000".
+               Thanks to Schlosser, Carsten ECOFIS <c.schlosser@ecofis.de>
+             Fixed: After calling system function malloc, variable excludecode 
+                   have some symbols inside (excludecode wasn't zeroed).
+               Thanks to Andrew Katkov <askat@crimea.net>
+
+Dec/29/1999: Czech language added by Milos Prudek <prudek@nembv.cz>
+               Thank you.
+             Russian-windows1251 language added by Dima I. Allaverdov <allav@ur.rags.ru>
+               Thank you.
+             Changed: Russian language changed to Russian_koi8 language.
+             Bug fixed: Sites&Users report dont resolve ip address.
+               Thanks to Pavel Jezek <Pavel.Jezek@i.cz>
+
+Nov/29/1999: Bug fixed: DENIED word translated to another language never printed.
+               Thanks to Rodolphe SIBERT <rsi@kyxar.fr>
+             New report added: Sites & Users
+               Implementation requested by Rodolphe SIBERT <rsi@kyxar.fr>
+             Added: The date format now also has the option "w" for week.
+                    The report is then 1999.47-1999.47 for instance.
+               Implemented by Seth Mos <stimpy@stimpy.multiweb.nl>, thank you for the patch.
+             Dutch language added by Seth Mos <stimpy@stimpy.multiweb.nl>
+               Thank you.
+             Added: new tag on sqmgrlog.conf, named user_ip, for setting a system wire -p, use ip address
+                    instead userid.
+               Implemented by Carlo Marcelo Arenas Belon <carenas@chasqui.lared.net.pe>
+               Thank you for the patch.
+             Added: new tag on sqmgrlog.conf, exclude_codes pointing to a file with codes to be
+                    ignored by sqmgrlog. Eg.: NONE/400
+               Implementation asked by Doug Burks <DBurks@Augserv.com>
+
+Sep/28/1999: Bug fixed: -split and -convert dont work with multiples -l options.
+               Thanks to G. Kelana Sudibyo" <kelana@inn.bppt.go.id>
+             Bug fixed: Bytes and Average corrupted in index.html after second execution.
+               Thanks to Rob Glasser <orso@onelist.com>
+
+Sep/13/1999: Bug fixed: get wrong access.log file when using access_log in sqmgrlog.conf file.
+               Thanks to Michael G. Koch <Michael.G.Koch@globalknowledge.de>
+
+Sep/10/1999: Spanish language added by Leonardo A. D'Angelo <ldangelo@san-cayetano.com>
+               Thank you.
+             New report added: topsites. This report show the top n sites accessed.
+                    You can set the top num sites in topuser_num tag in sqmgrlog.conf file.
+             Bug fixed: wrong userid when using Samba authenticator.
+              Thanks to klaubert@bcb.gov.br (Klaubert Herr da Silveira)
+            Changed: -v option removed. No more suport for Squid-1 log format.
+               Thanks to Nik Oxley <nik.oxley@iholland.co.uk>
+
+Aug/18/1999: New fields added to sqmgrlog.conf: 
+               - lastlog n
+                   With lastlog you can tell to sqmgrlog to remove old reports files.
+                   Usage: lastlog 0  - no remove nothing
+                          lastlog 10 - maintain only the last 10 reports
+                   Implementation requested by Evren Yurtesen <yurtesen@ispro.net.tr>
+                      Thank you for your help.
+               - remove_temp_files yes|no
+                   Remove temporary files: geral, usuarios, top, periodo from root report directory.
+                   Impementation requested by Fred Pacquier <fredp@dial.oleane.com>
+               - index yes|no|only
+                   Usage: index yes  - will genereate the main index.html in reports
+                          index no   - dont generate the main index.html in reports
+                          index only - generate only the main index.html in reports
+                   Implementation asked by Fred Pacquier <fredp@dial.oleane.com>
+               - overwrite_report yes|no
+                   If yes and the report already exist for that date, the reports will be overwrited.
+                   If no and the report alread exist, that report will be renamed to filename.n, filename.n+1
+                     Implementation requested by Eugeny Kuzakov <CoreDumped@CoreDumped.null.ru>
+               - records_without_userid ignore|ip|everybody
+                    What can I do with records without user id (no authentication) in access.log file ?
+                      ignore - This record will be ignored.
+                          ip - Use ip address instead. (default)
+                   everybody - Use "everybody" instead.
+               - use_comma
+                   Use comma instead point in reports.
+                     Eg.: use_comma yes => 23,450,110
+                          use_comma no  => 23.450.110
+               - mail_utility mail|mailx
+                   Which mail command must I use to send reports ?
+
+             Added: now every squid code that contain the MISS word will be counted as out cache. 
+                Implementation requested by Eugeny Kuzakov <CoreDumped@CoreDumped.null.ru>
+                   Thank you for your help and for share your FreeBSD with me.
+             Changed: the field url was changed to 8192 bytes to suport big urls.
+                Thanks to Eugeny Kuzakov <CoreDumped@CoreDumped.null.ru>
+             Changed: the header "TIME SPENT" changed to "USED TIME" in topuser report.
+             Changed: no more nouser will be in reports but IP address instead.
+             Changed: no more squid 1 log format supported.
+             Bug fixed: wrong reports when using common log format (emulate_http on).
+                Thanks to Patrick LIN <patrickl@cst.ca>  
+
+Aug/06/1999: French language added by Fred Pacquier <fredp@dial.oleane.com>
+                Thank you
+             Bug fixed: negative percentage in IN-CACHE-OUT.
+                Thanks to brad@baileylink.net
+             Bug fixed: wrong directory name created when using -g e and -d
+                Thanks to Fred Pacquier <fredp@dial.oleane.com>
+             Changed: atol use to get total bytes changed to atoll.
+                Thanks to brad@baileylink.net for the patch.
+             Changed: now use ',' as separator instead '.' when using US date (-g u)
+                Implementations requested by brad@baileylink.net
+             Changed: added -convert and -split to usage help (-h)
+                      new messages added to easy translation.
+                Implementations requested by Fred Pacquier <fredp@dial.oleane.com>
+
+Jul/29/1999: Changed: convert userid to lowercase to disable username case-sensitivity
+                when using auth_smb.
+                Implementations requested by Doug Burks <DBurks@Augserv.com>               
+             Changed: the sqmgrlog.conf now installs into /usr/local/etc
+                Implementations requested by Daniel L Sjvsvdrd <daniel.sjosvard@paals.se>
+
+Jul/06/1999: Y2K bug fixes.
+                Thanks to askat@crimea.net  (JSC CRELCOM)
+             Bug fixed: special character in userid cause core dump.
+               Thanks to Rick_Barzilli@xircom.com
+            Splitlog function added:  -split will split the log file by date in -d parameter.
+                Eg.: sqmgrlog -split -d 01/07/1999-02/07/1999 [-convert] [-g e]
+
+Jun/14/1999: German language added by Andreas Piesk <a.piesk@gmx.net>
+                Thank you
+             Some minor changes made by Andreas Piesk, thanks for the patches.
+
+Jun/09/1999: Bug fixed: to send reports via mail, use mail instead mailx in FreeBSD.
+                Thanks to Evren Yurtesen <yurtesen@ispro.net.tr> to share your FreeBSD with me.
+             Bug fixed: wrong userid when using smb_auth autenticator.
+                        The userid will be changed from NTDOMAIN\username to NTDOMAIN.username.
+                Thanks to Jouko Ylikulju <Jouko.Ylikulju@pkcables.com>
+
+Jun/04/1999: Y2K compliance implemented.
+             Bug fixed: wrong report created when using common log format.
+                Thanks to Carlos Santillana <Carlos@los-fresnos-cons.k12.tx.us>
+             Bug fixed: wrong fopen with "rt", must be "r".
+                Thanks to Wayne Bastow <wbastow@ccahs.health.nsw.gov.au>
+
+May/31/1999: Turkish language added by Evren Yurtesen <yurtesen@ispro.net.tr>
+                Thank you
+             Bug fixed: users in exclude_users file were not removed from reports.
+                Thanks to Arthur S. Petrossian <arthur@ipia.sci.am>
+                Thanks to Evren Yurtesen <yurtesen@ispro.net.tr>
+             Bug fixed: core dump when using output_email parm and mailx not installed.
+                Thanks to Evren Yurtesen <yurtesen@ispro.net.tr>
+             Thanks to Evren Yurtesen <yurtesen@ispro.net.tr> to share your FreeBSD with me.
+
+May/20/1999: New report field added: IN CACHE and OUT CACHE. 
+                This field show how many bytes (percent) was retrieved from the cache.
+               Implementations requested by Arthur S. Petrossian <arthur@ipia.sci.am>
+
+May/14/1999: Bug fixed. Abnormal End when using -i option
+                Thanks to Carlos Canau <canau@ionia.EUnet.pt> for the patch.            
+             Bug fixed. Sqmgrlog freeze if some records are broken in access.log file.
+                Thanks to Rick_Barzilli@xircom.com
+             Bugfix that prevents sqmgrlog from freezing up if a log file has "holes" (sequences of zeros) 
+             (caused by filesystem crash).
+                Thanks to drdivano@mail.axon.ru for the patch.
+
+Apr/14/1999: Per user limit added.
+                 If the user exceed the limit, userid will be saved in a file that can
+                 be used in squid acl.
+                Field per_user_limit added to sqmgrlog.conf: per_user_limit file limit
+                    file : where userid must be saved
+                    limit: in MB   Eg. 40 will limit in 40 MB.
+                Implementation requested by Csaba Kabai <ckabai@icnpharm.com>
+
+Mar/11/1999: Field exclude_users now accept indexonly to create only index.html report.
+                Implementation requested by Hanni Daniel <daniel.haenni@softlab.ch>
+            Bug fixed for FreeBSD. Missing \n on topuser.
+                Thanks to Andrew <andrew@extrim.ru> for share your FreeBSD-3.1
+             Some minors fixes and changes in html layout.
+                Thanks to Andrew Barnes <a.barnes@kaldor.com.au>
+
+Mar/03/1999: Bug fixed. Wrong href link if userid in format userid.name...
+                Thanks to Manon Goo <manon@manon.de>
+             Some changes on variable translations.
+                Thanks to Matteo Colombo <matteo@calcol.it>
+             Russian language (KOI8-R) added by Palamarchuk Eugen <eugen@cit.od.ukrtel.net>
+                Thank you
+             Field exclude_users added to sqmgrlog.conf. 
+               Users within the file will be excluded from reports.
+                Implementation requested by Hanni Daniel <daniel.haenni@softlab.ch>
+
+Feb/26/1999: New date/time report added.
+               Look at http://www.orso.x5.net/squid-reports/1999Feb01-1999Feb08/duser24.html
+            -d option now accept from-until (dd/mm/yy-dd/mm/yy) dates.
+               Requested by Eric V. Pino <ericvp@roadrunner.com.ph>
+
+Feb/10/1999: Italian language added by Matteo Colombo <matteo@calcol.it>
+             Thank you.
+             -convert option added. Convert the access.log file to a legible date
+             and time format. May be used with -l and/or -g options.
+
+Feb/05/1999: Field date_format added to sqmgrlog.conf.
+                date_format u: reports with USA format mm/dd/yy
+                date_format e: reports with Europe format dd/mm/yy
+                Implementation requested by Matteo Colombo <matteo@calcol.it>
+             Bug fixed: temporary file cannot be created if not run in root.
+                Thanks to Carlos Canau <canau@ionia.EUnet.pt> for the patch.
+             Changes from Tony Lorime <alorimes@csc.com>: use atoll instead atol in Solaris
+                                                       : ignore .htaccess when selecting files
+               Thank you.
+
+Dec/21/1998: -b option added. Generate useragent report. 
+                field useragent_log added to sqmgrlog.conf
+               Implementation requested by Alp <support@x5.net>
+             -j option added. Generate a kind of abuse report.
+               Implementation requested by Alp <support@x5.net>
+                To use this feature you must apply a patch (http://www.orso.x5.net/patches) on Squid.
+             -c exclude option improved. Now you can exclude B classes
+               Implementation requested by Yin Jun <yinj@mars.ahu.edu.cn>
+             Bug fixed for Solaris. Must user -lsocket and -lnsl to resolve names.
+                Thanks to Ryan Roehrich <ryanscott@mindless.com>
+
+Dec/11/1998:  Bug fixed for long long int in Alpha Digital
+               Thanks to Ilya V. Komarov <mur@mur.lynx.ru> for share your Digital server.
+
+Dec/10/1998:  Version 2.2 released
+            -n option added. Resolve domain name for reports with IP Address.
+                Field resolve_ip added to sqmgrlog.conf
+             Sort report by header fields implemented
+                Fields report1_sort_field and report2_sort_field added to sqmgrlog.conf 
+             -f option added. Allow config file override
+             Exclude hosts implemented            
+                Field exclude_hosts file added to sqmgrlog.conf. Exclude ips, names, subnets
+                  from reports.
+               Implementations requested by Arthur S. Petrossian <arthur@ipia.sci.am>
+
+Dec/07/1998:  Version 2.1 released
+             sqmgrlog now can read log file in gzip or compress format.
+               Implementation requested by Alp <support@x5.net>
+
+Nov/09/1998:  Version 2.0 released
+             -p option added. Allow redirect output report to email address.
+             sqmgrlog.conf with colors, headers, title, font size, backgound color, text color,
+                background image, font face, etc... added.
+             Reports will be generated only for users in passwd file (tag password in sqmgrlog.conf).
+             Many changes in html output layout.
+                Thanks to Alp <support@x5.net>
+
+Oct/19/1998:  Bug fixed by Maxim Berlin <mak@unesco.mitht.rssi.ru> for long long int in FreeBsd.
+             Many thanks.
+             Thanks to Ilya V. Komarov <mur@mur.lynx.ru> to share your FreeBSD 3.0 server to help on fixing.
+
+Sep/28/1998:  Bug fixed for log with emulate http on (Squid 1.2.beta)
+                Thanks to Alp <support@x5.net>
+            -p option added. Generated reports with IP Address insted Userid.
+            Use this option if you do not use Proxy authentication on Squid.
+               Implementation requested by Szalma Zoltan <zszalma@file.matav.hu>
+       
+Aug/11/1998:  Bug fixed for memory slack. 
+               Thanks to kevin@mcpeake.net
+                         Jose Luiz <jluiz@projesom.com.br>
+                         Patrick Darden <darden@server2.armc.org>
+                         Steve Chan <Steve.Chan@lucasfilm.com>
+
+Jul/07/1998:  Spent time added for native Squid log format (emulate_httpd_log off).
+            Connect added.
+            Layout change in html reports.
+
+Jun/02/1998:  -o option added. Allow output dir override.
+            Implemented index.html on root output dir.
+            Implemented auto rename if output dir already exist.
+            bug fixed, link error if user change output dir in conf.h
+            Thanks to Alp <cybergulf@cybergulf.net>
+
+May/28/1998:  -v option added. Allow Squid version override.
+
+May/28/1998:  Bug fixed in common log format
+            Thanks to Tony Lorimer <tlorimer@health.csc.com.au>
+                       Alp <cybergulf@cybergulf.net>
+                      Carlos Santillana <carlos@los-fresnos-cons.k12.tx.us
+
+May/21/1998:  Implemented Squid version verification because common log 
+            from 1.1 differ from 1.2 version.
+            -i option added (report by user and IP address)
+
+May/19/1998:  configure script implemented.
+
+May/18/1998:  Implemented auto log format recognize (Squid and Common log)
+
+Apr/15/1998:  bug fixed. Some garbage on period.
+             Thanks to Lee Shakespeare <lee@webfoundry.co.uk>
+Apr/15/1998:  -z option added (debug)
+
+Apr/07/1998:  top.html changed to index.html
+
+Mar/31/1998:  index.html added
+
+Mar/25/1998:  sqmgrlog was created
diff --git a/DONATIONS b/DONATIONS
new file mode 100644 (file)
index 0000000..6b678e9
--- /dev/null
+++ b/DONATIONS
@@ -0,0 +1,3 @@
+If you like SARG and want to contribute, please email me: orso@brturbo.com
+
+Thank you
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..a43ea21
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,339 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+       Appendix: How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..fbed350
--- /dev/null
@@ -0,0 +1,104 @@
+# Makefile.in for sarg
+
+CC             = @CC@
+BINDIR         = @BINDIR@
+IBINDIR        = -DBINDIR=\"@BINDIR@\"
+MANDIR         = @MANDIR@
+SYSCONFDIR     = @SYSCONFDIR@
+HTMLDIR                = @HTMLDIR@
+ISYSCONFDIR    = -DSYSCONFDIR=\"@SYSCONFDIR@\"
+IHTMLDIR       = -DHTMLDIR=\"@HTMLDIR@\"
+CFLAGS                 = @CFLAGS@
+LDFLAGS        = @LDFLAGS@
+DEFS            = @DEFS@ 
+LIBS            = @LIBS@ 
+SRCDIR                 = .
+VPATH          = .
+INSTALL        = cp
+
+INSTALL_PROGRAM = $(INSTALL)
+
+SRCS = util.c log.c report.c topuser.c email.c sort.c html.c \
+       totger.c index.c getconf.c usage.c decomp.c ip2name.c \
+       useragent.c exclude.c convlog.c totday.c repday.c datafile.c\
+       indexonly.c splitlog.c lastlog.c topsites.c siteuser.c css.c \
+       smartfilter.c denied.cauthfail.c language.c charset.c \
+       squidguard_log.c squidguard_report.c auth.c download.c grepday.c \
+       dansguardian_log.c dansguardian_report.c
+OBJS = util.o log.o report.o topuser.o email.o sort.o html.o \
+       totger.o index.o getconf.o usage.o decomp.o ip2name.o \
+       useragent.o exclude.o convlog.o totday.o repday.o datafile.o \
+       indexonly.o splitlog.o lastlog.o topsites.o siteuser.o css.o \
+       smartfilter.o denied.o authfail.o language.o charset.o \
+       squidguard_log.o squidguard_report.o auth.o download.o grepday.o \
+       dansguardian_log.o dansguardian_report.o
+
+DISTFILES = $(SRCS)
+
+all: sarg
+
+.c.o:
+       $(CC) -c -I. $(CPPFLAGS) $(DEFS) $(CFLAGS) $(IBINDIR) $(ISYSCONFDIR) $(IHTMLDIR) $<
+
+sarg: $(OBJS)
+       $(CC) $(LDFLAGS) $(LIBS) $(OBJS) $(LIBCRYPT) -o $@
+
+install: all
+       -@if test ! -d $(BINDIR); then \
+               echo "creating $(BINDIR)"; \
+               mkdir $(BINDIR); \
+       fi
+       -@if test ! -d $(MANDIR); then \
+               echo "creating $(MANDIR)"; \
+               mkdir -p $(MANDIR); \
+       fi
+       -@if test ! -d $(SYSCONFDIR); then \
+               echo "creating $(SYSCONFDIR)"; \
+               mkdir $(SYSCONFDIR); \
+       fi
+       -@if test ! -d $(SYSCONFDIR)/languages; then \
+               echo "Creating $(SYSCONFDIR)/languages"; \
+               mkdir $(SYSCONFDIR)/languages; \
+       fi
+       -@if test ! -d $(SYSCONFDIR)/fonts; then \
+               echo "Creating $(SYSCONFDIR)/fonts"; \
+               mkdir $(SYSCONFDIR)/fonts; \
+       fi
+       $(INSTALL_PROGRAM) sarg $(BINDIR)/sarg
+       chmod 755 $(BINDIR)/sarg
+       $(INSTALL_PROGRAM) sarg.1 $(MANDIR)/sarg.1
+       chmod 755 $(MANDIR)/sarg.1
+       @if test ! -f $(SYSCONFDIR)/sarg.conf; then \
+               echo "cp $(SYSCONFDIR)/sarg.conf"; \
+               cp sarg.conf $(SYSCONFDIR)/sarg.conf; \
+       else \
+               cp sarg.conf $(SYSCONFDIR)/sarg.conf.default; \
+       fi
+       cp -r ./languages $(SYSCONFDIR);
+       cp ./exclude_codes $(SYSCONFDIR);
+       cp -r ./images $(SYSCONFDIR);
+       cp -r ./sarg-php $(SYSCONFDIR);
+       cp -r ./fonts $(SYSCONFDIR);
+       cp -r ./css.tpl $(SYSCONFDIR);
+       -@if test -d $(HTMLDIR); then \
+               cp -r ./sarg-php $(HTMLDIR);    \
+       fi
+
+uninstall:
+       rm -f $(BINDIR)/sarg
+       rm -f $(MANDIR)/sarg.1
+
+TAGS: $(SRCS)
+       etags $(SRCS)
+
+clean:
+       rm -f sarg *.o core
+
+mostlyclean: clean
+
+distclean: clean
+       rm -f Makefile config.status config.cache config.log
+
+realclean: distclean
+       rm -f TAGS
+
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..34aa3da
--- /dev/null
+++ b/README
@@ -0,0 +1,74 @@
+Sarg is a Squid Analysis Report Generator that allow you to view "where" your users
+are going to on the Internet.
+Sarg generate reports in html, with many fields, like: users, IP Addresses, bytes, sites and times.
+
+Support to SmartFilter added - 09/02/2000
+
+Special thanks to:
+Matteo Colombo <matteo@calcol.it>                      - Italian language
+Palamarchuk Eugen <eugen@cit.od.ukrtel.net>            - Russian language
+Csaba Kabai <ckabai@icnpharm.com>                      - Hungarian language
+Evren Yurtesen <yurtesen@ispro.net.tr>                 - Turkish language
+Andreas Piek <a.piesk@gmx.net>                         - German language
+Fred Pacquier <fredp@dial.oleane.com>                  - French language
+Leonardo A. D'Angelo <ldangelo@san-cayetano.com>       - Spanish language
+Seth Mos <stimpy@stimpy.multiweb.nl>                   - Dutch language
+Milos Prudek <prudek@nembv.cz>                          - Czech language
+Dima I. Allaverdov <allav@ur.rags.ru>                   - Russian_windows1251 language
+V Gatut Harijiso <gatut@student.unpar.ac.id>           - Indonesian language
+Ivan Minchev <vanko@uni-svishtov.bg>                   - Bulgarian_windows1251 language
+Akira Kitamura <click@anet.ne.jp>                      - Japanese language
+Radovan Drobnjakovic <admin.rts@rts.co.yu>             - Serbian language
+Pieter Kooistra <pkooistra@hr.nl>                      - Dutch language fix
+Andrew Okhmat <andy@crgu.com>                          - Russian Koi8 language fixed
+Nikolai V. Ivanyushin <koko@infocenter.bryansk.ru>     - Russian and Bulgarian language fix
+Juris Valdovskis <juris@auce.lv>                       - Latvian language
+Jordan Kanev <dancho@globcom.net>                      - Bulgarian language fix
+Wszebor Boksa <Wszebor_Boksa@koncept.pl>               - Polish language
+Adi Cretu <adi@usv.ro>                                 - Romanian language
+Roman Vynar <rvynar@icqmail.com>                       - Ukrainian_windows1251 language
+Andreu Sanchez <tanis@lleida.com>                      - Catalan language
+Antonis Maglaras <vegos@magla.gr>                      - Greek language
+Dusan Woletz <Dusan.WOLETZ@orange.sk>                  - Slovak Language
+
+Translating
+   . Copy include/English to YourLanguage
+   . Translate YourLanguage
+   . Send YourLanguage to orso@brturbo.com to implement
+
+
+If you use native squid log format, the elapsed time will be in reports (emulate_httpd_log off).
+
+1. run ./configure
+
+   configure options: --enable-bindir=where sarg binary will be saved
+                                default: /usr/bin
+
+                      --enable-sysconfdir - where the configuration directory is
+                                default: /usr/local/sarg
+
+                      --enable-htmldir - where the www html root dir is
+                                default: /var/www/html
+
+                      --enable-mandir - where the sarg man page will be saved
+                                default: /usr/local/man/man1
+
+
+3. make
+
+4. make install
+
+5. Go to /usr/local/sarg (or file entered with --sysconfdir on configure)
+   and change sarg.conf as you need.
+
+6. Notes about sarg:
+
+   Date/Time report:
+         Every minute that a request is logged your time is incremented by the smaller
+         of 1 minute or the total time for the requests.
+
+Usage: sarg -h
+
+Source: http://www.sarg-squid.org
+
+Any suggests and/or comments, please: orso@brturbo.com
diff --git a/auth.c b/auth.c
new file mode 100644 (file)
index 0000000..a1906f2
--- /dev/null
+++ b/auth.c
@@ -0,0 +1,63 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void htaccess(char *name)
+{
+   FILE *fp_auth;
+
+   if(strncmp(UserAuthentication,"yes",3) !=0 )
+      return;
+
+   sprintf(warea,"%s/%s/.htaccess",dirname,name);
+   if((fp_auth=fopen(warea,"w"))==NULL) {
+      fprintf(stderr, "SARG: (auth) %s: %s\n",text[45],warea);
+      exit(1);
+   }
+
+   strcpy(warea,Require);
+   getword(buf,warea,'%');
+   fputs("AuthUserFile ",fp_auth);
+   fputs(AuthUserFile,fp_auth);
+   fputs("\n",fp_auth);
+   fputs("AuthName ",fp_auth);
+   if(strstr(AuthName,"\"") == 0)
+      fputs("\"",fp_auth);
+   fputs(AuthName,fp_auth);
+   if(strstr(AuthName,"\"") == 0)
+      fputs("\"",fp_auth);
+   fputs("\n",fp_auth);
+   fputs("AuthType ",fp_auth);
+   fputs(AuthType,fp_auth);
+   fputs("\n<Limit GET POST>\n",fp_auth);
+   fputs(buf,fp_auth);
+   fputs(name,fp_auth);
+   fputs("\n</LIMIT>\n",fp_auth);
+
+   fclose(fp_auth);
+
+   return;
+}
diff --git a/authfail.c b/authfail.c
new file mode 100644 (file)
index 0000000..b73d262
--- /dev/null
@@ -0,0 +1,199 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                             orso@brturbo.com
+ *                                                            1998, 2004
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void authfail_report()
+{
+
+   FILE *fp_in = NULL, *fp_ou = NULL;
+      
+   char url[MAXLEN];
+   char html[MAXLEN];
+   char html2[MAXLEN];
+   char authfail_in[MAXLEN];
+   char per[MAXLEN];
+   char report[MAXLEN];
+   char periodo[100];
+   char ip[MAXLEN];
+   char oip[MAXLEN];
+   char user[MAXLEN];
+   char ouser[MAXLEN];
+   char ouser2[MAXLEN];
+   char data[15];
+   char hora[15];
+   char ftime[128];
+   char *str;
+   int  z=0;
+   int  count=0;
+
+   if(strlen(DataFile) > 0) return;
+
+   ouser[0]='\0';
+
+   sprintf(tmp4,"%s/authfail.log.unsort",TempDir);
+   
+   if(!authfail_count) {
+      unlink(tmp4);
+      return;
+   }
+
+   sprintf(authfail_in,"%s/authfail.log",TempDir);
+   sprintf(per,"%s/periodo",dirname);
+   sprintf(report,"%s/authfail.html",dirname);
+
+   sprintf(csort,"sort -b -T %s -k 3,3 -k 5,5 -o %s %s", TempDir, authfail_in, tmp4);
+   system(csort);
+   unlink(tmp4);
+
+   if ((fp_in = fopen(per, "r")) == 0) {
+      fprintf(stderr, "SARG: (authfail) %s: %s\n",text[45],per);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   if((fp_in=fopen(authfail_in,"r"))==NULL) {
+     fprintf(stderr, "SARG: (authfail) %s: %s\n",text[45],authfail_in);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(report,"w"))==NULL) {
+     fprintf(stderr, "SARG: (authfail) %s: %s\n",text[45],report);
+     exit(1);
+   }
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);
+   fputs("<html>\n",fp_ou);
+   fputs("<head>\n",fp_ou);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ou);
+   css(fp_ou);
+   fputs("</head>\n",fp_ou);
+
+   if(strlen(FontFace) > 0) {
+      sprintf(url,"<font face=%s>\n",FontFace);
+      fputs(url,fp_ou);
+   }
+
+   sprintf(url,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   fputs(url,fp_ou);
+
+   if(strlen(LogoImage) > 0) {
+      fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+      sprintf(url,"<tr><th align=\"center\"><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(url,fp_ou);
+      fputs("</table>\n",fp_ou);
+   }
+
+   show_sarg(fp_ou,"..");
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+   sprintf(url,"<tr><th class=\"title\">%s</th></tr>\n",Title);
+   fputs(url,fp_ou);
+
+   sprintf(url,"<tr><td class=\"header\">%s: %s</td></tr>\n",text[89],periodo);
+   fputs(url,fp_ou);
+   sprintf(url,"<tr><th class=\"header\">%s %s</th></tr>\n",text[117],text[55]);
+   fputs(url,fp_ou);
+   fputs("</table></center>\n",fp_ou);
+
+   fputs("<center><table cellpadding=0 cellspacing=2>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   sprintf(url,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[98],text[111],text[110],text[91]);
+   fputs(url,fp_ou);
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(data,buf,' ');
+      getword(hora,buf,' ');
+      getword(user,buf,' ');
+      getword(ip,buf,' ');
+      getword(url,buf,' ');
+
+      if((str=(char *) strstr(user, "_")) != (char *) NULL ) {
+         if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
+            fixip(user);
+      }
+
+      if(strcmp(Ip2Name,"yes") == 0) 
+         ip2name(ip);
+
+      if(!z) {
+         strcpy(ouser,user);
+         strcpy(oip,ip);
+         z++;
+      } else {
+         if(strcmp(ouser,user) == 0)
+            user[0]='\0';
+         if(user[0] != '\0')
+            strcpy(ouser,user);
+         if(strcmp(oip,ip) == 0) 
+            ip[0]='\0';
+         if(ip[0] != '\0')
+            strcpy(oip,ip);
+      }
+
+      if(UserTabFile[0] != '\0') {
+         sprintf(warea,":%s:",user);
+         if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+            z1=0;
+            str2=(char *) strstr(str+1,":");
+            str2++;
+            bzero(name, MAXLEN);
+            while(str2[z1] != ':') {
+               name[z1]=str2[z1];
+               z1++;
+            }
+         } else strcpy(name,user);
+      } else strcpy(name,user);
+
+     if(AuthfailReportLimit) {
+        if(strcmp(ouser2,name) == 0) {
+            count++;
+         } else {
+            count=1;
+            strcpy(ouser2,name);
+         }
+         if(count >= AuthfailReportLimit)
+            continue;
+      }
+
+      sprintf(html2,"<tr><td class=\"data2\">%s</td><td class=\"data2\">%s</td><td class=\"data2\">%s-%s</td><td class=\"data2\">%s<a href=\"%s\">%s</a></td></th>\n",name,ip,data,hora,BlockImage,url,url);
+      fputs(html2,fp_ou);
+   }
+
+   fputs("</table>\n",fp_ou);
+
+   show_info(fp_ou);
+
+   fputs("</body>\n</html>\n",fp_ou);
+
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   unlink(authfail_in);
+
+   return;
+}
diff --git a/cfgaux/config.guess b/cfgaux/config.guess
new file mode 100755 (executable)
index 0000000..b0f5dca
--- /dev/null
@@ -0,0 +1,696 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    alpha:OSF1:*:*)
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
+       exit 0 ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit 0 ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-cbm-sysv4
+       exit 0;;
+    amiga:NetBSD:*:*)
+      echo m68k-cbm-netbsd${UNAME_RELEASE}
+      exit 0 ;;
+    amiga:OpenBSD:*:*)
+      echo m68k-cbm-openbsd${UNAME_RELEASE}
+      exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit 0;;
+    Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit 0 ;;
+    NILE:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit 0 ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    i86pc:SunOS:5.*:*)
+       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit 0 ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit 0 ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit 0 ;;
+    atari*:NetBSD:*:*)
+       echo m68k-atari-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    atari*:OpenBSD:*:*)
+       echo m68k-atari-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    sun3*:NetBSD:*:*)
+       echo m68k-sun-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    sun3*:OpenBSD:*:*)
+       echo m68k-sun-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mac68k:NetBSD:*:*)
+       echo m68k-apple-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    mac68k:OpenBSD:*:*)
+       echo m68k-apple-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit 0 ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit 0 ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit 0 ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       sed 's/^        //' << EOF >dummy.c
+       int main (argc, argv) int argc; char **argv; {
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       ${CC-cc} dummy.c -o dummy \
+         && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+         && rm dummy.c dummy && exit 0
+       rm -f dummy.c dummy
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit 0 ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit 0 ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit 0 ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit 0 ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit 0 ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+        if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+       if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+            -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+       else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+       fi
+        else echo i586-dg-dgux${UNAME_RELEASE}
+        fi
+       exit 0 ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit 0 ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit 0 ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit 0 ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+       exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i?86:AIX:*:*)
+       echo i386-ibm-aix
+       exit 0 ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               sed 's/^                //' << EOF >dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+               rm -f dummy.c dummy
+               echo rs6000-ibm-aix3.2.5
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit 0 ;;
+    *:AIX:*:4)
+       if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=4.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit 0 ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit 0 ;;
+    9000/[3478]??:HP-UX:*:*)
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
+           9000/8?? )            HP_ARCH=hppa1.0 ;;
+       esac
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit 0 ;;
+    3050*:HI-UX:*:*)
+       sed 's/^        //' << EOF >dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+       rm -f dummy.c dummy
+       echo unknown-hitachi-hiuxwe2
+       exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit 0 ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit 0 ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit 0 ;;
+    i?86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit 0 ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*X-MP:*:*:*)
+       echo xmp-cray-unicos
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE}
+       exit 0 ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+       exit 0 ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE}
+       exit 0 ;;
+    CRAY-2:*:*:*)
+       echo cray2-cray-unicos
+        exit 0 ;;
+    F300:UNIX_System_V:*:*)
+        FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit 0 ;;
+    F301:UNIX_System_V:*:*)
+       echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+       exit 0 ;;
+    hp3[0-9][05]:NetBSD:*:*)
+       echo m68k-hp-netbsd${UNAME_RELEASE}
+       exit 0 ;;
+    hp3[0-9][05]:OpenBSD:*:*)
+       echo m68k-hp-openbsd${UNAME_RELEASE}
+       exit 0 ;;
+    i?86:BSD/386:*:* | *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit 0 ;;
+    *:FreeBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit 0 ;;
+    *:NetBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+       exit 0 ;;
+    *:OpenBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+       exit 0 ;;
+    i*:CYGWIN*:*)
+       echo i386-pc-cygwin32
+       exit 0 ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin32
+       exit 0 ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit 0 ;;
+    *:GNU:*:*)
+       echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit 0 ;;
+    *:Linux:*:*)
+       # The BFD linker knows what the default object file format is, so
+       # first see if it will tell us.
+       ld_help_string=`ld --help 2>&1`
+       if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
+         echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
+       elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
+         echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
+       elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
+         echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
+       elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
+         echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
+       elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
+         echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
+       elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
+         echo "powerpc-unknown-linux-gnu" ; exit 0
+       elif test "${UNAME_MACHINE}" = "alpha" ; then
+         echo alpha-unknown-linux-gnu ; exit 0
+       elif test "${UNAME_MACHINE}" = "sparc" ; then
+         echo sparc-unknown-linux-gnu ; exit 0
+       else
+         # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
+         # useful --help.  Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
+         test ! -d /usr/lib/ldscripts/. \
+           && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+         # Determine whether the default compiler is a.out or elf
+         cat >dummy.c <<EOF
+main(argc, argv)
+int argc;
+char *argv[];
+{
+#ifdef __ELF__
+  printf ("%s-pc-linux-gnu\n", argv[1]);
+#else
+  printf ("%s-pc-linux-gnuaout\n", argv[1]);
+#endif
+  return 0;
+}
+EOF
+         ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+         rm -f dummy.c dummy
+       fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+    i?86:DYNIX/ptx:4*:*)
+       echo i386-sequent-sysv4
+       exit 0 ;;
+    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+       fi
+       exit 0 ;;
+    i?86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit 0 ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit 0 ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit 0 ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit 0 ;;
+    M68*:*:R3V[567]*:*)
+       test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m68*:LynxOS:2.*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit 0 ;;
+    i?86:LynxOS:2.*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit 0 ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit 0 ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit 0 ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit 0 ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit 0 ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit 0 ;;
+    R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+        exit 0 ;;
+    PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                           # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit 0 ;;
+    news*:NEWS-OS:[56].*:*)
+       echo mips-sony-newsos${UNAME_RELEASE}
+       exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+         ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+  printf ("vax-dec-bsd\n"); exit (0);
+#else
+  printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit 0 ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit 0 ;;
+    c34*)
+       echo c34-convex-bsd
+       exit 0 ;;
+    c38*)
+       echo c38-convex-bsd
+       exit 0 ;;
+    c4*)
+       echo c4-convex-bsd
+       exit 0 ;;
+    esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/cfgaux/config.sub b/cfgaux/config.sub
new file mode 100755 (executable)
index 0000000..67d8f39
--- /dev/null
@@ -0,0 +1,930 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+#   Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+       echo Configuration name missing. 1>&2
+       echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+       echo "or     $0 ALIAS" 1>&2
+       echo where ALIAS is a recognized configuration type. 1>&2
+       exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+       *local*)
+               echo $1
+               exit 0
+               ;;
+       *)
+       ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  linux-gnu*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple)
+               os=
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco5)
+               os=sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
+               | arme[lb] | pyramid \
+               | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+               | alpha | we32k | ns16k | clipper | i370 | sh \
+               | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
+               | pdp11 | mips64el | mips64orion | mips64orionel \
+               | sparc | sparclet | sparclite | sparc64)
+               basic_machine=$basic_machine-unknown
+               ;;
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i[3456]86)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
+             | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
+             | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
+             | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
+             | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+             | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
+             | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
+             | mips64el-* | mips64orion-* | mips64orionel-* | f301-* | iE86-*)
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-cbm
+               ;;
+       amigados)
+               basic_machine=m68k-cbm
+               os=-amigados
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-cbm
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       cray2)
+               basic_machine=cray2-cray
+               os=-unicos
+               ;;
+       [ctj]90-cray)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+       i[3456]86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i[3456]86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i[3456]86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i[3456]86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       mab-next)
+               os=-nextstep3
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+        pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pentium | p5)
+               basic_machine=i586-intel
+               ;;
+       pentiumpro | p6)
+               basic_machine=i686-intel
+               ;;
+       pentium-* | p5-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       k5)
+               # We don't have specific support for AMD's K5 yet, so just call it a Pentium
+               basic_machine=i586-amd
+               ;;
+       nexen)
+               # We don't have specific support for Nexgen yet, so just call it a Pentium
+               basic_machine=i586-nexgen
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=rs6000-ibm
+               ;;
+       ppc)    basic_machine=powerpc-unknown
+               ;;
+       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       xmp)
+               basic_machine=xmp-cray
+               os=-unicos
+               ;;
+        xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       mips)
+               basic_machine=mips-mips
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sparc)
+               basic_machine=sparc-sun
+               ;;
+        cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -unixware* | svr4*)
+               os=-sysv4
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+             | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+             | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -linux-gnu* | -uxpv*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+        pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               # This also exists in the configure program, but was not the
+               # default.
+               # os=-sunos4
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigados
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+        *-gould)
+               os=-sysv
+               ;;
+        *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+        *-sgi)
+               os=-irix
+               ;;
+        *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f301-fujitsu)
+               os=-uxpv
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -aix*)
+                               vendor=ibm
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -vxsim* | -vxworks*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
diff --git a/cfgaux/install-sh b/cfgaux/install-sh
new file mode 100755 (executable)
index 0000000..ebc6691
--- /dev/null
@@ -0,0 +1,250 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+       -c) instcmd="$cpprog"
+           shift
+           continue;;
+
+       -d) dir_arg=true
+           shift
+           continue;;
+
+       -m) chmodcmd="$chmodprog $2"
+           shift
+           shift
+           continue;;
+
+       -o) chowncmd="$chownprog $2"
+           shift
+           shift
+           continue;;
+
+       -g) chgrpcmd="$chgrpprog $2"
+           shift
+           shift
+           continue;;
+
+       -s) stripcmd="$stripprog"
+           shift
+           continue;;
+
+       -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+           shift
+           continue;;
+
+       -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+           shift
+           continue;;
+
+       *)  if [ x"$src" = x ]
+           then
+               src=$1
+           else
+               # this colon is to work around a 386BSD /bin/sh bug
+               :
+               dst=$1
+           fi
+           shift
+           continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+       echo "install:  no input file specified"
+       exit 1
+else
+       true
+fi
+
+if [ x"$dir_arg" != x ]; then
+       dst=$src
+       src=""
+       
+       if [ -d $dst ]; then
+               instcmd=:
+       else
+               instcmd=mkdir
+       fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+       if [ -f $src -o -d $src ]
+       then
+               true
+       else
+               echo "install:  $src does not exist"
+               exit 1
+       fi
+       
+       if [ x"$dst" = x ]
+       then
+               echo "install:  no destination specified"
+               exit 1
+       else
+               true
+       fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+       if [ -d $dst ]
+       then
+               dst="$dst"/`basename $src`
+       else
+               true
+       fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='   
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+       pathcomp="${pathcomp}${1}"
+       shift
+
+       if [ ! -d "${pathcomp}" ] ;
+        then
+               $mkdirprog "${pathcomp}"
+       else
+               true
+       fi
+
+       pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+       $doit $instcmd $dst &&
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+       if [ x"$transformarg" = x ] 
+       then
+               dstfile=`basename $dst`
+       else
+               dstfile=`basename $dst $transformbasename | 
+                       sed $transformarg`$transformbasename
+       fi
+
+# don't allow the sed command to completely eliminate the filename
+
+       if [ x"$dstfile" = x ] 
+       then
+               dstfile=`basename $dst`
+       else
+               true
+       fi
+
+# Make a temp file name in the proper directory.
+
+       dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+       $doit $instcmd $src $dsttmp &&
+
+       trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+       $doit $rmcmd -f $dstdir/$dstfile &&
+       $doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0
diff --git a/cfgaux/ll.novo b/cfgaux/ll.novo
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/charset.c b/charset.c
new file mode 100644 (file)
index 0000000..7b54ab6
--- /dev/null
+++ b/charset.c
@@ -0,0 +1,66 @@
+/*\r
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br\r
+ *                                                            1998, 2005\r
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org\r
+ *\r
+ * SARG donations:\r
+ *      please look at http://sarg.sourceforge.net/donations.php\r
+ * ---------------------------------------------------------------------\r
+ *\r
+ *  This program is free software; you can redistribute it and/or modify\r
+ *  it under the terms of the GNU General Public License as published by\r
+ *  the Free Software Foundation; either version 2 of the License, or\r
+ *  (at your option) any later version.\r
+ *\r
+ *  This program is distributed in the hope that it will be useful,\r
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ *  GNU General Public License for more details.\r
+ *\r
+ *  You should have received a copy of the GNU General Public License\r
+ *  along with this program; if not, write to the Free Software\r
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.\r
+ *\r
+ */\r
+\r
+#include "include/conf.h"\r
+\r
+void ccharset()\r
+{\r
+\r
+   if(strcmp(CharSet,"Latin2") == 0)\r
+      strcpy(CharSet,"ISO-8859-2");\r
+\r
+   if(strcmp(CharSet,"Latin3") == 0)\r
+      strcpy(CharSet,"ISO-8859-3");\r
+\r
+   if(strcmp(CharSet,"Latin4") == 0)\r
+      strcpy(CharSet,"ISO-8859-4");\r
+\r
+   if(strcmp(CharSet,"Cyrillic") == 0)\r
+      strcpy(CharSet,"ISO-8859-5");\r
+\r
+   if(strcmp(CharSet,"Arabic") == 0)\r
+      strcpy(CharSet,"ISO-8859-6");\r
+\r
+   if(strcmp(CharSet,"Greek") == 0)\r
+      strcpy(CharSet,"ISO-8859-7");\r
+\r
+   if(strcmp(CharSet,"Hebrew") == 0)\r
+      strcpy(CharSet,"ISO-8859-8");\r
+\r
+   if(strcmp(CharSet,"Latin5") == 0)\r
+      strcpy(CharSet,"ISO-8859-9");\r
+\r
+   if(strcmp(CharSet,"Latin6") == 0)\r
+      strcpy(CharSet,"ISO-8859-10");\r
+\r
+   if(strcmp(CharSet,"Windows-1251") == 0)\r
+      strcpy(CharSet,"Windows-1251");\r
+\r
+   if(strcmp(CharSet,"Koi8-r") == 0)\r
+      strcpy(CharSet,"KOI8-R");\r
+\r
+   return;\r
+\r
+}\r
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..5b213d6
--- /dev/null
+++ b/configure
@@ -0,0 +1,4662 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="log.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP BINDIR MANDIR SYSCONFDIR HTMLDIR LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+             localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$0" : 'X\(//\)[^/]' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                         [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                         [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-bindir=bindir
+                        Select bindir
+  --enable-mandir=mandir
+                        Select mandir
+  --enable-sysconfdir=sysconfdir
+                        Select sysconfdir
+  --enable-htmldir=htmldir
+                        Select htmldir
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --without-gcc           use CC to compile
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+          test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd $ac_popdir
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+       "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=$`echo $ac_var`
+       echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+              sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+       ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in cfgaux $srcdir/cfgaux; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in cfgaux $srcdir/cfgaux" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in cfgaux $srcdir/cfgaux" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+
+LDFLAGS="-g"
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+
+
+# Check whether --with-gcc or --without-gcc was given.
+if test "${with_gcc+set}" = set; then
+  withval="$with_gcc"
+
+fi;
+
+test -n "$CC" && cc_specified=yes
+case ${with_gcc} in
+  yes ) CC=gcc ;;
+  no  ) CC=cc ;;
+  *   ) ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+       ;;
+    conftest.$ac_ext )
+       # This is the source file.
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+       ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       # FIXME: I believe we export ac_cv_exeext for Libtool,
+       # but it would be cool to find out if it's true.  Does anybody
+       # maintain Libtool? --akim.
+       export ac_cv_exeext
+       break;;
+    * )
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         export ac_cv_exeext
+         break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+;;
+esac
+
+if test "${CC}" = "cc" ; then
+   CFLAGS="${CFLAGS} -w -g -O2 -Aa"
+else
+   CFLAGS="${CFLAGS} -w"
+fi
+
+case "$host" in
+   *-solaris*)
+   LDFLAGS="${LDFLAGS} -lsocket -lnsl"
+   CFLAGS="-DSOLARIS ${CFLAGS}"
+   ;;
+esac
+
+#dnl Checks for programs.
+#AC_PROG_CC
+
+
+
+
+
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+if test "${ac_cv_search_opendir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_opendir=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char opendir ();
+int
+main ()
+{
+opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_opendir="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_opendir" = no; then
+  for ac_lib in dir; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char opendir ();
+int
+main ()
+{
+opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_opendir="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6
+if test "$ac_cv_search_opendir" != no; then
+  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+
+fi
+
+else
+  echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+if test "${ac_cv_search_opendir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_opendir=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char opendir ();
+int
+main ()
+{
+opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_opendir="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_opendir" = no; then
+  for ac_lib in x; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char opendir ();
+int
+main ()
+{
+opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_opendir="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6
+if test "$ac_cv_search_opendir" != no; then
+  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+
+fi
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \
+                dirent.h sys/socket.h netdb.h arpa/inet.h sys/types.h netinet/in.h sys/stat.h \
+                ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h errno.h \
+                sys/resource.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+echo "$as_me:$LINENO: checking for gdImagePng in -lgd" >&5
+echo $ECHO_N "checking for gdImagePng in -lgd... $ECHO_C" >&6
+if test "${ac_cv_lib_gd_gdImagePng+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgd  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gdImagePng ();
+int
+main ()
+{
+gdImagePng ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_gd_gdImagePng=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_gd_gdImagePng=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_gd_gdImagePng" >&5
+echo "${ECHO_T}$ac_cv_lib_gd_gdImagePng" >&6
+if test $ac_cv_lib_gd_gdImagePng = yes; then
+  LIBS="-lgd ${LIBS}"; HAVE_GD="yes"
+else
+  HAVE_GD=""
+fi
+
+
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset x;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *ccp;
+  char **p;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  ccp = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++ccp;
+  p = (char**) ccp;
+  ccp = (char const *const *) p;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+  }
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_const=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_const=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
+echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6
+if test "${ac_cv_struct_tm+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <time.h>
+
+int
+main ()
+{
+struct tm *tp; tp->tm_sec;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_struct_tm=time.h
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_struct_tm=sys/time.h
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
+echo "${ECHO_T}$ac_cv_struct_tm" >&6
+if test $ac_cv_struct_tm = sys/time.h; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TM_IN_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
+# needs to be defined for it
+echo "$as_me:$LINENO: checking for fopen64" >&5
+echo $ECHO_N "checking for fopen64... $ECHO_C" >&6
+if test "${bu_cv_have_fopen64+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen64 ("/tmp/foo","r");
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  bu_cv_have_fopen64=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+saved_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen64 ("/tmp/foo","r");
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+bu_cv_have_fopen64=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+ CPPFLAGS=$saved_CPPFLAGS
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+
+echo "$as_me:$LINENO: result: $bu_cv_have_fopen64" >&5
+echo "${ECHO_T}$bu_cv_have_fopen64" >&6
+if test "$bu_cv_have_fopen64" != no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_FOPEN64 1
+_ACEOF
+
+  if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _LARGEFILE64_SOURCE 1
+_ACEOF
+
+  fi
+fi
+
+
+# Check whether --enable-bindir or --disable-bindir was given.
+if test "${enable_bindir+set}" = set; then
+  enableval="$enable_bindir"
+
+    if test "$enableval"; then
+        BINDIR=$enableval
+    fi
+
+else
+  BINDIR="/usr/bin"
+fi;
+echo "using $BINDIR as the SARG binary"
+
+
+# Check whether --enable-mandir or --disable-mandir was given.
+if test "${enable_mandir+set}" = set; then
+  enableval="$enable_mandir"
+
+    if test "$enableval"; then
+        MANDIR=$enableval
+    fi
+
+else
+  MANDIR="/usr/local/man/man1"
+fi;
+echo "using $MANDIR as the SARG man page"
+
+
+# Check whether --enable-sysconfdir or --disable-sysconfdir was given.
+if test "${enable_sysconfdir+set}" = set; then
+  enableval="$enable_sysconfdir"
+
+    if test "$enableval"; then
+        SYSCONFDIR=$enableval
+    fi
+
+else
+  SYSCONFDIR="/usr/local/sarg"
+fi;
+echo "using $SYSCONFDIR as the SARG configuration dir"
+
+
+# Check whether --enable-htmldir or --disable-htmldir was given.
+if test "${enable_htmldir+set}" = set; then
+  enableval="$enable_htmldir"
+
+    if test "$enableval"; then
+        HTMLDIR=$enableval
+    fi
+
+else
+  HTMLDIR="/var/www/html"
+fi;
+echo "using $HTMLDIR as the WWW Document Root dir"
+
+
+
+          ac_config_files="$ac_config_files Makefile"
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[    ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[      ]*$//;
+}'
+fi
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\),-D\1=\2,g
+t quote
+s,^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[     `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output.  A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+        sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                  instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@BINDIR@,$BINDIR,;t t
+s,@MANDIR@,$MANDIR,;t t
+s,@SYSCONFDIR@,$SYSCONFDIR,;t t
+s,@HTMLDIR@,$HTMLDIR,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                    sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/configure.in b/configure.in
new file mode 100644 (file)
index 0000000..9a9afc5
--- /dev/null
@@ -0,0 +1,123 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(log.c)
+AC_CONFIG_AUX_DIR(cfgaux)
+
+LDFLAGS="-g"
+
+AC_CANONICAL_HOST
+
+AC_ARG_WITH(gcc,
+[  --without-gcc           use CC to compile])
+
+test -n "$CC" && cc_specified=yes
+case ${with_gcc} in
+  yes ) CC=gcc ;;
+dnl yes ) CC=g++ ;;
+  no  ) CC=cc ;;
+  *   ) AC_PROG_CC;;
+dnl  *   ) AC_PROG_CXX ;;
+esac
+
+if test "${CC}" = "cc" ; then
+   CFLAGS="${CFLAGS} -w -g -O2 -Aa"
+else
+   CFLAGS="${CFLAGS} -w"
+fi
+
+case "$host" in
+   *-solaris*)
+   LDFLAGS="${LDFLAGS} -lsocket -lnsl"
+   CFLAGS="-DSOLARIS ${CFLAGS}"
+   ;;
+esac
+
+#dnl Checks for programs.
+#AC_PROG_CC
+
+dnl Check for headers
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+
+AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \
+                dirent.h sys/socket.h netdb.h arpa/inet.h sys/types.h netinet/in.h sys/stat.h \
+                ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h errno.h)
+
+AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="")
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_STRUCT_TM
+
+# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
+# needs to be defined for it
+AC_MSG_CHECKING([for fopen64])
+AC_CACHE_VAL(bu_cv_have_fopen64,
+[AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
+bu_cv_have_fopen64=yes,
+[saved_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
+ AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
+bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
+bu_cv_have_fopen64=no)
+ CPPFLAGS=$saved_CPPFLAGS])])
+AC_MSG_RESULT($bu_cv_have_fopen64)
+if test "$bu_cv_have_fopen64" != no; then
+  AC_DEFINE([HAVE_FOPEN64], 1,
+            [Is fopen64 available?])
+  if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
+    AC_DEFINE([_LARGEFILE64_SOURCE], 1,
+              [Enable LFS])
+  fi
+fi
+
+
+dnl Select bindir
+AC_ARG_ENABLE(bindir,
+[  --enable-bindir=bindir
+                        Select bindir ],
+[
+    if test "$enableval"; then
+        BINDIR=$enableval
+    fi
+],[BINDIR="/usr/bin"])
+echo "using $BINDIR as the SARG binary"
+AC_SUBST(BINDIR)
+
+dnl Select mandir
+AC_ARG_ENABLE(mandir,
+[  --enable-mandir=mandir
+                        Select mandir ],
+[
+    if test "$enableval"; then
+        MANDIR=$enableval
+    fi
+],[MANDIR="/usr/local/man/man1"])
+echo "using $MANDIR as the SARG man page"
+AC_SUBST(MANDIR)
+
+dnl Select sysconfdir
+AC_ARG_ENABLE(sysconfdir,
+[  --enable-sysconfdir=sysconfdir
+                        Select sysconfdir ],
+[
+    if test "$enableval"; then
+        SYSCONFDIR=$enableval
+    fi
+],[SYSCONFDIR="/usr/local/sarg"])
+echo "using $SYSCONFDIR as the SARG configuration dir"
+AC_SUBST(SYSCONFDIR)
+
+dnl Select htmldir
+AC_ARG_ENABLE(htmldir,
+[  --enable-htmldir=htmldir
+                        Select htmldir ],
+[
+    if test "$enableval"; then
+        HTMLDIR=$enableval
+    fi
+],[HTMLDIR="/var/www/html"])
+echo "using $HTMLDIR as the WWW Document Root dir"
+AC_SUBST(HTMLDIR)
+
+
+AC_OUTPUT(Makefile)
diff --git a/convlog.c b/convlog.c
new file mode 100644 (file)
index 0000000..dd1b918
--- /dev/null
+++ b/convlog.c
@@ -0,0 +1,71 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void convlog(char *arq, char *df, int dfrom, int duntil)
+{
+
+   FILE *fp_in;
+   char buf[MAXLEN];
+   char data[30];
+   char dia[11];
+   char hora[9];
+   char wdata[20];
+   time_t tt;
+   int idata=0;
+   struct tm *t;
+
+   if(arq[0] == '\0')
+      strcpy(arq,"/usr/local/squid/logs/access.log");
+
+   if((fp_in=fopen(arq,"r"))==NULL) {
+      fprintf(stderr, "SARG: (convlog) %s: %s\n",text[8],arq);
+      exit(1);
+   }
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(data,buf,' ');
+      tt=atoi(data);
+      t=localtime(&tt);
+
+      if(dfrom) {
+         strftime(wdata, 127, "%Y%m%d", t);
+         idata=atoi(wdata);
+        if(idata < dfrom || idata > duntil)
+         continue;
+      }
+
+      if(strncmp(df,"e",1) == 0)
+         strftime(dia, 127, "%d/%m/%Y", t);
+       else
+         strftime(dia, 127, "%m/%d/%Y", t);
+      sprintf(hora,"%02d:%02d:%02d",t->tm_hour,t->tm_min,t->tm_sec);
+
+      printf("%s %s %s",dia,hora,buf);
+   }
+
+   fclose(fp_in);
+}
diff --git a/css.c b/css.c
new file mode 100644 (file)
index 0000000..28ea8a9
--- /dev/null
+++ b/css.c
@@ -0,0 +1,98 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+int css(FILE *fp_css)
+{
+   FILE *fp_in, *fp_ou;
+   char csstext[512];
+
+   fp_ou = fp_css;
+   if(strlen(ExternalCSSFile) > 0) {
+      if((fp_in=fopen(ExternalCSSFile,"r"))==NULL) {
+         fprintf(stderr, "SARG: (css) %s: %s\n",text[45],ExternalCSSFile);
+         exit(1);
+      }
+      fputs("<style>\n",fp_ou);
+      while(fgets(buf,MAXLEN,fp_in)!=NULL)
+         fputs(buf,fp_ou);
+      fputs("</style>\n",fp_ou);
+      return;
+   }
+
+   fputs("<style>\n",fp_ou);
+   fputs(".logo {font-family:Verdana,Tahoma,Arial;font-size:11px;color:#006699;}\n",fp_ou);
+   sprintf(csstext,".body {font-family:%s;color:%s;background-color:%s;}\n", \
+               FontFace, TxColor, BgColor);
+   fputs(csstext,fp_ou);
+
+
+   sprintf(csstext,".info {font-family:%s;font-size:9px;}\n", FontFace);
+   fputs(csstext,fp_ou);
+   sprintf(csstext,".info a:link,a:visited {font-family:%s;color:#0000FF;font-size:9px;text-decoration:none;}\n", FontFace);
+   fputs(csstext,fp_ou);
+
+   sprintf(csstext,".title {font-family:%s;font-size:%s;color:%s;background-color:%s;}\n", \
+               FontFace, TitleFontSize, TiColor, BgColor);
+   fputs(csstext,fp_ou);
+
+   sprintf(csstext,".header {font-family:%s;font-size:%s;color:%s;background-color:%s; \
+               text-align:left;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}\n", \
+               FontFace, HeaderFontSize, HeaderColor, HeaderBgColor);
+   fputs(csstext,fp_ou);
+
+   sprintf(csstext,".header2 {font-family:%s;font-size:%s;color:%s;background-color:%s; \
+               text-align:right;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}\n", \
+               FontFace, HeaderFontSize, HeaderColor, HeaderBgColor);
+   fputs(csstext,fp_ou);
+
+   sprintf(csstext,".header3 {font-family:%s;font-size:%s;color:%s;background-color:%s;text-align:center;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}\n", \
+               FontFace, HeaderFontSize, HeaderColor, HeaderBgColor);
+   fputs(csstext,fp_ou);
+
+   sprintf(csstext,".text {font-family:%s;color:%s;font-size:%s;}\n", FontFace, TxColor, FontSize);
+   fputs(csstext,fp_ou);
+
+   sprintf(csstext,".data {font-family:%s;color:%s;font-size:%s;background-color:%s;text-align:right;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}\n", FontFace, TxColor, FontSize, TxBgColor);
+   fputs(csstext,fp_ou);
+   sprintf(csstext,".data a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;background-color:%s;text-align:right;text-decoration:none;}\n", FontFace, FontSize, TxBgColor);
+   fputs(csstext,fp_ou);
+
+   sprintf(csstext,".data2 {font-family:%s;color:%s;font-size:%s;background-color:%s;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}\n", FontFace, TxColor, FontSize, TxBgColor);
+   fputs(csstext,fp_ou);
+   sprintf(csstext,".data2 a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;background-color:%s;text-decoration:none;}\n", FontFace, FontSize, TxBgColor);
+   fputs(csstext,fp_ou);
+
+   sprintf(csstext,".link {font-family:%s;font-size:%s;color:#0000FF;}\n", FontFace, FontSize);
+   fputs(csstext,fp_ou);
+   sprintf(csstext,".link a:link,a:visited {font-family:%s;font-size:%s;color:#0000FF;text-decoration:none;}\n", FontFace, FontSize);
+   fputs(csstext,fp_ou);
+
+   fputs("</style>\n",fp_ou);
+   fflush(fp_ou);
+
+   return;
+;}
diff --git a/css.tpl b/css.tpl
new file mode 100644 (file)
index 0000000..d6b6be7
--- /dev/null
+++ b/css.tpl
@@ -0,0 +1,14 @@
+.body {font-family:Verdana,Tahoma,Arial;color:#000000;background-color:#FFFFFF;}
+.info {font-family:Verdana,Tahoma,Arial;font-size:9px;}
+.info a:link,a:visited {font-family:Verdana,Tahoma,Arial;color:#0000FF;font-size:9px;text-decoration:none;}
+.title {font-family:Verdana,Tahoma,Arial;font-size:11px;color:darkblue;background-color:#FFFFFF;}
+.header {font-family:Verdana,Tahoma,Arial;font-size:9px;color:darkblue;background-color:#DDDDDD;text-align:left;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}
+.header2 {font-family:Verdana,Tahoma,Arial;font-size:9px;color:darkblue;background-color:#DDDDDD;text-align:right;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}
+.header3 {font-family:Verdana,Tahoma,Arial;font-size:9px;color:darkblue;background-color:#DDDDDD;text-align:center;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}
+.text {font-family:Verdana,Tahoma,Arial;color:#000000;font-size:9px;}
+.data {font-family:Verdana,Tahoma,Arial;color:#000000;font-size:9px;background-color:lavender;text-align:right;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}
+.data a:link,a:visited {font-family:Verdana,Tahoma,Arial;color:#0000FF;font-size:9px;background-color:lavender;text-align:right;text-decoration:none;}
+.data2 {font-family:Verdana,Tahoma,Arial;color:#000000;font-size:9px;background-color:lavender;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}
+.data2 a:link,a:visited {font-family:Verdana,Tahoma,Arial;color:#0000FF;font-size:9px;background-color:lavender;text-decoration:none;}
+.link {font-family:Verdana,Tahoma,Arial;font-size:9px;color:#0000FF;}
+.link a:link,a:visited {font-family:Verdana,Tahoma,Arial;font-size:9px;color:#0000FF;text-decoration:none;}
diff --git a/dansguardian_log.c b/dansguardian_log.c
new file mode 100644 (file)
index 0000000..e80cb1e
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+int dansguardian_log()
+{
+
+   FILE *fp_in = NULL, *fp_ou = NULL, *fp_guard = NULL;
+   char guard_in[MAXLEN];
+   char guard_ou[MAXLEN];
+   char loglocation[MAXLEN] = "/var/log/dansguardian/access.log";
+   char year[10], mon[10], day[10];
+   char hour[15];
+   char user[MAXLEN], code1[255], code2[255];
+   char ip[30];
+   char wdata[127];
+   int  idata=0;
+   int  x, y;
+
+   if(strlen(DansGuardianConf) < 1)
+     return;
+
+   bzero(day, 3);
+   bzero(mon, 4);
+   bzero(year, 5);
+
+   if(strcmp(df,"e") == 0) {
+      strncpy(day,periodo,2);
+      strncpy(mon,periodo+2,3);
+      strncpy(year,periodo+5,4);
+      conv_month(mon);
+      sprintf(warea,"%s%s%s",year,mon,day);
+      dfrom=atoi(warea);
+      strncpy(day,periodo+10,2);
+      strncpy(mon,periodo+12,3);
+      strncpy(year,periodo+15,4);
+      conv_month(mon);
+      sprintf(warea,"%s%s%s",year,mon,day);
+      duntil=atoi(warea);
+   } else {
+      strncpy(day,periodo+7,2);
+      strncpy(mon,periodo+4,3);
+      strncpy(year,periodo,4);
+      conv_month(mon);
+      sprintf(warea,"%s%s%s",year,mon,day);
+      dfrom=atoi(warea);
+      strncpy(day,periodo+17,2);
+      strncpy(mon,periodo+14,3);
+      strncpy(year,periodo+10,4);
+      conv_month(mon);
+      sprintf(warea,"%s%s%s",year,mon,day);
+      duntil=atoi(warea);
+   }
+
+   sprintf(guard_in,"%s/dansguardian.unsort",tmp);
+   sprintf(guard_ou,"%s/dansguardian.log",tmp);
+
+   if(access(DansGuardianConf, R_OK) != 0) {
+      sprintf(msg,"Cannot open DansGuardian config file: %s",DansGuardianConf);
+      debuga(msg);
+      exit(1);
+   }
+
+   if((fp_guard=fopen(DansGuardianConf,"r"))==NULL) {
+      fprintf(stderr, "SARG: (dansguardian) %s: %s\n",text[8],DansGuardianConf);
+      exit(1);
+   }
+
+   if((fp_ou=fopen(guard_in,"a"))==NULL) {
+      fprintf(stderr, "SARG: (dansguardian) %s: %s\n",text[8],guard_in);
+      exit(1);
+   }
+
+   while(fgets(buf,sizeof(buf),fp_guard)!=NULL) {
+      if(strstr(buf,"\n") != 0)
+         buf[strlen(buf)-1]='\0';
+      if(strncmp(buf,"#",1) == 0)
+         continue;
+      if(strstr(buf,"loglocation ") != 0) {
+         getword(loglocation,buf,'\'');
+         getword(loglocation,buf,'\'');
+         break;
+      }
+   }
+
+   if(debug) {
+      strcpy(buf,text[7]);
+      getword(urly,buf,' ');
+      getword(href,buf,' ');
+      sprintf(msg,"%s DansGuardian %s: %s",urly,buf,loglocation);
+      debuga(msg);
+   }
+   
+   if((fp_in=fopen(loglocation,"r"))==NULL) {
+      fprintf(stderr, "SARG: (dansguardian) %s: %s\n",text[8],loglocation);
+      exit(1);
+   }
+   while(fgets(buf,sizeof(buf),fp_in) != NULL) {
+      if(strstr(buf," *DENIED* ") == 0)
+         continue;
+      getword(year,buf,'.');
+      getword(mon,buf,'.');
+      getword(day,buf,' ');
+      getword(hour,buf,' ');
+      getword(user,buf,' ');
+      getword(ip,buf,' ');
+      getword(url,buf,'/');
+      getword(url,buf,'/');
+      getword(url,buf,' ');
+      getword(code1,buf,' ');
+      getword(code1,buf,' ');
+      getword(code2,buf,' ');
+      sprintf(wdata,"%s%02d%s",year,atoi(mon),day);
+      idata = atoi(wdata);
+
+      if(idata >= dfrom && idata <= duntil) {
+         if(strcmp(user,"-") == 0)
+            strcpy(user,ip);
+         sprintf(tmp6,"%s %d %s %s %s %s %s\n",user,idata,hour,ip,url,code1,code2);
+         fputs(tmp6, fp_ou);
+         dansguardian_count++;
+      }
+   }
+   fclose(fp_in);
+   fclose(fp_guard);
+   fclose(fp_ou);
+   sprintf(tmp6,"sort -k 1,1 -k 2,2 -k 4,4 %s -o %s",guard_in, guard_ou);
+   system(tmp6);
+   unlink(guard_in);
+   return;
+}
diff --git a/dansguardian_report.c b/dansguardian_report.c
new file mode 100644 (file)
index 0000000..836d060
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void dansguardian_report()
+{
+
+   FILE *fp_in = NULL, *fp_ou = NULL;
+      
+   char url[MAXLEN];
+   char html[MAXLEN];
+   char html2[MAXLEN];
+   char dansguardian_in[MAXLEN];
+   char dansguardian_ou[MAXLEN];
+   char per[MAXLEN];
+   char report[MAXLEN];
+   char periodo[100];
+   char ip[MAXLEN];
+   char rule[255];
+   char oip[MAXLEN];
+   char user[MAXLEN];
+   char ouser[MAXLEN];
+   char date[15];
+   char date2[15];
+   char hour[15];
+   char ftime[128];
+   char *str;
+   int  z=0;
+   int  count=0;
+
+   ouser[0]='\0';
+
+   sprintf(dansguardian_in,"%s/dansguardian.log",tmp);
+   if(!dansguardian_count) {
+      unlink(dansguardian_in);
+      return;
+   }
+
+   sprintf(per,"%s/periodo",dirname);
+   sprintf(report,"%s/dansguardian.html",dirname);
+
+   if ((fp_in = fopen(per, "r")) == 0) {
+      fprintf(stderr, "SARG: (dansguardian_report) %s: %s\n",text[45],per);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   if((fp_in=fopen(dansguardian_in,"r"))==NULL) {
+     fprintf(stderr, "SARG: (dansguardian_report) %s: %s\n",text[8],dansguardian_in);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(report,"w"))==NULL) {
+     fprintf(stderr, "SARG: (dansguardian_report) %s: %s\n",text[8],report);
+     exit(1);
+   }
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);
+   fputs("<html>\n",fp_ou);
+   fputs("<head>\n",fp_ou);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ou);
+   css(fp_ou);
+   fputs("</head>\n",fp_ou);
+
+   if(strlen(FontFace) > 0) {
+      sprintf(url,"<font face=%s>\n",FontFace);
+      fputs(url,fp_ou);
+   }
+
+   sprintf(url,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   fputs(url,fp_ou);
+
+   if(strlen(LogoImage) > 0) {
+      fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+      sprintf(url,"<tr><th><img src='%s' border=0 align=absmiddle width=%s height=%s> \
+         <font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(url,fp_ou);
+      fputs("</table>\n",fp_ou);
+   }
+
+   show_sarg(fp_ou,"..");
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+   sprintf(url,"<tr><th class=\"title\">%s</th></tr>\n",Title);
+   fputs(url,fp_ou);
+
+   sprintf(url,"<tr><td class=\"header\">%s: %s</td></tr>\n",text[89],periodo);
+   fputs(url,fp_ou);
+   sprintf(url,"<tr><th class=\"header3\">%s %s</th></tr>\n",text[128],text[55]);
+   fputs(url,fp_ou);
+   fputs("</table></center>\n",fp_ou);
+
+   fputs("<center><table cellpadding=1 cellspacing=2>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   sprintf(url,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[98],text[111],text[110],text[91],text[129]);
+   fputs(url,fp_ou);
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(user,buf,' ');
+      getword(date2,buf,' ');
+      getword(hour,buf,' ');
+      getword(ip,buf,' ');
+      getword(url,buf,' ');
+      getword(rule,buf,'\n');
+
+      if(strcmp(UserIp,"yes") == 0)
+           strcpy(user,ip);
+
+      bzero(date, 15);
+      if(strncmp(df,"u",1) != 0) {
+         strncpy(date,date2+6,2);
+         strcat(date,"/");
+         strncat(date,date2+4,2);
+         strcat(date,"/");
+         strncat(date,date2,4);
+      } else {
+         strncpy(date,date2+4,2);
+         strcat(date,"/");
+         strncat(date,date2+6,2);
+         strcat(date,"/");
+         strncat(date,date2,4);
+      }
+
+      if((str=(char *) strstr(user, "_")) != (char *) NULL ) {
+         if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
+            fixip(user);
+      }
+
+      if(strcmp(Ip2Name,"yes") == 0) 
+         ip2name(ip);
+
+      if(!z) {
+         strcpy(ouser,user);
+         strcpy(oip,ip);
+         z++;
+      } else {
+         if(strcmp(ouser,user) == 0)
+            user[0]='\0';
+         if(user[0] != '\0')
+            strcpy(ouser,user);
+         if(strcmp(oip,ip) == 0) 
+            ip[0]='\0';
+         if(ip[0] != '\0')
+            strcpy(oip,ip);
+      }
+
+      if(UserTabFile[0] != '\0') {
+         sprintf(warea,":%s:",user);
+         if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+            z1=0;
+            str2=(char *) strstr(str+1,":");
+            str2++;
+            bzero(name, MAXLEN);
+            while(str2[z1] != ':') {
+               name[z1]=str2[z1];
+               z1++;
+            }
+         } else strcpy(name,user);
+      } else strcpy(name,user);
+
+     if(DansGuardianReportLimit) {
+         if(strcmp(ouser2,name) == 0) {
+            count++;
+         } else {
+            count=1;
+            strcpy(ouser2,name);
+         }
+         if(count >= DansGuardianReportLimit)
+            continue;
+      }
+
+      sprintf(html2,"<tr><td class=\"data2\">%s</td><td class=\"data2\">%s</td><td class=\"data2\">%s-%s</td><td class=\"data2\"><a href=\"http://%s\">%s</a></td><td class=\"data2\">%s</td></tr>\n",name,ip,date,hour,url,url,rule);
+      fputs(html2,fp_ou);
+   }
+
+   fputs("</table>\n",fp_ou);
+
+   show_info(fp_ou);
+   
+   fputs("</body>\n</html>\n",fp_ou);
+
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   unlink(dansguardian_in);
+
+   return;
+}
diff --git a/datafile.c b/datafile.c
new file mode 100644 (file)
index 0000000..08ed1f9
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void saverecs(char *dirname, char *user, long long int nacc, char *url, long long int nbytes, char *ip, char *hora, char *dia, long long int nelap, long long int incache, long long int oucache);
+void grava_SmartFilter(char *dirname, char *user, char *ip, char *data, char *hora, char *url, char *smart);
+
+void data_file(char *tmp)
+{
+
+   FILE *fp_in;
+
+   char accdia[11], acchora[9], accuser[MAXLEN], accip[MAXLEN], accurl[MAXLEN], accbytes[12], accelap[10];
+   char oldaccdia[11], oldacchora[9], oldaccip[MAXLEN], wdir[MAXLEN], per1[MAXLEN];
+   char dirname[MAXLEN], wdirname[MAXLEN], oldurl[MAXLEN], oldaccuser[MAXLEN];
+   char olduser[MAXLEN], oldmsg[50], acccode[50], oldaccelap[10], oldacccode[50];
+   char ipantes[MAXLEN], nameantes[MAXLEN]; 
+   char accsmart[MAXLEN];
+   char Msg[MAXLEN];
+   int  smartfilter=0;
+   char wcrc[50];
+   char crc2[50];
+   char wdname[MAXLEN];
+   char wname2[MAXLEN];
+   DIR *dirp;
+   struct dirent *direntp;
+   long long int nbytes=0; 
+   long long int nelap=0; 
+   long long int nacc=0;
+   long long int rtotal=0;
+   long long int incache=0;
+   long long int oucache=0;
+   char *s;
+
+   ipantes[0]='\0';
+   nameantes[0]='\0';
+
+   olduser[0]='\0';
+   strncat(tmp,"/sarg",5);
+
+   dirp = opendir(tmp);
+   while ( (direntp = readdir( dirp )) != NULL ) {
+      if(strstr(direntp->d_name,".log") == 0)
+         continue;
+      sprintf(tmp3,"%s/%s",tmp,direntp->d_name);
+
+      if((fp_in=fopen(tmp3,"r"))==NULL){
+         fprintf(stderr, "SARG: (datafile) %s: %s\n",text[45],tmp);
+         exit(1);
+      }
+      strcpy(wdname,direntp->d_name);
+      strip_prefix:
+      getword(wname2,wdname,'.');
+      strcat(user,wname2);
+
+      ttopen=0;
+      while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+         getword(accdia,buf,' ');
+         getword(acchora,buf,' ');
+         getword(accuser,buf,' ');
+         getword(accip,buf,' ');
+         getword(accurl,buf,' ');
+         getword(accbytes,buf,' ');
+         getword(acccode,buf,' ');
+         getword(accelap,buf,' ');
+         getword(accsmart,buf,' ');
+         getword(accsmart,buf,'"');
+   
+         if(strcmp(Ip2Name,"yes") == 0) {
+            if(strcmp(accip,ipantes) != 0) {
+               strcpy(ipantes,accip);
+               ip2name(accip);
+               strcpy(nameantes,accip);
+            } else strcpy(accip,nameantes);
+         }
+   
+         if(!rtotal){
+            strcpy(oldurl,accurl);
+            strcpy(oldacccode,acccode);
+            strcpy(oldaccelap,accelap);
+            strcpy(oldaccuser,accuser);
+            strcpy(oldaccip,accip);
+            strcpy(oldaccdia,accdia);
+            strcpy(oldacchora,acchora);
+            rtotal++;
+         }
+   
+         if(strcmp(oldurl,accurl) != 0 || strcmp(oldaccuser,accuser) != 0){
+            strcpy(oldmsg,"OK");
+            if(strstr(oldacccode,"DENIED") != 0)
+               sprintf(oldmsg,"%s",text[46]);
+            strcpy(wdirname,dirname);
+            gravatmp(oldaccuser,wdirname,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
+            strcpy(wdirname,dirname);
+            saverecs(wdirname,oldaccuser,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache);
+            nacc=0;
+            nbytes=0;
+            nelap=0;
+            incache=0;
+            oucache=0;
+            if(strcmp(oldaccuser,accuser) != 0)
+               ind2=0;
+         }
+
+         nacc++;
+         nbytes+=my_atoll(accbytes);
+         nelap+=my_atoll(accelap);
+   
+         strcpy(wcrc,acccode);
+         getword(crc2,wcrc,'/');
+
+         if(strstr(crc2,"MISS") != 0)
+            oucache+=my_atoll(accbytes);
+          else incache+=my_atoll(accbytes);
+   
+         strcpy(oldurl,accurl);
+         strcpy(oldaccuser,accuser);
+         strcpy(oldacccode,acccode);
+         strcpy(oldaccelap,accelap);
+         strcpy(oldaccip,accip);
+         strcpy(oldaccdia,accdia);
+         strcpy(oldacchora,acchora);
+      }
+   
+      fclose(fp_in);
+}
+   
+   (void)closedir( dirp );
+   if(debug) {
+      sprintf(Msg,"Datafile %s successfully",DataFile);
+      debuga(Msg);
+   }
+   return;
+}
+
+void saverecs(char *dirname, char *user, long long int nacc, char *url, long long int nbytes, char *ip, char *hora, char *dia, long long int nelap, long long int incache, long long int oucache)
+{
+
+   FILE *fp_ou;
+   char reg[MAXLEN];
+
+   if((fp_ou=fopen(DataFile,"a"))==NULL){
+      fprintf(stderr, "SARG: (datafile) %s: %s\n",text[45],DataFile);
+      exit(1);
+   }
+
+   my_lltoa(nacc,val1,0);
+   my_lltoa(nbytes,val2,0);
+   my_lltoa(nelap,val3,0);
+   my_lltoa(incache,val4,0);
+   my_lltoa(oucache,val5,0);
+
+   if(strstr(DataFileFields,"user") != 0) {
+      strcpy(reg,user);
+      strncat(reg,DataFileDelimiter,1);
+   }
+   if(strstr(DataFileFields,"date") != 0) {
+      strncat(reg,dia,strlen(dia));
+      strncat(reg,DataFileDelimiter,1);
+   }
+   if(strstr(DataFileFields,"time") != 0) {
+      strncat(reg,hora,strlen(hora));
+      strncat(reg,DataFileDelimiter,1);
+   }
+   if(strstr(DataFileFields,"url") != 0) {
+      strcpy(name,url);
+      name2ip(name);
+      strncat(reg,name,strlen(name));
+      strncat(reg,DataFileDelimiter,1);
+   }
+   if(strstr(DataFileFields,"connect") != 0) {
+      strncat(reg,val1,strlen(val1));
+      strncat(reg,DataFileDelimiter,1);
+   }
+   if(strstr(DataFileFields,"bytes") != 0) {
+      strncat(reg,val2,strlen(val2));
+      strncat(reg,DataFileDelimiter,1);
+   }
+   if(strstr(DataFileFields,"in_cache") != 0) {
+      strncat(reg,val4,strlen(val4));
+      strncat(reg,DataFileDelimiter,1);
+   }
+   if(strstr(DataFileFields,"out_cache") != 0) {
+      strncat(reg,val5,strlen(val5));
+      strncat(reg,DataFileDelimiter,1);
+   }
+   if(strstr(DataFileFields,"elapsed") != 0) {
+      strncat(reg,val3,strlen(val3));
+      strncat(reg,DataFileDelimiter,1);
+   }
+
+   reg[strlen(reg)-1]='\n';
+   fputs(reg,fp_ou);
+
+   fclose(fp_ou);
+
+   return;
+
+}
diff --git a/decomp.c b/decomp.c
new file mode 100644 (file)
index 0000000..956e816
--- /dev/null
+++ b/decomp.c
@@ -0,0 +1,96 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void decomp(char *arq, char *zip, char *tmp)
+{
+
+   char cmd[1024];
+
+   if(access(arq, R_OK) != 0) {
+      sprintf(cmd,"%s: %s",text[64],arq);
+      debuga(cmd);
+      exit(1);
+   }
+
+   if(strstr(arq,".gz") !=0) {
+      sprintf(cmd,"%s: %s > %s/sarg-file.in (zcat)",text[62],arq,tmp);
+      debuga(cmd);
+      sprintf(cmd,"zcat %s > %s/sarg-file.in",arq,tmp);
+      system(cmd);
+      strcpy(zip,"zcat");
+      sprintf(arq,"%s/sarg-file.in",tmp);
+      return;
+   }
+
+   if(strstr(arq,".bz2") != 0) {
+      sprintf(cmd,"%s: %s > %s/sarg-file.in (bzcat)",text[62],arq,tmp);
+      debuga(cmd);
+      sprintf(cmd,"bzcat %s > %s/sarg-file.in",arq,tmp);
+      system(cmd);
+      strcpy(zip,"zcat");
+      sprintf(arq,"%s/sarg-file.in",tmp);
+      return;
+   }
+
+   if(strstr(arq,".Z")) {
+      sprintf(cmd,"%s: %s (uncompress)",text[62],arq);
+      debuga(cmd);
+      sprintf(cmd,"uncompress %s",arq);
+      system(cmd);
+      arq[strlen(arq)-2]='\0';
+      strcpy(zip,"compress");
+   }
+
+   return;
+
+}
+
+
+void recomp(char *arq, char *zip) 
+{
+
+   char cmd[1024];
+
+   if(access(arq, R_OK) != 0) {
+      sprintf(cmd,"%s: %s",text[64],arq);
+      debuga(cmd);
+      exit(1);
+   }
+
+   sprintf(cmd,"%s: %s",text[63],arq);
+   debuga(cmd);
+
+   if(strcmp(zip,"gzip") == 0)
+      sprintf(cmd,"%s %s",zip,arq);    
+
+   if(strcmp(zip,"compress") == 0)
+      sprintf(cmd,"%s %s",zip,arq);
+
+   system(cmd);
+   return;
+
+}
diff --git a/denied.c b/denied.c
new file mode 100644 (file)
index 0000000..954d0e4
--- /dev/null
+++ b/denied.c
@@ -0,0 +1,192 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void gen_denied_report()
+{
+
+   FILE *fp_in = NULL, *fp_ou = NULL;
+      
+   char url[MAXLEN];
+   char html[MAXLEN];
+   char html2[MAXLEN];
+   char denied_in[MAXLEN];
+   char denied_ou[MAXLEN];
+   char per[MAXLEN];
+   char report[MAXLEN];
+   char periodo[100];
+   char ip[MAXLEN];
+   char oip[MAXLEN];
+   char user[MAXLEN];
+   char ouser[MAXLEN];
+   char ouser2[MAXLEN];
+   char data[15];
+   char hora[15];
+   char ftime[128];
+   char *str;
+   int  z=0;
+   int  count=0;
+
+   ouser[0]='\0';
+
+   sprintf(denied_in,"%s/denied.log",TempDir);
+   if(!denied_count) {
+      unlink(denied_in);
+      return;
+   }
+
+   sprintf(per,"%s/periodo",dirname);
+   sprintf(report,"%s/denied.html",dirname);
+
+   if ((fp_in = fopen(per, "r")) == 0) {
+      fprintf(stderr, "SARG: (denied) %s: %s\n",text[45],per);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   if((fp_in=fopen(denied_in,"r"))==NULL) {
+     fprintf(stderr, "SARG: (denied) %s: %s\n",text[8],denied_in);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(report,"w"))==NULL) {
+     fprintf(stderr, "SARG: (denied) %s: %s\n",text[8],report);
+     exit(1);
+   }
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);
+   fputs("<html>\n",fp_ou);
+   fputs("<head>\n",fp_ou);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ou);
+   css(fp_ou);
+   fputs("</head>\n",fp_ou);
+
+   sprintf(url,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   fputs(url,fp_ou);
+
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+
+   if(strlen(LogoImage) > 0) {
+      sprintf(url,"<tr><th align=\"center\"><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(url,fp_ou);
+   }
+
+   show_sarg(fp_ou, "..");
+   sprintf(url,"<tr><th class=\"title\">%s</b></th></tr>\n",Title);
+   fputs(url,fp_ou);
+
+   sprintf(url,"<tr><td class=\"header\">%s: %s</td></tr>\n",text[89],periodo);
+   fputs(url,fp_ou);
+   sprintf(url,"<tr><th class=\"header3\">%s %s</th></tr>\n",text[46],text[55]);
+   fputs(url,fp_ou);
+   fputs("</table></center>\n",fp_ou);
+
+   fputs("<center><table cellpadding=0 cellspacing=2>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   sprintf(url,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[98],text[111],text[110],text[91]);
+   fputs(url,fp_ou);
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(data,buf,' ');
+      getword(hora,buf,' ');
+      getword(user,buf,' ');
+      getword(ip,buf,' ');
+      getword(url,buf,' ');
+
+      if((str=(char *) strstr(user, "_")) != (char *) NULL ) {
+         if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
+            fixip(user);
+      }
+
+      if(strcmp(Ip2Name,"yes") == 0) 
+         ip2name(ip);
+
+      if(!z) {
+         strcpy(ouser,user);
+         strcpy(oip,ip);
+         z++;
+      } else {
+         if(strcmp(ouser,user) == 0)
+            user[0]='\0';
+         if(user[0] != '\0')
+            strcpy(ouser,user);
+         if(strcmp(oip,ip) == 0) 
+            ip[0]='\0';
+         if(ip[0] != '\0')
+            strcpy(oip,ip);
+      }
+
+      if(UserTabFile[0] != '\0') {
+         sprintf(warea,":%s:",user);
+         if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+            z1=0;
+            str2=(char *) strstr(str+1,":");
+            str2++;
+            bzero(name, MAXLEN);
+            while(str2[z1] != ':') {
+               name[z1]=str2[z1];
+               z1++;
+            }
+         } else strcpy(name,user);
+      } else strcpy(name,user);
+
+      if(DeniedReportLimit) {
+         if(strcmp(ouser2,name) == 0) {
+            count++; 
+         } else {
+            count=1;
+            strcpy(ouser2,name);
+         }
+         if(count >= DeniedReportLimit)
+            continue;
+      }
+
+      if(strlen(BlockIt) > 0)
+         sprintf(BlockImage,"<a href=\"%s%s?url=%s\"><img src=\"../images/sarg-squidguard-block.png\" border=\"0\"></a>&nbsp;",wwwDocumentRoot,BlockIt,url);
+      else BlockImage[0]='\0';
+
+      sprintf(html2,"<tr><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s-%s</td><td class=\"data2\">%s<a href=\"%s\">%s</a></td></th>\n",name,ip,data,hora,BlockImage,url,url);
+      fputs(html2,fp_ou);
+   }
+
+   fputs("</table>\n",fp_ou);
+
+   show_info(fp_ou);
+   fputs("</body></html>\n",fp_ou);
+
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   unlink(denied_in);
+
+   return;
+}
diff --git a/download.c b/download.c
new file mode 100644 (file)
index 0000000..7d18d58
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void download_report()
+{
+
+   FILE *fp_in = NULL, *fp_ou = NULL;
+      
+   char url[MAXLEN];
+   char html[MAXLEN];
+   char html2[MAXLEN];
+   char report_in[MAXLEN];
+   char report_ou[MAXLEN];
+   char wdirname[MAXLEN];
+   char report[MAXLEN];
+   char periodo[100];
+   char ip[MAXLEN];
+   char oip[MAXLEN];
+   char user[MAXLEN];
+   char ouser[MAXLEN];
+   char ouser2[MAXLEN];
+   char data[15];
+   char hora[15];
+   char ftime[128];
+   char *str;
+   int  z=0;
+   int  count=0;
+
+   ouser[0]='\0';
+
+   sprintf(report_in,"%s/sarg/download.log",TempDir);
+   if(access(report_in, R_OK) != 0)
+      return;
+
+   strcpy(wdirname,dirname);
+   sprintf(report,"%s/download.html",wdirname);
+   strcat(wdirname,"/");
+   strcat(wdirname,"periodo");
+
+   if ((fp_in = fopen(wdirname, "r")) == 0) {
+      fprintf(stderr, "SARG: (download) %s: %s\n",text[45],wdirname);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   if((fp_in=fopen(report_in,"r"))==NULL) {
+     fprintf(stderr, "SARG: (download) %s: %s\n",text[8],report_in);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(report,"w"))==NULL) {
+     fprintf(stderr, "SARG: (download) %s: %s\n",text[8],report);
+     exit(1);
+   }
+
+   fputs("<html>\n",fp_ou);
+   fputs("<head>\n",fp_ou);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ou);
+   css(fp_ou);
+   fputs("</head>\n",fp_ou);
+
+   sprintf(url,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   fputs(url,fp_ou);
+
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+
+   if(strlen(LogoImage) > 0) {
+      sprintf(url,"<tr><th align=\"center\"><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(url,fp_ou);
+   }
+
+   show_sarg(fp_ou, "..");
+   sprintf(url,"<tr><th class=\"title\">%s</b></th></tr>\n",Title);
+   fputs(url,fp_ou);
+
+   sprintf(url,"<tr><td class=\"header\">%s: %s</td></tr>\n",text[89],periodo);
+   fputs(url,fp_ou);
+   sprintf(url,"<tr><th class=\"header3\">%s %s</th></tr>\n",text[125],text[55]);
+   fputs(url,fp_ou);
+   fputs("</table></center>\n",fp_ou);
+
+   fputs("<center><table cellpadding=0 cellspacing=2>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   sprintf(url,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[98],text[111],text[110],text[91]);
+   fputs(url,fp_ou);
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(data,buf,' ');
+      getword(hora,buf,' ');
+      getword(user,buf,' ');
+      getword(ip,buf,' ');
+      getword(url,buf,' ');
+
+      if((str=(char *) strstr(user, "_")) != (char *) NULL ) {
+         if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
+            fixip(user);
+      }
+
+      if(strcmp(Ip2Name,"yes") == 0) 
+         ip2name(ip);
+
+      if(!z) {
+         strcpy(ouser,user);
+         strcpy(oip,ip);
+         z++;
+      } else {
+         if(strcmp(ouser,user) == 0)
+            user[0]='\0';
+         if(user[0] != '\0')
+            strcpy(ouser,user);
+         if(strcmp(oip,ip) == 0) 
+            ip[0]='\0';
+         if(ip[0] != '\0')
+            strcpy(oip,ip);
+      }
+
+      if(UserTabFile[0] != '\0') {
+         sprintf(warea,":%s:",user);
+         if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+            z1=0;
+            str2=(char *) strstr(str+1,":");
+            str2++;
+            bzero(name, MAXLEN);
+            while(str2[z1] != ':') {
+               name[z1]=str2[z1];
+               z1++;
+            }
+         } else strcpy(name,user);
+      } else strcpy(name,user);
+
+      if(DeniedReportLimit) {
+         if(strcmp(ouser2,name) == 0) {
+            count++; 
+         } else {
+            count=1;
+            strcpy(ouser2,name);
+         }
+         if(count >= DeniedReportLimit)
+            continue;
+      }
+
+      if(strlen(BlockIt) > 0)
+         sprintf(BlockImage,"<a href=\"%s%s?url=%s\"><img src=\"../images/sarg-squidguard-block.png\" border=\"0\"></a>&nbsp;",wwwDocumentRoot,BlockIt,url);
+      else BlockImage[0]='\0';
+
+      sprintf(html2,"<tr><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s-%s</td><td class=\"data2\">%s<a href=\"%s\">%s</a></td></th>\n",name,ip,data,hora,BlockImage,url,url);
+      fputs(html2,fp_ou);
+   }
+
+   fputs("</table>\n",fp_ou);
+
+   show_info(fp_ou);
+   fputs("</html>\n",fp_ou);
+
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   unlink(report_in);
+
+   return;
+}
diff --git a/email.c b/email.c
new file mode 100644 (file)
index 0000000..e4cbbe2
--- /dev/null
+++ b/email.c
@@ -0,0 +1,323 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+int geramail(const char *dirname, int debug, const char *outdir, int userip, char *email, char *TempDir)
+{
+
+   FILE *fp_in, *fp_top1, *fp_top2, *fp_top3;
+   long long int ttnbytes=0, ttnacc=0, tnacc=0;
+   long long int tnbytes=0, ttnelap=0, tnelap=0;
+   float perc=0.00;
+   float perc2=0.00;
+   int posicao=0;
+   char olduser[MAXLEN], csort[MAXLEN], periodo[MAXLEN], arqper[MAXLEN];
+   char wger[MAXLEN], top1[MAXLEN], top2[MAXLEN], top3[MAXLEN], user[MAXLEN], nacc[20], nbytes[20], url[1024], preg[MAXLEN], tusr[MAXLEN];
+   char ip[MAXLEN], hora[9], data[11], elap[15], user2[MAXLEN], wperc[8], wperc2[8];
+   char strip1[MAXLEN], strip2[MAXLEN], strip3[MAXLEN], strip4[MAXLEN], strip5[MAXLEN], strip6[MAXLEN], strip7[MAXLEN];
+   char incac[16], oucac[16];
+   int totuser=0;
+   time_t t;
+   struct tm *local;
+
+   strcpy(wger,dirname);
+   strcpy(top1,dirname);
+   strcpy(top2,dirname);
+   strcpy(top3,dirname);
+   strcpy(tusr,dirname);
+   strcat(wger,"/geral");
+   strcat(top1,"/top");
+   strcat(top2,"/top.tmp");
+   strcat(top3,"/report");
+   strcat(tusr,"/usuarios");
+
+   if((fp_in=fopen(wger,"r"))==NULL) {
+      fprintf(stderr, "SARG: (email) %s: %s\n",text[45],wger);
+      exit(1);
+   }
+
+   if((fp_top1=fopen(top1,"w"))==NULL) {
+      fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top1);
+      exit(1);
+   }
+
+   if((fp_top2=fopen(top2,"w"))==NULL) {
+      fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top2);
+      exit(1);
+   }
+
+   fscanf(fp_in,"%s",user);
+   fscanf(fp_in,"%s",nacc);
+   fscanf(fp_in,"%s",nbytes);
+   fscanf(fp_in,"%s",url);
+   fscanf(fp_in,"%s",ip);
+   fscanf(fp_in,"%s",hora);
+   fscanf(fp_in,"%s",data);
+   fscanf(fp_in,"%s",elap);
+   fscanf(fp_in,"%s",incac);
+   fscanf(fp_in,"%s",oucac);
+
+   strcpy(olduser,user);
+   totuser=1;
+
+   while(!feof(fp_in))
+   {
+
+      if(strcmp(olduser,user) != 0)
+      {
+         if(strcmp(user,"TOTAL") != 0)
+            totuser++;
+
+#if defined(__FreeBSD__)
+   sprintf(preg,"%s %15qu %15qu %15qu\n",olduser,tnbytes,tnacc,tnelap);
+#elif defined(__alpha) || __ALPHA
+   sprintf(preg,"%s %15ld %15ld %15ld\n",olduser,tnbytes,tnacc,tnelap);
+#else
+   sprintf(preg,"%s %15lld %15lld %15lld\n",olduser,tnbytes,tnacc,tnelap);
+#endif
+         fputs(preg,fp_top2);
+        strcpy(olduser,user);
+         ttnbytes=ttnbytes+tnbytes;
+        ttnacc=ttnacc+tnacc;
+        ttnelap=ttnelap+tnelap;
+         tnbytes=0;
+         tnacc=0;
+         tnelap=0;
+      }
+
+      tnbytes=tnbytes+atol(nbytes);
+      tnacc=tnacc+atol(nacc);
+      tnelap=tnelap+atol(elap);
+
+      fscanf(fp_in,"%s",user);
+      fscanf(fp_in,"%s",nacc);
+      fscanf(fp_in,"%s",nbytes);
+      fscanf(fp_in,"%s",url);
+      fscanf(fp_in,"%s",ip);
+      fscanf(fp_in,"%s",hora);
+      fscanf(fp_in,"%s",data);
+      fscanf(fp_in,"%s",elap);
+      fscanf(fp_in,"%s",incac);
+      fscanf(fp_in,"%s",oucac);
+
+      if(strcmp(user,"TOTAL") == 0)
+         continue;
+   }
+#if defined(__FreeBSD__)
+   sprintf(preg,"%s %15qu %15qu %15qu\n",olduser,tnbytes,tnacc,tnelap);
+#elif defined(__alpha) || __ALPHA
+   sprintf(preg,"%s %15ld %15ld %15ld\n",olduser,tnbytes,tnacc,tnelap);
+#else
+   sprintf(preg,"%s %15lld %15lld %15lld\n",olduser,tnbytes,tnacc,tnelap);
+#endif
+   fputs(preg,fp_top2);
+   ttnbytes=ttnbytes+tnbytes;
+   ttnacc=ttnacc+tnacc;
+   ttnelap=ttnelap+tnelap;
+
+#if defined(__FreeBSD__)
+   sprintf(preg,"TOTAL %15qu %15qu %15qu\n",ttnbytes,ttnacc,ttnelap);
+#elif defined(__alpha) || __ALPHA
+   sprintf(preg,"TOTAL %15ld %15ld %15ld\n",ttnbytes,ttnacc,ttnelap);
+#else
+   sprintf(preg,"TOTAL %15lld %15lld %15lld\n",ttnbytes,ttnacc,ttnelap);
+#endif
+
+   fclose(fp_in);
+   fclose(fp_top2);
+
+   sprintf(csort,"sort -n -T %s -r -k 2,2 -o %s %s", TempDir, top1, top2);
+   system(csort);
+
+   unlink(top2);
+
+   if((fp_top1=fopen(top1,"a"))==NULL) {
+      fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top1);
+      exit(1);
+   }
+   fputs(preg,fp_top1);
+   fclose(fp_top1);
+
+   if((fp_top1=fopen(top1,"r"))==NULL) {
+      fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top1);
+      exit(1);
+   }
+
+   if((fp_top3=fopen(top3,"w"))==NULL) {
+      fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top3);
+      exit(1);
+   }
+
+ /*
+ * Obtem o periodo
+ */
+
+   strcpy(arqper,dirname);
+   strcat(arqper,"/periodo");
+
+   if ((fp_in = fopen(arqper, "r")) == 0){
+      fprintf(stderr, "SARG: (email) %s: %s\n",text[45],arqper);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   sprintf(strip1,"%s",text[88]);
+   strip_latin(strip1);
+   sprintf(preg,"%s\n",strip1);
+   fputs(preg,fp_top3);
+
+   sprintf(strip1,"%s",text[97]);
+   strip_latin(strip1);
+   sprintf(preg,"%s\n",strip1);
+   fputs(preg,fp_top3);
+
+   sprintf(strip1,"%s",text[89]);
+   strip_latin(strip1);
+   sprintf(preg,"%s %s\n\n",strip1,periodo);
+   fputs(preg,fp_top3);
+
+   sprintf(strip1,"%s",text[100]);
+   strip_latin(strip1);
+   sprintf(strip2,"%s",text[98]);
+   strip_latin(strip2);
+   sprintf(strip3,"%s",text[92]);
+   strip_latin(strip3);
+   sprintf(strip4,"%s",text[93]);
+   strip_latin(strip4);
+   sprintf(strip5,"%s",text[94]);
+   strip_latin(strip5);
+   sprintf(strip6,"%s",text[95]);
+   strip_latin(strip6);
+   sprintf(strip7,"%s",text[99]);
+   strip_latin(strip7);
+
+   sprintf(preg,"%-7s %-20s %-8s %-15s %%%-6s %-10s %-10s %%%-7s\n------- -------------------- -------- --------------- ------- ---------- ---------- -------\n",strip1,strip2,strip3,strip4,strip4,strip5,strip6,strip7);
+   fputs(preg,fp_top3);
+
+   fscanf(fp_top1,"%s",user);
+   fscanf(fp_top1,"%s",nbytes);
+   fscanf(fp_top1,"%s",nacc);
+   fscanf(fp_top1,"%s",elap);
+
+   while(!feof(fp_top1))
+   {
+
+      if(strstr(user,"_") != 0)
+         fixip(user);
+
+      strcpy(user2,user);
+
+      tnbytes=atol(nbytes);
+
+      if(tnbytes) {
+         perc=ttnbytes / 100;
+         perc=tnbytes / perc;
+      } else perc = 0;
+
+      if(atol(elap)) {
+         perc2=ttnelap / 100;
+         perc2=atol(elap) / perc2;
+      } else perc2 = 0;
+
+      posicao++;
+      tnelap=atol(elap);
+
+      sprintf(wperc,"%3.2f%%",perc);
+      sprintf(wperc2,"%3.2f%%",perc2);
+
+#if defined(__FreeBSD__)
+      sprintf(preg,"%7d %20s %8s %15s %7s %10s %10qu %7s%%\n",posicao,user2,nacc,fixnum(tnbytes,1),wperc,buildtime(tnelap),tnelap,wperc2);
+#elif defined(__alpha) || __ALPHA
+      sprintf(preg,"%7d %20s %8s %15s %7s %10s %10ld %7s%%\n",posicao,user2,nacc,fixnum(tnbytes,1),wperc,buildtime(tnelap),tnelap,wperc2);
+#else
+      sprintf(preg,"%7d %20s %8s %15s %7s %10s %10lld %7s\n",posicao,user2,nacc,fixnum(tnbytes,1),wperc,buildtime(tnelap),tnelap,wperc2);
+#endif
+
+      if(strstr(user,"TOTAL") != 0){
+         sprintf(preg,"------- -------------------- -------- --------------- ------- ---------- ---------- -------\n");
+         fputs(preg,fp_top3);
+#if defined(__FreeBSD__)
+         sprintf(preg,"%-7s %20s %8qu %15s %8s %9s %10qu\n",text[107]," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap);
+#elif defined(__alpha) || __ALPHA
+         sprintf(preg,"%-7s %20s %8ld %15s %8s %9s %10ld\n",text[107]," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap);
+#else
+         sprintf(preg,"%-7s %20s %8lld %15s %8s %9s %10lld\n",text[107]," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap);
+#endif
+      }
+
+      fputs(preg,fp_top3);
+
+      fscanf(fp_top1,"%s",user);
+      fscanf(fp_top1,"%s",nbytes);
+      fscanf(fp_top1,"%s",nacc);
+      fscanf(fp_top1,"%s",elap);
+   }
+
+   if(ttnbytes) {
+      tnbytes=ttnbytes / totuser;
+   } else tnbytes=0;
+
+   sprintf(strip1,"%s",text[96]);
+   strip_latin(strip1);
+#if defined(__FreeBSD__)
+   sprintf(preg,"%-7s %20s %8qu %15s %8s %9s %10qu\n",strip1," ",ttnacc/totuser,fixnum(tnbytes,1)," ",buildtime(ttnelap/totuser),ttnelap/totuser);
+#elif defined(__alpha) || __ALPHA
+   sprintf(preg,"%-7s %20s %8ld %15s %8s %9s %10ld\n",strip1," ",ttnacc/totuser,fixnum(tnbytes,1)," ",buildtime(ttnelap/totuser),ttnelap/totuser);
+#else
+   sprintf(preg,"%-7s %20s %8lld %15s %8s %9s %10lld\n",strip1," ",ttnacc/totuser,fixnum(tnbytes,1)," ",buildtime(ttnelap/totuser),ttnelap/totuser);
+#endif
+   fputs(preg,fp_top3);
+
+   fclose(fp_top1);
+   unlink(top1);
+
+   t = time(NULL);
+   local = localtime(&t);
+   sprintf(preg, "\n%s\n", asctime(local));
+   fputs(preg,fp_top3);
+
+   fclose(fp_top3);
+
+   if(strcmp(email,"stdout") == 0) {
+      if((fp_top3=fopen(top3,"r"))==NULL) {
+         fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top3);
+         exit(1);
+      }
+
+      while(fgets(buf,sizeof(buf),fp_top3)!=NULL)
+         printf("%s",buf);
+    } else {
+      sprintf(buf,"%s -s 'SARG %s, %s' %s <%s",MailUtility,text[55],asctime(local),email,top3);
+      system(buf);
+   }
+   sprintf(csort,"rm -r %s/sarg_tmp",TempDir);
+   system(csort);
+
+   return (0);
+}
diff --git a/exclude.c b/exclude.c
new file mode 100644 (file)
index 0000000..89de2e1
--- /dev/null
+++ b/exclude.c
@@ -0,0 +1,77 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+int vhexclude(char *excludefile, char *ip)
+{
+
+   char whost[1024];
+   char wip1[1024], wip2[1024];
+   char sn1[4], sn2[4], sn3[4];
+   char str[strlen(excludefile)];
+
+   whost[0]='\0';
+   strcpy(str,excludefile);
+   getword(whost,str,' ');
+   
+   while(strcmp(whost,"*FIM*") != 0) {
+      if(strcmp(ip,whost) ==0)
+         return(0);
+
+      strcpy(wip1,ip);
+      getword(sn1,wip1,'.');
+      getword(sn2,wip1,'.');
+      getword(sn3,wip1,'.');
+
+      sprintf(wip1,"%s.%s.%s.0",sn1,sn2,sn3);
+      sprintf(wip2,"%s.%s.0.0",sn1,sn2);
+
+      if(strstr(whost,wip1) !=0)
+         return(0);
+
+      if(strstr(whost,wip2) !=0)
+         return(0);
+
+      getword(whost,str,' ');
+   }
+
+   return(1);
+}
+
+
+int vuexclude(char *excludeuser, char *user)
+{
+
+   char wuser[MAXLEN];
+
+   strcpy(wuser,user);
+   strcat(wuser," ");
+
+   if(strstr(excludeuser,wuser) != 0 )
+      return(0);
+
+   return(1);
+}
diff --git a/exclude_codes b/exclude_codes
new file mode 100644 (file)
index 0000000..cae078b
--- /dev/null
@@ -0,0 +1 @@
+NONE/400
diff --git a/fonts/FreeSans.ttf b/fonts/FreeSans.ttf
new file mode 100644 (file)
index 0000000..46f5532
Binary files /dev/null and b/fonts/FreeSans.ttf differ
diff --git a/fonts/README b/fonts/README
new file mode 100644 (file)
index 0000000..cd9ee10
--- /dev/null
@@ -0,0 +1,3 @@
+# Note from the author
+
+FreeSans.ttf is a GPL font and comes from http://savannah.gnu.org/
diff --git a/fonts/license b/fonts/license
new file mode 100644 (file)
index 0000000..1bb399f
--- /dev/null
@@ -0,0 +1,341 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
diff --git a/getconf.c b/getconf.c
new file mode 100644 (file)
index 0000000..4141d0d
--- /dev/null
+++ b/getconf.c
@@ -0,0 +1,747 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+extern numlist hours, weekdays;
+
+char wbuf[MAXLEN];
+char Msg[255];
+
+void getconf()
+{
+
+   FILE *fp_in;
+   char buf[MAXLEN];
+
+   if(debug) {
+      sprintf(Msg,"Loading configuration from: %s",ConfigFile);
+      debuga(Msg);
+   }
+
+   if ((fp_in = fopen(ConfigFile, "r")) == NULL) {
+      fprintf(stderr, "SARG: (getconf) Cannot open file: %s\n",ConfigFile);
+      exit(1);
+   }
+
+   while (fgets(buf, MAXLEN, fp_in) != NULL) {
+      if(strstr(buf,"\n") != 0)
+         buf[strlen(buf)-1]='\n';
+
+      if(debugm)
+         printf("SYSCONFDIR %s",buf);
+
+      if(strncmp(buf,"#",1) == 0)
+         continue;
+
+      parmtest(buf);
+
+   }
+
+   fclose(fp_in);
+   language_load(language);
+   return;
+}
+
+
+int parmtest(char *buf)
+{
+
+      if(strstr(buf,"background_color") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(BgColor,buf);
+         fixnone(BgColor);
+         return;
+      }
+
+      if(strstr(buf,"text_color") != 0) {
+         if(strstr(buf,"logo_text_color") == 0) {
+            getword(wbuf,buf,' ');
+            strcpy(TxColor,buf);
+            fixnone(TxColor);
+            return;
+         }
+      }
+
+      if(strstr(buf,"text_bgcolor") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(TxBgColor,buf);
+         fixnone(TxBgColor);
+         return;
+      }
+
+      if(strstr(buf,"title_color") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(TiColor,buf);
+         fixnone(TiColor);
+         return;
+      }
+
+      if(strstr(buf,"logo_image") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(LogoImage,buf);
+         fixnone(LogoImage);
+         return;
+      }
+
+      if(strstr(buf,"logo_text") != 0) {
+         if(strstr(buf,"logo_text_color") == 0) {
+            getword(wbuf,buf,'"');
+            getword(LogoText,buf,'"');
+            fixnone(LogoText);
+            return;
+         }
+      }
+
+      if(strstr(buf,"logo_text_color") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(LogoTextColor,buf);
+         fixnone(LogoTextColor);
+         return;
+      }
+
+      if(strstr(buf,"background_image") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(BgImage,buf);
+         fixnone(BgImage);
+         return;
+      }
+
+      if(strstr(buf,"show_sarg_info") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(ShowSargInfo,buf);
+         fixnone(ShowSargInfo);
+         return;
+      }
+
+      if(strstr(buf,"show_sarg_logo") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(ShowSargLogo,buf);
+         fixnone(ShowSargLogo);
+         return;
+      }
+
+      if(strstr(buf,"font_face") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(FontFace,buf);
+         fixnone(FontFace);
+         return;
+      }
+
+      if(strstr(buf,"header_color") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(HeaderColor,buf);
+         fixnone(HeaderColor);
+         return;
+      }
+
+      if(strstr(buf,"header_bgcolor") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(HeaderBgColor,buf);
+         fixnone(HeaderBgColor);
+         return;
+      }
+
+      if(strstr(buf,"font_size") != 0) {
+         if(strstr(buf,"header_font_size") == 0 && strstr(buf,"title_font_size") == 0) {
+            getword(wbuf,buf,' ');
+            strcpy(FontSize,buf);
+            fixnone(FontSize);
+            return;
+         }
+      }
+
+      if(strstr(buf,"header_font_size") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(HeaderFontSize,buf);
+         fixnone(HeaderFontSize);
+         return;
+      }
+
+      if(strstr(buf,"title_font_size") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(TitleFontSize,buf);
+         fixnone(TitleFontSize);
+         return;
+      }
+
+      if(strstr(buf,"image_size") != 0) {
+         getword(wbuf,buf,' ');
+         getword(Width,buf,' ');
+         strcpy(Height,buf);
+         fixnone(Width);
+         fixnone(Height);
+         return;
+      }
+
+      if(strstr(buf,"title") != 0) {
+         getword(wbuf,buf,'"');
+         getword(Title,buf,'"');
+         fixnone(Title);
+         return;
+      }
+
+      if(strstr(buf,"resolve_ip") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(Ip2Name,buf);
+         fixnone(Ip2Name);
+         return;
+      }
+
+      if(strstr(buf,"user_ip") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(UserIp,buf);
+         fixnone(UserIp);
+         return;
+      }
+
+      if(strstr(buf,"max_elapsed") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(MaxElapsed,buf);
+         fixnone(MaxElapsed);
+         return;
+      }
+
+      if(strstr(buf,"date_format") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(DateFormat,buf);
+         fixnone(DateFormat);
+         return;
+      }
+
+      if( strstr( buf, "hours" ) != 0 ) {
+         if( getnumlist( buf, &hours, 24, 24 ) ) {
+            fprintf( stderr, "Error: Invalid syntax in hours tag!\n" );
+            exit( 1 );
+         }
+       }
+
+      if( strstr( buf, "weekdays" ) != 0 ) {
+         if( getnumlist( buf, &weekdays, 7, 7 ) ) {
+            fprintf( stderr, "Error: Invalid syntax in weekdays tag!\n" );
+            exit( 1 );
+         }
+      }
+
+      if(strstr(buf,"topuser_sort_field") != 0) {
+         getword(wbuf,buf,' ');
+         getword(TopuserSortField,buf,' ');
+         strcpy(TopuserSortOrder,buf);
+         fixnone(TopuserSortOrder);
+         return;
+      }
+
+      if(strstr(buf,"user_sort_field") != 0) {
+         getword(wbuf,buf,' ');
+         getword(UserSortField,buf,' ');
+         strcpy(UserSortOrder,buf);
+         fixnone(UserSortOrder);
+         return;
+      }
+
+      if(strstr(buf,"access_log") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(AccessLog,buf);
+         fixnone(AccessLog);
+         return;
+      }
+
+      if(strstr(buf,"useragent_log") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(UserAgentLog,buf);
+         fixnone(UserAgentLog);
+         return;
+      }
+
+      if(strstr(buf,"exclude_hosts") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(ExcludeHosts,buf);
+         fixnone(ExcludeHosts);
+         return;
+      }
+
+      if(strstr(buf,"exclude_codes") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(ExcludeCodes,buf);
+         fixnone(ExcludeCodes);
+         return;
+      }
+
+      if(strstr(buf,"exclude_users") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(ExcludeUsers,buf);
+         fixnone(ExcludeUsers);
+         return;
+      }
+
+      if(strstr(buf,"password") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(PasswdFile,buf);
+         fixnone(PasswdFile);
+         return;
+      }
+
+      if(strstr(buf,"temporary_dir") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(TempDir,buf);
+         fixnone(TempDir);
+         return;
+      }
+
+      if(strstr(buf,"report_type") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(ReportType,buf);
+         fixnone(ReportType);
+         return;
+      }
+
+      if(strstr(buf,"output_dir") != 0) {
+         if(strstr(buf,"output_dir_form") == 0) {
+            getword(wbuf,buf,' ');
+            strcpy(OutputDir,buf);
+            fixnone(OutputDir);
+            return;
+         }
+      }
+
+      if(strstr(buf,"output_email") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(OutputEmail,buf);
+         fixnone(OutputEmail);
+         return;
+      }
+
+      if(strstr(buf,"per_user_limit") != 0) {
+         getword(wbuf,buf,' ');
+         getword(PerUserLimitFile,buf,' ');
+         strcpy(PerUserLimit,buf);
+         fixnone(PerUserLimitFile);
+         fixnone(PerUserLimit);
+         return;
+      }
+
+
+      if(strstr(buf,"lastlog") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(LastLog,buf);
+         fixnone(LastLog);
+         return;
+      }
+
+      if(strstr(buf,"remove_temp_files") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(RemoveTempFiles,buf);
+         fixnone(RemoveTempFiles);
+         return;
+      }
+
+      if(strstr(buf,"replace_index") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(ReplaceIndex,buf);
+         fixnone(ReplaceIndex);
+         return;
+      }      
+
+      if(strstr(buf,"index") != 0) {
+         if(strstr(buf,"index_sort_order") == 0) {
+            getword(wbuf,buf,' ');
+            strcpy(Index,buf);
+            fixnone(Index);
+            return;
+         }
+      }
+
+      if(strstr(buf,"overwrite_report") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(OverwriteReport,buf);
+         fixnone(OverwriteReport);
+         return;
+      }
+
+      if(strstr(buf,"records_without_userid") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(RecordsWithoutUser,buf);
+         fixnone(RecordsWithoutUser);
+         return;
+      }
+
+      if(strstr(buf,"use_comma") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(UseComma,buf);
+         fixnone(UseComma);
+         return;
+      }
+
+      if(strstr(buf,"mail_utility") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(MailUtility,buf);
+         fixnone(MailUtility);
+         return;
+      }
+
+      if(strstr(buf,"topsites_num") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(TopSitesNum,buf);
+         fixnone(TopSitesNum);
+         return;
+      }
+
+      if(strstr(buf,"topuser_num") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(TopUsersNum,buf);
+         fixnone(TopUsersNum);
+         return;
+      }
+
+      if(strstr(buf,"usertab") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(UserTabFile,buf);
+         fixnone(UserTabFile);
+         return;
+      }
+
+      if(strstr(buf,"index_sort_order") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(IndexSortOrder,buf);
+         fixnone(IndexSortOrder);
+         return;
+      }
+
+      if(strstr(buf,"topsites_sort_order") != 0) {
+         getword(wbuf,buf,' ');
+         getword(TopsitesSortField,buf,' ');
+         strcpy(TopsitesSortType,buf);
+         fixnone(TopsitesSortField);
+         fixnone(TopsitesSortType);
+         return;
+      }
+
+      if(strstr(buf,"long_url") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(LongUrl,buf);
+         fixnone(LongUrl);
+         return;
+      }
+
+      if(strstr(buf,"language") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(language,buf);
+         fixnone(language);
+         return;
+      }
+
+      if(strstr(buf,"dansguardian_conf") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(DansGuardianConf,buf);
+         fixnone(DansGuardianConf);
+         return;
+      }
+
+      if(strstr(buf,"squidguard_conf") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(SquidGuardConf,buf);
+         fixnone(SquidGuardConf);
+         return;
+      }
+
+      if(strstr(buf,"date_time_by") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(datetimeby,buf);
+         fixnone(datetimeby);
+         return;
+      }
+
+      if(strstr(buf,"charset") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(CharSet,buf);
+         fixnone(CharSet);
+         ccharset(CharSet);
+         return;
+      }
+
+      if(strstr(buf,"user_invalid_char") != 0) {
+         getword(wbuf,buf,'"');
+         getword(UserInvalidChar,buf,'"');
+         fixnone(UserInvalidChar);
+         return;
+      }
+
+      if(strstr(buf,"include_users") != 0) {
+         getword(wbuf,buf,'"');
+         getword(wbuf,buf,'"');
+        sprintf(IncludeUsers,":%s:",wbuf);
+         fixnone(IncludeUsers);
+         return;
+      }
+
+      if(strstr(buf,"exclude_string") != 0) {
+         getword(wbuf,buf,'"');
+         getword(ExcludeString,buf,'"');
+         fixnone(ExcludeString);
+         return;
+      }
+
+      if(strstr(buf,"privacy") != 0) {
+         if(strstr(buf,"privacy_string") == 0 && \
+           strstr(buf,"privacy_string_color") == 0) {
+            getword(wbuf,buf,' ');
+            strcpy(Privacy,buf);
+            fixnone(Privacy);
+            return;
+        }
+      }
+
+      if(strstr(buf,"privacy_string") != 0) {
+        if(strstr(buf,"privacy_string_color") == 0) {
+            getword(wbuf,buf,'"');
+            getword(PrivacyString,buf,'"');
+            fixnone(PrivacyString);
+            return;
+        }
+      }
+
+      if(strstr(buf,"privacy_string_color") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(PrivacyStringColor,buf);
+         fixnone(PrivacyStringColor);
+         return;
+      }
+
+      if(strstr(buf,"show_successful_message") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(SuccessfulMsg,buf);
+         fixnone(SuccessfulMsg);
+         return;
+      }
+
+      if(strstr(buf,"show_read_statistics") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(ShowReadStatistics,buf);
+         fixnone(ShowReadStatistics);
+         return;
+      }
+
+      if(strstr(buf,"topuser_fields") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(TopUserFields,buf);
+         fixnone(TopUserFields);
+         return;
+      }
+
+      if(strstr(buf,"user_report_fields") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(UserReportFields,buf);
+         fixnone(UserReportFields);
+         return;
+      }
+
+      if(strstr(buf,"site_user_time_date_type") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(SiteUserTimeDateType,buf);
+         fixnone(SiteUserTimeDateType);
+         return;
+      }
+
+      if(strstr(buf,"datafile ") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(DataFile,buf);
+         fixnone(DataFile);
+         return;
+      }
+
+      if(strstr(buf,"datafile_delimiter") != 0) {
+         getword(wbuf,buf,' ');
+         getword(wbuf,buf,'"');
+         getword(DataFileDelimiter,buf,'"');
+         fixnone(DataFileDelimiter);
+         return;
+      }
+
+      if(strstr(buf,"datafile_fields") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(DataFileFields,buf);
+         fixnone(DataFileFields);
+         return;
+      }
+
+      if(strstr(buf,"parsed_output_log") != 0) {
+        if(strstr(buf,"parsed_output_log_compress") == 0) {
+            getword(wbuf,buf,' ');
+            strcpy(ParsedOutputLog,buf);
+            fixnone(ParsedOutputLog);
+            return;
+         }
+      }
+
+      if(strstr(buf,"parsed_output_log_compress") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(ParsedOutputLogCompress,buf);
+         fixnone(ParsedOutputLogCompress);
+         return;
+      }
+
+      if(strstr(buf,"displayed_values") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(DisplayedValues,buf);
+         fixnone(DisplayedValues);
+         return;
+      }
+
+      if(strstr(buf,"authfail_report_limit") != 0) {
+         getword(wbuf,buf,' ');
+         AuthfailReportLimit=atoi(buf);
+         return;
+      }
+
+      if(strstr(buf,"denied_report_limit") != 0) {
+         getword(wbuf,buf,' ');
+         DeniedReportLimit=atoi(buf);
+         return;
+      }
+
+      if(strstr(buf,"siteusers_report_limit") != 0) {
+         getword(wbuf,buf,' ');
+         SiteUsersReportLimit=atoi(buf);
+         return;
+      }
+
+      if(strstr(buf,"dansguardian_report_limit") != 0) {
+         getword(wbuf,buf,' ');
+         DansGuardianReportLimit=atoi(buf);
+         return;
+      }
+
+      if(strstr(buf,"squidguard_report_limit") != 0) {
+         getword(wbuf,buf,' ');
+         SquidGuardReportLimit=atoi(buf);
+         return;
+      }
+
+      if(strstr(buf,"user_report_limit") != 0) {
+         getword(wbuf,buf,' ');
+         UserReportLimit=atoi(buf);
+         return;
+      }
+
+      if(strstr(buf,"www_document_root") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(wwwDocumentRoot,buf);
+         fixnone(wwwDocumentRoot);
+         return;
+      }
+
+      if(strstr(buf,"block_it") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(BlockIt,buf);
+         fixnone(BlockIt);
+         return;
+      }
+
+      if(strstr(buf,"external_css_file") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(ExternalCSSFile,buf);
+         fixnone(ExternalCSSFile);
+         return;
+      }
+
+      if(strstr(buf,"user_authentication") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(UserAuthentication,buf);
+         fixnone(UserAuthentication);
+         return;
+      }
+
+      if(strstr(buf,"AuthUserFile") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(AuthUserFile,buf);
+         fixnone(AuthUserFile);
+         return;
+      }
+
+      if(strstr(buf,"AuthName") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(AuthName,buf);
+         fixnone(AuthName);
+         return;
+      }
+
+      if(strstr(buf,"AuthType") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(AuthType,buf);
+         fixnone(AuthType);
+         return;
+      }
+
+      if(strstr(buf,"Require") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(Require,buf);
+         fixnone(Require);
+         return;
+      }
+
+      if(strstr(buf,"download_suffix") != 0) {
+         getword(wbuf,buf,'"');
+         getword(DownloadSuffix,buf,'"');
+         fixnone(DownloadSuffix);
+         return;
+      }
+
+      if(strstr(buf,"graphs") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(Graphs,buf);
+         fixnone(Graphs);
+         return;
+      }
+
+      if(strstr(buf,"graph_days_bytes_bar_color") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(GraphDaysBytesBarColor,buf);
+         fixnone(GraphDaysBytesBarColor);
+         return;
+      }
+
+      if(strstr(buf,"squidguard_log_format") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(SquidGuardLogFormat,buf);
+         fixnone(SquidGuardLogFormat);
+         return;
+      }
+
+      if(strstr(buf,"ulimit") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(Ulimit,buf);
+         fixnone(Ulimit);
+         return;
+      }
+
+      if(strstr(buf,"ntlm_user_format") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(NtlmUserFormat,buf);
+         fixnone(NtlmUserFormat);
+         return;
+      }
+    
+      return;
+}
diff --git a/grepday.c b/grepday.c
new file mode 100644 (file)
index 0000000..bb5dfaf
--- /dev/null
+++ b/grepday.c
@@ -0,0 +1,455 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+int blue;
+int white;
+int lavender;
+int darkblue;
+int dimgray;
+int goldenrod;
+int goldenrod2;
+int gray;
+int silver;
+int black;
+int x1;
+char *font1 = SYSCONFDIR"/fonts/FreeSans.ttf";
+char s[15];
+
+#ifdef HAVE_ICONV_H
+#include <iconv.h>
+#define SARGgdImageStringFT I18NgdImageStringFT
+
+BGD_DECLARE(char *) I18NgdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
+                         double ptsize, double angle, int x, int y,
+                                                 char *string)
+{
+ iconv_t localtoutf;
+ char *sstring, *str, *sstr, *retval;
+ size_t slen, sslen;
+
+ slen = strlen(string) + 1; // We must include string termination character
+ sslen = slen * 2;          // We assume that UTF8 maximum 2 times large than local
+ sstring = (char *)malloc(sslen);
+
+ str = (char *) string;
+ sstr = (char *) sstring;
+
+ localtoutf = iconv_open ("UTF-8", CharSet);
+ iconv (localtoutf, &str, &slen, &sstr, &sslen);
+ iconv_close (localtoutf);
+
+ retval = gdImageStringFTEx (im, brect, fg, fontlist, ptsize, angle, x, y, sstring, gdFTEX_Unicode);
+ free(sstring);
+
+ return retval;
+}
+#else
+#define SARGgdImageStringFT gdImageStringFT
+#endif
+
+void *bar(long long int *n)
+{     
+#ifdef HAVE_GD
+   gdPoint points[4];
+   int brect[8];
+   int val=0, x;
+   float f=0;
+   long long int lim, num;
+   char v[15];
+
+   static char limits[400][12]={"0","500","1000","2000","3000","4000",
+       "5000","6000","7000","8000","9000","10000",
+       "20000","30000","40000","50000","70000","90000",
+       "110000","130000","150000","170000","190000","210000",
+       "230000","250000","280000","310000","340000","370000",
+       "400000","430000","450000","460000","490000","500000",
+       "550000","600000","650000","700000","750000","800000",
+       "850000","900000","950000","1000000","1100000","1200000",
+       "1300000","1400000","1500000","1600000","1700000","1800000",
+       "1900000","2000000","2100000","2200000","2300000","2400000",
+       "2500000","2600000","2700000","2800000","2900000","3000000",
+       "3100000","3200000","3300000","3400000","3500000","3600000",
+       "3700000","3800000","3900000","4000000","4100000","4200000",
+       "4300000","4400000","4500000","4600000","4700000","4800000",
+       "4900000","5000000","5100000","5200000","5300000","5400000",
+       "5500000","5600000","5700000","5800000","5900000","6000000",
+       "6100000","6200000","6300000","6400000","6500000","6600000",
+       "6700000","6800000","6900000","7000000","7100000","7200000",
+       "7300000","7400000","7500000","7600000","7700000","7800000",
+       "7900000","8000000","8100000","8200000","8300000","8400000",
+       "8500000","8600000","8700000","8800000","8900000","9000000",
+       "9100000","9200000","9300000","9400000","9500000","9600000",
+       "9700000","9800000","9900000","10000000","10500000","11000000",
+       "11500000","12000000","12500000","13000000","13500000","14000000",
+       "14500000","15000000","15500000","16000000","16500000","17000000",
+       "17500000","18000000","18500000","19000000","19500000","20000000",
+       "21000000","22000000","23000000","24000000","25000000","26000000",
+       "27000000","28000000","29000000","30000000","31000000","32000000",
+       "33000000","34000000","35000000","36000000","37000000","38000000",
+       "39000000","40000000","41000000","42000000","43000000","44000000",
+       "45000000","46000000","47000000","48000000","49000000","50000000",
+       "51000000","52000000","53000000","54000000","55000000","56000000",
+       "57000000","58000000","59000000","60000000","61000000","62000000",
+       "63000000","64000000","65000000","66000000","67000000","68000000",
+       "69000000","70000000","71000000","72000000","73000000","74000000",
+       "75000000","76000000","77000000","78000000","79000000","80000000",
+       "81000000","82000000","83000000","84000000","85000000","86000000",
+       "87000000","88000000","89000000","90000000","91000000","92000000",
+       "93000000","94000000","95000000","96000000","97000000","98000000",
+       "99000000","100000000","110000000","120000000","130000000","140000000",
+       "150000000","160000000","170000000","180000000","190000000","200000000",
+       "210000000","220000000","230000000","240000000","250000000","260000000",
+       "270000000","280000000","290000000","300000000","310000000","320000000",
+       "330000000","340000000","350000000","360000000","370000000","380000000",
+       "390000000","400000000","410000000","420000000","430000000","440000000",
+       "450000000","460000000","470000000","480000000","490000000","500000000",
+       "510000000","520000000","530000000","540000000","550000000","560000000",
+       "570000000","580000000","590000000","600000000","610000000","620000000",
+       "630000000","640000000","650000000","660000000","670000000","680000000",
+       "690000000","700000000","710000000","720000000","730000000","740000000",
+       "750000000","760000000","770000000","780000000","790000000","800000000",
+       "810000000","820000000","830000000","840000000","850000000","860000000",
+       "870000000","880000000","890000000","900000000","910000000","920000000",
+       "930000000","940000000","950000000","960000000","970000000","980000000",
+       "990000000","1000000000","1100000000","1200000000","1300000000","1400000000",
+       "1500000000","1600000000","1700000000","1800000000","1900000000","2000000000",
+       "2100000000","2200000000","2300000000","2400000000","2500000000","2600000000",
+       "2700000000","2800000000","2900000000","3000000000","3100000000","3200000000",
+       "3300000000","3400000000","3500000000","3600000000","3700000000","3800000000",
+       "3900000000","4000000000","4100000000","4200000000","4300000000","4400000000",
+       "4500000000","4600000000","4700000000","4800000000","4900000000","5000000000"};
+
+   if(access(font1, R_OK) != 0) {
+     fprintf(stderr, "SARG: (grepday) Fontname: %s not found.\n",font1);
+     exit(1);
+   }
+
+   if(strcmp(GraphDaysBytesBarColor,"orange") == 0) {
+      color1 = gdImageColorAllocate(im, 255, 233, 142);
+      color2 = gdImageColorAllocate(im, 220, 163, 72);
+      color3 = gdImageColorAllocate(im, 255, 198, 107);
+   }
+   if(strcmp(GraphDaysBytesBarColor,"blue") == 0) {
+      color1 = gdImageColorAllocate(im, 62, 80, 167);
+      color2 = gdImageColorAllocate(im, 40, 51, 101);
+      color3 = gdImageColorAllocate(im, 57, 73, 150);
+   }
+   if(strcmp(GraphDaysBytesBarColor,"green") == 0) {
+      color1 = gdImageColorAllocate(im,120,166,129);
+      color2 = gdImageColorAllocate(im,84,113,82);
+      color3 = gdImageColorAllocate(im,158,223,167);
+   }
+   if(strcmp(GraphDaysBytesBarColor,"yellow") == 0) {
+      color1 = gdImageColorAllocate(im,185,185,10);
+      color2 = gdImageColorAllocate(im,111,111,10);
+      color3 = gdImageColorAllocate(im,166,166,10);
+   }
+   if(strcmp(GraphDaysBytesBarColor,"brown") == 0) {
+      color1 = gdImageColorAllocate(im,97,45,27);
+      color2 = gdImageColorAllocate(im,60,30,20);
+      color3 = gdImageColorAllocate(im,88,41,26);
+   }
+   if(strcmp(GraphDaysBytesBarColor,"red")  == 0){
+      color1 = gdImageColorAllocate(im,185,10,10);
+      color2 = gdImageColorAllocate(im,111,10,10);
+      color3 = gdImageColorAllocate(im,166,10,10);
+   }
+
+   blue = gdImageColorAllocate(im, 0, 0, 255);
+   white = gdImageColorAllocate(im, 255, 255, 255);
+   dimgray = gdImageColorAllocate(im, 105, 105, 105);  
+   goldenrod = gdImageColorAllocate(im, 234, 234, 174);
+   goldenrod2 = gdImageColorAllocate(im, 207, 181, 59);
+
+   num = n;
+   for(x=0; x<=366; x++) {
+      lim = my_atoll(limits[x]);
+      if(lim >= num) {
+         val = 425 - x;
+         break;
+      }
+   }
+   if(x>366) val = 55;
+
+   gdImageFilledRectangle(im, x1, val, x1+11, 425, color3);
+
+   points[0].x = x1+7;
+   points[0].y = val-5;
+   points[1].x = x1;
+   points[1].y = val;
+   points[2].x = x1+11;
+   points[2].y = val;
+   points[3].x = x1+17;
+   points[3].y = val-5;
+   gdImageFilledPolygon(im, points, 4, color1);
+
+   gdImageLine(im, x1+8, val-2, x1+8, val-10, dimgray);  
+   gdImageFilledRectangle(im, x1-2, val-20, x1+18, val-10, goldenrod);
+   gdImageRectangle(im, x1-2, val-20, x1+18, val-10, goldenrod2);
+
+   snprintf(v,6,"%s",fixnum(num,0));
+
+   SARGgdImageStringFT(im,&brect[0],black,font1,6,0.0,x1-1,val-12,v);
+   
+   points[0].x = x1+17;
+   points[0].y = val-5;
+   points[1].x = x1+11;
+   points[1].y = val;
+   points[2].x = x1+11;
+   points[2].y = 426;
+   points[3].x = x1+17;
+   points[3].y = 420;
+   gdImageFilledPolygon(im, points, 4, color2);
+
+#endif
+   return;
+}
+
+void greport_day(char *user, int *iprel, int *ipuser)
+{
+   FILE *fp_in, *pngout;
+   int x, y, z;
+   int brect[8];
+   char wdirname[MAXLEN];
+   char graph[MAXLEN];
+   char wuser[255];
+   char csort[255];
+   char data[20];
+   int  count=0;
+   char oday[20];
+   char day[20];
+   char bytes[20];
+   long long int tot;
+   time_t t;
+   struct tm *local;
+#ifdef HAVE_GD
+
+   if(strcmp(Graphs,"yes") != 0) {
+      unlink(wdirname);
+      return;
+   }
+
+   im = gdImageCreate(720, 480);
+
+   lavender = gdImageColorAllocate(im, 230, 230, 250);  
+   white = gdImageColorAllocate(im, 255, 255, 255);  
+   gray = gdImageColorAllocate(im, 192, 192, 192);  
+   silver = gdImageColorAllocate(im, 211, 211, 211);  
+   black = gdImageColorAllocate(im, 0, 0, 0);  
+   blue = gdImageColorAllocate(im, 35, 35, 227);  
+   dimgray = gdImageColorAllocate(im, 105, 105, 105);  
+   darkblue = gdImageColorAllocate(im, 0, 0, 139);
+
+   gdImageRectangle(im, 0, 0, 719, 479, dimgray);
+   gdImageFilledRectangle(im, 60, 60, 700, 420, silver);
+
+   points[0].x = 50;
+   points[0].y = 65;
+   points[1].x = 50;
+   points[1].y = 425;
+   points[2].x = 60;
+   points[2].y = 420;
+   points[3].x = 60;
+   points[3].y = 60;
+   gdImageFilledPolygon(im, points, 4, gray);
+
+   points[0].x = 60;
+   points[0].y = 420;
+   points[1].x = 50;
+   points[1].y = 425;
+   points[2].x = 690;
+   points[2].y = 425;
+   points[3].x = 700;
+   points[3].y = 420;
+   gdImageFilledPolygon(im, points, 4, gray);
+  
+   gdImageLine(im, 50, 65, 50, 430, black);  
+   gdImageLine(im, 45, 425, 690, 425, black);  
+   gdImageLine(im, 50, 425, 60, 420, black);  
+   gdImageLine(im, 60, 420, 60, 60, black);  
+   gdImageLine(im, 700, 60, 700, 420, black);  
+   gdImageLine(im, 690, 425, 700, 420, black);  
+
+   for(x=415; x>=65; x=x-10) {
+      gdImageLine(im, 50, x, 60, x-5, dimgray);  
+      gdImageLine(im, 47, x, 50, x, dimgray);  
+   }
+
+   for(x=60; x<=420; x=x+10)
+      gdImageLine(im, 60, x, 700, x, dimgray);  
+  
+   gdImageLine(im, 60, 420, 700, 420, black);  
+
+   for(x=70; x<=680; x=x+20)
+      gdImageLine(im, x, 425, x, 428, dimgray);  
+
+   y=65;
+   for(x=1; x<=31; x++) {
+      sprintf(s,"%02d",x);
+      SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,y,437,s);
+      y=y+20;
+   }
+
+   t = time(NULL);
+   local = localtime(&t);
+   if(strcmp(DateFormat,"u") == 0)
+      strftime(ftime, 127, "%b/%d/%Y %H:%M", local);
+   if(strcmp(DateFormat,"e") == 0)
+      strftime(ftime, 127, "%d/%b/%Y-%H:%M", local);
+
+   SARGgdImageStringFT(im,&brect[0],darkblue,font1,7,0.0,620,470,ftime);
+   if(strcmp(ShowSargInfo,"yes") == 0) SARGgdImageStringFT(im,&brect[0],darkblue,font1,10,0.0,257,15,"SARG, ");
+   SARGgdImageStringFT(im,&brect[0],darkblue,font1,10,0.0,300,15,Title);
+   sprintf(warea,"%s: %s",text[89],periodo);
+   SARGgdImageStringFT(im,&brect[0],darkblue,font1,9,0.0,300,27,warea);
+   sprintf(warea,"%s: %s",text[90],name);
+   SARGgdImageStringFT(im,&brect[0],darkblue,font1,9,0.0,300,38,warea);
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,418,"  50K");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,408,"250K");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,398,"500K");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,388,"   1M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,378,"   2M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,368,"   3M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,358,"   4M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,348,"   5M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,338,"   6M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,328,"   7M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,318,"   8M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,308,"   9M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,298," 10M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,288," 15M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,278," 20M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,268," 30M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,258," 40M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,248," 50M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,238," 60M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,228," 70M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,218," 80M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,208," 90M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,198,"100M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,188,"200M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,178,"300M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,168,"400M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,158,"500M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,148,"600M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,138,"700M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,128,"800M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,118,"900M");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,108,"   1G");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 98,"   2G");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 88,"   3G");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 78,"   4G");
+   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 68,"   5G");
+   SARGgdImageStringFT(im,&brect[0],black,font1,10,3.14/2,20,248,text[93]);
+   SARGgdImageStringFT(im,&brect[0],black,font1,10,0.0,330,460,text[127]);
+   sprintf(graph,"%s/%s/graph_day.png",dirname,user);
+   sprintf(wdirname,"%s/%s.day",tmp,user);
+   sprintf(tmp5,"%s/%s.graph",tmp,user);
+
+   if(access(wdirname, R_OK) != 0)
+      return;
+
+   sprintf(csort,"sort -t'/' -k 2,2 -o %s %s",tmp5,wdirname);
+   if(strcmp(DateFormat,"e") == 0)
+      sprintf(csort,"sort -t'/' -k 1,1 -o %s %s",tmp5,wdirname);
+
+   system(csort);
+
+   if((fp_in=fopen(tmp5,"r"))==NULL) {
+     fprintf(stderr, "SARG: (grepday) %s: %s\n",text[8],tmp5);
+     exit(1);
+   }
+
+   if((pngout=fopen(graph,"wb"))==NULL) {
+     fprintf(stderr, "SARG: (grepday) %s: %s\n",text[8],graph);
+     exit(1);
+   }
+
+   strcpy(wuser,user);
+   if(strstr(wuser,"_") != 0)
+      fixip(wuser);
+
+   if(strcmp(Ip2Name,"yes") == 0)
+      if((str=(char *) strstr(name, ".")) != (char *) NULL) {
+         if((str=(char *) strstr(str+1, ".")) != (char *) NULL)
+            ip2name(wuser);
+   }
+
+   if(UserTabFile[0] != '\0') {
+      sprintf(warea,":%s:",wuser);
+      if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+         z1=0;
+         str2=(char *) strstr(str+1,":");
+         str2++;
+         bzero(name, MAXLEN);
+         while(str2[z1] != ':') {
+            name[z1]=str2[z1];
+            z1++;
+         }
+      } else strcpy(name,wuser);
+   } else strcpy(name,user);
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(data,buf,' ');
+      getword(day,data,'/');
+      if(strcmp(DateFormat,"u") == 0)
+         getword(day,data,'/');
+      if(!count) {
+         strcpy(oday,day);
+         count++;
+      }
+      getword(bytes,buf,' ');
+      getword(bytes,buf,' ');
+      bytes[strlen(bytes)-1]='\0';
+
+      if(strcmp(oday,day) != 0) {
+         strcpy(warea,oday);
+         x1 = 44 +(atoi(oday) * 20);
+         bar(tot);
+         strcpy(oday,day);
+         tot=0;
+      } else
+         tot=tot+my_atoll(bytes);
+   }
+
+   if(tot) {
+      x1 = 44 +(atoi(day) * 20);
+      bar(tot);
+   }
+
+   gdImagePng(im, pngout);
+   fclose(pngout);
+   gdImageDestroy(im);
+
+   fclose(fp_in);
+   unlink(wdirname);
+   unlink(tmp5);
+#endif  
+   return;
+}
diff --git a/htaccess b/htaccess
new file mode 100644 (file)
index 0000000..4bfefc1
--- /dev/null
+++ b/htaccess
@@ -0,0 +1,6 @@
+AuthUserFile /usr/local/sarg/passwd
+AuthName "SARG, Squid Analysis Report Generator"
+AuthType Basic
+<Limit GET POST>
+require user admin %u
+</LIMIT>
diff --git a/html.c b/html.c
new file mode 100644 (file)
index 0000000..18b8dff
--- /dev/null
+++ b/html.c
@@ -0,0 +1,718 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void htmlrel()
+{
+   DIR *dirp;
+   FILE *fp_in, *fp_ou, *fp_ip, *fp_ip2, *fp_usr, *fp_tt;
+
+   struct dirent *direntp;
+   long long int nnbytes=0, unbytes=0, tnbytes=0, totbytes=0, totbytes2=0;
+   long long int totelap=0, totelap2=0, nnelap=0, unelap=0, tnelap=0;
+   long long int incache=0, oucache=0, tnincache=0, tnoucache=0, twork=0, twork2=0;
+   char arqin[MAXLEN], arqou[MAXLEN], arqper[MAXLEN], arqip[MAXLEN];
+   char nacc[20], nbytes[20], url[1024], purl[1024], tmsg[30], tmsg2[30], nelap[20], csort[MAXLEN];
+   char periodo[MAXLEN], usuario[MAXLEN], wusuario[MAXLEN], u2[MAXLEN], duser[MAXLEN];
+   char userbytes[20], userelap[20], userurl[1024], userhora[9], userdia[9];
+   char user_ip[MAXLEN], olduserip[MAXLEN], tmp2[MAXLEN], tmp3[MAXLEN], incac[20], oucac[20];
+   char denied_report[255];
+   char ttd1[3], ttd2[3], ttd3[5], ttt1[3], ttt2[3], ttt3[3];
+   char *str;
+   char ftime[128], warea[MAXLEN];
+   char wtemp[MAXLEN], totuser[8];
+   long long int tnacc=0, ttnacc=0, unacc=0;
+   float perc=0, perc2=0, ouperc=0, inperc=0;
+   char *s;
+   int  x, count;
+
+   if(indexonly) return;
+   if(strstr(ReportType,"users_sites") == 0) return;
+
+   strcpy(tmp2,TempDir);
+   strcat(tmp2,"/sargtmp.unsort");
+
+   strcpy(tmp3,TempDir);
+   strcat(tmp3,"/sargtmp.log");
+
+   strcpy(arqper,dirname);
+   strcat(arqper,"/periodo");
+
+   if ((fp_in = fopen(arqper, "r")) == 0){
+      fprintf(stderr, "SARG: (html1) %s: %s\n",text[45],arqper);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   strcpy(arqper,dirname);
+   strcat(arqper,"/geral");
+
+   if ((fp_in = fopen(arqper, "r")) == 0){
+      fprintf(stderr, "SARG: (html2) %s: %s\n",text[45],arqper);
+      exit(1);
+   }
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      if(strstr(buf,"TOTAL") == 0) {
+         getword(wtemp,buf,' ');
+         ttnacc+=my_atoll(buf);
+         getword(wtemp,buf,' ');
+         getword(wtemp,buf,' ');
+         totbytes+=my_atoll(wtemp);
+         getword(wtemp,buf,' ');
+         getword(wtemp,buf,' ');
+         getword(wtemp,buf,' ');
+         getword(wtemp,buf,' ');
+         getword(wtemp,buf,' ');
+         totelap+=my_atoll(wtemp);
+      }
+   }
+
+   fclose(fp_in);
+
+   dirp = opendir(tmp);
+   while ( (direntp = readdir( dirp )) != NULL ) {
+      if(strstr(direntp->d_name,".txt") == 0)
+         continue;
+
+      count=1;
+      strcpy(usuario,direntp->d_name);
+      wusuario[0]='\0';
+   
+      striptxt:
+      getword(warea,usuario,'.');
+      strcpy(denied_report,warea);
+      strcat(wusuario,warea);
+   
+      if(strcmp(usuario,"txt") !=0) {
+         strcat(wusuario,".");
+         goto striptxt;
+      }
+      sprintf(warea,"%s/%s",dirname,wusuario);
+      mkdir(warea,0755);
+
+      report_day(wusuario, iprel, userip);
+      greport_day(wusuario, iprel, userip);
+
+      strcpy(usuario,wusuario);
+      strcpy(arqin,tmp);
+      strcat(arqin,"/");
+      strcpy(arqou,dirname);
+      strcat(arqou,"/");
+      strcat(arqou,usuario);
+      strcat(arqou,"/");
+      strcat(arqou,usuario);
+      strcat(arqou,".html");
+      strcpy(duser,arqin);
+      strcat(duser,"denied_");
+      strcat(arqin,direntp->d_name);
+      if((str=(char *) strstr(denied_report, "_")) != (char *) NULL ) {
+         if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
+            fixip(denied_report);
+      }
+      strcat(duser,denied_report);
+      strcat(duser,".html");
+      if(access(duser, R_OK) != 0)
+         denied_report[0]='\0';
+   
+      if ((fp_in = fopen(arqin, "r")) == 0){
+         fprintf(stderr, "SARG: (html3) %s: %s\n",text[45],arqin);
+         exit(1);
+      }
+   
+      while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+         getword(wtemp,buf,' ');
+         tnacc+=my_atoll(wtemp);
+         getword(wtemp,buf,' ');
+         tnbytes+=my_atoll(wtemp);
+         getword(wtemp,buf,' ');
+         getword(wtemp,buf,' ');
+         getword(wtemp,buf,' ');
+         tnelap+=my_atoll(wtemp);
+         getword(wtemp,buf,' ');
+         tnincache+=my_atoll(wtemp);
+         getword(wtemp,buf,' ');
+         tnoucache+=my_atoll(wtemp);
+      }
+
+      fclose(fp_in);
+   
+      if ((fp_in = fopen(arqin, "r")) == 0){
+         fprintf(stderr, "SARG: (html4) %s: %s\n",text[45],arqin);
+         exit(1);
+      }
+   
+      if ((fp_ou = fopen(arqou, "w")) == 0){
+         fprintf(stderr, "SARG: (html5) %s: %s\n",text[45],arqou);
+         exit(1);
+      }
+   
+      fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+      fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);
+      fputs("<html>\n",fp_ou);
+      fputs("<head>\n",fp_ou);
+      sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+      fputs(html,fp_ou);
+      css(fp_ou);
+      fputs("</head>\n",fp_ou);
+
+      sprintf(buf,"<body style=\"font-family:%s;font-size:%s;background-color:%s; \
+           background-image:url(%s)\">\n",FontFace,TitleFontSize,BgColor,BgImage);
+      fputs(buf,fp_ou);
+
+      if(strlen(LogoImage) > 0) {
+         fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou);
+         sprintf(html,"<tr><th align=left><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+         fputs(html,fp_ou);
+         fputs("</table>\n",fp_ou);
+      }
+
+      show_sarg(fp_ou,"../..");
+      fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou);
+      sprintf(html,"<tr><th class=\"title\" colspan=\"2\">%s</th></tr>\n",Title);
+      fputs(html,fp_ou);
+
+      strcpy(u2,usuario);
+      if(userip){
+         strcpy(u2,usuario);
+         fixip(u2);
+      }
+      if(strcmp(Ip2Name,"yes") == 0)
+         ip2name(u2);
+
+      if(UserTabFile[0] != '\0') {
+         sprintf(warea,":%s:",u2);
+         if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+            z1=0;
+            str2=(char *) strstr(str+1,":");
+            str2++;
+            bzero(name, MAXLEN);
+            while(str2[z1] != ':') {
+               name[z1]=str2[z1];
+               z1++;
+            }
+         } else strcpy(name,u2);
+      } else strcpy(name,u2);
+   
+      sprintf(html,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[89],periodo);
+      fputs(html,fp_ou);
+      sprintf(html,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[90],name);
+      fputs(html,fp_ou);
+      sprintf(html,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s, %s</td></tr>\n",text[104],UserSortField,UserSortOrder);
+      fputs(html,fp_ou);
+      sprintf(html,"<tr><td class=\"header3\" colspan=2>%s %s</td></tr>\n",text[32],text[55]);
+      fputs(html,fp_ou);
+      fputs("<tr><td></td></tr>\n",fp_ou);
+      fputs("</table></center>\n",fp_ou);
+      fputs("<center><table cellpadding=\"1\" cellspaging=\"2\">\n",fp_ou);
+   
+      if(strlen(denied_report) > 0) {
+         sprintf(html,"<tr><td class=\"header\" colspan=11><a href=\"denied_%s.html\">%s</a> %s</td></tr>\n",denied_report,text[116],text[55]);
+         fputs(html,fp_ou);
+      }
+   
+      strcpy(val3,text[92]);
+      strcpy(val4,text[93]);
+      sprintf(val11,"%%%s",text[93]);
+      sprintf(val5,"%s-%s-%s",text[113],text[114],text[112]);
+      strcpy(val6,text[94]);
+      strcpy(val7,text[95]);
+      sprintf(val8,"%%%s",text[99]);
+      strcpy(val9,"colspan=2");
+      bzero(val10, 255);
+      
+      if(strstr(UserReportFields,"CONNECT") == 0)
+         bzero(val3, 255);
+      if(strstr(UserReportFields,"BYTES") == 0)
+         bzero(val4, 255);
+      if(strstr(UserReportFields,"SETYB") == 0)
+         bzero(val11, 255);
+      if(strstr(UserReportFields,"IN-CACHE-OUT") == 0) {
+         bzero(val5, 255);
+         bzero(val9, 255);
+         strcpy(val10,"<td></td>");
+      }
+      if(strstr(UserReportFields,"USED_TIME") == 0)
+         bzero(val6, 255);
+      if(strstr(UserReportFields,"MILISEC") == 0)
+         bzero(val7, 255);
+      if(strstr(UserReportFields,"%TIME") == 0)
+         bzero(val8, 255);
+   
+      sprintf(html,"<tr><th></th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header3\" %s>%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[91],val3,val4,val11,val9,val5,val6,val7,val8);
+      fputs(html,fp_ou);
+  
+      if(debug) {
+         if(userip) {
+            strcpy(u2,usuario);
+            fixip(u2);
+            sprintf(msg, "%s: %s",text[61],u2);
+         } else
+            sprintf(msg, "%s: %s",text[61],usuario);
+            debuga(msg);
+      }
+
+      fscanf(fp_in,"%s",nacc);
+      fscanf(fp_in,"%s",nbytes);
+      fscanf(fp_in,"%s",url);
+      fscanf(fp_in,"%s",tmsg);
+      fscanf(fp_in,"%s",nelap);
+      fscanf(fp_in,"%s",incac);
+      fscanf(fp_in,"%s",oucac);
+
+      while(!feof(fp_in)) {
+         if(strncmp(tmsg,"OK",2) != 0)
+            sprintf(tmsg,"<td class=\"data\">%s</td>",text[46]);
+         else bzero(tmsg, 50);
+
+         nnbytes=my_atoll(nbytes);
+         nnelap=my_atoll(nelap);
+         incache=my_atoll(incac);
+         oucache=my_atoll(oucac);
+   
+         if(nnbytes) {
+            perc=nnbytes * 100;
+            perc=perc / tnbytes;
+         } else {
+            perc=0;
+            ouperc=0;
+         }
+
+         if(nnelap) {
+            perc2=nnelap * 100;
+            perc2=perc2 / tnelap;
+         } else perc2=0;
+         if(incache) {
+            inperc=incache * 100;
+            inperc=inperc / nnbytes;
+         } else inperc=0;
+   
+         if(oucache) {
+            ouperc=oucache * 100;
+            ouperc=ouperc / nnbytes;
+         } else ouperc=0;
+   
+         twork=my_atoll(nacc);
+         sprintf(wwork1,"%s",fixnum(twork,1));
+         sprintf(wwork2,"%s",fixnum(nnbytes,1));
+         sprintf(wwork3,"%s",fixnum(nnelap,1));
+
+         if(strcmp(LongUrl,"yes") != 0) {
+            getword(warea,url,'/');
+            sprintf(url,"%s",warea);
+            strcpy(urly,url);
+         } else {
+            strcpy(urly,url);
+            url_module(url, module);
+            getword(warea,url,'/');
+            sprintf(url,"%s...%s",warea,module);
+         }
+
+         if(strcmp(Privacy,"yes") == 0)
+            sprintf(httplink,"<font color=%s><href=http://%s>%s",       \
+                    PrivacyStringColor,PrivacyString,PrivacyString);
+          else
+             if(strlen(BlockIt) > 0)
+                sprintf(httplink,"<a href=\"%s%s?url=%s\"><img src=\"../../images/sarg-squidguard-block.png\" border=\"0\"></a><a href=http://%s>&nbsp;%s</a>",wwwDocumentRoot,BlockIt,urly,urly,urly);
+             else
+                sprintf(httplink,"<a href=http://%s title=\"%s\">%s</a>",urly,urly,url);
+
+         if(strstr(ReportType,"site_user_time_date") != 0) {
+            sprintf(ltext110,"%s",text[110]);
+            if(ltext110){
+               for(s=ltext110; *s; ++s)
+                  *s=tolower(*s);
+            }
+            strcpy(siteind,urly);
+            str=siteind;
+            for(z1=0; z1<strlen(str); z1++) {
+              if(str[z1]=='?' || str[z1]=='-' || str[z1]=='.' || str[z1]==':' || str[z1]=='/' || str[z1]=='\\')
+                  str[z1]='_';
+            }
+            sprintf(href2,"<a href=\"tt%s-%s.html\"><img src=\"../../images/datetime.png\" border=\"0\" title=\"%s %s\"></a>",usuario,siteind,ltext110,text[55]);
+         } else {
+            bzero(href2, MAXLEN);
+            bzero(ltext110, 50);
+         } 
+
+         sprintf(val2,"%s",href2);
+         sprintf(val3,"%3.2f%%",perc);
+         sprintf(val4,"%3.2f%%",inperc);
+         sprintf(val5,"%3.2f%%",ouperc);
+         sprintf(val6,"%s",buildtime(nnelap));
+         sprintf(val7,"%3.2f%%",perc2);
+      
+         if(strstr(UserReportFields,"CONNECT") == 0) {
+            bzero(wwork1, 255);
+            bzero(hbc1, 30);
+         }
+         if(strstr(UserReportFields,"BYTES") == 0) {
+            bzero(wwork2, 255);
+            bzero(hbc2, 30);
+         }
+         if(strstr(UserReportFields,"MILISEC") == 0) {
+            bzero(wwork3, 255);
+            bzero(hbc3, 30);
+         }
+         if(strstr(UserReportFields,"SETYB") == 0) {
+            bzero(val3, 255);
+            bzero(hbc4, 30);
+         }
+         if(strstr(UserReportFields,"IN-CACHE-OUT") == 0) {
+            bzero(val4, 255);
+            bzero(val5, 255);
+            bzero(hbc5, 30);
+            bzero(hbc6, 30);
+         }
+         if(strstr(UserReportFields,"USED_TIME") == 0) {
+            bzero(val6, 255);
+            bzero(hbc7, 30);
+         }
+         if(strstr(UserReportFields,"%TIME") == 0) {
+            bzero(val7, 255);
+            bzero(hbc8, 30);
+         }
+         if(strncmp(tmsg," ",1) == 0)
+            bzero(hbc9, 30);
+
+         sprintf(html,"<tr><td class=\"data\">%s</td><td class=\"data2\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td>%s</tr>\n",val2,httplink,wwork1,wwork2,val3,val4,val5,val6,wwork3,val7,tmsg);
+   
+         if(UserReportLimit) {
+            if(count <= UserReportLimit) {
+               fputs(html,fp_ou);
+               count++;
+            }
+         } else fputs(html,fp_ou);
+
+         if(iprel) {
+            strcpy(arqip,tmp);
+            strcat(arqip,"/");
+            strcat(arqip,usuario);
+            strcat(arqip,".ip");
+   
+            if ((fp_ip = fopen(arqip, "r")) == 0){
+               fprintf(stderr, "SARG: (html6) %s: %s\n",text[45],arqip);
+               exit(1);
+            }
+   
+            if ((fp_ip2 = fopen(tmp2, "a")) == 0){
+               fprintf(stderr, "SARG: (html7) %s: %s\n",text[45],tmp2);
+               exit(1);
+            }
+   
+            while(fgets(buf,sizeof(buf),fp_ip)!=NULL) {
+               if(strstr(buf,url) != 0)
+                  fputs(buf,fp_ip2);
+            }
+   
+            fclose(fp_ip);
+            fclose(fp_ip2);
+
+            sprintf(csort,"sort -n -T %s -k 1,1 -k 5,5 -o %s %s",TempDir,tmp3,tmp2);
+            system(csort);
+   
+            if ((fp_ip = fopen(tmp3, "r")) == 0) {
+               fprintf(stderr, "SARG: (html8) %s: %s\n",text[45],tmp3);
+               exit(1);
+            }
+
+            fscanf(fp_ip,"%s",user_ip);
+            fscanf(fp_ip,"%s",userurl);
+            fscanf(fp_ip,"%s",userdia);
+            fscanf(fp_ip,"%s",userhora);
+            fscanf(fp_ip,"%s",userbytes);
+            fscanf(fp_ip,"%s",userelap);
+   
+            strcpy(olduserip,user_ip);
+   
+            while(!feof(fp_ip)) {
+               if(strcmp(user_ip,olduserip) != 0) {
+                  my_lltoa(unelap,val2,0);
+                  sprintf(wwork1,"%s",fixnum(unbytes,1));
+                  sprintf(html,"<tr><td></td><td class=\"data\">%s</td><td></td><td class=\"data\">%s</td><td></td><td></td><td></td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",olduserip,wwork1,buildtime(unelap),val2);
+                  fputs(html,fp_ou);
+  
+                  strcpy(olduserip,user_ip);
+                  unacc=0;
+                  unbytes=0;
+                  unelap=0;
+               }
+   
+               unbytes=unbytes+my_atoll(userbytes);
+               unelap=unelap+my_atoll(userelap);
+   
+               fscanf(fp_ip,"%s",user_ip);
+               fscanf(fp_ip,"%s",userurl);
+               fscanf(fp_ip,"%s",userdia);
+               fscanf(fp_ip,"%s",userhora);
+               fscanf(fp_ip,"%s",userbytes);
+               fscanf(fp_ip,"%s",userelap);
+   
+            }
+
+            fclose(fp_ip);
+
+            unlink(tmp2);
+            unlink(tmp3);
+
+            my_lltoa(unelap,val3,0);
+            sprintf(wwork1,"%s",fixnum(unbytes,1));
+            sprintf(html,"<tr><td></td><td class=\"data\">%s</td><td></td><td class=\"data\">%s</td><td></td><td></td><td></td><td class=\"data\">%s</td><td class=\"data\">%s</font></td></tr>\n",olduserip,wwork1,buildtime(unelap),val3);
+            fputs(html,fp_ou);
+         }
+
+         unacc=0;
+         unbytes=0;
+         unelap=0;
+
+         fscanf(fp_in,"%s",nacc);
+         fscanf(fp_in,"%s",nbytes);
+         fscanf(fp_in,"%s",url);
+         fscanf(fp_in,"%s",tmsg);
+         fscanf(fp_in,"%s",nelap);
+         fscanf(fp_in,"%s",incac);
+         fscanf(fp_in,"%s",oucac);
+//         fscanf(fp_in,"%s",datestimes);
+
+      }
+
+      if(iprel)
+         unlink(arqip);
+      unlink(arqin);
+
+      if(tnbytes) {
+         perc=totbytes / 100;
+         perc=tnbytes / perc;
+      } else perc=0;
+   
+      if(tnelap) {
+         perc2=totelap / 100;
+         perc2=tnelap / perc2;
+      } else perc2=0;
+   
+      if(tnoucache) {
+         ouperc=tnoucache * 100;
+         ouperc=ouperc / tnbytes;
+      } else ouperc=0;
+   
+      if(tnincache) {
+         inperc=tnincache * 100;
+         inperc=inperc / tnbytes;
+      } else inperc=0;
+   
+      sprintf(wwork1,"%s",fixnum(tnacc,1));
+      sprintf(wwork2,"%s",fixnum(tnbytes,1));
+      sprintf(wwork3,"%s",fixnum(tnelap,1));
+
+      sprintf(val2,"%s%s",href2,ltext110);
+      sprintf(val3,"%3.2f%%",perc);
+      sprintf(val4,"%3.2f%%",inperc);
+      sprintf(val5,"%3.2f%%",ouperc);
+      sprintf(val6,"%s",buildtime(tnelap));
+      sprintf(val7,"%3.2f%%",perc2);
+
+      strcpy(hbc1,"class=\"header2\"");
+      strcpy(hbc2,"class=\"header2\"");
+      strcpy(hbc3,"class=\"header2\"");
+      strcpy(hbc4,"class=\"header2\"");
+      strcpy(hbc5,"class=\"header2\"");
+      strcpy(hbc6,"class=\"header2\"");
+      strcpy(hbc7,"class=\"header2\"");
+      strcpy(hbc8,"class=\"header2\"");
+      strcpy(hbc9,"class=\"header\"");
+
+      if(strstr(UserReportFields,"CONNECT") == 0) {
+         bzero(wwork1, 255);
+         bzero(hbc1, 30);
+      }
+      if(strstr(UserReportFields,"BYTES") == 0) {
+         bzero(wwork2, 255);
+         bzero(hbc2, 30);
+      }
+      if(strstr(UserReportFields,"MILISEC") == 0) {
+         bzero(wwork3, 255);
+         bzero(hbc3, 30);
+      }
+      if(strstr(UserReportFields,"SETYB") == 0) {
+         bzero(val3, 255);
+         bzero(hbc4, 30);
+      }
+      if(strstr(UserReportFields,"IN-CACHE-OUT") == 0) {
+         bzero(val4, 255);
+         bzero(hbc5, 30);
+      }
+      if(strstr(UserReportFields,"IN-CACHE-OUT") == 0) {
+         bzero(val5, 255);
+         bzero(hbc6, 30);
+      }
+      if(strstr(UserReportFields,"USED_TIME") == 0) {
+         bzero(val6, 255);
+         bzero(hbc7, 30);
+      }
+      if(strstr(UserReportFields,"%TIME") == 0) {
+         bzero(val7, 255);
+         bzero(hbc8, 30);
+      }
+
+      if(strstr(UserReportFields,"TOTAL") != 0) {
+         sprintf(html,"<tr><th></th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</font></th><th %s>%s</font></th></tr>\n",hbc9,text[107],hbc1,wwork1,hbc2,wwork2,hbc4,val3,hbc5,val4,hbc6,val5,hbc7,val6,hbc3,wwork3,hbc8,val7);
+         fputs(html,fp_ou);
+      }
+
+      fclose(fp_in);
+  
+      if(atoi(PerUserLimit) > 0) {
+         if(tnbytes > (atoi(PerUserLimit)*1000000)) {
+            limit_flag=0;
+            if(access(PerUserLimitFile, R_OK) == 0) {
+               if((fp_usr = fopen(PerUserLimitFile, "r")) == 0) {
+                  fprintf(stderr, "SARG: (html9) %s: %s\n",text[45],PerUserLimitFile);
+                  exit(1);
+               }
+               while(fgets(tmp5,sizeof(tmp5),fp_usr)!=NULL) {
+                  if(strstr(tmp5,"\n") != 0)
+                     tmp5[strlen(tmp5)-1]='\0';
+                  if(strcmp(tmp5,u2) == 0) {
+                     limit_flag=1;
+                     break;
+                  }
+               }
+               fclose(fp_usr);
+            }
+  
+            if(!limit_flag) {
+               if((fp_usr = fopen(PerUserLimitFile, "a")) == 0) {
+                  fprintf(stderr, "SARG: (html10) %s: %s\n",text[45],PerUserLimitFile);
+                  exit(1);
+               }
+               sprintf(html,"%s\n",u2);
+               fputs(html,fp_usr);
+               fclose(fp_usr);
+    
+               if(debug) {
+                  sprintf(msg, "%s %s %s (%s MB). %s %s",text[32],u2,text[74],PerUserLimit,text[75],PerUserLimitFile);
+                      debuga(msg);
+               }
+            }
+         }
+      }
+
+      strcpy(arqper,dirname);
+      strcat(arqper,"/usuarios");
+   
+      if ((fp_in = fopen(arqper, "r")) == 0){
+         fprintf(stderr, "SARG: (html11) %s: %s\n",text[45],arqper);
+         exit(1);
+      }
+
+      fgets(totuser,8,fp_in);
+      fclose(fp_in);
+      totbytes2=totbytes/my_atoll(totuser);
+      totelap2=totelap/my_atoll(totuser);
+      if(totbytes2) {
+         perc = totbytes / 100;
+         perc = totbytes2 / perc;
+      } else perc=0;
+   
+      if(totelap2) {
+         perc2 = totelap / 100;
+         perc2 = totelap2 / perc2;
+      } else perc2=0;
+   
+      twork2=my_atoll(totuser);
+      twork=ttnacc/twork2;
+  
+      sprintf(wwork1,"%s",fixnum(twork,1));
+      sprintf(wwork2,"%s",fixnum(totbytes2,1));
+      sprintf(wwork3,"%s",fixnum(totelap2,1));
+
+      sprintf(val6,"%s",buildtime(totelap2));
+      sprintf(val7,"%3.2f%%",perc2); 
+   
+      strcpy(hbc1,"class=\"header2\"");
+      strcpy(hbc2,"class=\"header2\"");
+      strcpy(hbc3,"class=\"header2\"");
+      strcpy(hbc4,"class=\"header2\"");
+      strcpy(hbc5,"class=\"header2\"");
+      strcpy(hbc6,"class=\"header\"");
+
+      if(strstr(UserReportFields,"CONNECT") == 0) {
+         bzero(wwork1, 255);
+         bzero(hbc1, 30);
+      }
+      if(strstr(UserReportFields,"BYTES") == 0) {
+         bzero(wwork2, 255);
+         bzero(hbc2, 30);
+      }
+      if(strstr(UserReportFields,"MILISEC") == 0) {
+         bzero(wwork3, 255);
+         bzero(hbc3, 30);
+      }
+      if(strstr(UserReportFields,"USED_TIME") == 0) { 
+         bzero(val6, 255);
+         bzero(hbc4, 30);
+      }
+      if(strstr(UserReportFields,"%TIME") == 0) {
+         bzero(val7, 255);
+         bzero(hbc5, 30);
+      }
+   
+      if(strstr(UserReportFields,"AVERAGE") != 0) {
+         sprintf(html,"<tr><th></th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th></th><th></th><th></th><th %s>%s</th><th %s>%s</font></th><th %s>%s</th></tr>\n",hbc6,text[96],hbc1,wwork1,hbc2,wwork2,hbc4,val6,hbc3,wwork3,hbc5,val7);
+         fputs(html,fp_ou);
+      }
+
+      tnacc=0;
+      tnbytes=0;
+      tnelap=0;
+      tnincache=0;
+      tnoucache=0;
+
+      fputs("</center></table>\n",fp_ou);
+
+      show_info(fp_ou);
+
+      fputs("</body>\n</html>\n",fp_ou);
+
+      fclose(fp_ou);
+
+      htaccess(name);
+
+   }
+
+   (void)rewinddir(dirp);
+   (void)closedir(dirp);
+
+   return;
+}
diff --git a/images/datetime.png b/images/datetime.png
new file mode 100644 (file)
index 0000000..61543da
Binary files /dev/null and b/images/datetime.png differ
diff --git a/images/graph.png b/images/graph.png
new file mode 100644 (file)
index 0000000..3fc5ecf
Binary files /dev/null and b/images/graph.png differ
diff --git a/images/sarg-squidguard-block.png b/images/sarg-squidguard-block.png
new file mode 100644 (file)
index 0000000..3163894
Binary files /dev/null and b/images/sarg-squidguard-block.png differ
diff --git a/images/sarg.png b/images/sarg.png
new file mode 100644 (file)
index 0000000..1f04091
Binary files /dev/null and b/images/sarg.png differ
diff --git a/include/conf.h b/include/conf.h
new file mode 100755 (executable)
index 0000000..0809bb2
--- /dev/null
@@ -0,0 +1,316 @@
+
+#include "info.h"
+
+#if HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#if HAVE_TIME_H
+#include <time.h>
+#endif
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_DIRENT_H && !HAVE_DIRENT_H
+#include <sys/dirent.h>
+#endif
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_TYPES_H
+#include <types.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#if HAVE_GD_H
+#include <gd.h>
+#define HAVE_GD
+gdImagePtr im;
+gdPoint points[4];
+#endif
+#if HAVE_GDFONTL_H
+#include <gdfontl.h>
+#endif
+#if HAVE_GDFONTT_H
+#include <gdfontt.h>
+#endif
+#if HAVE_GDFONTS_H
+#include <gdfonts.h>
+#endif
+#if HAVE_GDFONTMB_H
+#include <gdfontmb.h>
+#endif
+#if HAVE_GDFONTG_H
+#include <gdfontg.h>
+#endif
+
+#if HAVE_FOPEN64
+#define _FILE_OFFSET_BITS 64
+#define MY_FOPEN fopen
+#else
+#define MY_FOPEN fopen
+#endif
+
+
+#define MAXLEN 20000
+long long int my_atoll (const char *nptr);
+
+FILE *fp_tt; 
+
+char outdir[MAXLEN];
+char dirname[MAXLEN];
+char buf[MAXLEN];
+char url[MAXLEN];
+char urly[MAXLEN];
+char user[MAXLEN];
+char periodo[MAXLEN];
+char msg[1024];
+char per_hour[128];
+char tmp[MAXLEN];
+char tmp2[MAXLEN];
+char tmp3[MAXLEN];
+char tmp4[MAXLEN];
+char tmp5[MAXLEN];
+char tmp6[MAXLEN];
+char parse_out[MAXLEN];
+char arqtt[MAXLEN];
+char html[MAXLEN];
+char datestimes[MAXLEN];
+char ConfigFile[MAXLEN];
+char href[MAXLEN];
+char href2[MAXLEN];
+char href3[MAXLEN];
+char df[20];
+char day[3], month[3], year[5];
+char ltext110[50];
+char cdfrom[30];
+char cduntil[30];
+char LastLog[5];
+char RemoveTempFiles[4];
+char ReplaceIndex[256];
+char Index[5];
+char OverwriteReport[4];
+char RecordsWithoutUser[20];
+char UseComma[4];
+char MailUtility[6];
+char TopSitesNum[5];
+char TopUsersNum[5];
+char ExcludeCodes[256];
+char TopsitesSortField[15];
+char TopsitesSortType[5];
+char ReportType[255];
+char UserTabFile[255];
+char warea[MAXLEN];
+char name[MAXLEN];
+char LongUrl[4];
+char Ip2Name[5];
+char language[255];
+char AccessLog[MAXLEN];
+char Title[MAXLEN];
+char BgColor[MAXLEN];
+char BgImage[MAXLEN];
+char TxColor[MAXLEN];
+char TxBgColor[MAXLEN];
+char TiColor[MAXLEN];
+char LogoImage[MAXLEN];
+char LogoText[MAXLEN];
+char LogoTextColor[MAXLEN];
+char Width[MAXLEN];
+char Height[MAXLEN];
+char FontFace[MAXLEN];
+char HeaderColor[MAXLEN];
+char HeaderBgColor[MAXLEN];
+char FontSize[MAXLEN];
+char PasswdFile[MAXLEN];
+char TempDir[MAXLEN];
+char OutputDir[MAXLEN];
+char OutputEmail[MAXLEN];
+char TopuserSortField[30];
+char UserSortField[30];
+char TopuserSortOrder[10];
+char UserSortOrder[10];
+char UserAgentLog[255];
+char module[255];
+char ExcludeHosts[255];
+char ExcludeUsers[255];
+char DateFormat[2];
+char PerUserLimitFile[255];
+char PerUserLimit[20];
+char UserIp[5];
+char MaxElapsed[255];
+char datetimeby[10];
+char csort[255];
+char CharSet[255];
+char UserInvalidChar[255];
+char Graphs[5];
+char GraphDaysBytesBarColor[255];
+char Privacy[10];
+char PrivacyString[255];
+char PrivacyStringColor[30];
+char IncludeUsers[MAXLEN];
+char ExcludeString[MAXLEN];
+char SuccessfulMsg[5];
+char TopUserFields[255];
+char UserReportFields[255];
+char DataFile[MAXLEN];
+char DataFileDelimiter[3];
+char DataFileFields[MAXLEN];
+char SiteUserTimeDateType[10];
+char ShowReadStatistics[5];
+char IndexSortOrder[5];
+char DansGuardianConf[MAXLEN];
+char SquidGuardConf[MAXLEN];
+char SquidGuarddbHome[255];
+char SquidGuardLogFormat[MAXLEN];
+char ShowSargInfo[5];
+char ShowSargLogo[5];
+char ParsedOutputLog[MAXLEN];
+char ParsedOutputLogCompress[255];
+char DisplayedValues[20];
+char HeaderFontSize[3];
+char TitleFontSize[3];
+char wwwDocumentRoot[MAXLEN];
+char ExternalCSSFile[MAXLEN];
+char BlockIt[255];
+char BlockImage[512];
+char NtlmUserFormat[30];
+char hbc1[30];
+char hbc2[255];
+char hbc3[30];
+char hbc4[30];
+char hbc5[30];
+char hbc6[30];
+char hbc7[30];
+char hbc8[30];
+char hbc9[30];
+char hbc10[30];
+char UserAuthentication[10];
+char AuthUserFile[255];
+char AuthName[512];
+char AuthType[255];
+char Require[512];
+char DownloadSuffix[MAXLEN];
+char *excludecode;
+char *userfile;
+char *str;
+char *str2;
+char text[200][255];
+char val1[MAXLEN];
+char val2[MAXLEN];
+char val3[MAXLEN];
+char val4[MAXLEN];
+char val5[MAXLEN];
+char val6[MAXLEN];
+char val7[MAXLEN];
+char val8[MAXLEN];
+char val9[MAXLEN];
+char val10[MAXLEN];
+char val11[MAXLEN];
+char wwork1[MAXLEN];
+char wwork2[MAXLEN];
+char wwork3[MAXLEN];
+char ftime[128];
+char mask[MAXLEN];
+char httplink[MAXLEN];
+char html_old[MAXLEN];
+char siteind[MAXLEN];
+char site[MAXLEN];
+char us[50];
+char email[MAXLEN];
+char test[1];
+char ouser2[255];
+char user2[MAXLEN];
+char wentp[512];
+char addr[MAXLEN];
+char suffix[10];
+char download_url[MAXLEN];
+char Ulimit[5];
+char cmd[255];
+int  excode;
+int  idate;
+int  smartfilter;
+int  denied_count;
+int  download_count;
+int  authfail_count;
+int  dansguardian_count;
+int  squidguard_count;
+int  limit_flag;
+int  color1;
+int  color2;
+int  color3;
+int  z1, z2, z3;
+int  ttopen;
+int  ind2;
+int  sarglog;
+int  isalog;
+int  dfrom; 
+int  duntil;
+int  dataonly;
+int  indexonly;
+int  iprel;
+int  userip;
+int  langcode;
+int  debug;
+int  debugz;
+int  debugm;
+int  AuthfailReportLimit;
+int  DeniedReportLimit;
+int  SiteUsersReportLimit;
+int  DansGuardianReportLimit;
+int  SquidGuardReportLimit;
+int  UserReportLimit;
+int  download_flag;
+int  AuthfailReportLimit;
+int  DeniedReportLimit;
+int  SiteUsersReportLimit;
+int  SquidGuardReportLimit;
+int  UserReportLimit;
+int  download_flag;
+long l1, l2;
+float perc;
+
+long long int twork;
+long long int twork2;
+
+typedef struct
+{ int list[ 24 ];
+  int len;
+} numlist;
+
+DIR *dirp;
+struct dirent *direntp;
+
+int getnumlist( char *, numlist *, const int, const int );
diff --git a/include/defs.h b/include/defs.h
new file mode 100755 (executable)
index 0000000..e1d2124
--- /dev/null
@@ -0,0 +1,8 @@
+void maketmp(char *user, char *dirname, int debug, int indexonly);
+void maketmp_hour(char *user, char *dirname, int indexonly);
+void gravatmp(char *oldaccuser, char *dirname, char *oldurl, long long int nacc, long long int nbytes, char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache);
+void gravatmp_hora(char *dirname, char *user, char *data, char *hora, char *elap, char *accbytes, int indexonly);
+void gravatmpf(char *oldaccuser, char *dirname, char *oldurl, long long int nacc, long long int nbytes, char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache);
+void gravaporuser(char *user, char *dirname, char *url, char *ip, char *data, char *hora, char *tam, char *elap, int indexonly);
+void gravager(char *dirname, char *user, long long int nacc, char *url, long long int nbytes, char *ip, char *hora, char *dia, long long int nelap, long long int incache, long long int oucache);
+void grava_SmartFilter(char *dirname, char *user, char *ip, char *data, char *hora, char *url, char *smart);
diff --git a/include/extern.h b/include/extern.h
new file mode 100755 (executable)
index 0000000..ffc195e
--- /dev/null
@@ -0,0 +1,112 @@
+extern char *htm01;
+extern char *htm02;
+extern char *htm03;
+extern char *htm04;
+extern char *htm05;
+extern char *htm06;
+extern char *htm07;
+extern char *htm08;
+extern char *htm09;
+extern char *htm10;
+extern char *htm11;
+extern char *htm12;
+extern char *htm13;
+extern char *htm14;
+extern char *htm15;
+extern char *htm16;
+extern char *htm17;
+extern char *htm18;
+extern char *htm19;
+extern char *htm20;
+extern char *htm21;
+extern char *htm22;
+extern char *htm23;
+extern char *htm24;
+extern char *htm26;
+extern char *htm27;
+extern char *htm28;
+extern char *htm29;
+extern char *htm30;
+
+extern char *msg01;
+extern char *msg02;
+extern char *msg03;
+extern char *msg04;
+extern char *msg05;
+extern char *msg06;
+extern char *msg07;
+extern char *msg08;
+extern char *msg09;
+extern char *msg10;
+extern char *msg11;
+extern char *msg12;
+extern char *msg13;
+extern char *msg14;
+extern char *msg15;
+extern char *msg16;
+extern char *msg17;
+extern char *msg18;
+extern char *msg19;
+extern char *msg20;
+extern char *msg21;
+extern char *msg22;
+extern char *msg23;
+extern char *msg24;
+extern char *msg25;
+extern char *msg26;
+extern char *msg27;
+extern char *msg28;
+extern char *msg29;
+extern char *msg30;
+extern char *msg31;
+extern char *msg32;
+extern char *msg33;
+extern char *msg34;
+extern char *msg35;
+extern char *msg36;
+extern char *msg37;
+extern char *msg38;
+extern char *msg39;
+extern char *msg40;
+extern char *msg41;
+extern char *msg42;
+extern char *msg43;
+extern char *msg44;
+extern char *msg45;
+extern char *msg46;
+extern char *msg47;
+extern char *msg48;
+extern char *msg49;
+extern char *msg50;
+extern char *msg51;
+extern char *msg52;
+extern char *msg53;
+extern char *msg54;
+extern char *msg55;
+extern char *msg56;
+extern char *msg57;
+extern char *msg58;
+extern char *msg59;
+extern char *msg60;
+extern char *msg61;
+extern char *msg62;
+extern char *msg63;
+extern char *msg64;
+extern char *msg65;
+extern char *msg66;
+extern char *msg67;
+extern char *msg68;
+extern char *msg70;
+extern char *msg72;
+extern char *msg73;
+extern char *msg74;
+extern char *msg75;
+extern char *msg76;
+extern char *msg77;
+extern char *msg78;
+extern char *msg79;
+extern char *msg80;
+extern char *msg81;
+extern char *msg82;
+extern char *msg83;
+extern char *msg84;
diff --git a/include/info.h b/include/info.h
new file mode 100755 (executable)
index 0000000..b2dcad4
--- /dev/null
@@ -0,0 +1,3 @@
+#define VERSION "2.0.8 May-29-2005"
+#define PGM "sarg"
+#define URL "http://www.sarg-squid.org"
diff --git a/index.c b/index.c
new file mode 100644 (file)
index 0000000..d27c4d3
--- /dev/null
+++ b/index.c
@@ -0,0 +1,193 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void geraindex()
+{
+
+   FILE *fp_ou, *fp_tmp, *tp_tmp2;
+   DIR *dirp;
+   struct dirent *direntp;
+   char html[MAXLEN];
+   char wdir[MAXLEN];
+   char wdir_tmp[MAXLEN];
+   char wdir_tmp2[MAXLEN];
+   char newname[512];
+   char month[4];
+   char period[80];
+   char data[80];
+   char tuser[20];
+   char tbytes[20];
+   char media[20];
+   char ftime[128];
+   char day[4], mon[4], year[6], hour[10];
+   char h[3], m[3], s[3];
+
+   if(LastLog[0] != '\0')
+      mklastlog(outdir,debug);
+
+   sprintf(wdir,"%sindex.html",outdir);
+   sprintf(wdir_tmp,"%sindex.unsort",outdir);
+   sprintf(wdir_tmp2,"%sindex.sort",outdir);
+   strcpy(hbc1,"class=\"header\"");
+
+   if(strcmp(Index,"no") == 0) {
+      if(access(wdir, R_OK) == 0)
+         unlink(wdir);
+      return;
+   }
+
+   if(debug)
+      debuga(text[53]);
+
+   if((fp_ou=fopen(wdir,"w"))==NULL) {
+      fprintf(stderr, "SARG: (index) %s: %s\n",text[45],wdir);
+      exit(1);
+   }
+
+   if((fp_tmp=fopen(wdir_tmp,"w"))==NULL) {
+      fprintf(stderr, "SARG: (index) %s: %s\n",text[45],wdir_tmp);
+      exit(1);
+   }
+
+   dirp = opendir(outdir);
+   while ( (direntp = readdir( dirp )) != NULL ){
+      if(strstr(direntp->d_name,"-") == 0)
+         continue;
+
+      bzero(newname, 512);
+      strncat(newname,direntp->d_name,4);
+      strncpy(month,direntp->d_name+4,3);
+      month[3]='\0';
+      conv_month(month);
+      strcat(newname,month);
+      strncat(newname,direntp->d_name+7,2);
+
+      obtdate(outdir,direntp->d_name,data);
+      obtuser(outdir,direntp->d_name,tuser);
+      obttotal(outdir,direntp->d_name,tbytes,tuser,media);
+     
+      strcpy(html,data);
+      getword(mon,html,' ');
+      getword(mon,html,' ');
+      getword(day,html,' ');
+      getword(hour,html,' ');
+      getword(year,html,' ');
+      getword(year,html,' ');
+      strcpy(html,hour);
+      getword(h,html,':');
+      getword(m,html,':');
+      strcpy(s,html);
+      buildymd(day,mon,year,ftime);
+      
+      sprintf(html,"%s%s%s%s;%s;%s;%s;%s;%s;%s\n",ftime, h, m, s, direntp->d_name, data, tuser, tbytes, media,
+                       newname);
+      fputs(html, fp_tmp);
+   }
+
+   fclose(fp_tmp);
+   (void)rewinddir( dirp );
+   (void)closedir( dirp );
+
+   if(strcmp(IndexSortOrder,"A") == 0)
+//      sprintf(html,"sort -t';' -k 7,7 %s -o %s", wdir_tmp, wdir_tmp2);
+      sprintf(html,"sort -t';' +6.5n +6.2M +6.0n '%s' -o '%s'", wdir_tmp, wdir_tmp2);
+   else
+//      sprintf(html,"sort -t';' -r -k 7,7 %s -o %s", wdir_tmp, wdir_tmp2);
+      sprintf(html,"sort -t';' +6.5nr +6.2Mr +6.0nr '%s' -o '%s'", wdir_tmp, wdir_tmp2);
+
+   system(html);
+
+   unlink(wdir_tmp);
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);
+   fputs("<html>\n",fp_ou);
+   fputs("<head>\n",fp_ou);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ou);
+   fputs("</head>\n",fp_ou);
+   css(fp_ou);
+
+   sprintf(buf,"<body style=\"font-family:%s;font-size:%s;background-color:%s; \
+       background-image:url(%s)\">\n",FontFace,TitleFontSize,BgColor,BgImage);
+   fputs(buf,fp_ou);
+
+   sprintf(buf,"<center><table cellpadding=\"0\" cellspacing=\"0\">\n");
+   fputs(buf,fp_ou);
+   if(strlen(LogoImage) > 0) {
+      sprintf(html,"<tr><th align=\"center\"><img src=\"%s\" border=0 align=absmiddle width=%s height=%s> \
+       <font color=%s>%s</font></th></tr>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(html,fp_ou);
+   }
+   show_sarg(fp_ou, ".");
+   sprintf(html,"<tr><th class=\"title\">%s</th></tr>\n",Title);
+   fputs(html,fp_ou);
+   fputs("</table></center>\n",fp_ou);
+
+   fputs("<center><table cellpadding=\"1\" cellspacing=\"2\">\n",fp_ou);
+   fputs("<tr><td></td><td></td></tr>\n",fp_ou);
+
+   sprintf(html,"<tr><th %s>%s</th><th %s>%s</th><th %s>%s \
+       </th><th %s>%s</th><th %s>%s</th></tr>\n", \
+       hbc1,text[101],hbc1,text[102],hbc1,text[103],hbc1,text[93],hbc1,text[96]);
+   fputs(html,fp_ou);
+
+   if((fp_tmp=fopen(wdir_tmp2,"r"))==NULL) {
+      fprintf(stderr, "SARG: (index) %s: %s\n",text[45],wdir_tmp2);
+      exit(1);
+   }
+
+   while(fgets(buf,MAXLEN,fp_tmp)!=NULL) {
+      getword(period,buf,';');
+      getword(period,buf,';');
+      getword(data,buf,';');
+      getword(tuser,buf,';');
+      getword(tbytes,buf,';');
+      getword(media,buf,';');
+
+      sprintf(html,"<tr><td class=\"data2\"><a href='%s/%s'>%s</a></td><td class=\"data2\">%s</td> \
+       <td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n", \
+       period,ReplaceIndex,period,data,tuser,tbytes,media);
+      fputs(html,fp_ou);
+   }
+
+   strcpy(html,"</table></center>");
+   fputs(html,fp_ou);
+
+   zdate(ftime, DateFormat);
+
+   show_info(fp_ou);
+
+   strcpy(html,"</body>\n</html>\n");
+   fputs(html,fp_ou);
+
+   fclose(fp_ou);
+   fclose(fp_tmp);
+
+   unlink(wdir_tmp2);
+   return;
+}
diff --git a/indexonly.c b/indexonly.c
new file mode 100644 (file)
index 0000000..2c27f21
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+
+void index_only()
+{
+
+   DIR *dirp;
+   struct dirent *direntp;
+   char remove[MAXLEN];
+  
+
+   dirp = opendir(dirname);
+   while ( (direntp = readdir( dirp )) != NULL ){
+      if(strcmp(direntp->d_name,".") == 0 || strcmp(direntp->d_name,"..") == 0 || strcmp(direntp->d_name, "index.html") == 0)
+         continue;
+       
+      sprintf(remove,"%s/%s",dirname,direntp->d_name);
+      unlink(remove);
+   }
+
+   (void)rewinddir( dirp );
+   (void)closedir( dirp );
+
+   return;
+}
diff --git a/ip2name.c b/ip2name.c
new file mode 100644 (file)
index 0000000..5f88038
--- /dev/null
+++ b/ip2name.c
@@ -0,0 +1,81 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void ip2name(char *ip)
+{ 
+   u_long addr;
+   struct hostent *hp; 
+   char **p; 
+
+   if ((int)(addr = inet_addr(ip)) == -1)
+      return;
+
+   hp = gethostbyaddr((char *)&addr, sizeof (addr), AF_INET); 
+   if (hp == NULL) 
+      return;
+
+   for (p = hp->h_addr_list; *p != 0; p++) { 
+      struct in_addr in; 
+
+      (void) memcpy(&in.s_addr, *p, sizeof (in.s_addr));         
+      (void) sprintf(ip,"%s", hp->h_name); 
+   } 
+
+   return;
+} 
+
+void name2ip(char *name)
+{ 
+   struct in_addr ia;
+   struct hostent *hp;
+   char   work[MAXLEN];
+   char   n1[4];
+   char   n2[4];
+   char   n3[4];
+   char   n4[4];
+
+   if(strstr(name,":") > 0) {
+      getword(work,name,':');
+      strcpy(name,work);
+   }
+
+   if((hp=gethostbyname(name))==NULL)
+      return;
+   else {
+      memcpy(&ia.s_addr,hp->h_addr_list[0],sizeof(ia.s_addr));
+      ia.s_addr=ntohl(ia.s_addr);
+      sprintf(name,"%s",inet_ntoa(ia));
+      getword(n4,name,'.');
+      getword(n3,name,'.');
+      getword(n2,name,'.');
+      strcpy(n1,name);
+      sprintf(name,"%s.%s.%s.%s",n1,n2,n3,n4);
+
+   }
+
+   return;
+} 
diff --git a/language.c b/language.c
new file mode 100644 (file)
index 0000000..1eaa36a
--- /dev/null
@@ -0,0 +1,56 @@
+/*\r
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br\r
+ *                                                            1998, 2005\r
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org\r
+ *\r
+ * SARG donations:\r
+ *      please look at http://sarg.sourceforge.net/donations.php\r
+ * ---------------------------------------------------------------------\r
+ *\r
+ *  This program is free software; you can redistribute it and/or modify\r
+ *  it under the terms of the GNU General Public License as published by\r
+ *  the Free Software Foundation; either version 2 of the License, or\r
+ *  (at your option) any later version.\r
+ *\r
+ *  This program is distributed in the hope that it will be useful,\r
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ *  GNU General Public License for more details.\r
+ *\r
+ *  You should have received a copy of the GNU General Public License\r
+ *  along with this program; if not, write to the Free Software\r
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.\r
+ *\r
+ */\r
+\r
+#include "include/conf.h"\r
+\r
+\r
+void language_load(char *language)\r
+{\r
+\r
+   FILE *fp_text;\r
+   int record=0;\r
+\r
+   sprintf(warea,"%s/languages/%s",SYSCONFDIR,language);\r
+\r
+   if((fp_text=fopen(warea,"r"))==NULL) {\r
+     fprintf(stderr, "SARG: (language) Cannot open language file: %s\n",warea);\r
+     exit(1);\r
+   }\r
+\r
+   while(fgets(buf,MAXLEN,fp_text)!=NULL) {\r
+      getword(warea,buf,'"');\r
+      getword(warea,buf,'"');\r
+      strcpy(text[record],warea);\r
+\r
+      if(langcode)\r
+      printf("%d %s\n",record,warea);\r
+\r
+      record++;\r
+   }\r
+\r
+   fclose(fp_text);\r
+\r
+   return;\r
+}\r
diff --git a/languages/.new b/languages/.new
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/languages/Bulgarian_windows1251 b/languages/Bulgarian_windows1251
new file mode 100644 (file)
index 0000000..7fdb18a
--- /dev/null
@@ -0,0 +1,130 @@
+# by Ivan Minchev <vanko@uni-svishtov.bg>
+"Äà"
+"Íå"
+"Bulgarian"
+"Ïàðàìåòðè"
+"íåîáõîäèì å àðãóìåíò"
+"Èíèöèàëèçàöèÿ"
+"×åòåíå íà log ôàéëà"
+"Íå ìîãà äà íàìåðÿ log ôàéëà"
+"Íå ìîãà äà íàìåðÿ âðåìåííèÿ ôàéë"
+"Çàïèñèòå ñà ïðî÷åòåíè"
+"çàïèñàíî"
+"Log-à ñúäúðæà çàïèñè ñ ðàçëè÷íè ôîðìàòè (squid è äð.)"
+"Log ñ äðóã ôîðìàò"
+"Log â Squid-ôîðìàò"
+"Log ñ ãðåøåí ôîðìàò"
+"Çàïèñèòå íå ñà íàìåðåíè"
+"Ïåðèîä"
+"ñå èçïîëçâà"
+"êàòî âðåìåíåíà äèðåêòîðèÿ"
+"Ñîðòèðîâêà íà ôàéëîâåòå"
+"Çàâúðøåíî"
+"Ïàðàìåòðè"
+"Èìå èëè IP-àäðåñ"
+"Äàòà îò-äî"
+"Ôîðìàò íà äàòèòå"
+"Åâðîïà"
+"Àìåðèêà"
+"IP îò÷åò"
+"Èñïîëçâàéòå Ip-àäðåñ âìåñòî èìå íà ïîòðåáèòåëÿ"
+"Àäðåñ"
+"Âðåìå"
+"Èìå"
+"Âåðñèÿ íà Squid"
+"Âðåìåíåíà äèðåêòîðèÿ"
+"Êîíòðîëíè ñîîáùåíèÿ"
+"Ðàáîòíè ñúîáùåíèÿ"
+"Âõîäÿù log"
+"Èçõîäíà äèðåêòîðèÿ"
+"Èçïîëçîâàí"
+"ïàðàìåòðè"
+"E-mail àäðåñ çà èçïðàùàíå íà îò÷åòà"
+"ñò.èçõîä íà êîíçîëàòà"
+"Îò÷åò ïî ïîòðåáèòåëè è IP-àäðåñè"
+"îò÷åòè"
+"Íå ìîãà äà íàìåðÿ ôàéëà"
+"ÇÀÁÐÀÍÅÍÎ"
+"Îò÷åòà å ãåíåðèðàí â:"
+"Îò÷åòà å ãåíåðèðàí è èçïðàòåí"
+"Ñúçäàâàíå íà ôàéëà"
+"Ñúçäàâàíå íà ôàéëà çà ïåðèîäà"
+"Ôàéë"
+"âå÷å ñúùåñòâóâà, ïðåìåñòåí â"
+"Ñúçäàâàíå íà index.html"
+"Ñîðòèðîâêà íà ôàéëîâåòå"
+"Îò÷åò"
+"Squid íå å èíñòàëèðàí íà òàçè ìàøèíà"
+"Ìîëÿ, èñïîëçâàéòå ïàðàìåòúð -v çà çàäàâàíå íà âåðñèÿòà íà Squid"
+"Çàðåæäà êîíôèãóðàöèÿ îò"
+"ãðåøêà malloc"
+"Çàðåæäà ôàéëà ñ ïàðîëèòå îò"
+"Ñúçäàâàíå íà îò÷åòà"
+"Ðàçàðõèâèðàíå íà log ôàéëà"
+"Àðõèâèðàíå íà log ôàéëà"
+"Ôàéëà íå å íàìåðåí"
+"Íàìèðàíå íà IP-àäðåñà"
+"×åòåíå íà log-à íà áðàóçåðèòå"
+"Çàðåæäà ôàéëà ñ èçêëþ÷åíèÿòà îò"
+"èçêëþ÷åíèÿ"
+"Ôàéë ñ èçêëþ÷åíèÿ"
+"Ôàéë ñ êîíôèãóðàöèè"
+"Log íà áðàóçåðèòå"
+"Ñúçäàâàíå íà îò÷åòà ïî áðàóçåðè"
+"âåðñèÿ"
+"äîñòèãíàò ëèìèòà"
+"Äîáàâåí êúì ôàéëà"
+"Êîíâåðòèðàíå íà access.log ôàéëà êúì ÷åòëèâè äàòè"
+"Ðàçäåëÿíå íà log ôàéëà ïî äàòèòå â ïàðàìåòúð -d"
+"ïî"
+"â îáðàòåí ðåä"
+"íîðìàëíî"
+"Èçòðèâàíå íà ñòàðèÿ ôàéë ñ îò÷åòà"
+"Èçòðèâàíå íà âðåìåííèòå ôàéëîâå"
+"Top"
+"ñàéòîâå"
+"Ñåäìèöè"
+"Loading User table"
+"Cannot load. Memory fault"
+"Îò÷åò çà äîñòúïà íà ïîòðåáèòåëèòå íà Squid"
+"Ïåðèîä"
+"Ïîòðåáèòåë"
+"Àäðåñ"
+"Âêëþ÷âàíå"
+"Áàéòîâå"
+"Îáùî âðåìå"
+"Ìèëèñåê."
+"Ñðåäíî"
+"Íèçõîäÿùî (áàéòîâå)"
+"Ïîòðåáèòåë"
+"Âðåìå"
+"No"
+"Ïåðèîä"
+"Äàòà íà ñúçäàâàíå"
+"Ïîòðåáèòåëè"
+"Ñîðòèðàíî"
+"Îò÷åò Squid ïî áðàóçåðè"
+"Áðàóçåð"
+"Âñè÷êî"
+"Ãåíåðèðàíî îò"
+"íà"
+"Äàòà/Âðåìå"
+"IP/Èìå"
+"OUT"
+"IN"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication Failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Catalan b/languages/Catalan
new file mode 100644 (file)
index 0000000..c9ea2e8
--- /dev/null
@@ -0,0 +1,130 @@
+# by Leonardo A. D'Angelo <ldangelo@san-cayetano.com>
+"Si"
+"No"
+"Catalan"
+"Opcio"
+"requereix un argument"
+"Inicialització"
+"Llegint arxiu del log d'accesos"
+"No es pot obrir l'arxiu de log"
+"No es pot obrir l'arxiu temporal"
+"Registres llegits"
+"escrits"
+"El log té formats de registre barrejats (squid i common log)"
+"Format Common log"
+"Format Squid log"
+"Log amb format invàlid"
+"No s'han trobat registres"
+"Període"
+"fent anar"
+"com arxiu temporal"
+"Ordenant arxiu"
+"Fi"
+"Paràmetres"
+"Nom de host o direcció IP"
+"Data desde-fins a"
+"Format de data"
+"Formato de fecha"
+"Europa"
+"USA"
+"Report IP"
+"Fa anar direcció IP en cop de userid"
+"Lloc accedit"
+"Hora"
+"Usuari"
+"Versió de l'Squid"
+"Directori temporal"
+"Missatges de depuració"
+"Missatges de procesos"
+"Log d'entrada"
+"Directori de sortida"
+"Mode d'ús"
+"opcions"
+"Direcció de correu on enviar els reports"
+"stdout per a consola"
+"Reports per usuario i direcció IP"
+"reports"
+"No es pot obrir arxiu"
+"DENEGAT"
+"Report generat satisfactoriament a"
+"Report generat satisfactoriament i enviat a"
+"Creant arxiu"
+"Creant arxiu de període"
+"Arxiu"
+"ja existeix, renombrant-lo com a"
+"Creant index.html"
+"Ordenant arxiu"
+"Report"
+"Squid no instalat en aquesta màquina"
+"Si us plau, usi l'opció -v per veure la versió de l'Squid"
+"Carregant configuració desde"
+"error malloc"
+"Carregant arxiu de paraules de pas desde"
+"Creant report"
+"Descompactant arxiu de log"
+"Compactant arxiu de log"
+"Arxiu no trobat"
+"Resolguent direcció IP"
+"Llegint log de l'agent d'usuari"
+"Carregant arxiu d'exclusions desde"
+"excluit"
+"Arxiu d'exclusions"
+"Arxiu de configuració"
+"Log de l'agent d'usuari"
+"Creant report d'agent d'usuari"
+"versió"
+"límit excedit"
+"Afegint a l'arxiu"
+"Converteix l'arxiu access.log a una data llegible"
+"Cambia l'arxiu de log per data amb el paràmetre -d"
+"per"
+"invers"
+"normal"
+"Esborrant arxiu vell de report"
+"Esborrant arxius temporals"
+"Màxim"
+"Llocs"
+"Llocs i Usuaris""
+"Carregant taula d'usuaris"
+"No es pot carregar, fallida de la memòria"
+"Report d'Accesos d'Usuaris de l'Squid"
+"Període"
+"Usuari"
+"LLOC ACCEDIT"
+"CONEXIÓ"
+"BYTES"
+"TEMPS UTILITZAT"
+"MILISEC"
+"PROMITGE"
+"Accés Decreixent (bytes)"
+"USERID"
+"HORA"
+"NUM"
+"ARXIU/PERÍODE"
+"DATA CREACIÓ"
+"USUARIS"
+"Clasificat per"
+"Report d'Agent d'Usuari Squid"
+"AGENT"
+"TOTAL"
+"Generat per"
+"el"
+"DATA/HORA"
+"IP/NOM"
+"SORTIDA"
+"ENTRADA"
+"LlocsUsuaris"
+"FiltreInteligent"
+"Fallides d'autenticació"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"REGLA"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Czech b/languages/Czech
new file mode 100644 (file)
index 0000000..97c025a
--- /dev/null
@@ -0,0 +1,130 @@
+# by Milos Prudek <prudek@nembv.cz>
+"Ano"
+"Ne"
+"Èe¹tina"
+"Volba"
+"vy¾aduje argument"
+"Inicializace"
+"Ètu pøístupový ¾urnál"
+"Nemohu otevøít ¾urnál"
+"Nemohu otevøít pøechodný soubor"
+"Záznamù pøeèteno"
+"zapsáno"
+"®urnál má smíchané oba ¾urnálové formáty (obecný a squid ¾urnál)"
+"Obecný formát ¾urnálu"
+"Squid formát ¾urnálu"
+"®urnál s neplatným formátem"
+"Nena¹el jsem ¾ádné záznamy"
+"Období"
+"pou¾il jsem"
+"jako pøechodný adresáø"
+"Tøídím soubor"
+"Konec"
+"Parametry"
+"Jméno hostitele nebo IP adresa"
+"Datum od-do"
+"Formát data"
+"Evropa"
+"USA"
+"IP zpráva"
+"Pou¾ij IP Adresu místo ID u¾ivatele"
+"Nav¹tívený server"
+"Èas"
+"U¾ivatel"
+"verze Squidu"
+"Doèasnný adresáø"
+"Ladicí zprávy"
+"Zprávy o zpracování"
+"Vstupní ¾urnál"
+"Výstupní adresáø"
+"Pou¾ití"
+"volby"
+"Emailová adresa, na kterou se mají poslat pøehledy"
+"stdout pro konzolu"
+"Pøehledy podle u¾ivatele a IP adresy"
+"pøehledy"
+"Nemohu otevøít soubor"
+"Zakázáno"
+"Pøehled úspì¹nì generován"
+"Pøehled úspì¹nì generován a odeslán na adresu"
+"Vytváøím soubor"
+"Vytváøím soubor období"
+"Soubor"
+"u¾ existuje, pøesouvám do"
+"Vytváøím index.html"
+"Tøídím soubor"
+"Pøehled"
+"Squid není na tomto poèítaèi instalován"
+"Prosíme pou¾ijte volbu -v pro definování verze Squidu"
+"Naèítám konfiguraci z"
+"chyba malloc"
+"Naèítám heslo ze souboru"
+"Vytváøím zprávu"
+"Rozbaluji ¾urnálový soubor"
+"Balím ¾urnálový soubor"
+"Soubor nenalezen"
+"Pøevádí IP adresu na jméno"
+"Ètu ¾urnál s pøehledem klientù"
+"Naèítám soubor vyjímek z"
+"vyjmuto"
+"Soubor vyjímek"
+"Konfiguraèní soubor"
+"®urnál s pøehledem klientù"
+"Vytváøím pøehled o klientech"
+"verze"
+"limit pøekroèen"
+"Pøidáno do souboru"
+"Pøevede soubor access.log na správné datum"
+"Rozdìlí ¾urnálový soubor podle data v parametru -d"
+", napsal"
+"obrácenì"
+"normálnì"
+"Odstraòuji starý soubor s pøehledem"
+"Odstraòuji pøechodný soubor"
+"Nejlep¹ích"
+"serverù"
+"Týdny"
+"Loading User table"
+"Cannot load. Memory fault"
+"Pøehled o vyu¾ití Squidu podle u¾ivatelù"
+"Období"
+"U¾ivatel"
+"NAV©TÍVENÝ SERVER"
+"SPOJENÍ"
+"BYTÙ"
+"POU®ITÝ ÈAS"
+"MILISEC"
+"PRÙMÌR"
+"Klesající pøístup (bytù)"
+"ID U®IVATELE"
+"ÈAS"
+"POØADÍ"
+"SOUBOR/OBDOBÍ"
+"DATUM VZNIKU"
+"U®IVATELÉ"
+"Tøídìní"
+"Pøehled o pou¾itých klientech pro Squid"
+"KLIENT"
+"CELKEM"
+"Generoval"
+"dne"
+"datum/èas"
+"IP/JMÉNO"
+"VÝSTUP"
+"VSTUP"
+"CACHE"
+"ServeryU¾ivatelé"
+"SmartFilter"
+"Authentication failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Dutch b/languages/Dutch
new file mode 100644 (file)
index 0000000..56b3acb
--- /dev/null
@@ -0,0 +1,130 @@
+# by Seth Mos <stimpy@stimpy.multiweb.nl> and Pieter Kooistra <pkooistra@hr.nl>
+"Ja"
+"Nee"
+"Dutch"
+"Optie"
+"argument nodig"
+"Init"
+"Access log bestand inlezen"
+"Kan het log bestand niet openen"
+"Kan het tijdelijke bestand niet openen"
+"Records gelezen"
+"geschreven"
+"Log heeft gemixte indeling (squid en algemeen log)"
+"Algemene log indeling"
+"Squid log indeling"
+"Log met ongeldige indeling"
+"Geen records gevonden"
+"Periode"
+"gebruiken"
+"als tijdelijke directory"
+"Sorteren bestand"
+"Eind"
+"Parameters"
+"Hostname of IP adres"
+"Datum van-tot"
+"Datum indeling"
+"Europa"
+"USA"
+"IP rapport"
+"Gebruik Ip Adres i.p.v. gebruikersnaam"
+"Bezochte site"
+"Tijd"
+"Gebruiker"
+"Squid versie"
+"Tijdelijke dir"
+"Debug berichten"
+"Process berichten"
+"Invoer log"
+"Uitvoer dir"
+"Gebruik"
+"opties"
+"Email adres om rapporten te zenden"
+"stdout voor console"
+"Rapporten per gebruiker en IP adres"
+"rapporten"
+"Kan bestand niet openen"
+"GEWEIGERD"
+"Succesvol rapport gegenereerd op"
+"Succesvol rapport gegenereerd en verzonden naar"
+"Bestand maken"
+"Periode bestand maken"
+"Bestand"
+"bestaat al, verplaatst naar"
+"index.html maken"
+"Sorteren bestand"
+"Rapport"
+"Squid is niet geinstalleerd op deze machine"
+"Alstublieft, gebruik -v optie om squid versie te"
+"Configuratie laden uit"
+"malloc error"
+"Laden password bestand uit"
+"Maken rapport"
+"Decomprimeren log bestand"
+"Comprimeren log bestand"
+"Bestand niet gevonden"
+"Opzoeken IP Adres"
+"Lezen useragent log"
+"Laden uiztondering bestand uit"
+"uitgezonderd"
+"Uitzondering bestand"
+"Configuratie bestand"
+"Useragent log"
+"Maken Useragent rapport"
+"versie"
+"limiet overschreden"
+"Toegevoegd aan bestand"
+"Converteer het access.log bestand naar een geldige datum"
+"Deel het log bestand per datum met -d parameter"
+"door"
+"omgekeerd"
+"normaal"
+"Verwijderen oude rapport bestand"
+"Verwijderen tijdelijke bestanden"
+"Top"
+"sites"
+"Weken"
+"Loading User table"
+"Cannot load. Memory fault"
+"Squid Gebruikers Toegangs Rapport"
+"Periode"
+"Gberuiker"
+"BEZOCHTE SITE"
+"VERBINDING"
+"BYTES"
+"GEBRUIKTE TIJD"
+"MILISEC"
+"GEMIDDELDE"
+"Verminderen Toegang (bytes)"
+"GEBRUIKERSID"
+"TIJD"
+"NUM"
+"BESTAND/PERIODE"
+"CREATIE DATUM"
+"GEBRUKERS"
+"Sorteer"
+"Squid Useragent's Rapport"
+"AGENT"
+"TOTAAL"
+"Gegenereerd door"
+"op"
+"DATUM/TIJD"
+"IP/NAAM"
+"UIT"
+"IN"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/English b/languages/English
new file mode 100644 (file)
index 0000000..9a9a82c
--- /dev/null
@@ -0,0 +1,130 @@
+# by Pedro Lineu Orso <orso@onda.com.br>
+"Yes"
+"No"
+"English"
+"Option"
+"require an argument"
+"Init"
+"Reading access log file"
+"Cannot open log file"
+"Cannot open temporary file"
+"Records read"
+"written"
+"Log with mixed records format (squid and common log)"
+"Common log format"
+"Squid log format"
+"Log with invalid format"
+"No records found"
+"Period"
+"using"
+"as temporary dir"
+"Sorting file"
+"End"
+"Parameters"
+"Hostname or IP address"
+"Date from-until"
+"Date format"
+"Europe"
+"USA"
+"IP report"
+"Use Ip Address instead of userid"
+"Accessed site"
+"Time"
+"User"
+"Squid version"
+"Temporary dir"
+"Debug messages"
+"Process messages"
+"Input log"
+"Output dir"
+"Usage"
+"options"
+"Email address to send reports"
+"stdout for console"
+"Reports by user and IP address"
+"reports"
+"Cannot open file"
+"DENIED"
+"Successful report generated on"
+"Successful report generated and sent to"
+"Making file"
+"Making period file"
+"File"
+"already exists, moved to"
+"Making index.html"
+"Sorting file"
+"Report"
+"Squid not installed on this machine"
+"Please, use -v option to set Squid version"
+"Loading configuration from"
+"malloc error"
+"Loading password file from"
+"Making report"
+"Decompressing log file"
+"Compressing log file"
+"File not found"
+"Resolve IP Address"
+"Reading useragent log"
+"Loading exclude file from"
+"excluded"
+"Exclude file"
+"Config file"
+"Useragent log"
+"Making Useragent report"
+"version"
+"limit exceeded"
+"Added to file"
+"Convert the access.log file to a legible date"
+"Split the log file by date in -d parameter"
+"by"
+"reverse"
+"normal"
+"Removing old report file"
+"Removing temporary files"
+"Top"
+"sites"
+"Sites & Users"
+"Loading User table"
+"Cannot load. Memory fault"
+"Squid User Access Report"
+"Period"
+"User"
+"ACCESSED SITE"
+"CONNECT"
+"BYTES"
+"ELAPSED TIME"
+"MILISEC"
+"AVERAGE"
+"Decreasing Access (bytes)"
+"USERID"
+"TIME"
+"NUM"
+"FILE/PERIOD"
+"CREATION DATE"
+"USERS"
+"Sort"
+"Squid Useragent's Report"
+"AGENT"
+"TOTAL"
+"Generated by"
+"on"
+"DATE/TIME"
+"IP/NAME"
+"OUT"
+"IN"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication Failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/French b/languages/French
new file mode 100644 (file)
index 0000000..5462c97
--- /dev/null
@@ -0,0 +1,130 @@
+# by Fred Pacquier <fredp@dial.oleane.com>
+"Oui"
+"Non"
+"Français"
+"Option"
+"requiert un argument"
+"Initialisation"
+"Lecture du journal des accès"
+"Impossible d'ouvrir le journal"
+"Impossible d'ouvrir le fichier temporaire"
+"Enregistrements lus"
+"écrits"
+"Le journal contient des enregistrements de plusieurs formats (squid et common log)"
+"Format habituel du journal"
+"Format Squid du journal"
+"Le format du journal est invalide"
+"Aucun enregistrement trouvé"
+"Période"
+"utilisation de"
+"comme répertoire temporaire"
+"Tri du fichier"
+"Fin"
+"Paramètres"
+"Nom de l'hôte ou adresse IP"
+"Date début-fin"
+"Format de date"
+"Europe"
+"USA"
+"Statistiques des adresses IP"
+"Utiliser l'adresse IP au lieu de l'identifiant utilisateur"
+"Site accédé"
+"Heure"
+"Utilisateur"
+"Version de Squid"
+"Répertoire temporaire"
+"Messages de débogage"
+"Messages des processus"
+"Journal d'entrée"
+"Répertoire de sortie"
+"Utilisation"
+"options"
+"Adresse e-mail destinataire des statistiques"
+"Sortie standard de la console"
+"Statistiques par utilisateurs et par adresses IP"
+"statistiques"
+"Impossible d'ouvrir le fichier"
+"REFUSÉ"
+"Statistiques générées sans erreur sur"
+"Statistiques générées sans erreur envoyées à"
+"Création du fichier"
+"Création du fichier de l'intervalle"
+"Le fichier"
+"existe déjà, déplacé vers"
+"Création du fichier index.html"
+"Tri du fichier"
+"Statistiques"
+"Squid n'est pas installé sur cette machine"
+"Merci d'utiliser l'option -v pour spécifier la version de Squid"
+"Chargement de la configuration depuis"
+"erreur d'allocation mémoire"
+"Chargement des mots de passe depuis"
+"Création des statistiques"
+"Decompression du journal"
+"Compression du journal"
+"Fichier introuvable"
+"Résolution des adresses IP"
+"Lecture du journal des agents utilisateurs"
+"Chargement des exclusions depuis"
+"exclus"
+"Fichier des exclusions"
+"Fichier de configuration"
+"Journal des agents utilisateurs"
+"Création des statistiques des agents utilisateurs"
+"version"
+"limite dépassée"
+"Ajouté au fichier"
+"Convertit les dates du journal access.log en un format lisible"
+"Produit un journal correspondant aux dates passées par -d (sur stdout)"
+"par"
+"descendant"
+"ascendant"
+"Supprime le fichier des anciennes statistiques"
+"Supprime les fichiers temporaires"
+"Les"
+"sites les plus accédés"
+"Semaines"
+"Loading User table"
+"Cannot load. Memory fault"
+"Statistiques des accès utilisateurs de Squid"
+"Période"
+"Utilisateur"
+"SITES ACCÉDÉS"
+"ACCÈS"
+"OCTETS"
+"DURÉE"
+"millisecondes"
+"MOYENNE"
+"Accès décroissant (en octets)"
+"IDENTIFIANT"
+"DURÉE"
+"NUMÉRO"
+"FICHIER/PÉRIODE"
+"DATE DE CRÉATION"
+"UTILISATEURS"
+"Tri"
+"Statistiques des agents utilisateurs Squid"
+"AGENT"
+"TOTAL"
+"Généré par"
+"le"
+"DATE/HEURE"
+"IP/NOM"
+"HORS"
+"DANS"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication Failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/German b/languages/German
new file mode 100644 (file)
index 0000000..1c29b59
--- /dev/null
@@ -0,0 +1,130 @@
+# by Andreas Piek <a.piesk@gmx.net>
+"Ja"
+"Nein"
+"German"
+"Option"
+"Argument benoetigt"
+"Init"
+"Lese Zugriffsprotokoll"
+"Kann Zugriffsprotokoll nicht oeffnen"
+"Kann temporaere Datei nicht oeffnen"
+"Datensaetze gelesen"
+"geschrieben"
+"Protokolle beinhaltet Datensaetze in verschiedenen Formaten (SQUID -und allgemeines Format)"
+"allgemeines Protokollformat"
+"Squid-Protokollformat"
+"Protokoll mit ungueltigem Format"
+"Keine Datensaetze gefunden"
+"Zeitraum"
+"benutze"
+"als temporaeres Verzeichnis"
+"Sortiere Datei"
+"Ende"
+"Parameter"
+"Rechnername oder IP-Adresse"
+"Datum von-bis"
+"Datumsformat"
+"Europa"
+"USA"
+"IP Bericht"
+"Benutze IP-Adresse anstatt User-ID"
+"zugegriffene Site"
+"Zeit"
+"Benutzer"
+"Squid Version"
+"temporaeres Verzeichnis"
+"Debug Nachrichten"
+"Verarbeite Nachrichten"
+"Eingabeprotokoll"
+"Ausgabeverzeichnis"
+"Benutzung"
+"Optionen"
+"Sende Reports an folgende Email-Adresse"
+"Standardausgabe an Konsole"
+"Berichte geordnet nach Benutzer und IP-Adresse"
+"Berichte"
+"Kann Datei nicht oeffnen"
+"ABGELEHNT"
+"Bericht erfolgreich erstellt in"
+"Bericht erfolgreich erstellt und gesendet an"
+"Erstelle Datei"
+"Erstelle Zeitraum-Datei"
+"Datei"
+"bereits vorhanden, wechsle zu"
+"Erstelle index.html"
+"Sortiere Datei"
+"Bericht"
+"Squid ist auf diesem Rechner nicht installiert"
+"Bitte Option -v zum Angeben der Squid-Version setzen"
+"Lade Konfiguration aus"
+"Speicherallokationsfehler"
+"Lade Passwortdatei aus"
+"Erstelle Bericht"
+"Dekomprimiere Protokolldatei"
+"Komprimiere Protokolldatei"
+"Datei nicht gefunden"
+"Loese IP-Adressen auf"
+"Lese UserAgent-Protokoll"
+"Lade Ausschlussdatei aus"
+"ausgeschlossen"
+"Ausschlussdatei"
+"Konfigurationsdatei"
+"UserAgent-Protokoll"
+"Erstelle UserAgent-Bericht"
+"Version"
+"Grenze erreicht"
+"Angehaengt an Datei"
+"Convert the access.log file to a legible date"
+"Split the log file by date in -d parameter"
+"by"
+"reverse"
+"normal"
+"Removing old report file"
+"Removing temporary files"
+"Top"
+"sites"
+"Wochen"
+"Loading User table"
+"Cannot load. Memory fault"
+"Squid Bericht ueber Benutzerzugriffe"
+"Zeitraum"
+"Benutzer"
+"ZUGEGRIFFENE SITE"
+"VERBINDUNGEN"
+"Bytes"
+"ZEITDAUER"
+"MILLISEKUNDEN"
+"DURCHSCHNITT"
+"verringerter Zugriff (Bytes)"
+"BENUTZERKENNUNG"
+"ZEIT"
+"NR."
+"DATEI/ZEITRAUM"
+"ERSTELLUNGSDATUM"
+"BENUTZER"
+"Sortierung"
+"Squid Bericht ueber die verwendeten Browser"
+"BROWSER"
+"INSGESAMT"
+"Erstellt mit"
+"am"
+"DATUM/ZEIT"
+"IP/NAME"
+"AUSGEHEND"
+"EINGEHEND"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication Failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Greek b/languages/Greek
new file mode 100644 (file)
index 0000000..f730702
--- /dev/null
@@ -0,0 +1,129 @@
+# Translation: Antonis Maglaras - email:vegos@magla.gr - http://www.magla.gr\r
+"Íáé"\r
+"¼÷é"\r
+"ÅëëçíéêÜ"\r
+"¢ëëï"\r
+"÷ñåéÜæåôáé Ýíá óôïé÷åßï"\r
+"Init"\r
+"ÁíÜãíùóç áñ÷åßïõ "\r
+"Äåí ìðïñþ íá äéáâÜóù ôï áñ÷åßï log"\r
+"Äåí ìðïñþ íá äéáâÜóù ôá ðñïóùñéíÜ áñ÷åßá"\r
+"ÅããñáöÝò áíáãíþóôçêáí"\r
+"Áðïèçêåýèçêáí"\r
+"Áñ÷åßï Log ìå äéÜöïñåò åããñáöÝò (squid êáé ãåíéêü log)"\r
+"Êïéíü áñ÷åßï log"\r
+"öïñìÜô ôïõ Squid log"\r
+"Áñ÷åßï Log ìå Üãíùóôç ìïñöÞ"\r
+"Äåí âñÝèçêáí åããñáöÝò"\r
+"Ðåñßïäïò"\r
+"÷ñÞóç"\r
+"ùò ðñïóùñéíïý êáôáëüãïõ"\r
+"Ôáîéíüìçóç áñ÷åßïõ"\r
+"ÔÝëïò"\r
+"ÐáñÜìåôñïé"\r
+"Hostname Þ äéåýèõíóç IP"\r
+"Çìåñïìçíßá áðü-ìÝ÷ñé"\r
+"ÌïñöÞ çìåñïìçíßáò"\r
+"Åõñþðç"\r
+"ÁìåñéêÞ"\r
+"ÊáôÜóôáóç IP"\r
+"×ñÞóç äéåýèõíóçò Ip áíôß ïíüìáôïò"\r
+"ÐñïóâÜóéìá sites"\r
+"×ñüíïò"\r
+"×ñÞóôçò"\r
+"¸êäïóç Squid"\r
+"Ðñïóùñéíüò öÜêåëëïò"\r
+"Ìçíýìáôá Debug"\r
+"Ìçíýìáôá Process"\r
+"Áñ÷åßï åéóüäïõ"\r
+"ÖÜêåëëïò åîüäïõ"\r
+"×ñÞóç"\r
+"åðéëïãÝò"\r
+"Äéåýèõíóç Email ãéá áðïóôïëÞ áíáöïñþí"\r
+"stdout ãéá êïíóüëá"\r
+"ÁíáöïñÝò áíÜ ÷ñÞóôç êáé IP äéåýèõíóç"\r
+"áíáöïñÝò"\r
+"Äåí ìðïñþ íá äéáâÜóù ôï áñ÷åßï"\r
+"×ùñßò ðñüóâáóç"\r
+"Ïé áíáöïñÝò äçìéïõñãÞèçêáí åðéôõ÷þò óôéò"\r
+"Ïé áíáöïñÝò äçìéïõñãÞèçêáí åðéôõ÷þò êáé óôÜëèçêáí óå"\r
+"Äçìéïõñãßá áñ÷åßïõ"\r
+"Äçìéïõñãßá áñ÷åßïõ ðåñéüäïõ"\r
+"Áñ÷åßï"\r
+"õðÜñ÷åé Þäç, ìåôáêéíÞèçêå óå"\r
+"Äçìéïõñãßá áñ÷åßïõ index.html"\r
+"Ôáîéíüìçóç áñ÷åßïõ"\r
+"ÁíáöïñÜ"\r
+"Ôï Squid äåí õðÜñ÷åé óôïí õðïëïãéóôÞ"\r
+"Ðáñáêáëþ, ÷ñçóéìïðïéÞóôå ôçí åðéëïãÞ -v ãéá íá ïñßóåôå ôçí Ýêäïóç ôïõ Squid"\r
+"Öüñôùìá áñ÷åßïõ ñõèìßóåùí"\r
+"óöÜëìá ìíÞìçò"\r
+"Öüñôùìá áñ÷åßïõ êùäéêþí áðü"\r
+"Äçìéïõñãßá áíáöïñþí"\r
+"Áðïóõìðßåóç áñ÷åßïõ log"\r
+"Óõìðßåóç áñ÷åßïõ log"\r
+"Ôï áñ÷åßï äåí âñÝèçêå"\r
+"Áíôéóôïß÷éóç äéåõèýíóçò IP"\r
+"ÁíÜãíùóç áñ÷åßïõ useragent log"\r
+"Öüñôùóç áñ÷åßïõ åîáéñÝóåùí áðü"\r
+"åîáéñÝèçêáí"\r
+"Áñ÷åßï åîáéñÝóåùí"\r
+"Áñ÷åßï ñõèìßóåùí"\r
+"Áñ÷åßï Useragent log"\r
+"Äçìéïõñãßá áíáöïñþí Useragent"\r
+"Ýêäïóç"\r
+"ôï üñéï åîáíôëÞèçêå"\r
+"ÐñïóôÝèçêáí óôï áñ÷åßï"\r
+"ÌåôáôñïðÞ ôïõ áñ÷åßïõ access.log óå çìåñïìçíßá"\r
+"Äéá÷ùñéóìüò ôïõ áñ÷åßïõ log âÜóç çìåñïìçíßáò ìå ôçí -d ðáñÜìåôñï"\r
+"áðü"\r
+"áíÜðïäá"\r
+"êáíïíéêÜ"\r
+"Áöáßñåóç ðáëéïý áñ÷åßïõ áíáöïñþí"\r
+"Áöáßñåóç ðñïóùñéíþí áñ÷åßùí"\r
+"Top"\r
+"sites"\r
+"Óåëßäåò & ×ñÞóôåò"\r
+"Öüñôùóç ðßíáêá ÷ñçóôþí"\r
+"Äåí ìðïñþ íá äéáâÜóù. Ðñüâëçìá ìíÞìçò"\r
+"ÁíáëõôéêÞ êáôÜóôáóç ðñüóâáóçò ÷ñçóôþí ôïõ Proxy Server"\r
+"Ðåñßïäïò"\r
+"×ñÞóôçò"\r
+"Óåëßäá ðïõ æçôÞèçêå"\r
+"Óýíäåóç"\r
+"Bytes"\r
+"×ñüíïò"\r
+"msec"\r
+"ÌÝóïò üñïò"\r
+"ÌåéùìÝíç ðñüóâáóç (bytes)"\r
+"¼íïìá ÷ñÞóôç"\r
+"×ñüíïò"\r
+"Áñéèìüò"\r
+"Ðåñßïäïò (áðü/Ýùò)"\r
+"Çì/íßá Äçìéïõñãßáò"\r
+"×ñÞóôåò"\r
+"Ôáîéíüìçóç"\r
+"ÊáôÜóôáóç ÷ñçóôþí Proxy"\r
+"ÐñÜêôïñáò"\r
+"Óýíïëï"\r
+"ÄçìéïõñãÞèçêå áðü"\r
+"óôéò"\r
+"Çì/íßá-¿ñá "\r
+"IP/¼íïìá"\r
+"¸îù"\r
+"ÌÝóá"\r
+"Cache"\r
+"×ñÞóôåò"\r
+"¸îõðíï ößëôñï"\r
+"Ðñüâëçìá ðéóôïðïßçóçò"\r
+"Ìç åðéôñåðôÞ ðñüóâáóç"\r
+"Óåëßäåò ðïõ æçôÞèçêáí ðåñéóóüôåñï"\r
+"SQUIDGUARD"\r
+"Êáíüíåò"\r
+"squidGuard"\r
+"Ôï áñ÷åßï log ôïõ Sarg áðïèçêåýèçêå ùò"\r
+"ÖïñìÜô ôïõ Sarg log"\r
+"ËçöèÝíôá áñ÷åßá"\r
+"Ãñáöéêü"\r
+"ÇìÝñåò"\r
+"ÇìÝñåò"
\ No newline at end of file
diff --git a/languages/Hungarian b/languages/Hungarian
new file mode 100644 (file)
index 0000000..7fb7577
--- /dev/null
@@ -0,0 +1,130 @@
+# by Csaba Kabai <ckabai@icnpharm.com>
+"Igen"
+"Nem"
+"Hungarian"
+"Opciók"
+"paraméter szükséges"
+"Inicializálás"
+"Access log file olvasása"
+"Nem tudom megnyitni a log file-t"
+"Nem tudom megnyitni az ideiglenes file-t"
+"Rekord olvasva"
+"írva"
+"A log-ban keverednek a rekordformátumok (squid es közös log)"
+"Közös log formátum"
+"Squid log formátum"
+"Log érvénytelen formátummal"
+"Nem található rekord"
+"Periódus"
+"használva"
+"mint ideiglenes könyvtár"
+"A file rendezés alatt"
+"Vége"
+"Paraméterek"
+"Hosztnév vagy IP cím"
+"Dátum tól-ig"
+"Dátum formátum"
+"Európa"
+"USA"
+"IP kimutatás"
+"IP cimet használ userid helyett"
+"Meglátogatott hely"
+"Idõ"
+"Felhasználó"
+"Squid verzió"
+"Ideiglenes könyvtár"
+"Debug üzenet"
+"Processz üzenet"
+"Input log"
+"Output könyvtár"
+"Használat:"
+"opciók"
+"Email cím a kimutatás küldésére"
+"stdout a konzolra"
+"Kimutatás felhasználó és IP cím alapján"
+"kimutatások"
+"Megnyithatatlan file"
+"TILTOTT"
+"Sikeres kimutatás generálva:"
+"Sikeres kimutatás generálva és elküldve:"
+"File keszítés"
+"Periódus file készítés"
+"File"
+"letezik, átmozgatva"
+"Készítés alatt: index.html"
+"Rendezés"
+"Kimutatás"
+"A Squid nincs installálva ezen a gépen"
+"Kérlek, használd a -v opciót a Squid verzió beállításához"
+"Konfiguráció betöltése a"
+"malloc hiba"
+"Jelszó file betöltése a"
+"Kimutatás készítése"
+"Log file bontása"
+"Log file tömörítése"
+"File nem található"
+"IP cím visszafejtése"
+"Felhasználói agent log olvasása"
+"Kizaró file beolvasása a"
+"Kizárva"
+"Kizáró file"
+"Konfigurációs file"
+"Useragent log"
+"Useragent kimutatás készítése"
+"verzió"
+"limit exceeded"
+"Added to file"
+"Convert the access.log file to a legible date"
+"Split the log file by date in -d parameter"
+"by"
+"reverse"
+"normal"
+"Removing old report file"
+"Removing temporary files"
+"Top"
+"sites"
+"hét"
+"Loading User table"
+"Cannot load. Memory fault"
+"Squid Felhasználók szerinti kimutatás"
+"Periódus"
+"Felhasználó"
+"MEGLÁTOGATOTT HELY"
+"KAPCSOLAT"
+"BYTE-ok"
+"ELTÖLTÖTT IDÕ"
+"MILISEC"
+"ÁTLAG"
+"Elérés csökkentve (byte-al)"
+"FELHASZNÁLÓ"
+"IDÕ"
+"Sorszám"
+"FILE/PERIÓDUS"
+"KÉSZÍTÉS DÁTUMA"
+"FELHASZNÁLÓK"
+"Sorrend"
+"Squid Felhasználói kimutatás"
+"AGENT"
+"ÖSSZESEN"
+"Készítette:"
+"idõ:"
+"dátum/idõ"
+"IP/NÉV"
+"OUT"
+"IN"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication Failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Indonesian b/languages/Indonesian
new file mode 100644 (file)
index 0000000..b3ccf25
--- /dev/null
@@ -0,0 +1,130 @@
+# by V Gatut Harijiso <gatut@student.unpar.ac.id>
+"Ya"
+"Ndak"
+"Indonesiain"
+"Pilihan"
+"butuh argumen"
+"Awal"
+"Membaca file log akses"
+"Tak bisa buka file log"
+"Tak bisa buka file sementara"
+"Record dibaca"
+"ditulis"
+"Log mengandung format campuran (squid dan log umum/common)"
+"Format log common"
+"Format log Squid"
+"Log dengan format yang salah"
+"Tidak ada record yang dicari"
+"Periode"
+"menggunakan"
+"sebagai dir sementara"
+"mengurutkan file"
+"Selesai"
+"Parameter"
+"Alamat nama host or IP"
+"Tanggal dari-sampai"
+"Format tanggal"
+"Eropa"
+"USA"
+"Laporan IP"
+"Menggunakan Alamat Ip daripada userid"
+"Situs diakses"
+"Waktu"
+"User"
+"Versi Squid"
+"Dir sementara"
+"Pesan Debug"
+"Pesan process"
+"Log input"
+"Dir output"
+"Penggunaan"
+"opsi"
+"Alamat email penerima laporan"
+"stdout untuk console"
+"Laporan berdasar user dan alamat IP"
+"laporan"
+"Tak bisa buka file"
+"DITOLAK"
+"Berhasil melaporkan pada"
+"Berhasil melaporkan dan dikirim ke"
+"Membuat file"
+"Membuat laporan periodik"
+"File"
+"Sudah ada, dipindahkan ke"
+"Membuat index.html"
+"Mengurutkan file"
+"Laporan"
+"Squid tidak diinstall di mesin ini"
+"Mohon, gunakan opsi -v untuk menentukan versi Squid"
+"Menyertakan konfigurasi dari"
+"kesalahan malloc"
+"Menyertakan file password dari"
+"Membuat laporan"
+"Membongkar file log"
+"Mengkompres file log"
+"File tidak ditemukan"
+"Mengartikan Alamat IP"
+"Membaca log useragent"
+"Menyertakan file exclude dari"
+"tidak disertakan"
+"File exclude"
+"File konfig"
+"Log useragent"
+"Membuat laporan useragent"
+"versi"
+"batasan terlampaui"
+"Ditambahkan ke file"
+"Mengkonversi file access.log ke tanggal yang dipahami"
+"Membagi file log berdasarkan tanggal dalam parameter -d"
+"oleh"
+"terbalik"
+"normal"
+"Membuang file laporan lama"
+"Membuang file sementara"
+"Tertinggi"
+"situs"
+"Mingguan"
+"Loading User table"
+"Cannot load. Memory fault"
+"Laporan Akses Pemakai Squid"
+"Periode"
+"Pemakai"
+"SITUS DIAKSES"
+"MENGHUBUNGI"
+"BYTES"
+"WAKTU TERPAKAI"
+"MILIDETIK"
+"RATA-RATA"
+"Menurunkan Akses (bytes)"
+"USERID"
+"WAKTU"
+"NO."
+"FILE/PERIOD"
+"TANGGAL PEMBUATAN"
+"PEMAKAI"
+"Urut"
+"Laporan Useragent Squid"
+"AGEN"
+"TOTAL"
+"Dibuat oleh"
+"pada"
+"TANGGAL/WAKTU"
+"IP/NAMA"
+"OUT"
+"IN"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication Failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Italian b/languages/Italian
new file mode 100644 (file)
index 0000000..3fc801c
--- /dev/null
@@ -0,0 +1,130 @@
+# by Matteo Colombo <matteo@calcol.it>
+"Si" 
+"No"
+"Italian"
+"Opzione" 
+"richide un argomento" 
+"Inizializzazione" 
+"Lettura access log file" 
+"Non riesco a aprire il log file" 
+"Non riesco a aprire il file temporaneo" 
+"Records letti" 
+"scritto" 
+"Formato dei log misto (squid and common log)" 
+"Formato Common log" 
+"Formato Squid log" 
+"Formato invalido dei Log" 
+"Nessun records trovato." 
+"Periodo" 
+"utilizzare" 
+"come directory temporanea" 
+"Sto Ordinando il file" 
+"Fine" 
+"Parametri" 
+"Hostname o indirizzo IP" 
+"Data from-until" 
+"Formato della Data" 
+"Europa" 
+"USA" 
+"Rapporto IP" 
+"Usa l'indirizzo Ip invece della userid" 
+"Accessed site" 
+"Tempo" 
+"Utente" 
+"Squid versione" 
+"Directory Temporanea" 
+"Messaggi di Debug" 
+"Messaggi di Processo" 
+"Input log" 
+"Directory di destinazione" 
+"Usa" 
+"opzioni" 
+"Repporto spedito all'indirizzo Email" 
+"stdout per console" 
+"Rapporto di user e IP address" 
+"rapporti" 
+"Non riesco ad aprire il file" 
+"NEGATO" 
+"Rapporto generato con successo in" 
+"Rapporto generato e spedito con successo in" 
+"Creazione del file" 
+"Creazione del file del periodo" 
+"File" 
+"esiste gia', spostato in" 
+"Creazione index.html" 
+"Sto Ordinano il file" 
+"Rapporto" 
+"Squid non e' installato su questa macchina" 
+"Prego, usare l'opzione -v per settare la vesione dello Squid" 
+"Caricamento della configurazione da" 
+"malloc error" 
+"Caricamento del file delle password da" 
+"Creazione rapporto" 
+"Decompressione file di log" 
+"Compressione file di log" 
+"File non trovato" 
+"Risoluzione IP Address" 
+"Lettura useragent log" 
+"Caricamento exclude file da" 
+"esclusi" 
+"File Exclude" 
+"File di Configurazione" 
+"Useragent log" 
+"Creazione rapporto Useragent" 
+"versione"
+"limit exceeded"
+"Added to file"
+"Convert the access.log file to a legible date"
+"Split the log file by date in -d parameter"
+"by"
+"reverse"
+"normal"
+"Removing old report file"
+"Removing temporary files"
+"Top"
+"sites"
+"Sites & Users"
+"Loading User table"
+"Cannot load. Memory fault"
+"Squid - Rapporto Accessi per Utenti" 
+"Periodo" 
+"Utente" 
+"SITI VISITATI" 
+"CONNESSIONI" 
+"BYTES" 
+"TIME UTIL" 
+"MILISEC" 
+"MEDIA" 
+"Accesso Descrescente (bytes)" 
+"USERID" 
+"TEMPO" 
+"NUM" 
+"FILE/PERIODO" 
+"DATA DI CREAZIONE" 
+"UTENTI" 
+"Ordinato per" 
+"Squid - Rapporto Useragent" 
+"AGENTE" 
+"TOTALE" 
+"Generato da" 
+"il" 
+"DATA/TEMPO" 
+"IP/NOME" 
+"OUT"
+"IN"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication Failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Japanese b/languages/Japanese
new file mode 100644 (file)
index 0000000..01ca1dd
--- /dev/null
@@ -0,0 +1,130 @@
+# by Akira Kitamura <click@anet.ne.jp>
+"Yes"
+"No"
+"Japanese"
+"¥ª¥×¥·¥ç¥ó"
+"require an argument"
+"Init"
+"¥¢¥¯¥»¥¹¥í¥°¥Õ¥¡¥¤¥ë¤òÆÉ¤ó¤Ç¤¤¤Þ¤¹"
+"¥í¥°¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤­¤Þ¤»¤ó"
+"¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤­¤Þ¤»¤ó"
+"¥ì¥³¡¼¥É¤òÆÉ¤ó¤Ç¤¤¤Þ¤¹"
+"½ñ¹þ¤ßÃæ"
+"¥í¥°¥Õ¥©¡¼¥Þ¥Ã¥È¤¬º®ºß¤·¤Æ¤¤¤Þ¤¹ (squid and common log)"
+"Common ¥í¥°¥Õ¥©¡¼¥Þ¥Ã¥È"
+"Squid ¥í¥°¥Õ¥©¡¼¥Þ¥Ã¥È"
+"̵¸ú¤Ê¥í¥°¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¤¹"
+"¥ì¥³¡¼¥É¤¬¤¢¤ê¤Þ¤»¤ó"
+"½¸·×´ü´Ö"
+"»ÈÍÑ"
+"¥Æ¥ó¥Ý¥é¥ê¥Ç¥£¥ì¥¯¥È¥ê"
+"¥Õ¥¡¥¤¥ë¤òSort"
+"½ªÎ»"
+"¥Ñ¥é¥á¡¼¥¿"
+"¥Û¥¹¥È̾Ëô¤ÏIP¥¢¥É¥ì¥¹"
+"ÆüÉÕ from-until"
+"ÆüÉÕ¥Õ¥©¡¼¥Þ¥Ã¥È"
+"¥è¡¼¥í¥Ã¥Ñ"
+"¥¢¥á¥ê¥«"
+"IP ¥ì¥Ý¡¼¥È"
+"¥æ¡¼¥¶ID¤ÎÂå¤ï¤ê¤ËIP¥¢¥É¥ì¥¹¤ò»ÈÍѤ¹¤ë"
+"¥¢¥¯¥»¥¹À襵¥¤¥È"
+"»þ´Ö"
+"¥æ¡¼¥¶"
+"Squid ¥Ð¡¼¥¸¥ç¥ó"
+"¥Æ¥ó¥Ý¥é¥ê ¥Ç¥£¥ì¥¯¥È¥ê"
+"¥Ç¥Ð¥Ã¥°¥á¥Ã¥»¡¼¥¸"
+"¥×¥í¥»¥¹¥á¥Ã¥»¡¼¥¸"
+"ÆþÎÏ ¥í¥°¥Õ¥¡¥¤¥ë"
+"½ÐÎÏÀè¥Ç¥£¥ì¥¯¥È¥ê"
+"»È¤¤Êý"
+"¥ª¥×¥·¥ç¥ó"
+"¥ì¥Ý¡¼¥È¤òÁ÷¤ëE-Mail¥¢¥É¥ì¥¹"
+"stdout for console"
+"¥æ¡¼¥¶¡¦IP¥¢¥É¥ì¥¹¤Ë¤è¤ë¥ì¥Ý¡¼¥È"
+"¥ì¥Ý¡¼¥È"
+"¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤­¤Þ¤»¤ó"
+"µñÈÝ"
+"ºîÀ®´°Î»¡£°Ê²¼¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥ì¥Ý¡¼¥È¤¬ºîÀ®¤µ¤ì¤Þ¤·¤¿"
+"¥ì¥Ý¡¼¥È¤ÎºîÀ®¤¬´°Î»¤·¥á¡¼¥ë¤ò°Ê²¼°¸¤ËÁ÷¿®¤·¤Þ¤·¤¿"
+"Making file"
+"½¸·×´ü´Ö¥Õ¥¡¥¤¥ë¤òºîÀ®"
+"¥Õ¥¡¥¤¥ë"
+"´û¤Ë¸ºß¤·¤Þ¤¹, °Ê²¼¤Ë°Üư¤·¤Þ¤·¤¿"
+"index.html¤òºîÀ®"
+"¥Õ¥¡¥¤¥ë¤òSort"
+"¥ì¥Ý¡¼¥È"
+"¤³¤Î¥Þ¥·¥ó¤Ë¤ÏSquid¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Þ¤»¤ó"
+"Squid¤Î¥Ð¡¼¥¸¥ç¥ó¤ò»ØÄꤹ¤ë¤Ë¤Ï -v ¥ª¥×¥·¥ç¥ó¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤"
+"°Ê²¼¤«¤éÀßÄê¥Õ¥¡¥¤¥ë¤òÆÉ¤ß¹þ¤ß¤Þ¤¹"
+"malloc error"
+"°Ê²¼¤«¤é¥Ñ¥¹¥ï¡¼¥É¥Õ¥¡¥¤¥ë¤òÆÉ¤ß¹þ¤ß¤Þ¤¹"
+"¥ì¥Ý¡¼¥È¤òºîÀ®"
+"¥í¥°¥Õ¥¡¥¤¥ë¤ò²òÅà"
+"¥í¥°¥Õ¥¡¥¤¥ë¤ò°µ½Ì"
+"¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó"
+"¥Û¥¹¥È̾²ò·è"
+"¥æ¡¼¥¶¥¨¡¼¥¸¥§¥ó¥È¥í¥°¤òÆÉ¤ó¤Ç¤¤¤Þ¤¹"
+"°Ê²¼¤«¤éÇÓ½ü¤¹¤ë¥Õ¥¡¥¤¥ë¤òÆÉ¤ß¹þ¤ó¤Ç¤¤¤Þ¤¹"
+"ÇÓ½ü"
+"ÇÓ½ü¤¹¤ë¥Õ¥¡¥¤¥ë"
+"ÀßÄê¥Õ¥¡¥¤¥ë"
+"¥æ¡¼¥¶¥¨¡¼¥¸¥§¥ó¥È¥í¥°"
+"Abuse ¥ì¥Ý¡¼¥È"
+"¥æ¡¼¥¶¥¨¡¼¥¸¥§¥ó¥È¥ì¥Ý¡¼¥È¤òºîÀ®"
+"Making Abuse report"
+"¥Ð¡¼¥¸¥ç¥ó"
+"¥ê¥ß¥Ã¥È¤ò¥ª¡¼¥Ð¡¼"
+"¥Õ¥¡¥¤¥ë¤òÄɲÃ"
+"¥¢¥¯¥»¥¹¥í¥°¥Õ¥¡¥¤¥ë¤òÆÉ¤ß¤ä¤¹¤¤»þ´Ö¤ËÊÑ´¹"
+"-d ¥Ñ¥é¥á¡¼¥¿¤Ç»þ´Ö¤Ç¥í¥°¥Õ¥¡¥¤¥ë¤òʬ³ä¤·¤Þ¤¹"
+"by"
+"reverse"
+"normal"
+"¸Å¤¤¥ì¥Ý¡¼¥È¤òºï½ü"
+"¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤òºï½ü"
+"¥È¥Ã¥×"
+"¥µ¥¤¥È"
+"Sites & Users"
+"Loading User table"
+"Cannot load. Memory fault"
+"Squid¥æ¡¼¥¶¥¢¥¯¥»¥¹¥ì¥Ý¡¼¥È"
+"´ü´Ö"
+"¥æ¡¼¥¶"
+"¥¢¥¯¥»¥¹À襵¥¤¥È"
+"Àܳ"
+"¥Ð¥¤¥È¿ô"
+"»ÈÍÑ»þ´Ö"
+"¥ß¥êÉÃ"
+"Ê¿¶Ñ"
+"¸º¾¯¤·¤Æ¤¤¤ë¥¢¥¯¥»¥¹ (bytes)"
+"¥æ¡¼¥¶ID"
+"»þ´Ö"
+"¥Ê¥ó¥Ð¡¼"
+"¥Õ¥¡¥¤¥ë/´ü´Ö"
+"¥ì¥Ý¡¼¥ÈºîÀ®Æü»þ"
+"¥æ¡¼¥¶"
+"Sort"
+"Squid¥æ¡¼¥¶¥¨¡¼¥¸¥§¥ó¥È¥ì¥Ý¡¼¥È"
+"¥¨¡¼¥¸¥§¥ó¥È"
+"¹ç·×"
+"¤³¤Î¥ì¥Ý¡¼¥È¤Ï°Ê²¼¤Î¥×¥í¥°¥é¥à¤Ë¤è¤Ã¤ÆºîÀ®¤µ¤ì¤Þ¤·¤¿"
+"on"
+"Æü/»þ´Ö"
+"IP/NAME"
+"Squid Abuse Report"
+"OUT"
+"IN"
+"¥­¥ã¥Ã¥·¥å"
+"¥æ¡¼¥¶/¥µ¥¤¥È"
+"¥¹¥Þ¡¼¥È¥Õ¥£¥ë¥¿¡¼"
+"Authentication failures"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Latvian b/languages/Latvian
new file mode 100644 (file)
index 0000000..e0af463
--- /dev/null
@@ -0,0 +1,130 @@
+# by Juris Valdovskis <juris@auce.lv>
+"Jâ"
+"Nç"
+"Latvieðu"
+"Opcija"
+"nepiecieðams arguments"
+"Init"
+"Lasu access log failu"
+"Nevar atvçrt log failu"
+"Nevar atvçrt pagaidu failu"
+"Ieraksti nolasîti"
+"ierakstîti"
+"Log fails ar daþâda formâta ierakstiem"
+"Pamata log formâts"
+"Squid log formâts"
+"Nepareizs log formâts"
+"Ieraksti nav atrasti"
+"Periods"
+"lietojot"
+"kâ pagaidu direktoriju"
+"Kârtoju failu"
+"Beigas"
+"Parameteri"
+"Datora vârds vai IP adrese"
+"Datums no-lîdz"
+"Datuma formâts"
+"Europa"
+"USA"
+"IP atskaite"
+"Lietot IP adresi lietotâja vietâ"
+"Apmeklçtâ adrese"
+"Laiks"
+"Lietotâjs"
+"Squid versija"
+"Pagaidu direktorijs"
+"Izpildes ziòojumi"
+"Darbîbas ziòojumi"
+"Ievades log fails"
+"Izvades direktorijs"
+"Izmantots"
+"opcijas"
+"E-pasta adrese, kur nosûtît atskaiti"
+"stdout konsolei"
+"Atskaite kârtojot pçc lietotâja un IP adreses"
+"atskaites"
+"Nevar atvçrt failu"
+"AZLIEGTS"
+"Atskaite veiksmîgi izveidota uz"
+"Atskaite veiksmîgi izveidota un nosûtîta uz"
+"Taisu failu"
+"Taisu perioda failu"
+"Fails"
+"jau eksistç, pârceïu uz"
+"Veidoju index.html"
+"Kârtoju failu"
+"Atskaite"
+"Squid nav instalçts"
+"Lûdzu izmantojiet -v, lai noteiktu Squid versiju"
+"Ielâdçju konfigurâciju no"
+"malloc kïûda"
+"Ielâdçju paroïu failu no"
+"Taisu atskaiti"
+"Dekompresçju log failu"
+"Kompresçju log failu"
+"Fails nav atrasts"
+"Nosaku IP adresi"
+"Lasu useragent log failu"
+"Ielâdçju izòçmumu failu no"
+"izòçmums"
+"Izòemot failu"
+"Konfigurâcijas fails"
+"Useragent log fails"
+"Veidoju Useragent atskaiti"
+"versija"
+"limits beidzies"
+"Pievienots failam"
+"Konvertç access.log uz datumiem"
+"Sadali log failu ar  -d parametru"
+"ar"
+"apgriezti"
+"normâls"
+"Dzçðu vecos atskaiðu failus"
+"Dzçðu pagaidu failus"
+"Top"
+"saites"
+"Saites & Lietotâji"
+"Ielâdçju lietotâju tabulu"
+"Nevar ielâdçt. Atmiòas kïûda"
+"Squid lietotâju atskaite"
+"Periods"
+"Lietotâjs"
+"Apmeklçtâs lapas"
+"Pievienot"
+"Baiti"
+"Izmantotais laiks"
+"MILISEC"
+"Vidçji"
+"Samazinoði apmeklçts (baiti)"
+"Lietotâjs"
+"Laiks"
+"Nummurs"
+"Fails/Periods"
+"Izveides datums"
+"Lietotâji"
+"Sakârtot"
+"Squid Useragent's atskaite"
+"AGENT"
+"PAVISAM"
+"Ìenerçts ar"
+"uz"
+"Datums/Laiks"
+"IP/Vârds"
+"Ârâ"
+"Iekðâ"
+"Keðs"
+"Lietotâju saites"
+"Gudrais filtrs"
+"Autorizçðanâs kïûdas"
+"Aizliegts"
+"Topsaites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Polish b/languages/Polish
new file mode 100644 (file)
index 0000000..d097372
--- /dev/null
@@ -0,0 +1,130 @@
+# by Wszebor Boksa <boksa@koncept.pl>
+"Tak"
+"Nie"
+"Polski"
+"Opcje"
+"wymagany argument"
+"Inicjalizacja"
+"Czytam plik access log"
+"Nie mo¿na otworzyæ pliku logowania"
+"Nie mo¿na otworzyæ pliku przej\9cciowego"
+"Zapisy przeczytane"
+"zapisane"
+"Loguj z mieszanym formatem zapisu (squid i common log)"
+"Format logowania wspólny"
+"Format logowania Squid'a"
+"Loguj z nieprawid³owym formatem"
+"Nie znaleziono danych"
+"Przedzia³ czasowy"
+"u¿ywam"
+"jako katalog przej\9cciowy"
+"Sortuje plik"
+"Koniec"
+"Parametry"
+"Nazwa Host'a lub adres IP"
+"Data od-do"
+"Format daty"
+"Europa"
+"USA"
+"Raport IP"
+"U¿yj adresu IP zamiast USERID"
+"Odwiedzane serwisy WWW"
+"Czas"
+"U¿ytk."
+"Wersja Squid'a"
+"Katalog przej\9cciowy"
+"Komunikaty debugowania"
+"Przetwarzanie komunikatów"
+"Plik logowanie wej\9cciowy"
+"Katalog wynikowy"
+"U¿ytkowanie"
+"opcje"
+"Adres E-mail do wysy³ki raportów"
+"standardowe wyj\9ccie dla konsoli"
+"Raportuj wg. U¿ytk. i adresu IP"
+"raporty"
+"Nie mo¿na otworzyæ pliku"
+"ZABRONIONY"
+"Raport pomy\9clnie wygenerowany..."
+"Raport pomy\9clnie wygenerowany i wys³any do"
+"Tworzenie pliku"
+"Tworzenie pliku przedzia³u"
+"Plik"
+"ju¿ istnieje, przeniesiony do"
+"Tworzenie pliku index.html"
+"Sortowanie pliku"
+"Raport"
+"Uwaga! Squid nie jest zainstalowany na tym komputerze"
+"Proszê, u¿yæ parametru -v by ustawiæ wersje Squid'a"
+"£adujê konfiguracje z"
+"B³¹d malloc"
+"£adujê plik hase³ z"
+"Tworzenie raportu"
+"Dekompresja pliku logowania"
+"Kompresja pliku logowania"
+"Plik nie zosta³ znaleziony!"
+"Rozwi¹zujê adres IP"
+"Czytam plik logowania useragent"
+"Czytam plik wykluczenia z"
+"wykluczone"
+"Plik wykluczenia"
+"Plik konfiguracji"
+"Plik logowania agentów u¿ytkownika"
+"Tworzê raport agentów u¿ytkownika"
+"wersja"
+"przekroczony limit"
+"Dodane do pliku"
+"Konwertuj plik access.log do czytelnej daty"
+"Rozdziel plik logowania na datê z parametrem -d"
+"przez"
+"odwrotny"
+"standardowy"
+"Usuniecie pliku starego raportu"
+"Usuniecie plików przej\9cciowych"
+"Góra"
+"serwisy"
+"Serwisy & U¿ytkownicy"
+"£adujê tabele U¿ytkowników"
+"Nie mo¿na za³adowaæ. Pamiêæ RAM przepe³nion¹"
+"Raport dostêpu U¿ytkowników do serwera Squid"
+"Przedzia³ czasowy"
+"U¿ytkownik"
+"ODWIEDZONE SERWISY"
+"PO£¥CZENIA"
+"Bajt."
+"CZAS U¯YTKOWANIA"
+"MILISEK"
+"\8cREDNIA"
+"Zmniejszenie dostêpu (bajtów)"
+"ID U¿ytk."
+"CZAS"
+"Nr"
+"PLIK/PRZEDZ."
+"DATA UTWORZ."
+"U¯YT."
+"Sortowanie"
+"Raport SQUID'a - agentów U¿ytkowników"
+"AGENT"
+"SUMA"
+"Wygenerowany przez"
+"o"
+"DATA/CZAS"
+"IP/NAZWA"
+"Wyj"
+"Wyj"
+"CACHE"
+"Serwisy/U¿ytkownicy"
+"Szybki Filtr"
+"Autentykacja nie powiod³a siê!"
+"Zabroniony"
+"G³ówne Serwisy"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Portuguese b/languages/Portuguese
new file mode 100644 (file)
index 0000000..4aa2217
--- /dev/null
@@ -0,0 +1,130 @@
+# by Pedro Lineu Orso <orso@onda.com.br>
+"Sim"
+"Nao"
+"Portuguese"
+"Opcao"
+"requer um argumento"
+"Inicio"
+"Lendo arquivo acccess.log"
+"Erro no open do arquivo log"
+"Erro no open do arquivo temporario"
+"Registros lidos"
+"gravados"
+"Log com registros mistos (squid e common log)"
+"Log em format Common"
+"Log em formato Squid"
+"Log com formato invalido"
+"Nao ha registros"
+"Periodo"
+"usando"
+"como diretorio temporario"
+"Classificando arquivo"
+"Fim"
+"Parametros"
+"Hostname ou endereco IP"
+"Data de-ate"
+"Formato da data"
+"Europa"
+"EUA"
+"Relatorio por IP"
+"Utiliza endereco IP como usuario"
+"Site acessado"
+"Hora"
+"Usuario"
+"Squid versão"
+"Diretorio para temporario"
+"Mensagens de debug"
+"Mensagens do processo"
+"Log de entrada"
+"Diretorio de saida"
+"Uso"
+"opcoes"
+"Endereço email para envio do relatorio"
+"stdout para saida na console"
+"Relatorios por usuario e por endereço IP"
+"relatorios"
+"Erro no open do arquivo"
+"NEGADO"
+"Relatorio gerado com sucesso em"
+"Relatorio gerado com sucesso e enviado para"
+"Criando arquivo"
+"Criando arquivo periodo"
+"Arquivo"
+"ja existe, movido para"
+"Gerando index.html"
+"Classificando"
+"Relatorio"
+"Squid nao instalado neste servidor."
+"Por favor, use a opçao -v para informar a versão do Squid."
+"Obtendo parametros do arquivo"
+"erro no malloc"
+"Carregando arquivo de senhas"
+"Gerando relatorio"
+"Descompactando arquivo log"
+"Compactando arquivo log"
+"Arquivo nao encontrado"
+"Resolve endereco IP"
+"Lendo arquivo useragent"
+"Carregando arquivo de exclusao"
+"Excluidos"
+"Arquivo de exclusao"
+"Arquivo de configuracao"
+"Arquivo useragent log"
+"Criando Useragent report"
+"versao"
+"Limit excedido"
+"Adicionado no arquivo"
+"Converte a data do access.log em formato legivel"
+"Separa o access.log conforme a data entrada com -d"
+"por"
+"reverso"
+"normal"
+"Removendo relatorio antigo"
+"Removendo arquivos temporarios"
+"Top"
+"sites"
+"Sites & Users"
+"Carregandpo a tabela de usuários"
+"Falha de memoria na carga da tabela"
+"Squid - Relatório de Acessos por Usuario"
+"Periodo"
+"Usuario"
+"LOCAL ACESSADO"
+"CONEX&Atilde;O"
+"BYTES"
+"TEMPO GASTO"
+"MILISEG"
+"M&Eacute;DIA"
+"Acesso decrescente (bytes)"
+"USU&Aacute;RIO"
+"TEMPO"
+"NUM"
+"ARQUIVO/PER&Iacute;ODO"
+"DATA CRIA&Ccedil;&Atilde;O"
+"USU&Aacute;RIOS"
+"Ordem"
+"Squid - Relat&oacute;rio Useragent"
+"AGENTE"
+"TOTAL"
+"Gerado por"
+"em"
+"DATA/HORA"
+"IP/NOME"
+"OUT"
+"IN"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Falha de autentica&ccedil;&atilde;o"
+"Proibido"
+"Topsites"
+"SQUIDGUARD"
+"REGRA"
+"squidGuard"
+"Log parsed do sarg salvo em"
+"Log com formato sarg"
+"Downloads"
+"Gr&aacute;fico"
+"DIAS"
+"DansGuardian"
+"CAUSA"
diff --git a/languages/Romanian b/languages/Romanian
new file mode 100644 (file)
index 0000000..c0a5a4c
--- /dev/null
@@ -0,0 +1,130 @@
+# by Adrian Cretu <adi@usv.ro>
+"Da"
+"Nu"
+"Romana"
+"Optiune"
+"necesita un argument"
+"Initializare"
+"Se citeste fisierul de accese"
+"Nu poate fi deschis fisierul de accese"
+"Nu poate fi creat fisierul temporar"
+"Inregistrari citite"
+"scrise"
+"Fisier de loguri cu format mixat (squid si comun)"
+"Loguri in format comun"
+"Loguri in format squid"
+"Loguri in format invalid"
+"Nu s-au gasit inregistrari"
+"Virgula"
+"folosind"
+"ca director temporar"
+"Sortare fisier"
+"Sfarsit"
+"Parametri"
+"Nume de host sau adresa IP"
+"Data de la - pana la"
+"Formatul datei"
+"Europa"
+"USA"
+"Report adrese IP"
+"Se foloseste adresa IP in loc de userid"
+"Situri accesate"
+"Ora"
+"Utilizator"
+"Versiunea squid"
+"Director temporar"
+"Mesaj de debug"
+"Mesaje de proces"
+"Log de intrare"
+"Director de iesire"
+"Utilizare"
+"optiuni"
+"Adresa email pentru trimiterea rapoartelor"
+"stdout pentru consola"
+"Rapoarte dupa user si adresa IP"
+"rapoarte"
+"Nu poate fi deshis fisierul"
+"INTERZIS"
+"Raport generat cu succes in"
+"Raport generat cu succes si trimis la adresa"
+"Se creaza fisierul"
+"Se creaza fisierul despartit cu virgule"
+"Fisier"
+"exista deja, mutat in"
+"Se genereaza fisierul index.html"
+"Se sorteaza fisierul"
+"Raport"
+"Squid nu este instalat pe aceasta masina"
+"Va rog sa folositi optiunea -v pentru a specifica versiunea de Squid"
+"Se incarca configuratia din"
+"eroare la apelul malloc"
+"Se incarca fisierul de parole din"
+"Se genereaza raportul"
+"Se decompreseaza fisierul de loguri"
+"Fisier de loguri comprimat"
+"Fisierul nu a putut fi gasit"
+"Se rezolva adresa de IP"
+"Se citeste logul useragent"
+"Se incarca fisierul de excluderi din"
+"exclus"
+"Fisierul de excluderi"
+"Fisierul de configurare"
+"Logurile useragent"
+"Se genereaza raportul useragent"
+"versiune"
+"limita depasita"
+"Adaugat la fisierul"
+"Se converteste fisierul access.log catre o data legitima"
+"Se imparte fisierul de loguri dupa data in parametrul -d"
+"dupa"
+"invers"
+"normal"
+"Se sterge vechiul raport"
+"Se sterg fisierele temporare"
+"Topul primelor"
+"situri"
+"Situri & Utilizatori"
+"Se incarca tabela de utilizatori"
+"Nu se poate incarca. Problema de memorie"
+"Raportul de acces Squid"
+"Perioada"
+"Utilizator"
+"SIT ACCESAT"
+"CONECTARI"
+"OCTETI"
+"TIMP FOLOSIT"
+"MILISECUNDE"
+"MEDIU"
+"Acces descrescator (octeti)"
+"HOST"
+"ORA"
+"NR."
+"FISIER/PERIOADA"
+"DATA CREARII"
+"UTILIZATORI"
+"Sortare"
+"Raportul Squid Useragent"
+"AGENT"
+"TOTAL"
+"Generat de"
+"la"
+"DATA/ORA"
+"IP/NUME"
+"IESIRE"
+"INTRARE"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Autentificari esuate"
+"Interzis"
+"Topul siturilor -"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Russian_koi8 b/languages/Russian_koi8
new file mode 100644 (file)
index 0000000..fbac81d
--- /dev/null
@@ -0,0 +1,130 @@
+# by Andrew Okhmat <andy@crgu.com>
+"äÁ"
+"îÅÔ"
+"Russian"
+"ðÁÒÁÍÅÔÒÙ"
+"ÔÒÅÂÕÅÔÓÑ ÁÒÇÕÍÅÎÔ"
+"éÎÉÃÉÁÌÉÚÁÃÉÑ"
+"þÔÅÎÉÅ ÆÁÊÌÁ ÖÕÒÎÁÌÁ"
+"îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÆÁÊÌ ÖÕÒÎÁÌÁ"
+"îÅ ÍÏÇÕ ÏÔËÒÙÔØ ×ÒÅÍÅÎÎÙÊ ÆÁÊÌ"
+"úÁÐÉÓÅÊ ÐÒÏÞÉÔÁÎÏ"
+"ÚÁÐÉÓÁÎÏ"
+"öÕÒÎÁÌ ÓÏÄÅÒÖÉÔ ÚÁÐÉÓÉ ÒÁÚÎÙÈ ÆÏÒÍÁÔÏ× (squid É ÄÒ.)"
+"öÕÒÎÁÌ ÄÒÕÇÏÇÏ ÆÏÒÍÁÔÁ"
+"öÕÒÎÁÌ × Squid-ÆÏÒÍÁÔÅ"
+"öÕÒÎÁÌ × ÎÅ×ÅÒÎÏÍ ÆÏÒÍÁÔÅ"
+"úÁÐÉÓÉ ÎÅ ÎÁÊÄÅÎÙ"
+"ðÅÒÉÏÄ"
+"ÉÓÐÏÌØÚÕÅÔÓÑ"
+"ËÁË ×ÒÅÍÅÎÎÙÊ ËÁÔÁÌÏÇ"
+"óÏÒÔÉÒÏ×ËÁ ÆÁÊÌÏ×"
+"úÁ×ÅÒÛÅÎÏ"
+"ðÁÒÁÍÅÔÒÙ"
+"éÍÑ ÉÌÉ IP-ÁÄÒÅÓ"
+"äÁÔÁ ÏÔ-ÄÏ"
+"æÏÒÍÁÔ ÄÁÔÙ"
+"å×ÒÏÐÁ"
+"áÍÅÒÉËÁ"
+"IP ÏÔÞÅÔ"
+"éÓÐÏÌØÚÏ×ÁÔØ Ip-ÁÄÒÅÓ ×ÍÅÓÔÏ ÉÍÅÎÉ ÐÏÌØÚÏ×ÁÔÅÌÑ"
+"áÄÒÅÓÁ"
+"÷ÒÅÍÑ"
+"éÍÑ"
+"÷ÅÒÓÉÑ Squid"
+"÷ÒÅÍÅÎÎÙÊ ËÁÔÁÌÏÇ"
+"ïÔÌÁÄÏÞÎÙÅ ÓÏÏÂÝÅÎÉÑ"
+"òÁÂÏÞÉÅ ÓÏÏÂÝÅÎÉÑ"
+"÷ÈÏÄÑÝÉÊ ÖÕÒÎÁÌ"
+"÷ÙÈÏÄÎÏÊ ËÁÔÁÌÏÇ"
+"éÓÐÏÌØÚÏ×ÁÎÏ"
+"ÐÁÒÁÍÅÔÒÙ"
+"E-mail ÁÄÒÅÓ ÄÌÑ ÐÏÓÙÌËÉ ÏÔÞÅÔÁ"
+"ÓÔ.×Ù×ÏÄ ÎÁ ËÏÎÓÏÌØ"
+"ïÔÞÅÔ ÐÏ ÐÏÌØÚÏ×ÁÔÅÌÑÍ É IP-ÁÄÒÅÓÁÍ"
+"ÏÔÞÅÔÙ"
+"îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÆÁÊÌ"
+"úáðòåô"
+"ïÔÞÅÔ ÕÓÐÅÛÎÏ ÓÇÅÎÅÒÉÒÏ×ÁΠ×:"
+"ïÔÞÅÔ ÕÓÐÅÛÎÏ ÓÇÅÎÅÒÉÒÏ×ÁΠɠÏÔÏÓÌÁÎ"
+"óÏÚÄÁÎÉÅ ÆÁÊÌÁ"
+"óÏÚÄÁÎÉÅ ÆÁÊÌÁ ÐÅÒÉÏÄÁ"
+"æÁÊÌ"
+"ÕÖÅ ÓÕÝÅÓÔ×ÕÅÔ, ÐÅÒÅÎÅÓÅΠ×"
+"óÏÚÄÁÎÉÅ index.html"
+"óÏÒÔÉÒÏ×ËÁ ÆÁÊÌÏ×"
+"ïÔÞÅÔ"
+"Squid ÎÅ ÕÓÔÁÎÏ×ÌÅΠÎÁ ÜÔÏÊ ÍÁÛÉÎÅ"
+"ðÏÖÁÌÕÊÓÔÁ, ÉÓÐÏÌØÚÕÊÔÅ ÐÁÒÁÍÅÔÒ -v ÄÌÑ ÚÁÄÁÎÉÑ ×ÅÒÓÉÉ Squid"
+"úÁÇÒÕÚËÁ ËÏÎÆÉÇÕÒÁÃÉÉ ÉÚ"
+"ÏÛÉÂËÁ malloc"
+"úÁÇÒÕÚËÁ ÆÁÊÌÁ ÐÁÒÏÌÅÊ ÉÚ"
+"óÏÚÄÁÎÉÅ ÏÔÞÅÔÁ"
+"òÁÓÐÁËÏ×ËÁ ÆÁÊÌÁ ÖÕÒÎÁÌÁ"
+"óÖÁÔÉÅ ÆÁÊÌÁ ÖÕÒÎÁÌÁ"
+"æÁÊÌ ÎÅ ÎÁÊÄÅÎ"
+"ïÐÒÅÄÅÌÅÎÉÅ IP-ÁÄÒÅÓÁ"
+"þÔÅÎÉÅ ÖÕÒÎÁÌÁ ÂÒÏÕÚÅÒÏ×"
+"úÁÇÒÕÚËÁ ÉÓËÌÀÞÅÎÉÊ ÉÚ"
+"ÉÓËÌÀÞÅÎÙ"
+"æÁÊÌ ÉÓËÌÀÞÅÎÉÊ"
+"æÁÊÌ ËÏÎÆÉÇÕÒÁÃÉÉ"
+"öÕÒÎÁÌ ÂÒÏÕÚÅÒÏ×"
+"óÏÚÄÁÎÉÅ ÏÔÞÅÔÁ ÐÏ ÂÒÏÕÚÅÒÁÍ"
+"×ÅÒÓÉÑ"
+"ÌÉÍÉÔ ÐÒÅ×ÙÛÅÎ"
+"äÏÂÁ×ÌÅÎÏ × ÆÁÊÌ"
+"ëÏ×ÅÒÔÉÒÕÊÔÅ ÆÁÊÌ access.log, ÞÔÏÂÙ ÄÁÔÁ ÂÙÌÁ ÐÏÎÑÔÎÏÊ"
+"òÁÚÄÅÌÉÔÅ log ÆÁÊÌ ÐÏ ÄÁÔÅ, ÉÓÐÏÌØÚÕÑ ÐÁÒÁÍÅÔÒ -d"
+"ÐÏ"
+"× ÏÂÒÁÔÎÏÍ ÐÏÒÑÄËÅ"
+"× ÏÂÙÞÎÏÍ ÐÏÒÑÄËÅ"
+"õÄÁÌÑÀ ÓÔÁÒÙÊ ÆÁÊÌ ÏÔÞÅÔÁ"
+"õÄÁÌÑÀ ×ÒÅÍÅÎÎÙÅ ÆÁÊÌÙ"
+"ôÏÐ"
+"óÁÊÔÙ"
+"óÁÊÔÙ É ðÏÌØÚÏ×ÁÔÅÌÉ"
+"úÁÇÒÕÖÁÀ ÔÁÂÌÉÃÕ ÐÏÌØÚÏ×ÁÔÅÌÑ"
+"îÅ ÍÏÇÕ ÚÁÇÒÕÚÉÔØ. ïÛÉÂËÁ ÐÁÍÑÔÉ"
+"ïÔÞÅÔ Ï ÒÁÂÏÔÅ ÐÏÌØÚÏ×ÁÔÅÌÅÊ ÞÅÒÅÚ Squid"
+"ðÅÒÉÏÄ"
+"ðÏÌØÚÏ×ÁÔÅÌØ"
+"áÄÒÅÓÁ"
+"ðÏÄËÌÀÞÅÎÉÊ"
+"âÁÊÔ"
+"ïÂÝÅÅ ×ÒÅÍÑ"
+"íÉÌÌÉÓÅË."
+"óÒÅÄÎÑÑ"
+"ðÏ ÕÂÙ×ÁÎÉÀ (ÂÁÊÔÙ)"
+"ðÏÌØÚÏ×ÁÔÅÌØ"
+"÷ÒÅÍÑ"
+"No"
+"ðÅÒÉÏÄ"
+"äÁÔÁ ÓÏÚÄÁÎÉÑ"
+"ðÏÌØÚÏ×ÁÔÅÌÅÊ"
+"ïÔÓÏÒÔÉÒÏ×ÁÎÏ"
+"ïÔÞÅÔ Squid ÐÏ ÂÒÏÕÚÅÒÁÍ"
+"âÒÏÕÚÅÒ"
+"÷ÓÅÇÏ"
+"óÇÅÎÅÒÉÒÏ×ÁÎ"
+"ÎÁ"
+"äÁÔÁ/÷ÒÅÍÑ"
+"IP/éÍÑ"
+"OUT"
+"IN"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication Failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Russian_windows1251 b/languages/Russian_windows1251
new file mode 100644 (file)
index 0000000..fb6beea
--- /dev/null
@@ -0,0 +1,130 @@
+# by Palamarchuk Eugen <eugen@cit.od.ukrtel.net> and Dima I. Allaverdov <allav@ur.rags.ru>
+"Äà"
+"Íåò"
+"Russian"
+"Ïàðàìåòðû"
+"òðåáóåòñÿ àðãóìåíò"
+"Èíèöèàëèçàöèÿ"
+"×òåíèå ôàéëà æóðíàëà"
+"Íå ìîãó îòêðûòü ôàéë æóðíàëà"
+"Íå ìîãó îòêðûòü âðåìåííûé ôàéë"
+"Çàïèñåé ïðî÷èòàíî"
+"çàïèñàíî"
+"Æóðíàë ñîäåðæèò çàïèñè ðàçíûõ ôîðìàòîâ (squid è äð.)"
+"Æóðíàë äðóãîãî ôîðìàòà"
+"Æóðíàë â Squid-ôîðìàòå"
+"Æóðíàë â íåâåðíîì ôîðìàòå"
+"Çàïèñè íå íàéäåíû"
+"Ïåðèîä"
+"èñïîëüçóåòñÿ"
+"êàê âðåìåííûé êàòàëîã"
+"Ñîðòèðîâêà ôàéëîâ"
+"Çàâåðøåíî"
+"Ïàðàìåòðû"
+"Èìÿ èëè IP-àäðåñ"
+"Äàòà îò-äî"
+"Ôîðìàò äàòû"
+"Åâðîïà"
+"Àìåðèêà"
+"IP îò÷åò"
+"Èñïîëüçîâàòü Ip-àäðåñ âìåñòî èìåíè ïîëüçîâàòåëÿ"
+"Àäðåñà"
+"Âðåìÿ"
+"Èìÿ"
+"Âåðñèÿ Squid"
+"Âðåìåííûé êàòàëîã"
+"Îòëàäî÷íûå ñîîáùåíèÿ"
+"Ðàáî÷èå ñîîáùåíèÿ"
+"Âõîäÿùèé æóðíàë"
+"Âûõîäíîé êàòàëîã"
+"Èñïîëüçîâàíî"
+"ïàðàìåòðû"
+"E-mail àäðåñ äëÿ ïîñûëêè îò÷åòà"
+"ñò.âûâîä íà êîíñîëü"
+"Îò÷åò ïî ïîëüçîâàòåëÿì è IP-àäðåñàì"
+"îò÷åòû"
+"Íå ìîãó îòêðûòü ôàéë"
+"ÇÀÏÐÅÒ"
+"Îò÷åò óñïåøíî ñãåíåðèðîâàí â:"
+"Îò÷åò óñïåøíî ñãåíåðèðîâàí è îòîñëàí"
+"Ñîçäàíèå ôàéëà"
+"Ñîçäàíèå ôàéëà ïåðèîäà"
+"Ôàéë"
+"óæå ñóùåñòâóåò, ïåðåíåñåí â"
+"Ñîçäàíèå index.html"
+"Ñîðòèðîâêà ôàéëîâ"
+"Îò÷åò"
+"Squid íå óñòàíîâëåí íà ýòîé ìàøèíå"
+"Ïîæàëóéñòà, èñïîëüçóéòå ïàðàìåòð -v äëÿ çàäàíèÿ âåðñèè Squid"
+"Çàãðóçêà êîíôèãóðàöèè èç"
+"îøèáêà malloc"
+"Çàãðóçêà ôàéëà ïàðîëåé èç"
+"Ñîçäàíèå îò÷åòà"
+"Ðàñïàêîâêà ôàéëà æóðíàëà"
+"Ñæàòèå ôàéëà æóðíàëà"
+"Ôàéë íå íàéäåí"
+"Îïðåäåëåíèå IP-àäðåñà"
+"×òåíèå æóðíàëà áðîóçåðîâ"
+"Çàãðóçêà èñêëþ÷åíèé èç"
+"èñêëþ÷åíû"
+"Ôàéë èñêëþ÷åíèé"
+"Ôàéë êîíôèãóðàöèè"
+"Æóðíàë áðîóçåðîâ"
+"Ñîçäàíèå îò÷åòà ïî áðîóçåðàì"
+"âåðñèÿ"
+"ëèìèò ïðåâûøåí"
+"Äîáàâëåíî â ôàéë"
+"Êîâåðòèðóéòå ôàéë access.log, ÷òîáû äàòà áûëà ïîíÿòíîé"
+"Ðàçäåëèòå log ôàéë ïî äàòå, èñïîëüçóÿ ïàðàìåòð -d"
+"ïî"
+"â îáðàòíîì ïîðÿäêå"
+"â îáû÷íîì ïîðÿäêå"
+"Óäàëÿþ ñòàðûé ôàéë îò÷åòà"
+"Óäàëÿþ âðåìåííûå ôàéëû"
+"Òîï"
+"Ñàéòû"
+"Ñàéòû è Ïîëüçîâàòåëè"
+"Çàãðóæàþ òàáëèöó ïîëüçîâàòåëÿ"
+"Íå ìîãó çàãðóçèòü. Îøèáêà ïàìÿòè"
+"Îò÷åò î ðàáîòå ïîëüçîâàòåëåé ÷åðåç Squid"
+"Ïåðèîä"
+"Ïîëüçîâàòåëü"
+"Àäðåñà"
+"Ïîäêëþ÷åíèé"
+"Áàéò"
+"Îáùåå âðåìÿ"
+"Ìèëëèñåê."
+"Ñðåäíÿÿ"
+"Ïî óáûâàíèþ (áàéòû)"
+"Ïîëüçîâàòåëü"
+"Âðåìÿ"
+"No"
+"Ïåðèîä"
+"Äàòà ñîçäàíèÿ"
+"Ïîëüçîâàòåëåé"
+"Îòñîðòèðîâàíî"
+"Îò÷åò Squid ïî áðîóçåðàì"
+"Áðîóçåð"
+"Âñåãî"
+"Ñãåíåðèðîâàí"
+"íà"
+"Äàòà/Âðåìÿ"
+"IP/Èìÿ"
+"OUT"
+"IN"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication Failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Serbian b/languages/Serbian
new file mode 100644 (file)
index 0000000..7016d2c
--- /dev/null
@@ -0,0 +1,131 @@
+# by Radovan Drobnjakovic <admin.rts@rts.co.yu>
+"Yes"
+"No"
+"Serbian"
+"Izbor"
+"potreban argument"
+"Init"
+"Citanje access log datoteke"
+"Nemoguce otvoriti log datoteku"
+"Nemoguce otvoriti privremanu datoteku"
+"Podaci procitani"
+"upisano"
+"Log ima pomesan format podataka (squid i common log)"
+"Common log format"
+"Squid log format"
+"Log sa pogresnim formatom"
+"Podaci nisu pronadjeni"
+"Period"
+"koristeci"
+"kao privremen direktorijum"
+"Sortiranje datoteke"
+"Kraj"
+"Parametri"
+"Racunar ili njegova IP adresa"
+"Datum od-do"
+"Format datuma"
+"Evropski"
+"USA"
+"IP izvestaj"
+"Upotrebi IP adresu umesto korisnicke identifikacije"
+"Posecene adrese na internetu"
+"Vreme"
+"Korisnik"
+"Squid verzija"
+"Privremeni direktorijum"
+"Debug poruke"
+"Obradi poruke"
+"Ulazni log"
+"Izlazni dir"
+"Upotreba"
+"izbor"
+"E-mail adresa za slanje izvestaja"
+"stdout za konzolu"
+"Izvaestaj po korisniku i IP adresi"
+"izvestaj"
+"Nemoguce otvoriti datoteku ili je los putokaz"
+"ODBIJA SE"
+"Uspesno je generisan izvestaj"
+"Izvestaj je uspesno generisan i upucen na"
+"Pravljenje datoteke"
+"Pravljenje datoteke za period"
+"Datoteka"
+"Vec postoji, preseljeno na"
+"Pravljenje datoteke index.html"
+"Sortiranje datoteke"
+"Izvestaj"
+"Squid nije instaliran na ovom racunaru"
+"Upotrebi -v da podesis verziju za Squid"
+"Ucitavanje konfiguracije iz"
+"malloc greska"
+"Ucitavanje datoteke sa lozinkama iz"
+"Pravljenje izvestaja"
+"Decompresija log datoteke"
+"Kompresija log datoteke"
+"Datoteka nije nadjena ili je los putokaz"
+"Razresi IP Adresu"
+"Citanje useragent log-a"
+"Ucitavanje exclude datoteke iz"
+"iskljuceno"
+"Iskljuci datoteku"
+"Konfiguraciona datoteka"
+"Useragent log"
+"Izvestaj o zloupotrebi"
+"Pravljenje Useragent izvestaja"
+"Pravljenje izvestaja o zloupotrebi"
+"verzija"
+"limit prekoracen"
+"Dodato datoteci"
+"Prevodjenje access.log datoteke u ? datum"
+"Razdvajanje log datoteke preko -d parametra"
+"by"
+"obrnuti"
+"normalno"
+"Sklonjen stari izvestaj"
+"Sklonjen privremeni izvestaj"
+"Vrh"
+"sajtovi"
+"Sites & Users"
+"Loading User table"
+"Cannot load. Memory fault"
+"Izvestaj o pristupu Squid korisnika"
+"Period"
+"Korisnik"
+"POSECENE ADRESE NA INTERNET-u"
+"BROJ KONEKCIJA"
+"BAJTOVA"
+"UPOTREBLJENO VREME"
+"MILISEKUNDE"
+"PROCENTUALNO"
+"Smanjivanje pristupa (bajtova)"
+"KORISNIK"
+"VREME"
+"BROJ"
+"DATOTEKA/PERIOD"
+"DATUM KREIRANJA"
+"KORISNICI"
+"Sortiranje"
+"Squid Useragent izvestaj"
+"AGENT"
+"UKUPNO"
+"Generisano od"              
+"on"
+"DATUM/VREME"
+"IP/IME"
+"Squid izvestaj o zloupotrebi"
+"IZASLO"
+"USLO"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication failures"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DansGuardian"
+"DAYS"
+"CAUSE"
diff --git a/languages/Slovak b/languages/Slovak
new file mode 100644 (file)
index 0000000..4be7c2d
--- /dev/null
@@ -0,0 +1,130 @@
+# by Du¹an Woletz <w@orange.sk>
+"Áno"
+"Nie"
+"Slovenèina"
+"Voµba"
+"vy¾aduje argument"
+"Inicializácia"
+"Èítam prístupový ¾urnál"
+"Nemô¾em otvorí» ¾urnál"
+"Nemô¾em otvorí» doèasný súbor"
+"Záznamov naèítano"
+"zapísane"
+"®urnál má zmie¹ané oba ¾urnálové formáty (v¹eobecný a squid ¾urnál)"
+"V¹eobecný formát ¾urnálu"
+"Squid formát ¾urnálu"
+"®urnál s neplatným formátom"
+"Nena¹iel som ¾iadne záznamy"
+"Obdobie"
+"pou¾il som"
+"ako prechodný adresár"
+"Triedím súbor"
+"Koniec"
+"Parametre"
+"Meno hostiteµa alebo IP adresa"
+"Dátum od-do"
+"Formát data"
+"Európa"
+"USA"
+"IP správa"
+"Pou¾i IP Adresu namiesto ID u¾ívateµa"
+"Nav¹tívený server"
+"Èas"
+"U¾ívateµ"
+"verzia Squidu"
+"Doèasný adresár"
+"Ladiaca zprávy"
+"Správy o spracování"
+"Vstupný ¾urnál"
+"Výstupný adresár"
+"Pou¾itie"
+"voµby"
+"Emailová adresa, na ktorú sa majú odosla» prehµady"
+"stdout pre konzolu"
+"Prehµady podµa u¾ívatela a IP adresy"
+"prehµady"
+"Nedá sa otvori» súbor"
+"Zakázané"
+"Prehµad úspe¹ne vygenerovaný"
+"Prehµad úspe¹ne vygenerovaný a zaslaný na adresu"
+"Vytváram súbor"
+"Vytváram súbor období"
+"Súbor"
+"u¾ existuje, presúvám do"
+"Vytváram index.html"
+"Triedim súbor"
+"Prehµad"
+"Squid není na tomto poèítaèi nain¹talováný"
+"Prosíme pou¾ite voµbu -v pre definovanie verzie Squidu"
+"Naèítávam konfiguráciu z"
+"chyba malloc"
+"Naèítávam heslo zo súboru"
+"Vytváram správu"
+"Rozbaµujem ¾urnálový súbor"
+"Balím ¾urnálový súbor"
+"Súbor nebol nájdený"
+"Prevádzam IP adresu na meno"
+"Naèitávam ¾urnál s prehµadom klientov"
+"Naèítávam súbor výnimok z"
+"vyòaté"
+"Súbor výnimok"
+"Konfiguraèný súbor"
+"®urnál s prehµadom klientov"
+"Vytváram prehµad o klientoch"
+"verzia"
+"limit prekroèený"
+"Pridáné do súboru"
+"Prevedie súbor access.log na správný dátum"
+"Rozdelí ¾urnálový súbor podµa data v parametru -d"
+", napísal"
+"opaène"
+"normálne"
+"Odstraòujem starý súbor s prehµadom"
+"Odstraòujem prechodný súbor"
+"Najlep¹ích"
+"serverov"
+"Tý¾dne"
+"Loading User table"
+"Cannot load. Memory fault"
+"Prehµad o vyu¾ití Squidu podµa u¾ivatelov"
+"Obdobie"
+"U¾ívateµ"
+"NAV©TÍVENÝ SERVER"
+"SPOJENÍ"
+"BYTOV"
+"POU®ITÝ ÈAS"
+"MILISEC"
+"PRIEMER"
+"Klesajúcí prístup (bytov)"
+"ID U®ÍVATE¥A"
+"ÈAS"
+"PORADIE"
+"SÚBOR/OBDOBIE"
+"DÁTUM VZNIKU"
+"U®ÍVATELIA"
+"Triedenie"
+"Prehµad o pou¾itých klientech pre Squid"
+"KLIENT"
+"CELKOM"
+"Generoval"
+"dòa"
+"dátum/èas"
+"IP/MÉNO"
+"VÝSTUP"
+"VSTUP"
+"CACHE"
+"SitesUsers"
+"SmartFilter"
+"Authentication Failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Spanish b/languages/Spanish
new file mode 100644 (file)
index 0000000..76e3f0c
--- /dev/null
@@ -0,0 +1,130 @@
+# by Leonardo A. D'Angelo <ldangelo@san-cayetano.com>and Jose Luis Hernandez Lopez <jhdz@simbiotica.net>
+"Si"
+"No"
+"Espa&ntilde;ol"
+"Opci&oacute;n"
+"requiere un argumento"
+"Inicializaci&oacute;n"
+"Leyendo archivo de log de accesos"
+"No se puede abrir archivo de log"
+"No se puede abrir archivo temporal"
+"Registros leidos"
+"escritos"
+"El log tiene formatos de registro mezclados (squid y common log)"
+"Formato Common log"
+"Formato Squid log"
+"Log con formato invalido"
+"No se encontraron registros"
+"Periodo"
+"usando"
+"como archivo temporario"
+"Ordenando archivo"
+"Fin"
+"Parametros"
+"Nombre de host o direccion IP"
+"Fecha desde-hasta"
+"Formato de fecha"
+"Europa"
+"USA"
+"Reporte IP"
+"Usa direccion IP en vez de userid"
+"Sitio accedido"
+"Hora"
+"Usuario"
+"Version de Squid"
+"Directorio temporal"
+"Mensajes de depuraci&oacute;n"
+"Mensajes de procesos"
+"Log de entrada"
+"Directorio de salida"
+"Modo de uso"
+"opciones"
+"Direccion e-mail a donde enviar reportes"
+"stdout para consola"
+"Reportes por usuario y direccion IP"
+"reportes"
+"No se puede abrir archivo"
+"DENEGADO"
+"Reporte generado satisfactoriamente en"
+"Reporte generado satisfactoriamente y enviado a"
+"Creando archivo"
+"Creando archivo de periodo"
+"Archivo"
+"ya existe, renombrando como"
+"Creando index.html"
+"Ordenando archivo"
+"Reporte"
+"Squid no instalado en esta maquina"
+"Por favor, use la opcion -v para configurar la version de Squid"
+"Cargando configuracion desde"
+"error malloc"
+"Cargando archivo de passwords desde"
+"Creando reporte"
+"Descompactando archivo de log"
+"Compactando archivo de log"
+"Archivo no encontrado"
+"Resolviendo direccion IP"
+"Leyendo log del agente de usuario"
+"Cargando archivo de exclusiones desde"
+"excluido"
+"Archivo de exclusiones"
+"Archivo de configuracion"
+"Log del agente de usuario"
+"Creando reporte de agente de usuario"
+"version"
+"limite excedido"
+"Agregado al archivo"
+"Convierte el archivo access.log a una fecha legible"
+"Cambia el archivo de log por fecha en el parametro -d"
+"por"
+"inverso"
+"normal"
+"Borrando archivos viejos del reporte"
+"Borrando archivos temporales"
+"Top"
+"sitios"
+"Sitios y Usuarios"
+"Cargando tabla de usuarios"
+"No se puede cargar. Fallo de memoria"
+"Reporte de Accesos de Usuarios de Squid"
+"Per&iacute;odo"
+"Usuario"
+"SITIO ACCEDIDO"
+"CONEXION"
+"BYTES"
+"TIEMPO UTILIZADO"
+"MILISEC"
+"PROMEDIO"
+"Acceso Decreciente (bytes)"
+"USERID"
+"HORA"
+"NUM"
+"ARCHIVO/PERIODO"
+"FECHA CREACION"
+"USUARIOS"
+"Clasificado por"
+"Reporte de Agente de Usuario Squid"
+"AGENTE"
+"TOTAL"
+"Generado por"
+"el"
+"FECHA/HORA"
+"IP/NOMBRE"
+"SALIDA"
+"ENTRADA"
+"CACHE"
+"Sitios de Usuarios"
+"SmartFilter"
+"Fallos de autenticaci&ocaute;n"
+"Denegado"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Bajados"
+"Gr&aacute;ficos"
+"DIAS"
+"DansGuardian"
+"CAUSA"
diff --git a/languages/Turkish b/languages/Turkish
new file mode 100644 (file)
index 0000000..33ef742
--- /dev/null
@@ -0,0 +1,130 @@
+# by Evren Yurtesen <yurtesen@ispro.net.tr>
+"Evet"
+"Hayir"
+"Turkish"
+"Opsiyon"
+"bir arguman gerekli"
+"Init"
+"erisim kutuk dosyasi okunuyor"
+"Kutuk dosyasi acilamadi"
+"Gecici dosya acilamadi"
+"Okunan kayitlar"
+"yazilan"
+"Kutukte karisik bicimde kayitlar var (squid ve common kutuk)"
+"Common kutuk bicimi"
+"Squid kutuk bicimi"
+"Gecersiz bicimdeki kutuk"
+"Kayit bulunamadi"
+"Periyod"
+"gecici dizin olarak"
+"kullaniliyor"
+"Dosya siralaniyor"
+"Son"
+"Parametreler"
+"Host ismi veya IP adresi"
+"Tarih baslangic-bitis"
+"Tarih bicimi"
+"Avrupa"
+"ABD"
+"IP raporu"
+"Userid yerine IP Adresi kullan"
+"Erisilen site"
+"Zaman"
+"Kullanici"
+"Squid surumu"
+"Gecici dizin"
+"Debug mesajlari"
+"Islem mesajlari"
+"Girdi kutugu"
+"Cikti dizini"
+"kullanim"
+"opsiyonlar"
+"Raporlari gondermek icin e-posta adresi"
+"konsol icin stdout"
+"Kullanici ve IP adresi ile raporlar"
+"raporlar"
+"Dosya acilamiyor"
+"IZIN&nbspYOK"
+"Raporun basari ile yaratildigi yer"
+"Rapor basari ile yaratildi ve gonderildigi yer"
+"Dosya yaratiliyor"
+"Periyod dosyasi yaratiliyor"
+"Dosya"
+"zaten var, tasindigi yer"
+"index.html yaratiliyor"
+"Dosya siralaniyor"
+"Rapor"
+"Bu makinede squid kurulu degil"
+"Lutfen, -v opsiyonunu Squid surumunu ayarlamak icin kullanin"
+"Konfigurasyonun yuklendigi yer"
+"malloc hatasi"
+"Password dosyasinin yuklendigi yer"
+"Rapor yaratiliyor"
+"Kutuk dosyasi aciliyor"
+"Kutuk dosyasi sikistiriliyor"
+"Dosya bulunamadi"
+"IP addreslerini Host ismine donustur"
+"useragent kutugu okunuyor"
+"Exclude dosyasi okunuyor"
+"exclude yapildi"
+"Exclude dosyasi"
+"Konfigurasyon dosyasi"
+"Useragent kutugu"
+"Useragent raporu yaratiliyor"
+"surum"
+"limit asildi"
+"Dosyaya eklendi"
+"access.log dosyasini okunakli bir tarihe cevir"
+"log dosyasini -d paremetresindeki tarihe gore parcala"
+"ile"
+"ters"
+"normal"
+"Eski rapor dosya(lar) siliniyor"
+"Gecici dosya(lar) siliniyor"
+"Top"
+"siteler"
+"Siteler & Kullanicilar"
+"Kullanici tablosu yukleniyor"
+"Yuklenemiyor. Hafiza hatasi"
+"Squid Kullanicilari Erisim Raporu"
+"Periyod"
+"Kullanici"
+"SITE"
+"BAGLANTI"
+"BYTE"
+"HARCANAN ZAMAN"
+"MILISANIYE"
+"ORTALAMA"
+"Azalan erisim (byte)"
+"KULLANICI&nbspADI"
+"ZAMAN"
+"USERID"
+"DOSYA/PERIYOD"
+"YARATILIS TARIHI"
+"KULLANICILAR"
+"Siralama"
+"Squid Useragent'in Raporu"
+"AGENT"
+"TOPLAM"
+"Yaratilma Tarihi"
+"ile"
+"TARIH/SAAT"
+"IP/ISIM"
+"DISARI"
+"ICERI"
+"CACHE"
+"SitelerKullanicilar"
+"SmartFilter"
+"Authentication failures"
+"Denied"
+"Topsites"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+"DansGuardian"
+"CAUSE"
diff --git a/languages/Ukrainian_windows1251 b/languages/Ukrainian_windows1251
new file mode 100644 (file)
index 0000000..fd09847
--- /dev/null
@@ -0,0 +1,130 @@
+# by Roman Vynar <rvynar@icqmail.com>
+"Òàê"
+"ͳ"
+"Ukrainian"
+"Ïàðàìåòðè"
+"ïîòð³áíèé ïàðàìåòð"
+"²í³ö³àë³çàö³ÿ"
+"×èòàííÿ ôàéëó æóðíàëó"
+"Íå ìîæó â³äêðèòè ôàéë æóðíàëó"
+"Íå ìîæó â³äêðèòè òèì÷àñîâèé ôàéë"
+"Çàïèñ³â ïðî÷èòàíî"
+"çàïèñàíî"
+"Æóðíàë ì³ñòèòü çàïèñè ð³çíèõ ôîðìàò³â (squid ³ ³í.)"
+"Æóðíàë ³íøîãî ôîðìàòó"
+"Æóðíàë â Squid-ôîðìàò³"
+"Æóðíàë â íåâ³ðíîìó ôîðìàò³"
+"Çàïèñè íå çíàéäåí³"
+"Ïåð³îä"
+"Âèêîðèñòîâóºòüñÿ"
+"ÿê òèì÷àñîâèé êàòàëîã"
+"Ñîðòóâàííÿ ôàéë³â"
+"Çðîáëåíî"
+"Ïàðàìåòðè"
+"Õîñò àáî IP-àäðåñà"
+"Äàòà â³ä-äî"
+"Ôîðìàò äàòè"
+"ªâðîïà"
+"ÑØÀ"
+"IP çâ³ò"
+"Âèêîðèñòîâóâàòè Ip-àäðåñó çàì³ñòü ³ìåí³ êîðèñòóâà÷à"
+"Àäðåñà"
+"×àñ"
+"Êîðèñòóâà÷"
+"Âåðñ³ÿ Squid"
+"Òèì÷àñîâèé êàòàëîã"
+"³äëàãîäæóâàëüí³ ïîâ³äîìëåííÿ"
+"Ðîáî÷³ ïîâ³äîìëåííÿ"
+"Âõ³äíèé æóðíàë"
+"Âèõ³äíèé êàòàëîã"
+"Âèêîðèñòàííÿ"
+"ïàðàìåòðè"
+"E-mail àäðåñà äëÿ â³äïðàâêè çâ³òó"
+"ñò. âèâ³ä íà êîíñîëü"
+"Çâ³ò ïî êîðèñòóâà÷àõ ³ IP-àäðåñàõ"
+"çâ³òè"
+"Íå ìîæó â³äêðèòè ôàéë"
+"ÇÀÁÎÐÎÍÀ"
+"Çâ³ò óñï³øíî ñãåíåðîâàíèé â:"
+"Çâ³ò óñï³øíî ñãåíåðîâàíèé ³ íàä³ñëàíèé"
+"Ñòâîðåííÿ ôàéëó"
+"Ñòâîðåííÿ ôàéëó ïåð³îäó"
+"Ôàéë"
+"âæå ³ñíóº, ïåðåíåñåíèé â"
+"Ñòâîðåííÿ index.html"
+"Ñîðòóâàííÿ ôàéë³â"
+"Çâ³ò"
+"Squid íå âñòàíîâëåíèé íà ö³é ìàøèí³"
+"Áóäü-ëàñêà, âèêîðèñòàéòå ïàðàìåòð -v äëÿ âñòàíîâëåííÿ âåðñ³¿ Squid"
+"Çàâàíòàæåííÿ êîíô³ãóðàö³¿ ç"
+"Ïîìèëêà malloc"
+"Çàâàíòàæåííÿ ôàéëó ïàðîë³â ³ç"
+"Ñòâîðåííÿ çâ³òó"
+"Ðîçïàêóâàííÿ ôàéëó æóðíàëó"
+"Ïàêóâàííÿ ôàéëó æóðíàëó"
+"Ôàéë íå çíàéäåíèé"
+"Âèçíà÷åííÿ IP-àäðåñè"
+"×èòàííÿ æóðíàëó áðîóçåð³â"
+"Çàâàíòàæåííÿ âèêëþ÷åíü ¿ç"
+"âèêëþ÷åí³"
+"Ôàéë âèêëþ÷åíü"
+"Ôàéë êîíô³ãóðàö³¿"
+"Æóðíàë áðîóçåð³â"
+"Ñòâîðåííÿ çâ³òó ïî áðîóçåðàõ"
+"âåðñ³ÿ"
+"ë³ì³ò ïåðåâèøåíèé"
+"Äîäàíî ó ôàéë"
+"Êîíâåðòóéòå ôàéë access.log, ùîá äàòà áóëà çðîçóì³ëîþ"
+"Ðîçä³ë³òü log ôàéë ïî äàò³, âèêîðèñòîâóþ÷è ïàðàìåòð -d"
+"ïî"
+"â çâîðîòíüîìó ïîðÿäêó"
+"ïî ïîðÿäêó"
+"Çíèùóþ ñòàðèé ôàéë çâ³òó"
+"Çíèùóþ òèì÷àñîâ³ ôàéëè"
+"Òîï"
+"Ñàéòè"
+"Ñàéòè ³ Êîðèñòóâà÷³"
+"Çàâàíòàæóþ òàáëèöþ êîðèñòóâà÷à"
+"Íå ìîæó çàâàíòàæèòè. Ïîìèëêà ïàì'ÿò³"
+"Çâ³ò ïðî ðîáîòó êîðèñòóâà÷³â ÷åðåç Squid"
+"Ïåð³îä"
+"Êîðèñòóâà÷"
+"Àäðåñà"
+"ϳäêëþ÷åííÿ"
+"Áàéò"
+"Âèêîðèñòàíèé ÷àñ"
+"̳ë³ñåê."
+"Ñåðåäí³é"
+"Ïî ñïàäàííþ (áàéòè)"
+"Êîðèñòóâà÷"
+"×àñ"
+"¹"
+"Ïåð³îä"
+"Äàòà ñòâîðåííÿ"
+"Êîðèñòóâà÷³"
+"³äñîðòîâàíî"
+"Çâ³ò Squid ïî áðîóçåðàõ"
+"Áðîóçåð"
+"Âñüîãî"
+"Çãåíåðîâàíèé"
+"íà"
+"Äàòà/×àñ"
+"IP/Õîñò"
+"OUT"
+"IN"
+"CACHE"
+"SitesUsers"
+"ÑìàðòÔ³ëüòð"
+"Ïîìèëêà àóòåíòèô³êàö³¿"
+"Çàáîðîíåí³"
+"Òîï ñàéòè"
+"SQUIDGUARD"
+"RULE"
+"squidGuard"
+"Sarg parsed log saved as"
+"Sarg log format"
+"Downloads"
+"Graphic"
+"DAYS"
+DansGuardian"
+"CAUSE"
diff --git a/lastlog.c b/lastlog.c
new file mode 100644 (file)
index 0000000..bf34da2
--- /dev/null
+++ b/lastlog.c
@@ -0,0 +1,112 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void mklastlog()
+{
+
+   FILE *fp_in, *fp_ou;
+   DIR *dirp;
+   struct dirent *direntp;
+   char temp[MAXLEN];
+   char warea[MAXLEN];
+   char ftime[128];
+   int  ftot=0;
+   time_t t;
+   struct tm *local;
+   struct stat statb;
+
+   if(strcmp(LastLog,"0") == 0)
+      return;
+
+   sprintf(temp,"%slastlog1",outdir);
+   if((fp_ou=fopen(temp,"w"))==NULL) {
+     fprintf(stderr, "SARG: (lastlog) %s: %s\n",text[9],temp);        
+     exit(1);
+   }
+
+   dirp = opendir(outdir);
+   while ((direntp = readdir( dirp )) != NULL ){
+      if(strstr(direntp->d_name,"-") == 0)
+         continue;
+
+      sprintf(warea,"%s%s",outdir,direntp->d_name);
+      stat(warea,&statb);
+      t=statb.st_ctime;
+      local = localtime(&t);
+      strftime(ftime, 127, "%Y%m%d%H%M%S", local);
+      sprintf(buf,"%s %s\n",ftime,direntp->d_name);
+      fputs(buf,fp_ou);
+      ftot++;
+   }
+
+   (void)rewinddir( dirp );
+   (void)closedir( dirp );
+   fclose(fp_ou);
+   
+   sprintf(buf,"sort -n -k 1,1 -o %slastlog %s",outdir,temp);
+   system(buf);
+
+   unlink(temp);
+
+   if(ftot<=atoi(LastLog)) {
+      sprintf(temp,"%slastlog",outdir);
+      if(access(temp, R_OK) == 0)
+         unlink(temp);
+      return;
+   }
+
+   ftot-=atoi(LastLog);
+
+   sprintf(temp,"%slastlog",outdir);
+   if((fp_in=fopen(temp,"r"))==NULL) {
+     fprintf(stderr, "SARG: (lastlog) %s: %s\n",text[9],temp);        
+     exit(1);
+   }
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(warea,buf,' ');
+      buf[strlen(buf)-1]='\0';
+     
+      if(ftot) {
+         if(debug) {
+            sprintf(msg,"%s: %s",text[81],buf);
+            debuga(msg);
+         }
+//         sprintf(temp,"%s%s",outdir,buf);
+         sprintf(temp,"rm -r %s%s",outdir,buf);
+         system(temp);
+         unlink(temp);
+         ftot--;
+      }
+   }
+
+   fclose(fp_in);
+   sprintf(temp,"%slastlog",outdir);
+   unlink(temp);
+   return;
+}
diff --git a/log.c b/log.c
new file mode 100644 (file)
index 0000000..254dc2a
--- /dev/null
+++ b/log.c
@@ -0,0 +1,1534 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                         orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator                   http://sarg-squid.org
+ * 
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php 
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+#define LEGACY_WRITE_USER
+#define LEGACY_WRITE_DOWNLOAD
+#define REPORT_EVERY_X_LINES 5000
+
+
+char *userfile;
+char *excludefile;
+char *excludeuser;
+
+char sz_Last_User[ MAXLEN ] = { 0 } ;
+int bool_ShowReadStatistics ;
+
+numlist weekdays = { { 0, 1, 2, 3, 4, 5, 6 }, 7 };
+numlist hours = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+             13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }, 24 };
+
+void getusers(char *pwdfile, int debug);
+void gethexclude(char *hexfile, int debug);
+void getuexclude(char *uexfile, int debug);
+void ttx(char *user);
+int compar( const void *, const void * );
+
+#define _FILE_OFFSET_BITS 64
+
+int main(argc,argv)
+   int argc;
+   char *argv[];
+{
+
+   FILE *fp_in = NULL, *fp_ou = NULL, *fp_denied, *fp_usr, *fp_authfail, *fp_log;
+
+   char sz_Download_Unsort[ 20000 ] ;
+   FILE * fp_Download_Unsort = NULL ;
+   FILE * fp_Write_User = NULL ;
+
+   extern int optind;
+   extern int optopt;
+   extern char *optarg;
+
+   char w[MAXLEN];
+   char data[255]; 
+   char elap[255];
+   char none[255];
+   char ip[MAXLEN];
+   char msg[MAXLEN];
+   char tam[255];
+   char fun[255];
+   char wuser[MAXLEN]; 
+   char code[MAXLEN];
+   char code2[MAXLEN];
+   char smartfilter[MAXLEN];
+   char dia[128]; 
+   char wdata[128];
+   char mes[30];
+   char ano[30];
+   char hora[30];
+   char wtemp[MAXLEN];
+   char wtemp2[255];
+   char date[255];
+   char arq[255];
+   char arq_log[255];
+   char warq[255][255];
+   char hm[15], hmf[15], hmr[15], whm[15];
+   int  chm=0;
+   char uagent[MAXLEN];
+   char hexclude[MAXLEN];
+   char csort[MAXLEN]; 
+   char tbuf[128];
+   char tbuf2[128];
+   char zip[20];
+   char *str;
+   char bufz[MAXLEN];
+   char bufy[MAXLEN];
+   int  common; 
+   int  common_log=0;
+   int  squid_log=0;
+   int  ch;
+   int  d;
+   int  x, l, i;
+   int  errflg=0;
+   int  puser=0;
+   int  fhost=0;
+   int  dns=0;
+   int  fuser=0;
+   int  idata=0;
+   int  narq=0;
+   int  iarq=0;
+   int  exstring=0;
+   int  i0=0,i1=0,i2=0,i3=0,i4=0,i5=0,i6=0,i7=0,i8=0;
+   long totregsl=0; 
+   long totregsg=0;
+   long totregsx=0;
+   long totper=0;
+   long int  max_elapsed=0;
+   time_t tt;
+   struct tm *t;
+   unsigned long nreg=0;
+   off_t recs1=0;
+   unsigned long recs2=0;
+   struct rlimit rl;
+   int OutputNonZero = REPORT_EVERY_X_LINES ;
+
+   BgImage[0]='\0';
+   LogoImage[0]='\0';
+   LogoText[0]='\0';
+   PasswdFile[0]='\0';
+   OutputEmail[0]='\0';
+   Ip2Name[0]='\0';
+   UserAgentLog[0]='\0';
+   ExcludeHosts[0]='\0';
+   ExcludeUsers[0]='\0';
+   ConfigFile[0]='\0';
+   code[0]='\0';
+   LastLog[0]='\0';
+   UserIp[0]='\0';
+   MaxElapsed[0]='\0';
+   ReportType[0]='\0';
+   UserTabFile[0]='\0';
+   BlockIt[0]='\0';
+   ExternalCSSFile[0]='\0';
+   SquidGuardLogFormat[0]='\0';
+
+   strcpy(AccessLog,"/usr/local/squid/var/logs/access.log");
+   sprintf(ExcludeCodes,"%s/exclude_codes",SYSCONFDIR);
+   strcpy(GraphDaysBytesBarColor,"orange");
+   strcpy(BgColor,"#FFFFFF");
+   strcpy(TxColor,"#000000");
+   strcpy(TxBgColor,"lavender");
+   strcpy(TiColor,"darkblue");
+   strcpy(Width,"80");
+   strcpy(Height,"45");
+   strcpy(LogoTextColor,"#000000");
+   strcpy(HeaderColor,"darkblue");
+   strcpy(HeaderBgColor,"#DDDDDD");
+   strcpy(FontSize,"9px");
+   strcpy(TempDir,"/tmp");
+   strcpy(OutputDir,"/usr/local/etc/httpd/htdocs/squid-reports");
+   strcpy(Ip2Name,"no");
+   strcpy(DateFormat,"u");
+   strcpy(OverwriteReport,"no");
+   strcpy(RemoveTempFiles,"yes");
+   strcpy(ReplaceIndex,"index.html");
+   strcpy(Index,"yes");
+   strcpy(RecordsWithoutUser,"ip");
+   strcpy(UseComma,"no");
+   strcpy(MailUtility,"mailx");
+   strcpy(TopSitesNum,"100");
+   strcpy(UserIp,"no");
+   strcpy(TopuserSortField,"BYTES");
+   strcpy(UserSortField,"BYTES");
+   strcpy(TopuserSortOrder,"reverse");
+   strcpy(UserSortOrder,"reverse");
+   strcpy(TopsitesSortField,"CONNECT");
+   strcpy(TopsitesSortType,"D");
+   strcpy(LongUrl,"no");
+   strcpy(language,"English");
+   strcpy(FontFace,"Verdana,Tahoma,Arial");
+   strcpy(datetimeby,"bytes");
+   strcpy(CharSet,"ISO-8859-1");
+   strcpy(Privacy,"no");
+   strcpy(PrivacyString,"***.***.***.***");
+   strcpy(PrivacyStringColor,"blue");
+   strcpy(SuccessfulMsg,"yes");
+   strcpy(TopUserFields,"NUM DATE_TIME USERID CONNECT BYTES %BYTES IN-CACHE-OUT USED_TIME MILISEC %TIME TOTAL AVERAGE");
+   strcpy(UserReportFields,"CONNECT BYTES %BYTES IN-CACHE-OUT USED_TIME MILISEC %TIME TOTAL AVERAGE");
+   strcpy(DataFileDelimiter,";");
+   strcpy(DataFileFields,"user;date;time;url;connect;bytes;in_cache;out_cache;elapsed");
+   strcpy(SiteUserTimeDateType,"table");
+   strcpy(ShowReadStatistics,"yes");
+   strcpy(IndexSortOrder,"D");
+   strcpy(ShowSargInfo,"yes");
+   strcpy(ShowSargLogo,"yes");
+   strcpy(ParsedOutputLog,"no");
+   strcpy(ParsedOutputLogCompress,"/bin/gzip");
+   strcpy(DisplayedValues,"abbreviation");
+   strcpy(HeaderFontSize,"9px");
+   strcpy(TitleFontSize,"11px");
+   strcpy(AuthUserFile,"/usr/local/sarg/passwd");
+   strcpy(AuthName,"SARG, Restricted Access");
+   strcpy(AuthType,"basic");
+   strcpy(Require,"require user admin %u");
+   strcpy(DownloadSuffix,"7z,ace,arj,avi,bat,bin,bz2,bzip,cab,com,cpio,dll,doc,dot,exe,gz,iso,lha,lzh,mdb,mov,mp3,mpeg,mpg,mso,nrg,ogg,ppt,rar,rtf,shs,src,sys,tar,tgz,vcd,vob,wma,wmv,zip");
+   strcpy(Graphs,"yes");
+   strcpy(Ulimit,"20000");
+   strcpy(NtlmUserFormat,"domainname+username");
+
+   dia[0]='\0';
+   mes[0]='\0';
+   ano[0]='\0';
+   hora[0]='\0';
+   tmp[0]='\0';
+   tmp2[0]='\0';
+   tmp3[0]='\0';
+   wtemp[0]='\0';
+   wtemp2[0]='\0';
+   us[0]='\0';
+   date[0]='\0';
+   df[0]='\0';
+   uagent[0]='\0';
+   hexclude[0]='\0';
+   addr[0]='\0';
+   hm[0]='\0';
+   hmf[0]='\0';
+   site[0]='\0';
+   outdir[0]='\0';
+   elap[0]='\0';
+   email[0]='\0';
+   zip[0]='\0';
+   UserInvalidChar[0]='\0';
+   DataFile[0]='\0';
+   SquidGuardConf[0]='\0';
+   DansGuardianConf[0]='\0';
+
+   excode=0;
+   denied_count=0;
+   download_count=0;
+   authfail_count=0;
+   dansguardian_count=0;
+   squidguard_count=0;
+   DeniedReportLimit=10;
+   AuthfailReportLimit=10;
+   DansGuardianReportLimit=10;
+   SquidGuardReportLimit=10;
+   UserReportLimit=0;
+   debug=0;
+   debugz=0;
+   debugm=0;
+   iprel=0;
+   userip=0;
+   color1=0;
+   color2=0;
+   color3=0;
+   sarglog=0;
+   isalog=0;
+
+   bzero(IncludeUsers, MAXLEN);
+   bzero(ExcludeString, MAXLEN);
+
+   for(x=0; x<=254; x++) 
+      warq[x][0]='\0';
+
+   language_load(language);
+   strcpy(Title,text[88]);
+
+   while((ch = getopt(argc, argv, "a:b:c:d:e:f:g:u:l:o:r:s:t:w:hijmnpvxyz")) != -1){
+      switch(ch)
+      {
+         case 'a':
+            strcpy(addr,optarg);
+            break;
+         case 'b':
+            strcpy(uagent,optarg);
+            break;
+         case 'c':
+            strcpy(hexclude,optarg);
+            break;
+         case 'd':
+            strcpy(date,optarg);
+            strcpy(cduntil,optarg);
+            getword(cdfrom,cduntil,'-');
+            date_from(date, cdfrom, cduntil);
+            dfrom=atoi(cdfrom);
+            duntil=atoi(cduntil);
+            break;
+         case 'e':
+            strcpy(email,optarg);
+            break;
+         case 'f':
+            strcpy(ConfigFile,optarg);
+            break;
+         case 'g':
+            strcpy(df,optarg);
+            break;
+        case 'h':
+           usage(argv[0]);
+            exit(0);
+           break;
+         case 'i':
+            iprel++;
+            break;
+         case 'l':
+            strcpy(warq[narq],optarg);
+            narq++;
+            break;
+         case 'm':
+            debugm++;
+            break;
+         case 'n':
+            dns++;
+            break;
+         case 'o':
+            strcpy(outdir,optarg);
+            break;
+         case 'p':
+            userip++;
+            break;
+         case 's':
+            strcpy(site,optarg);
+            break;
+         case 't':
+            if(strstr(optarg,"-") == 0) {
+              strcpy(hm,optarg);
+              strcpy(hmf,optarg);
+            } else {
+               getword(hm,optarg,'-');
+               strcpy(hmf,optarg);
+            }
+            if(strlen(hm) > 5) {
+              printf("SARG: time period must be MM or MM:SS. Exit.\n");
+              exit(1);
+            }
+            bzero(whm,15);
+            if(strstr(hm,":") != 0) {
+               getword(warea,hm,':');
+               sprintf(whm,"%s%s",warea,hm);
+               strcpy(hm,whm);
+            }
+            bzero(whm,15);
+            if(strstr(hmf,":") != 0) {
+               getword(warea,hmf,':');
+               sprintf(whm,"%s%s",warea,hmf);
+               strcpy(hmf,whm);
+            }
+            break;
+         case 'u':
+            strcpy(us,optarg);
+            break;
+         case 'v':
+            version();
+            break;
+         case 'w':
+            strcpy(tmp,optarg);
+            break;
+         case 'x':
+            debug++;
+            break;
+         case 'y':
+            langcode++;
+            break;
+         case 'z':
+            debugz++;
+            break;
+         case ':':
+           fprintf(stderr, "Option -%c require an argument\n",optopt);
+           errflg++;
+           break;
+         case '?':
+            usage(argv[0]);
+            exit(1);
+            break;
+      }
+
+   }
+
+   if (errflg) {
+      usage(argv[0]);
+      exit(2);
+   }
+
+   if(debug)
+      debuga("Init");
+
+   if(ConfigFile[0] == '\0')
+      sprintf(ConfigFile,"%s/sarg.conf",SYSCONFDIR);
+    else {
+      if(access(ConfigFile, R_OK) != 0) {
+         sprintf(msg,"Cannot open config file: %s - %s",ConfigFile,strerror(errno));
+         debuga(msg);
+         exit(1);
+      }
+   }
+    
+   if(access(ConfigFile, R_OK) == 0)
+      getconf(debugm, ConfigFile, AccessLog, debug, BgColor, TxColor, TxBgColor, TiColor, LogoImage, LogoText, LogoTextColor, Width, Height, Title, BgImage, FontFace, HeaderColor, HeaderBgColor, FontSize, PasswdFile, TempDir, OutputDir, OutputEmail, Ip2Name, TopuserSortField, UserSortField, TopuserSortOrder, UserSortOrder, UserAgentLog, ExcludeHosts, DateFormat, ExcludeUsers, PerUserLimitFile, PerUserLimit, UserIp, MaxElapsed);
+
+   if(debugz) {
+      fprintf(stderr, "SARG: ConfigFile.........= %s\n",ConfigFile);
+      fprintf(stderr, "SARG: AccessLog..........= %s\n",AccessLog);
+      fprintf(stderr, "SARG: BgColor............= %s\n",BgColor);
+      fprintf(stderr, "SARG: TxColor............= %s\n",TxColor);
+      fprintf(stderr, "SARG: TxBgColor..........= %s\n",TxBgColor);
+      fprintf(stderr, "SARG: TiColor............= %s\n",TiColor);
+      fprintf(stderr, "SARG: LogoImage..........= %s\n",LogoImage);
+      fprintf(stderr, "SARG: LogoText...........= %s\n",LogoText);
+      fprintf(stderr, "SARG: LogoTextColor......= %s\n",LogoTextColor);
+      fprintf(stderr, "SARG: Width..............= %s\n",Width);
+      fprintf(stderr, "SARG: Height.............= %s\n",Height);
+      fprintf(stderr, "SARG: Title..............= %s\n",Title);
+      fprintf(stderr, "SARG: BgImage............= %s\n",BgImage);
+      fprintf(stderr, "SARG: FontFace...........= %s\n",FontFace);
+      fprintf(stderr, "SARG: HeaderColor........= %s\n",HeaderColor);
+      fprintf(stderr, "SARG: HeaderBgColor......= %s\n",HeaderBgColor);
+      fprintf(stderr, "SARG: FontSize...........= %s\n",FontSize);
+      fprintf(stderr, "SARG: PasswdFile.........= %s\n",PasswdFile);
+      fprintf(stderr, "SARG: TempDir............= %s\n",TempDir);
+      fprintf(stderr, "SARG: OutputDir..........= %s\n",OutputDir);
+      fprintf(stderr, "SARG: Ip2Name............= %s\n",Ip2Name);
+      fprintf(stderr, "SARG: TopuserSortField.........= %s\n",TopuserSortField);
+      fprintf(stderr, "SARG: UserSortField.........= %s\n",UserSortField);
+      fprintf(stderr, "SARG: TopuserSortOrder.........= %s\n",TopuserSortOrder);
+      fprintf(stderr, "SARG: UserSortOrder.........= %s\n",UserSortOrder);
+      fprintf(stderr, "SARG: UserAgentLog.......= %s\n",UserAgentLog);
+      fprintf(stderr, "SARG: ExcludeHosts.......= %s\n",ExcludeHosts);
+      fprintf(stderr, "SARG: DateFormat.........= %s\n",DateFormat);
+      fprintf(stderr, "SARG: ExcludeUsers.......= %s\n",ExcludeUsers);
+      fprintf(stderr, "SARG: PerUserLimitFile...= %s\n",PerUserLimitFile);
+      fprintf(stderr, "SARG: PerUserLimit.......= %s\n",PerUserLimit);
+      fprintf(stderr, "SARG: UserIp.............= %s\n",UserIp);
+      fprintf(stderr, "SARG: MaxElapsed.........= %s\n",MaxElapsed);
+      fprintf(stderr, "SARG: LastLog............= %s\n",LastLog);
+      fprintf(stderr, "SARG:\n");
+   }
+   dataonly=0;
+   if(DataFile[0] != '\0');
+      dataonly++;
+   
+   str2=(char *)subs(TopUserFields,"%BYTES","SETYB");
+   strcpy(TopUserFields,str2);
+   
+   str2=(char *)subs(UserReportFields,"%BYTES","SETYB");
+   strcpy(UserReportFields,str2);
+
+   if(!narq) {
+      strcpy(warq[0],AccessLog);
+      narq++;
+   }
+
+   if(strcmp(hexclude,"onvert") == 0 && strcmp(site,"plit") != 0) {
+      convlog(warq[0], df, dfrom, duntil);
+      exit(0);
+   }
+   
+   if(strcmp(site,"plit") == 0) {
+      splitlog(warq[0], df, dfrom, duntil, hexclude);
+      exit(0);
+   }
+
+   if(ExcludeCodes[0] != '\0') {
+      if((excludecode=(char *) malloc(1024))==NULL) {
+         fprintf(stderr, "SARG: %s (1024):\n",text[59]);
+         exit(1);
+      }
+      bzero(excludecode,1024);
+      load_excludecodes();
+   }
+
+   if(access(PasswdFile, R_OK) == 0) {
+      getusers(PasswdFile,debug);
+      puser++;
+   }
+
+   if(hexclude[0] == '\0')
+      strcpy(hexclude,ExcludeHosts);
+   if(strlen(hexclude) > 0) {
+      if(access(hexclude, R_OK) != 0) {
+         sprintf(msg,"Cannot open exclude_hosts file: %s - %s",hexclude,strerror(errno));
+         debuga(msg);
+         exit(1);
+      } else {
+         gethexclude(hexclude,debug);
+         fhost++;
+      }
+   }
+
+   if(ReportType[0] == '\0')
+      strcpy(ReportType,"topsites users_sites sites_users date_time denied auth_failures site_user_time_date");
+
+   if(access(ExcludeUsers, R_OK) == 0) {
+      getuexclude(ExcludeUsers,debug);
+      fuser++;
+   }
+
+   indexonly=0;
+   if(fuser) {
+      if(strstr(excludeuser,"indexonly") != 0)
+         indexonly++;
+   }
+   if(strcmp(ExcludeUsers,"indexonly") == 0)
+      indexonly++;
+   if(strcmp(Index,"only") == 0)
+      indexonly++;
+
+   if(dns)
+      strcpy(Ip2Name,"yes");
+
+   if(strcmp(UserIp,"yes") == 0)
+      userip++;
+
+   if(strlen(MaxElapsed)>1)
+      max_elapsed=atol(MaxElapsed);
+
+   if(strlen(outdir)<1)
+      strcpy(outdir,OutputDir);
+   strcat(outdir,"/");
+
+
+   if(arq[0] == '\0')
+      strcpy(arq,AccessLog);
+
+   if(uagent[0] == '\0')
+      strcpy(uagent,UserAgentLog);
+
+   if(tmp[0] == '\0')
+     strcpy(tmp,TempDir);
+    else
+     strcpy(TempDir,tmp);
+
+   if(df[0] == '\0')
+      strcpy(df,DateFormat);
+    else
+      strcpy(DateFormat,df);
+
+   if(df[0] == '\0') {
+      strcpy(df,"u");
+      strcpy(DateFormat,"u");
+   }
+
+   if(strlen(email)<1){
+      if(strlen(OutputEmail)>0)
+         strcpy(email,OutputEmail);
+   }
+
+   strcpy(tmp2,tmp);
+   strcpy(tmp4,tmp);
+   strcpy(tmp5,tmp);
+   strcpy(tmp6,tmp);
+
+   if(strlen(email) > 0) {
+      sprintf(wtemp2,"%s/sarg_tmp",tmp2);
+      my_mkdir(wtemp2);
+      strcat(tmp2,"/sarg_tmp");
+      strcpy(outdir,tmp2);
+      strcat(outdir,"/");
+    }
+
+   strcat(tmp2,"/sarg.log");
+
+   sprintf(warea,"%s/sarg",tmp);
+   if(access(warea, R_OK) == 0) {
+      sprintf(tmp3,"rm -rf %s",warea);
+      system(tmp3);
+   }
+   
+   sprintf(tmp3,"%s/sarg",tmp);
+   my_mkdir(tmp3);
+   strcat(tmp4,"/denied.log.unsort");
+   strcat(tmp5,"/denied.log");
+   strcat(tmp6,"/authfail.log.unsort");
+
+   if(debug) {
+      fprintf(stderr, "SARG: %s:\nSARG:\n",text[22]);
+      fprintf(stderr, "SARG: %35s (-a) = %s\n",text[23],addr);
+      fprintf(stderr, "SARG: %35s (-b) = %s\n",text[71],uagent);
+      fprintf(stderr, "SARG: %35s (-c) = %s\n",text[69],hexclude);
+      fprintf(stderr, "SARG: %35s (-d) = %s\n",text[24],date);
+      fprintf(stderr, "SARG: %35s (-e) = %s\n",text[41],email);
+      fprintf(stderr, "SARG: %35s (-f) = %s\n",text[70],ConfigFile);
+      if(strcmp(df,"e") == 0)
+         fprintf(stderr, "SARG: %35s (-g) = %s (dd/mm/yyyy)\n",text[25],text[26]);
+      if(strcmp(df,"u") == 0)
+         fprintf(stderr, "SARG: %35s (-g) = %s (mm/dd/yyyy)\n",text[25],text[27]);
+      if(strcmp(df,"w") == 0)
+         fprintf(stderr, "SARG: %35s (-g) = %s (yyyy/ww)\n",text[25],text[85]);
+      if(iprel)
+         fprintf(stderr, "SARG: %35s (-i) = %s\n",text[28],text[1]);
+       else
+         fprintf(stderr, "SARG: %35s (-i) = %s\n",text[28],text[2]);
+      fprintf(stderr, "SARG: %35s (-l) = %s\n",text[37],arq);
+      if(strcmp(Ip2Name,"yes") == 0)
+         fprintf(stderr, "SARG: %35s (-n) = %s\n",text[65],text[1]);
+       else
+         fprintf(stderr, "SARG: %35s (-n) = %s\n",text[65],text[2]);
+      fprintf(stderr, "SARG: %35s (-o) = %s\n",text[38],outdir);
+      if(strcmp(UserIp,"yes") == 0)
+         fprintf(stderr, "SARG: %35s (-p) = %s\n",text[29],text[1]);
+       else
+         fprintf(stderr, "SARG: %35s (-p) = %s\n",text[29],text[2]);
+      fprintf(stderr, "SARG: %35s (-s) = %s\n",text[30],site);
+      fprintf(stderr, "SARG: %35s (-t) = %s\n",text[31],hm);
+      fprintf(stderr, "SARG: %35s (-u) = %s\n",text[32],us);
+      fprintf(stderr, "SARG: %35s (-w) = %s\n",text[34],tmp);
+      if(debug)
+         fprintf(stderr, "SARG: %35s (-x) = %s\n",text[35],text[1]);
+       else
+         fprintf(stderr, "SARG: %35s (-x) = %s\n",text[35],text[2]);
+      if(debugz)
+         fprintf(stderr, "SARG: %35s (-z) = %s\n",text[36],text[1]);
+       else
+         fprintf(stderr, "SARG: %35s (-z) = %s\n",text[36],text[2]);
+      fprintf(stderr, "SARG:\n");
+   }
+
+   if(debugm) {
+      printf("%s:\nSARG:\n",text[22]);
+      printf("%35s (-a) = %s\n",text[23],addr);
+      printf("%35s (-b) = %s\n",text[71],uagent);
+      printf("%35s (-c) = %s\n",text[69],hexclude);
+      printf("%35s (-d) = %s\n",text[24],date);
+      printf("%35s (-e) = %s\n",text[41],email);
+      printf("%35s (-f) = %s\n",text[70],ConfigFile);
+      if(strcmp(df,"e") == 0)
+         printf("%35s (-g) = %s (dd/mm/yyyy)\n",text[25],text[26]);
+      if(strcmp(df,"u") == 0)
+         printf("%35s (-g) = %s (mm/dd/yyyy)\n",text[25],text[27]);
+      if(strcmp(df,"w") == 0)
+         printf("%35s (-g) = %s (yyyy/ww)\n",text[25],text[85]);
+      if(iprel)
+         printf("%35s (-i) = %s\n",text[28],text[1]);
+       else
+         printf("%35s (-i) = %s\n",text[28],text[2]);
+      printf("%35s (-l) = %s\n",text[37],arq);
+      if(strcmp(Ip2Name,"yes") == 0)
+         printf("%35s (-n) = %s\n",text[65],text[1]);
+       else
+         printf("%35s (-n) = %s\n",text[65],text[2]);
+      printf("%35s (-o) = %s\n",text[38],outdir);
+      if(strcmp(UserIp,"yes") == 0)
+         printf("%35s (-p) = %s\n",text[29],text[1]);
+       else
+         printf("%35s (-p) = %s\n",text[29],text[2]);
+      printf("%35s (-s) = %s\n",text[30],site);
+      printf("%35s (-t) = %s\n",text[31],hm);
+      printf("%35s (-u) = %s\n",text[32],us);
+      printf("%35s (-w) = %s\n",text[34],tmp);
+      if(debug)
+         printf("%35s (-x) = %s\n",text[35],text[1]);
+       else
+         printf("%35s (-x) = %s\n",text[35],text[2]);
+      if(debugz)
+         printf("%35s (-z) = %s\n",text[36],text[1]);
+       else
+         printf("%35s (-z) = %s\n",text[36],text[2]);
+      printf("sarg %s: %s\n",text[73],VERSION);
+      printf("Language=%s\n\n",text[3]);
+   }
+
+   if(debug){
+      sprintf(msg,"sarg %s: %s",text[73],VERSION);
+      debuga(msg);
+   }
+#if defined(RLIMIT_NOFILE)
+   getrlimit (RLIMIT_NOFILE, &rl);
+#else #if defined(RLIMIT_OFILE)
+   getrlimit (RLIMIT_OFILE, &rl);
+#endif
+   l1 = rl.rlim_cur;
+   l2 = rl.rlim_max;
+
+   rl.rlim_cur = atol(Ulimit);
+   rl.rlim_max = atol(Ulimit);
+#if defined(RLIMIT_NOFILE)
+   if(setrlimit (RLIMIT_NOFILE, &rl) == -1) {
+#else #if defined(RLIMIT_OFILE)
+   if(setrlimit (RLIMIT_OFILE, &rl) == -1) {
+#endif
+      sprintf(msg,"setrlimit error - %s\n",strerror(errno));
+      debuga(msg);
+   }
+
+   if(debug) {
+      sprintf(msg,"Maximum file descriptor: cur=%ld max=%ld, changed to cur=%ld max=%ld",l1,l2,rl.rlim_cur,rl.rlim_max);
+      debuga(msg);
+   }
+
+   if(UserTabFile[0] != '\0') {
+      if(debug) {
+         sprintf(msg,"%s: %s",text[86],UserTabFile);
+         debuga(msg);
+      }
+      if((fp_usr=fopen(UserTabFile,"r"))==NULL) {
+        fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[45],UserTabFile,strerror(errno));
+        exit(1);
+      }
+      nreg = lseek(fileno(fp_usr), 0, SEEK_END);
+      lseek(fileno(fp_usr), 0, 0);
+      if((userfile=(char *) malloc(nreg+100))==NULL){
+         fprintf(stderr, "%s ERROR: %s",argv[0],text[87]);
+         exit(1);
+      }
+      bzero(userfile,nreg+100);
+      strncat(userfile,":",1);
+      z1=0;
+      z2=1;
+      while(fgets(buf,MAXLEN,fp_usr)!=NULL){
+        buf[strlen(buf)-1]='\0';
+        if(strstr(buf,"\r") != 0)
+           buf[strlen(buf)-1]='\0';
+        getword(bufy,buf,' ');
+        for(z1=0; z1<=strlen(bufy); z1++) {
+           userfile[z2]=bufy[z1];
+           z2++;
+        }
+        strncat(userfile,":",1);
+        for(z1=0; z1<=strlen(buf); z1++) {
+           userfile[z2]=buf[z1];
+           z2++;
+        }
+        strncat(userfile,":",1);
+      }
+      fclose(fp_usr);
+   }
+
+   sprintf ( sz_Download_Unsort , "%s/sarg/download.unsort", tmp);
+   bool_ShowReadStatistics = ( strcmp(ShowReadStatistics,"yes") == 0 ) ;
+
+   while(narq--) {
+      strcpy(arq,warq[iarq]);
+      iarq++;  
+
+   strcpy(arqtt,arq);
+   decomp(arq,zip,tmp);
+   if(debug) {
+      sprintf(msg, "%s: %s",text[7],arq);
+      debuga(msg);
+   }
+
+#if defined(HAVE_FOPEN64)
+   if((fp_in=(long)fopen64(arq,"r"))==NULL) {
+#else
+   if((fp_in=fopen(arq,"r"))==NULL) {
+#endif
+     fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[8],arq,strerror(errno));
+     exit(1);
+   }
+   fgets(bufz,sizeof(bufz),fp_in);
+   if(!isalog) {
+      if(strncmp(bufz,"#Software: Mic",14) == 0)
+         isalog++;
+   }
+   if(strncmp(bufz,"*** SARG Log ***",16) == 0) {
+      getword(val2,arqtt,'-');
+      getword(val2,arqtt,'_');
+      getword(val3,arqtt,'-');
+      getword(val3,arqtt,'_');
+      sprintf(periodo,"%s-%s",val2,val3);
+      sarglog=1;
+   } else lseek(fileno(fp_in), 0, 0);
+
+   if(strcmp(ParsedOutputLog, "no") != 0 && !sarglog) {
+      if(access(ParsedOutputLog,R_OK) != 0) {
+         sprintf(csort,"%s",ParsedOutputLog);
+         my_mkdir(csort);
+      }
+      sprintf(arq_log,"%s/sarg_temp.log",ParsedOutputLog);
+      if((fp_log=fopen(arq_log,"w"))==NULL) {
+        fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[8],arq_log,strerror(errno));
+        exit(1);
+      }
+      fputs("*** SARG Log ***\n",fp_log);
+   }
+
+   if(strstr(ReportType,"denied") != 0) {
+      if((fp_denied=fopen(tmp4,"w"))==NULL) {
+         fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[45],tmp4,strerror(errno));
+         exit(1);
+      }
+   }
+
+   if(DataFile[0]=='\0') {
+      if(strstr(ReportType,"denied") != 0 || strstr(ReportType,"auth_failures") != 0) {
+         if((fp_authfail=fopen(tmp6,"w"))==NULL) {
+            fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[45],tmp6,strerror(errno));
+            exit(1);
+         }
+      }
+   }
+
+   // pre-Read the file only if I have to show stats
+   if(bool_ShowReadStatistics) {
+      rewind(fp_in);
+      recs1=0;
+      recs2=0;
+      while( fgets(bufz,sizeof(bufz),fp_in) != NULL )
+         recs1++;
+      rewind(fp_in);
+
+      printf("SARG: Records in file: %d, reading: %3.2f%%\r",recs1,(float) 0);
+      fflush( stdout ) ;
+   }
+   
+    
+   while(fgets(bufz,sizeof(bufz),fp_in)!=NULL) {
+       recs2++;
+       if( bool_ShowReadStatistics && ! --OutputNonZero) {
+           perc = recs2 * 100 ;
+           perc = perc / recs1 ;
+          printf("SARG: Records in file: %d, reading: %3.2f%%\r",recs1,perc);
+           fflush (stdout);
+           OutputNonZero = REPORT_EVERY_X_LINES ;
+        }
+        if(strlen(bufz) > MAXLEN-1) continue;
+        if(!bufz[0]) continue;
+        if(strstr(bufz,"HTTP/0.0") != 0) continue;
+        if(strstr(bufz,"logfile turned over") != 0) continue;
+        if(bufz[0] == ' ') continue;
+        if(strlen(bufz) < 58) continue;
+
+        // Record only hours usage which is required
+        tt = (time_t) strtoul( bufz, NULL, 10 );
+        t = localtime( &tt );
+
+        if( bsearch( &( t -> tm_wday ), weekdays.list, weekdays.len,
+                                        sizeof( int ), compar ) == NULL )
+          continue;
+
+        if( bsearch( &( t -> tm_hour ), hours.list, hours.len,
+                                        sizeof( int ), compar ) == NULL )
+          continue;
+
+        // exclude_string
+        exstring=0;
+        if(strlen(ExcludeString) > 0) {
+           strcpy(warea,bufz);
+           strcpy(html,ExcludeString);
+           while(strstr(html,":") != 0) {
+              getword(val1,html,':');
+              if((str=(char *) strstr(warea,val1)) != (char *) NULL )
+                 exstring++;
+           }
+           if((str=(char *) strstr(warea,html)) != (char *) NULL )
+                 exstring++;
+        }
+        if(exstring) continue;
+
+        strcpy(bufy,bufz);
+        if ((str = strchr(bufz, '\n')) != NULL)
+           *str = '\0';          /* strip \n */       
+
+        totregsl++;
+        common=0;
+        if(debugm)
+                  printf("BUF=%s\n",bufz);
+
+        if(!sarglog && !isalog) {
+           getword(data,bufz,' ');
+           if((str=(char *) strstr(data, ".")) != (char *) NULL ) {
+              if((str=(char *) strstr(str+1, ".")) != (char *) NULL ) {
+                 strcpy(ip,data);
+                        strcpy(elap,"0");
+                getword(user,bufz,' ');
+                getword(none,bufz,' ');
+                getword(data,bufz,']');
+                getword(fun,bufz,'"');
+                getword(fun,bufz,' ');
+                getword(url,bufz,' ');
+                 getword(code2,bufz,' ');
+                 getword(code2,bufz,' ');
+                 getword(tam,bufz,' ');
+                 if((str=(char *) strstr(bufz, " ")) != (char *) NULL )
+                    getword(code,bufz,' ');
+                 else strcpy(code,bufz);
+
+                 if ((str = strchr(code, ':')) != NULL)
+                    *str = '/'; 
+
+                if(strcmp(tam,"\0") == 0)
+                   strcpy(tam,"0");
+
+                common++;
+                common_log=1;
+             }
+          }
+
+          if(!common) {
+             getword(elap,bufz,' ');
+             while(strcmp(elap,"") == 0)
+                getword(elap,bufz,' ');
+             getword(ip,bufz,' ');
+             getword(code,bufz,' ');
+             getword(tam,bufz,' ');
+             getword(fun,bufz,' ');
+             getword(url,bufz,' ');
+             getword(user,bufz,' ');
+             squid_log=1;
+          }
+        } else if(!isalog) {
+          getword(data,bufz,' ');
+          getword(hora,bufz,' ');
+          getword(user,bufz,' ');
+          getword(ip,bufz,' ');
+          getword(url,bufz,' ');
+          getword(tam,bufz,' ');
+          getword(code,bufz,' ');
+          getword(elap,bufz,' ');
+          getword(smartfilter,bufz,' ');
+        } else if(isalog) {
+           if(!i0) {
+              getword(val1,bufz,' ');
+              while(strstr(bufz,"\t") != 0) {
+                 getword(val1,bufz,'\t');
+                 i0++;
+                 if(strcmp(val1,"c-ip") == 0) i1=i0;
+                 if(strcmp(val1,"cs-username") == 0) i2=i0;
+                 if(strcmp(val1,"date") == 0) i3=i0;
+                 if(strcmp(val1,"time") == 0) i4=i0;
+                 if(strcmp(val1,"time-taken") == 0) i5=i0;
+                 if(strcmp(val1,"sc-bytes") == 0) i6=i0;
+                 if(strcmp(val1,"cs-uri") == 0) i7=i0;
+                 if(strcmp(val1,"sc-status") == 0) i8=i0;
+              }
+           }
+           fgets(bufz,sizeof(bufz),fp_in);
+           strcpy(val1,bufz);
+           for(x=0; x<=i1-1; x++) getword3(ip,val1,'\t');
+           strcpy(val1,bufz);
+           for(x=0; x<=i2-1; x++) getword3(user,val1,'\t');
+           strcpy(val1,bufz);
+           for(x=0; x<=i3-1; x++) getword3(data,val1,'\t');
+           strcpy(val1,bufz);
+           for(x=0; x<=i4-1; x++) getword3(hora,val1,'\t');
+           strcpy(val1,bufz);
+           for(x=0; x<=i5-1; x++) getword3(elap,val1,'\t');
+           strcpy(val1,bufz);
+           for(x=0; x<=i6-1; x++) getword3(tam,val1,'\t');
+           strcpy(val1,bufz);
+           for(x=0; x<=i7-1; x++) getword3(url,val1,'\t');
+           strcpy(val1,bufz);
+           for(x=0; x<=i8-1; x++) getword3(code,val1,'\t');
+           
+           if(strcmp(code,"401") == 0 || strcmp(code,"403") == 0 || strcmp(code,"407") == 0) {
+              sprintf(val1,"DENIED/%s",code);
+              strcpy(code,val1);
+           }
+           getword(ano,data,'-');
+           getword(mes,data,'-');
+           strcpy(dia,data);
+           conv_month_name(mes);
+           sprintf(data," %s/%s/%s:%s",dia,mes,ano,hora);
+        }
+
+       // include_users
+       if(strlen(IncludeUsers) > 0) {
+           sprintf(val1,":%s:",user);
+           if((str=(char *) strstr(IncludeUsers,val1)) == (char *) NULL )
+              continue;
+       }
+
+        if(excode) {
+           if(vercode(code)) {
+              totregsx++;
+              continue;
+           }
+        }
+
+        if(testvaliduserchar(user))
+          continue;
+
+        while(strstr(user,"%5c") != 0 || strstr(user,"%20") != 0) {
+           getword(w,user,'%');
+           strcpy(wuser,user+2);
+           sprintf(user,"%s.%s",w,wuser);
+        }
+
+       str=user;
+       for(z1=0; z1<strlen(str); z1++) {
+          if(isalnum(str[z1]) || ispunct(str[z1])) {
+          if(str[z1]=='?' || str[z1]=='.' || str[z1]==':' || str[z1]=='/' || str[z1]=='\\')
+             str[z1]='_';
+          }
+       }
+
+        strlow(user);
+        if(strncmp(NtlmUserFormat,"user",4) == 0) {
+           if(strstr(user,"_") != 0)
+              getword(warea,user,'_');  
+        }
+
+        if(strstr(ReportType,"denied") != 0)
+           strcpy(urly,url);
+
+        if(strlen(DownloadSuffix)) {
+           suffix[0]='\0';
+           download_flag=0;
+           if(strncmp(url+strlen(url)-4,".",1) == 0)
+              strcpy(suffix,url+strlen(url)-3);
+           else strcpy(suffix,url+strlen(url)-4);
+           if(strstr(DownloadSuffix,suffix) != 0) {
+              strcpy(download_url,url);
+              download_flag=1;
+              download_count++;
+           }
+        }
+         
+        if (strchr(url,'/')) {
+           getword(w,url,'/');
+           getword(w,url,'/');
+        }
+
+        if(strcmp(LongUrl,"no") == 0) {
+           getword(w,url,'/');
+           strcpy(url,w);
+        }
+
+        if(!sarglog) {
+           if(!common && !isalog) {
+              tt=atoi(data);
+              t=localtime(&tt);
+
+              strftime(tbuf2, 127, "%H%M", t);
+              if(strncmp(df,"u",1) == 0)
+                strftime(tbuf, 127, "%Y%b%d", t);
+              if(strncmp(df,"e",1) == 0)
+                strftime(tbuf, 127, "%d%b%Y", t);
+              if(strncmp(df,"w",1) == 0)
+                strftime(tbuf, 127, "%Y.%U", t);
+
+              strftime(dia, 127, "%d/%m/%Y", t);
+              strftime(wdata, 127, "%Y%m%d", t);
+          
+              idata=atoi(wdata);
+
+              if(strncmp(df,"u",1)==0)
+                 strftime(dia, 127, "%m/%d/%Y", t);
+              sprintf(hora,"%02d:%02d:%02d",t->tm_hour,t->tm_min,t->tm_sec);
+           } else {
+             strcpy(wtemp,data+1);
+             getword(data,wtemp,':');
+             getword(hora,wtemp,' ');
+             getword(dia,data,'/');
+             getword(mes,data,'/');
+             getword(ano,data,'/');
+
+              if(strcmp(df,"u") == 0)
+                sprintf(tbuf,"%s%s%s",ano,mes,dia);
+              if(strcmp(df,"e") == 0)
+                sprintf(tbuf,"%s%s%s",dia,mes,ano);
+             builddia(dia,mes,ano,df,wdata);
+              idata=atoi(wdata);
+          }
+        } else {
+          getword(mes,data,'/');
+          getword(dia,data,'/');
+          strcpy(ano,data);
+        }
+
+        if(debugm)
+           printf("DATE=%s IDATA=%d DFROM=%d DUNTIL=%d\n",date,idata,dfrom,duntil);
+
+        l=1;
+        if(strlen(us)>0){
+          if(strcmp(user,us)==0)
+             l=1;else l=0;
+       }
+           
+        if(l){
+           if(strlen(addr)>0){
+             if(strcmp(addr,ip)==0)
+                l=1;else l=0;
+          }
+           if(fhost) {
+              l=vhexclude(excludefile,ip);
+              if(l) l=vhexclude(excludefile,url);
+              if(!l)
+                totregsx++;
+           }
+        }
+
+        if(l){
+           if(strlen(date) > 0){
+              if(idata >= dfrom && idata <= duntil)
+                l=1;else l=0;
+          }
+        }
+        if(l){
+           if(strlen(hm)>0) {
+              strcpy(whm,hora);
+              bzero(hmr,15);
+              chm++;
+              while(chm) {
+                 getword(warea,whm,':');
+                 strncat(hmr,warea,2);
+                 chm--;
+              }
+              strncat(hmr,whm,2);
+
+             if(atoi(hmr) >= atoi(hm) && atoi(hmr) <= atoi(hmf))
+                l=1;else l=0;
+          }
+        }
+        if(l){
+           if(strlen(site)>0){
+             if(strstr(url,site)!=0)
+                l=1;else l=0;
+          }
+        }
+
+        if(userip)
+           strcpy(user,ip);
+
+        if(strcmp(user,"-") == 0 || strcmp(user," ") == 0 || strcmp(user,"") == 0) {
+           if(strcmp(RecordsWithoutUser,"ip") == 0)
+             strcpy(user,ip);
+           if(strcmp(RecordsWithoutUser,"ignore") == 0)
+             continue;
+           if(strcmp(RecordsWithoutUser,"everybody") == 0)
+             strcpy(user,"everybody");
+        }
+
+        if(puser) {
+           sprintf(wuser,":%s:",user);
+           if(strstr(userfile, wuser) == 0)
+              continue;
+        }
+        
+        if(l) {
+           if(fuser) {
+              l=vuexclude(excludeuser,user);
+              if(!l)
+                totregsx++;
+           }
+        }
+
+        if(l) {
+           if(userip)
+              fixip(user);
+        }
+
+        if(l&&max_elapsed) {
+           if(atol(elap)>max_elapsed) {
+              elap[0]='0';
+              elap[1]='\0';
+           }
+        }
+
+        if(l) {
+          if(strcmp(user,"-") !=0 && strlen(url) > 0 && strcmp(user," ") !=0 && strcmp(user,"") !=0 && strcmp(user,":") !=0){
+              if((str=(char *) strstr(bufz, "[SmartFilter:")) != (char *) NULL ) {
+                 str[strlen(str)-1]='\0';
+                 sprintf(smartfilter,"\"%s\"",str+1);
+              } else sprintf(smartfilter,"\"\"");
+
+              sprintf(bufz, "%s %s %s %s %s %s %s %s %s\n",dia,hora,user,ip,url,tam,code,elap,smartfilter);
+
+#ifdef LEGACY_WRITE_USER
+              sprintf(tmp3,"%s/sarg/%s.unsort",tmp,user);
+#if defined(HAVE_FOPEN64)
+              if((fp_ou=fopen64(tmp3,"a"))==NULL) {
+#else
+              if((fp_ou=fopen(tmp3,"a"))==NULL) {
+#endif
+                fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[9],tmp3,strerror(errno));
+                exit(1);
+              }
+              fputs(bufz,fp_ou);
+
+#else
+                  if ( strcmp ( user , sz_Last_User ) != 0 ) {
+                        if ( fp_Write_User )
+                                fclose( fp_Write_User ) ;
+                        sprintf (tmp3, "%s/sarg/%s.unsort", tmp, user);
+
+#if defined(HAVE_FOPEN64)
+                        if ((fp_Write_User = fopen64 (tmp3, "a")) == NULL) {
+#else
+                        if ((fp_Write_User = fopen (tmp3, "a")) == NULL) {
+#endif
+                              fprintf (stderr, "%s: (log) %s: %s - %s\n", argv[0], text[9], tmp3, strerror(errno));
+                                exit (1);
+                        }
+                        strcpy( sz_Last_User , user ) ;
+                  }
+                  fputs (bufz, fp_Write_User);
+#endif
+
+              if(strcmp(ParsedOutputLog, "no") != 0 && !sarglog)
+                 fputs(bufz,fp_log);
+
+#ifdef LEGACY_WRITE_USER
+              fclose(fp_ou);
+#endif
+             totregsg++;
+
+              if(download_flag) {
+                 sprintf(bufz, "%s %s %s %s %s\n",dia,hora,user,ip,download_url);
+
+#ifdef LEGACY_WRITE_DOWNLOAD
+                 sprintf(tmp3,"%s/sarg/download.unsort",tmp);
+#if defined(HAVE_FOPEN64)
+                 if((fp_ou=fopen64(tmp3,"a"))==NULL) {
+#else
+                 if((fp_ou=fopen(tmp3,"a"))==NULL) {
+#endif
+                    fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[9],tmp3,strerror(errno));
+                    exit(1);
+                 }
+                 fputs(bufz,fp_ou);
+                 fclose(fp_ou);
+#else
+                 if ( ! fp_Download_Unsort ) {
+#if defined(HAVE_FOPEN64)
+                      if ((fp_Download_Unsort = fopen64 ( sz_Download_Unsort, "a")) == NULL) {
+#else
+                      if ((fp_Download_Unsort = fopen (sz_Download_Unsort, "a")) == NULL) {
+#endif
+                          fprintf (stderr, "%s: (log) %s: %s - %s\n", argv[0], text[9], tmp3, strerror(errno));
+                          exit (1);
+                      }
+                 }
+                 fputs (bufz, fp_Download_Unsort);
+#endif
+              }
+
+              if(strstr(ReportType,"denied") != 0 || strstr(ReportType,"auth_failures") != 0) {
+                 if(strstr(code,"DENIED/403") != 0) {
+                    sprintf(bufz, "%s %s %s %s %s\n",dia,hora,user,ip,urly);
+                    fputs(bufz,fp_denied);
+                    denied_count++;
+                 }
+                 if(strstr(code,"DENIED/401") != 0 || strstr(code,"DENIED/407") != 0) {
+                    sprintf(bufz, "%s %s %s %s %s\n",dia,hora,user,ip,urly);
+                    if(fp_authfail)
+                       fputs(bufz,fp_authfail);
+                    authfail_count++;
+                 }
+              }
+       
+              if(!totper && !sarglog){
+                totper++;
+                 sprintf(periodo,"%s-",tbuf);
+                 sprintf(per_hour,"%s-",tbuf2);
+                 if(strlen(date)>0)
+                    fixper(tbuf, periodo, cduntil);
+                 if(debugz){
+                    debugaz("tbuf",tbuf);
+                    debugaz("periodo",periodo);
+                 }
+             }
+           }
+
+           if(debugm){
+              printf("IP=\t%s\n",ip);
+              printf("USER=\t%s\n",user);
+              printf("ELAP=\t%s\n",elap);
+              printf("DATE=\t%s\n",dia);
+              printf("TIME=\t%s\n",hora);
+              printf("FUNC=\t%s\n",fun);
+              printf("URL=\t%s\n",url);
+              printf("CODE=\t%s\n",code);
+              printf("LEN=\t%s\n",tam);
+          }
+        }
+      }
+      if( bool_ShowReadStatistics )
+        printf("SARG: Records in file: %d, reading: %3.2f%%\n",recs1, (float) 100 );
+   }
+
+   if ( fp_Download_Unsort ) 
+     fclose (fp_Download_Unsort);
+
+   if (fp_Write_User) 
+     fclose (fp_Write_User);
+
+   if(debug) {
+      sprintf(msg, "   %s: %ld, %s: %ld, %s: %ld",text[10],totregsl,text[11],totregsg,text[68],totregsx);
+      debuga(msg);
+  
+      if((common_log) && (squid_log))
+         debuga(text[12]);
+  
+      if((common_log) && (!squid_log)) 
+         debuga(text[13]);
+      if((!common_log) && (squid_log))
+         debuga(text[14]);
+
+      if(sarglog)
+         debuga(text[124]);
+      if((!common_log) && (!squid_log) && (!sarglog) && (!isalog)) {
+         if(!totregsg) {
+            fprintf(stderr, "SARG: %s\n",text[16]);
+            fprintf(stderr, "SARG: %s\n",text[21]);
+        } else fprintf(stderr, "SARG: %s\n",text[15]);
+         bzero(msg,sizeof(msg));
+         fclose(fp_in);
+//         fclose(fp_ou);
+         if(fp_denied)
+            fclose(fp_denied);
+         if(fp_authfail)
+            fclose(fp_authfail);
+         if(tmp4)
+            unlink(tmp4);
+         if(tmp6)
+            unlink(tmp6);
+         unlink(tmp3);
+         exit(0);
+      }
+   }
+   if(!totregsg){
+      fprintf(stderr, "SARG: %s\n",text[16]);
+      fprintf(stderr, "SARG: %s\n",text[21]);
+      fclose(fp_in);
+//      fclose(fp_ou);
+      if(fp_denied)
+         fclose(fp_denied);
+      if(fp_authfail)
+         fclose(fp_authfail);
+      exit(0);
+   }
+
+   if(date[0] == '\0' && !sarglog) {
+      strcat(periodo,tbuf);
+      strcat(per_hour,tbuf2);
+   }
+
+   if(debugz){
+      debugaz("data",dia);
+      debugaz("tbuf",tbuf);
+      debugaz("periodo",periodo);
+   }
+
+   if(debug){
+     sprintf(msg, "%s: %s",text[17],periodo);
+     debuga(msg);
+   }
+
+   fclose(fp_in);
+//   fclose(fp_ou);
+   if(fp_denied)
+      fclose(fp_denied);
+   if(fp_authfail)
+      fclose(fp_authfail);
+
+   if(strcmp(ParsedOutputLog, "no") != 0 && !sarglog) {
+      fclose(fp_log); 
+      strcpy(val1,periodo);
+      getword(val2,val1,'-');
+      getword(val3,per_hour,'-');
+      sprintf(val4,"%s/sarg-%s_%s-%s_%s.log",ParsedOutputLog,val2,val3,val1,per_hour);
+      rename(arq_log,val4);
+      strcpy(arq_log,val4);
+
+      if(strcmp(ParsedOutputLogCompress,"nocompress") != 0) {
+         sprintf(val1,"%s %s",ParsedOutputLogCompress,arq_log);
+         system(val1);
+      }
+
+      if(debug) {
+         sprintf(msg,"%s %s",text[123],arq_log);
+         debuga(msg);
+      }
+   }
+   sort_users_log(tmp, debug);
+
+   if(strstr(ReportType,"denied") != 0) {
+      sprintf(csort,"sort -T %s -k 3,3 -k 5,5 -o %s %s",tmp,tmp5,tmp4);
+      system(csort);
+      unlink(tmp4);
+   }
+
+   report_gen:
+   if(strlen(DataFile) > 0)
+      data_file(tmp);
+   else
+      gerarel();
+
+   unlink(tmp2);
+   if(strstr(ReportType,"denied") != 0)
+      unlink(tmp5);
+   if((strlen(zip) > 0 && strcmp(zip,"zcat") !=0)) {
+      recomp(arq, zip); }
+//   else  unlink(arq);
+
+   if(debug)
+      debuga(text[21]);
+
+   sprintf(csort,"rm -rf %s",tmp);
+   system(csort);
+
+   exit(0);
+
+}
+
+
+void getusers(char *pwdfile, int debug)
+{
+
+   FILE *fp_usr;
+   char buf[255];
+   char Msg[255];
+   char user[255];
+   unsigned long int nreg=0;
+
+   if(debug) {
+      sprintf(Msg,"%s: %s",text[60],pwdfile);
+      debuga(Msg);
+   }
+
+   if ((fp_usr = fopen(pwdfile, "r")) == NULL) {
+      fprintf(stderr, "SARG: (getusers) %s: %s - %s\n",text[45],pwdfile,strerror(errno));
+      exit(1);
+   }
+
+   nreg = lseek(fileno(fp_usr), (off_t)0, SEEK_END);
+   nreg = nreg+5000; 
+   lseek(fileno(fp_usr), (off_t)0, 0);
+
+   if((userfile=(char *) malloc(nreg))==NULL){
+      fprintf(stderr, "SARG: %s (%ld):\n",text[59],nreg);
+      exit(1);
+   }
+
+   bzero(userfile,nreg);
+   sprintf(userfile,":");
+
+   while(fgets(buf,255,fp_usr)!=NULL){
+     getword(user,buf,':');
+     strncat(userfile,user,strlen(user));
+     strncat(userfile,":",1);
+   }
+
+   fclose(fp_usr);
+
+   return;
+}
+
+
+void gethexclude(char *hexfile, int debug)
+{
+
+   FILE *fp_ex;
+   char buf[255];
+   char Msg[255];
+   unsigned long int nreg=0;
+
+   if(debug) {
+      sprintf(Msg,"%s: %s",text[67],hexfile);
+      debuga(Msg);
+   }
+
+   if ((fp_ex = fopen(hexfile, "r")) == NULL) {
+      fprintf(stderr, "SARG: (gethexclude) %s: %s - %s\n",text[45],hexfile,strerror(errno));
+      exit(1);
+   }
+
+   nreg = lseek(fileno(fp_ex), (off_t)0, SEEK_END);
+   lseek(fileno(fp_ex), (off_t)0, 0);
+
+   if((excludefile=(char *) malloc(nreg+11))==NULL){
+      fprintf(stderr, "SARG: %s (%ld):\n",text[59],nreg);
+      exit(1);
+   }
+
+   bzero(excludefile,nreg+11);
+
+   while(fgets(buf,255,fp_ex)!=NULL){
+     if(strstr(buf,"#") != 0)
+        continue;
+     buf[strlen(buf)-1]='\0';
+     strcat(excludefile,buf);
+     strcat(excludefile," ");
+   }
+
+   strcat(excludefile,"*FIM* ");
+
+   fclose(fp_ex);
+
+   return;
+}
+
+
+void getuexclude(char *uexfile, int debug)
+{
+
+   FILE *fp_ex;
+   char buf[255];
+   char Msg[255];
+   unsigned long int nreg=0;
+
+   if(debug) {
+      sprintf(Msg,"%s: %s",text[67],uexfile);
+      debuga(Msg);
+   }
+
+   if ((fp_ex = fopen(uexfile, "r")) == NULL) {
+      fprintf(stderr, "SARG: (gethexclude) %s: %s - %s\n",text[45],uexfile,strerror(errno));
+      exit(1);
+   }
+
+   nreg = lseek(fileno(fp_ex), (off_t)0, SEEK_END);
+   lseek(fileno(fp_ex), (off_t)0, 0);
+
+   if((excludeuser=(char *) malloc(nreg+11))==NULL){
+      fprintf(stderr, "SARG: %s (%ld):\n",text[59],nreg);
+      exit(1);
+   }
+
+   bzero(excludeuser,nreg+11);
+
+   while(fgets(buf,255,fp_ex)!=NULL){
+     if(strstr(buf,"#") != 0)
+        continue;
+     buf[strlen(buf)-1]='\0';
+     strcat(excludeuser,buf);
+     strcat(excludeuser," ");
+   }
+
+   strcat(excludeuser,"*FIM* ");
+
+   fclose(fp_ex);
+
+   return;
+}
diff --git a/patches/oleg b/patches/oleg
new file mode 100644 (file)
index 0000000..1c798f3
--- /dev/null
@@ -0,0 +1,541 @@
+From xsov@mail.ru Sun Apr 24 16:42:06 2005
+Received: 194.67.23.121 / smx1.brturbo.com
+Received: from [212.48.203.89] (port=1505 helo=[192.168.0.77]) by
+       mx1.mail.ru with asmtp  id 1DPgEw-0006L9-00 for orso@brturbo.com; Sun, 24
+       Apr 2005 16:29:35 +0400
+From: Oleg <xsov@mail.ru>
+To: Pedro Lineu Orso <orso@brturbo.com>
+Subject: sarg-2.0.6 new patches
+Date: Sun, 24 Apr 2005 16:42:06 +0400
+User-Agent: KMail/1.7.2
+MIME-Version: 1.0
+Content-Type: Multipart/Mixed; boundary="Boundary-00=_eQ5aCJp/CximSea"
+Message-Id: <200504241642.06841.xsov@mail.ru>
+X-Evolution-Source: pop://orso@pop.brturbo.com
+
+
+--Boundary-00=_eQ5aCJp/CximSea
+Content-Type: text/plain; charset="koi8-r"
+Content-Disposition: inline
+Content-Transfer-Encoding: 8bit
+
+     Good day, Pedro!
+
+ Again me :-) I just make some new good patches for sarg and review my old 
+patches to sarg, so there is:
+
+1) CONTRIBUTORS.patch:
+Look at the CONTRIBUTORS file, there is two equal lines about Evren Yurtesen 
+<yurtesen@ispro.net.tr>, I just remove first one, the second (equal to first) 
+is here, on place.
+
+2) grepday.patch:
+I add internationalisation of SARG user graph by using iconv function, which 
+is presented only in Linux, so I add required #ifdef and other stuff to clean 
+compile code on other platforms.
+
+3) htmllogreport.patch:
+Fixed two issues:
+- '?' symbol problems for apache and other cgi-supporting web server which 
+doesn't support '?' symbol in links (all of them interprete this like 
+parameter to cgi script);
+- some good optimization to all three similar cicles in these files by 
+reducing false checks in 'if ...' strings.
+
+4) index.patch:
+Fixes segfault, produced by inproper use of strncpy functions, look - strncpy 
+doesn't copy leading '\0' symbol!
+
+5) repday.patch:
+Just localisation support for this type of report, patch is simple, just look 
+at it.
+
+6) siteuser.patch:
+Support usertab IP->USERNAME change in siteuser report, which was removed 
+prior to sarg-2.0.0 versions.
+WARNING: I'm not sure about bugs in this patch, but must warn you, that we 
+don't heavily test this patch in other configurations!
+
+7) Russian_koi8.patch:
+Just proper Russian koi8 localisation, believe me, it is good enought, because 
+I'm russian :-)
+
+Pedro, can you tell which my patches you will include in next sarg release? 
+None of all previous sended to you my patches was included in sarg 
+releases ... :-(
+
+And one bugreport:
+SARG version: 2.0.6 (clean, downloaded from sf.net, without any additional 
+patches)
+OS: Linux Slackware 10.1
+Reproduction of bug:
+tar xvfz sarg-2.0.6.tar.gz
+cd sarg-2.0.6
+autoconf
+./configure
+make
+gcc -c -I.  -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" 
+-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_DIRENT_H=1 
+-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 
+-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 
+-DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 
+-DHAVE_STRING_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_TIME_H=1 
+-DHAVE_UNISTD_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_NETDB_H=1 
+-DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_NETINET_IN_H=1 
+-DHAVE_SYS_STAT_H=1 -DHAVE_CTYPE_H=1 -DHAVE_GD_H=1 -DHAVE_GDFONTL_H=1 
+-DHAVE_GDFONTT_H=1 -DHAVE_GDFONTS_H=1 -DHAVE_GDFONTMB_H=1 -DHAVE_GDFONTG_H=1 
+-DHAVE_ERRNO_H=1 -DHAVE_FOPEN64=1   -g -O2 -w -DBINDIR=\"/usr/bin\" 
+-DSYSCONFDIR=\"/usr/local/sarg\" -DHTMLDIR=\"/var/www/html\" log.c
+log.c: In function `main':
+log.c:127: error: storage size of 'rl' isn't known
+log.c:668: error: `RLIMIT_OFILE' undeclared (first use in this function)
+log.c:668: error: (Each undeclared identifier is reported only once
+log.c:668: error: for each function it appears in.)
+make: *** [log.o] Error 1
+
+Best regards,
+Sapon Oleg,
+RusBusinessSecurity Co. Ltd.
+
+--Boundary-00=_eQ5aCJp/CximSea
+Content-Type: text/x-diff; charset="koi8-r"; name="CONTRIBUTORS.patch"
+Content-Disposition: attachment; filename="CONTRIBUTORS.patch"
+Content-Transfer-Encoding: 8bit
+
+diff -ru sarg-2.0.6/CONTRIBUTORS sarg-2.0.6rbs/CONTRIBUTORS
+--- sarg-2.0.6/CONTRIBUTORS    2004-11-22 16:37:02.000000000 +0300
++++ sarg-2.0.6rbs/CONTRIBUTORS 2004-11-25 03:05:24.000000000 +0300
+@@ -10,7 +10,6 @@
+ Dima I. Allaverdov <allav@ur.rags.ru>
+ Eugeny Kuzakov <CoreDumped@CoreDumped.null.ru>
+ Evren Yurtesen <yurtesen@ispro.net.tr>
+-Evren Yurtesen <yurtesen@ispro.net.tr>
+ Hanni Daniel <daniel.haenni@softlab.ch>
+ Ilya V. Komarov <mur@mur.lynx.ru>
+ Jose Luiz <jluiz@projesom.com.br>
+
+--Boundary-00=_eQ5aCJp/CximSea
+Content-Type: text/x-diff; charset="koi8-r"; name="grepday.patch"
+Content-Disposition: attachment; filename="grepday.patch"
+Content-Transfer-Encoding: 8bit
+
+diff -ur sarg-2.0.6/configure.in sarg-2.0.6rbs/configure.in
+--- sarg-2.0.6/configure.in    2005-02-21 21:13:21.000000000 +0300
++++ sarg-2.0.6rbs/configure.in 2005-04-24 15:31:31.000000000 +0400
+@@ -40,7 +40,7 @@
+ AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \
+                dirent.h sys/socket.h netdb.h arpa/inet.h sys/types.h netinet/in.h sys/stat.h \
+-               ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h errno.h)
++               ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h errno.h)
+ AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="")
+diff -ur sarg-2.0.6/grepday.c sarg-2.0.6rbs/grepday.c
+--- sarg-2.0.6/grepday.c       2005-04-23 02:27:48.000000000 +0400
++++ sarg-2.0.6rbs/grepday.c    2005-04-24 15:34:19.000000000 +0400
+@@ -36,6 +36,38 @@
+ char *font1 = SYSCONFDIR"/fonts/Verdana.TTF";
+ char s[15];
++#ifdef HAVE_ICONV_H
++#include <iconv.h>
++#define SARGgdImageStringFT I18NgdImageStringFT
++
++BGD_DECLARE(char *) I18NgdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
++                         double ptsize, double angle, int x, int y,
++                                                 char *string)
++{
++ iconv_t localtoutf;
++ char *sstring, *str, *sstr, *retval;
++ size_t slen, sslen;
++
++ slen = strlen(string) + 1; // We must include string termination character
++ sslen = slen * 2;          // We assume that UTF8 maximum 2 times large than local
++ sstring = (char *)malloc(sslen);
++
++ str = (char *) string;
++ sstr = (char *) sstring;
++
++ localtoutf = iconv_open ("UTF-8", CharSet);
++ iconv (localtoutf, &str, &slen, &sstr, &sslen);
++ iconv_close (localtoutf);
++
++ retval = gdImageStringFTEx (im, brect, fg, fontlist, ptsize, angle, x, y, sstring, gdFTEX_Unicode);
++ free(sstring);
++
++ return retval;
++}
++#else
++#define SARGgdImageStringFT gdImageStringFT
++#endif
++
+ void *bar(long long int *n)
+ {     
+ #ifdef HAVE_GD
+@@ -173,7 +205,7 @@
+    snprintf(v,6,"%s",fixnum(num,0));
+-   gdImageStringFT(im,&brect[0],black,font1,5,0.0,x1-1,val-12,v);
++   SARGgdImageStringFT(im,&brect[0],black,font1,5,0.0,x1-1,val-12,v);
+    
+    points[0].x = x1+17;
+    points[0].y = val-5;
+@@ -270,7 +302,7 @@
+    y=65;
+    for(x=1; x<=31; x++) {
+       sprintf(s,"%02d",x);
+-      gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,y,437,s);
++      SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,y,437,s);
+       y=y+20;
+    }
+@@ -281,51 +313,51 @@
+    if(strcmp(DateFormat,"e") == 0)
+       strftime(ftime, 127, "%d/%b/%Y-%H:%M", local);
+-   gdImageStringFT(im,&brect[0],darkblue,font1,6,0.0,620,470,ftime);
+-   gdImageStringFT(im,&brect[0],darkblue,font1,9,0.0,257,15,"SARG, ");
+-   gdImageStringFT(im,&brect[0],darkblue,font1,9,0.0,300,15,Title);
++   SARGgdImageStringFT(im,&brect[0],darkblue,font1,6,0.0,620,470,ftime);
++   if(strcmp(ShowSargInfo,"yes") == 0) SARGgdImageStringFT(im,&brect[0],darkblue,font1,9,0.0,257,15,"SARG, ");
++   SARGgdImageStringFT(im,&brect[0],darkblue,font1,9,0.0,300,15,Title);
+    sprintf(warea,"%s: %s",text[89],periodo);
+-   gdImageStringFT(im,&brect[0],darkblue,font1,7,0.0,300,27,warea);
++   SARGgdImageStringFT(im,&brect[0],darkblue,font1,7,0.0,300,27,warea);
+    sprintf(warea,"%s: %s",text[90],name);
+-   gdImageStringFT(im,&brect[0],darkblue,font1,7,0.0,300,38,warea);
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,418,"  50K");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,408,"250K");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,398,"500K");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,388,"   1M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,378,"   2M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,368,"   3M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,358,"   4M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,348,"   5M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,338,"   6M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,328,"   7M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,318,"   8M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,308,"   9M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,298," 10M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,288," 15M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,278," 20M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,268," 30M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,258," 40M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,248," 50M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,238," 60M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,228," 70M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,218," 80M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,208," 90M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,198,"100M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,188,"200M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,178,"300M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,168,"400M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,158,"500M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,148,"600M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,138,"700M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,128,"800M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,118,"900M");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,108,"   1G");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 98,"   2G");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 88,"   3G");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 78,"   4G");
+-   gdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 68,"   5G");
+-   gdImageStringFT(im,&brect[0],black,font1,10,3.14/2,20,248,text[93]);
+-   gdImageStringFT(im,&brect[0],black,font1,10,0.0,330,460,text[127]);
++   SARGgdImageStringFT(im,&brect[0],darkblue,font1,7,0.0,300,38,warea);
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,418,"  50K");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,408,"250K");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,398,"500K");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,388,"   1M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,378,"   2M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,368,"   3M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,358,"   4M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,348,"   5M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,338,"   6M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,328,"   7M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,318,"   8M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,308,"   9M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,298," 10M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,288," 15M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,278," 20M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,268," 30M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,258," 40M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,248," 50M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,238," 60M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,228," 70M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,218," 80M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,208," 90M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,198,"100M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,188,"200M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,178,"300M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,168,"400M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,158,"500M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,148,"600M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,138,"700M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,128,"800M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,118,"900M");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23,108,"   1G");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 98,"   2G");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 88,"   3G");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 78,"   4G");
++   SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 68,"   5G");
++   SARGgdImageStringFT(im,&brect[0],black,font1,10,3.14/2,20,248,text[93]);
++   SARGgdImageStringFT(im,&brect[0],black,font1,10,0.0,330,460,text[127]);
+  
+    sprintf(graph,"%s/%s/graph_day.png",dirname,user);
+    sprintf(wdirname,"%s/%s.day",tmp,user);
+
+--Boundary-00=_eQ5aCJp/CximSea
+Content-Type: text/x-diff; charset="koi8-r"; name="htmllogreport.patch"
+Content-Disposition: attachment; filename="htmllogreport.patch"
+Content-Transfer-Encoding: 8bit
+
+diff -ur sarg-2.0.6/html.c sarg-2.0.6rbs/html.c
+--- sarg-2.0.6/html.c  2005-04-23 02:27:48.000000000 +0400
++++ sarg-2.0.6rbs/html.c       2005-04-24 15:58:36.000000000 +0400
+@@ -349,23 +349,11 @@
+                for(s=ltext110; *s; ++s)
+                   *s=tolower(*s);
+             }
+-            z1=0;
+-            z2=0;
+-            strcpy(siteind,url);
++            strcpy(siteind,urly);
+             str=siteind;
+-            for(z1=0; z1<=strlen(str); z1++) {
+-               if(str[z1]=='-')
++            for(z1=0; z1<strlen(str); z1++) {
++             if(str[z1]=='?' || str[z1]=='-' || str[z1]=='.' || str[z1]==':' || str[z1]=='/' || str[z1]=='\\')
+                   str[z1]='_';
+-               if(str[z1]=='.')
+-                  str[z1]='_';
+-               if(str[z1]==':')
+-                  str[z1]='_';
+-               if(str[z1]=='/')
+-                  str[z1]='_';
+-               if(str[z1]=='\\')
+-                  str[z1]='_';
+-               siteind[z2]=str[z1];
+-               z2++;
+             }
+             sprintf(href2,"<a href=\"tt%s-%s.html\"><img src=\"../../images/datetime.png\" border=\"0\" title=\"%s %s\"></a>",usuario,siteind,ltext110,text[55]);
+          } else {
+diff -ur sarg-2.0.6/log.c sarg-2.0.6rbs/log.c
+--- sarg-2.0.6/log.c   2005-04-23 01:03:19.000000000 +0400
++++ sarg-2.0.6rbs/log.c        2005-04-24 16:00:53.000000000 +0400
+@@ -974,21 +974,11 @@
+            sprintf(user,"%s.%s",w,wuser);
+         }
+-      z1=0;
+-      z2=0;
+       str=user;
+-      for(z1=0; z1<=strlen(str); z1++) {
++      for(z1=0; z1<strlen(str); z1++) {
+          if(isalnum(str[z1]) || ispunct(str[z1])) {
+-            if(str[z1]=='/')
+-               str[z1]='_';
+-            if(str[z1]=='\\')
+-               str[z1]='_';
+-            if(str[z1]==';')
+-               str[z1]='_';
+-            if(str[z1]=='\'')
+-               str[z1]='_';
+-            user[z2]=str[z1];
+-            z2++;
++         if(str[z1]=='?' || str[z1]=='-' || str[z1]=='.' || str[z1]==':' || str[z1]=='/' || str[z1]=='\\')
++            str[z1]='_';
+          }
+       }
+diff -ur sarg-2.0.6/report.c sarg-2.0.6rbs/report.c
+--- sarg-2.0.6/report.c        2005-04-23 00:57:22.000000000 +0400
++++ sarg-2.0.6rbs/report.c     2005-04-24 16:02:12.000000000 +0400
+@@ -186,22 +186,10 @@
+          if(!ttopen) {
+             ind2++;
+           strcpy(siteind,accurl);
+-            z1=0;
+-          z2=0;
+           str=siteind;
+-          for(z1=0; z1<=strlen(str); z1++) {
+-             if(str[z1]=='-')
+-                  str[z1]='_';
+-             if(str[z1]=='.')
+-                  str[z1]='_';
+-             if(str[z1]==':')
+-                  str[z1]='_';
+-             if(str[z1]=='/')
+-                  str[z1]='_';
+-             if(str[z1]=='?')
+-                  str[z1]='_';
+-               siteind[z2]=str[z1];
+-               z2++;
++          for(z1=0; z1<strlen(str); z1++) {
++          if(str[z1]=='?' || str[z1]=='-' || str[z1]=='.' || str[z1]==':' || str[z1]=='/' || str[z1]=='\\')
++                           str[z1]='_';
+             }
+           sprintf(arqtt,"%s/%s",dirname,accuser);
+           if(access(arqtt, R_OK) != 0)
+
+--Boundary-00=_eQ5aCJp/CximSea
+Content-Type: text/x-diff; charset="koi8-r"; name="repday.patch"
+Content-Disposition: attachment; filename="repday.patch"
+Content-Transfer-Encoding: 8bit
+
+diff -ur sarg-2.0.6/repday.c sarg-2.0.6rbs/repday.c
+--- sarg-2.0.6/repday.c        2005-02-21 21:13:22.000000000 +0300
++++ sarg-2.0.6rbs/repday.c     2005-04-21 01:37:06.000000000 +0400
+@@ -140,13 +140,13 @@
+    fputs( "<tr><td border=0></td>\n", fp_ou );
+    if(strcmp(datetimeby,"bytes") == 0)
+-     strcpy( html, "BYTES" );
++     strcpy( html, text[93] );
+    else
+      strcpy( html, "H:M:S" );
+    for( i = 0; i < hours.len; i++ )
+      fprintf( fp_ou,
+-      "<td class=\"header3\">%02dH<br>%s</td>\n", hours.list[ i ], html );
++      "<td class=\"header3\">%d%s<br>%s</td>\n", hours.list[ i ], text[129], html );
+    fprintf( fp_ou,
+      "<td class=\"header3\">%s<br>%s</td></tr>\n", text[107], html );
+
+--Boundary-00=_eQ5aCJp/CximSea
+Content-Type: text/x-diff; charset="koi8-r"; name="Russian_koi8.patch"
+Content-Disposition: attachment; filename="Russian_koi8.patch"
+Content-Transfer-Encoding: 8bit
+
+diff -ru sarg-2.0.6/languages/Russian_koi8 sarg-2.0.6rbs/languages/Russian_koi8
+--- sarg-2.0.6/languages/Russian_koi8  2004-11-22 16:37:02.000000000 +0300
++++ sarg-2.0.6rbs/languages/Russian_koi8       2004-11-25 03:02:36.000000000 +0300
+@@ -1,4 +1,4 @@
+-# by Andrew Okhmat <andy@crgu.com>
++# by Andrew Okhmat <andy@crgu.com> and Sapon Oleg <xsov@mail.ru>
+ "äÁ"
+ "îÅÔ"
+ "Russian"
+@@ -27,7 +27,7 @@
+ "å×ÒÏÐÁ"
+ "áÍÅÒÉËÁ"
+ "IP ÏÔÞÅÔ"
+-"éÓÐÏÌØÚÏ×ÁÔØ Ip-ÁÄÒÅÓ ×ÍÅÓÔÏ ÉÍÅÎÉ ÐÏÌØÚÏ×ÁÔÅÌÑ"
++"éÓÐÏÌØÚÏ×ÁÔØ IP-ÁÄÒÅÓ ×ÍÅÓÔÏ ÉÍÅÎÉ ÐÏÌØÚÏ×ÁÔÅÌÑ"
+ "áÄÒÅÓÁ"
+ "÷ÒÅÍÑ"
+ "éÍÑ"
+@@ -81,7 +81,7 @@
+ "× ÏÂÙÞÎÏÍ ÐÏÒÑÄËÅ"
+ "õÄÁÌÑÀ ÓÔÁÒÙÊ ÆÁÊÌ ÏÔÞÅÔÁ"
+ "õÄÁÌÑÀ ×ÒÅÍÅÎÎÙÅ ÆÁÊÌÙ"
+-"ôÏÐ"
++"ôÏРÓÁÊÔÙ"
+ "óÁÊÔÙ"
+ "óÁÊÔÙ É ðÏÌØÚÏ×ÁÔÅÌÉ"
+ "úÁÇÒÕÖÁÀ ÔÁÂÌÉÃÕ ÐÏÌØÚÏ×ÁÔÅÌÑ"
+@@ -113,13 +113,18 @@
+ "OUT"
+ "IN"
+ "CACHE"
+-"SitesUsers"
+-"óÍÁÒÔæÉÌØÔÒ"
+-"ïÛÉÂËÁ ÁÕÔÅÎÔÉÆÉËÁÃÉÉ"
++"óÁÊÔÙ É ðÏÌØÚÏ×ÁÔÅÌÉ"
++"SmartFilter"
++"ïÛÉÂËÉ ÁÕÔÅÎÔÉÆÉËÁÃÉÉ"
++"úáðòåô"
++"ôÏРÓÁÊÔÙ"
+ "SQUIDGUARD"
+-"RULE"
++"ðÒÁ×ÉÌÏ"
+ "squidGuard"
+-"Sarg parsed log saved as"
+-"Sarg log format"
+-"Graphic"
+-"DAYS"
++"öÕÒÎÁÌ, ÏÂÒÁÂÏÔÁÎÎÙÊ Sarg ÓÏÈÒÁÎÅΠ×"
++"æÏÒÍÁÔ ÆÁÊÌÁ ÖÕÒÎÁÌÁ Sarg"
++"úÁËÁÞËÉ"
++"äÉÁÇÒÁÍÍÁ"
++"äÎÉ"
++"äÎÉ"
++"þ"
+
+--Boundary-00=_eQ5aCJp/CximSea
+Content-Type: text/x-diff; charset="koi8-r"; name="siteuser.patch"
+Content-Disposition: attachment; filename="siteuser.patch"
+Content-Transfer-Encoding: 8bit
+
+diff -ru sarg-2.0.6/siteuser.c sarg-2.0.6rbs/siteuser.c
+--- sarg-2.0.6/siteuser.c      2005-04-20 20:52:20.000000000 +0400
++++ sarg-2.0.6rbs/siteuser.c   2005-02-21 21:13:23.000000000 +0300
+@@ -131,6 +131,24 @@
+          continue;
+       if(userip)
+          fixip(user);
++
++      if(UserTabFile[0] != '\0') {
++          sprintf(warea,":%s:",user);
++          if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
++              z1=0;
++              str2=(char *) strstr(str+1,":");
++              str2++;
++              bzero(name, MAXLEN);
++                while(str2[z1] != ':') {
++                  name[z1]=str2[z1];
++                  z1++;
++              }
++          } else strcpy(name,user);
++      } else strcpy(name,user);
++
++      if(strcmp(Ip2Name,"yes") == 0)
++         ip2name(user);
++
+       if(strcmp(Ip2Name,"yes") == 0)
+          ip2name(user);
+@@ -143,9 +161,9 @@
+          regs++;
+       }
+       
+-      sprintf(wuser," %s ",user);
++      sprintf(wuser," %s ",name);
+       if(strstr(users,wuser) == 0 && strcmp(url,ourl) == 0) {
+-         strcat(users,user);
++         strcat(users,name);
+          strcat(users," ");
+          ucount++;
+          if(ucount>4) {
+@@ -168,7 +186,7 @@
+          fputs(html,fp_ou);
+          regs++;
+          ucount=0;
+-       strcpy(users,user);
++       strcpy(users,name);
+          strcat(users," ");
+          strcpy(ourl,url);
+       }
+
+--Boundary-00=_eQ5aCJp/CximSea
+Content-Type: text/x-diff; charset="koi8-r"; name="index.patch"
+Content-Disposition: attachment; filename="index.patch"
+Content-Transfer-Encoding: 8bit
+
+diff -ur sarg-2.0.6/index.c sarg-2.0.6rbs/index.c
+--- sarg-2.0.6/index.c 2005-02-21 21:13:23.000000000 +0300
++++ sarg-2.0.6rbs/index.c      2005-04-24 07:40:41.000000000 +0400
+@@ -78,6 +78,7 @@
+       bzero(newname, 512);
+       strncat(newname,direntp->d_name,4);
+       strncpy(month,direntp->d_name+4,3);
++      month[3]='\0';
+       conv_month(month);
+       strcat(newname,month);
+       strncat(newname,direntp->d_name+7,2);
+
+--Boundary-00=_eQ5aCJp/CximSea--
+
diff --git a/patches/oleg1 b/patches/oleg1
new file mode 100644 (file)
index 0000000..33a8712
--- /dev/null
@@ -0,0 +1,322 @@
+From xsov@mail.ru Fri May  6 04:30:56 2005
+Received: 194.67.23.149 / smx2.brturbo.com
+Received: from [212.48.201.194] (port=40725 helo=[192.168.0.77]) by
+       mx3.mail.ru with asmtp  id 1DTqX4-0008GO-00 for orso@brturbo.com.br; Fri,
+       06 May 2005 04:17:31 +0400
+From: Oleg <xsov@mail.ru>
+To: Pedro Lineu Orso <orso@brturbo.com.br>
+Subject: Re: sarg-2.0.6 new patches
+Date: Fri, 6 May 2005 04:30:56 +0400
+User-Agent: KMail/1.7.2
+References: <200504241642.06841.xsov@mail.ru>
+        <1115290770.4499.7.camel@lcaklds49>
+In-Reply-To: <1115290770.4499.7.camel@lcaklds49>
+MIME-Version: 1.0
+Content-Type: Multipart/Mixed; boundary="Boundary-00=_BrreCrvUGWRZVaY"
+Message-Id: <200505060430.57213.xsov@mail.ru>
+X-Evolution-Source: pop://orso@pop.brturbo.com.br
+
+
+--Boundary-00=_BrreCrvUGWRZVaY
+Content-Type: text/plain; charset="koi8-r"
+Content-Disposition: inline
+Content-Transfer-Encoding: 8bit
+
+Hello Pedro!
+
+PL > I have implemented your patches on sarg-2.0.7 and there are some sarg
+PL > users asking me
+PL > about this one:
+PL >
+PL > . Fixes segfault, produced by inproper use of strncpy functions, look -
+PL > strncpy
+PL >
+PL > Can you please explain when segfault happens?
+PL >
+PL > I've seen that the forth characted of month[] in index.c is set to null
+PL > to avoid strcat to segfault, but I cannot understand when this is
+PL > needed.
+
+I have big-big squid.log file, and this error is produced only when I use 
+"LongUrl=yes" option in configuration file, I deeply debug code and see, that 
+error was at that place of code. I also can assume that overrun of '\0' 
+symbol was produced by error in other part of code. If you want I can get 
+part of my squid.log file, which produce this error and send it to you with 
+my squid.conf file (but I can do this not so fast, because file is very 
+large, and I can't send sensitive information from it to anybody).
+
+I include here another my patches for new sarg 2.0.7 version:
+1) topuser.diff:
+URL size is too small for URL with coded symbols, like %2f for slash ('/') 
+symbol, I see URLs in my squid.log file with length about 1400 characters. So 
+because there was number 1024 (I don't know where you get it, may be from 
+some RFC?), and one symbol can be 3-times longer, I enlarge buffer to 3072 
+characters (3 x 1024).
+
+2) util.diff
+There I replace all '<=12' condition to '<12' because array of months has 12 
+elements, which are numbered from 0, so:
+0 - 1st (January)
+1 - 2nd (February)
+...
+11 - 12th (December)
+and condition <=12 will loop for 13 elements, that is wrong.
+
+I also remove unneeded 'return;' at the ends of some functions (I don't think 
+it is required for other operating systems).
+
+Regards, Oleg.
+
+--Boundary-00=_BrreCrvUGWRZVaY
+Content-Type: text/x-diff; charset="koi8-r"; name="topuser.diff"
+Content-Disposition: attachment; filename="topuser.diff"
+Content-Transfer-Encoding: 8bit
+
+--- sarg-2.0.7/topuser.c       2005-05-02 17:55:04.000000000 +0400
++++ sarg-2.0.7rbs/topuser.c    2005-05-04 03:53:48.000000000 +0400
+@@ -38,7 +38,7 @@
+    int posicao=0;
+    char olduser[MAXLEN], csort[MAXLEN], periodo[MAXLEN], arqper[MAXLEN];
+    char wger[MAXLEN], top1[MAXLEN], top2[MAXLEN], top3[MAXLEN];
+-   char user[MAXLEN], nacc[20], nbytes[20], url[1024], preg[8000], tusr[MAXLEN];
++   char user[MAXLEN], nacc[20], nbytes[20], url[3072], preg[8000], tusr[MAXLEN];
+    char ip[MAXLEN], hora[9], data[11], elap[15], incac[15], oucac[15], html[MAXLEN];
+    char ipantes[MAXLEN], nameantes[MAXLEN];
+    char sfield[10]="2,2";
+
+--Boundary-00=_BrreCrvUGWRZVaY
+Content-Type: text/x-diff; charset="koi8-r"; name="util.diff"
+Content-Disposition: attachment; filename="util.diff"
+Content-Transfer-Encoding: 8bit
+
+--- sarg-2.0.7/util.c  2005-05-02 17:55:04.000000000 +0400
++++ sarg-2.0.7rbs/util.c       2005-05-04 04:04:01.000000000 +0400
+@@ -246,7 +246,7 @@
+    ndia[0]='\0';
+    nmes[0]='\0';
+-   for(x=0; x<=12; x++) {
++   for(x=0; x<12; x++) {
+       if(strcmp(mtab1[x],mes) == 0) {
+          strncpy(nmes,mtab2[x],sizeof(nmes)-1);
+          nmes[sizeof(nmes)-1]=0;
+@@ -262,9 +262,6 @@
+    strncpy(dia,ndia,sizeof(dia)-1);
+    dia[sizeof(dia)-1]=0;
+-
+-   return;
+-
+ }
+@@ -275,15 +272,12 @@
+    nmes[0]='\0';
+-   for(x=0; x<=12; x++) {
++   for(x=0; x<12; x++) {
+       if(strcmp(mtab1[x],mes) == 0)
+          strcpy(nmes,mtab2[x]);
+    }
+    sprintf(wdata,"%s%s%s",ano,nmes,dia);
+-
+-   return;
+-
+ }
+@@ -291,13 +285,10 @@
+ {
+    int  x;
+-   for(x=0; x<=12; x++) {
++   for(x=0; x<12; x++) {
+       if(strcmp(mtab1[x],month) == 0)
+          strcpy(month,mtab2[x]);
+    }
+-
+-   return;
+-
+ }
+@@ -305,7 +296,7 @@
+ {
+    int x;
+-   for(x=0; x<=12; x++) {
++   for(x=0; x<12; x++) {
+       if(strcmp(mtab2[x],month) == 0)
+          strcpy(month,mtab1[x]);
+    }
+@@ -328,7 +319,7 @@
+    strncpy(ano,duntil,4);
+    ano[4]='\0';
+-   for(x=0; x<=12; x++) {
++   for(x=0; x<12; x++) {
+       if(strcmp(mtab2[x],mes) == 0)
+          strcpy(mes,mtab1[x]);
+    }
+@@ -339,23 +330,18 @@
+       sprintf(warea,"%s%s%s",ano,mes,dia);
+    strcat(periodo,warea);
+-   return;
+ }
+ void debuga(char *msg)
+ {
+   fprintf(stderr, "SARG: %s\n",msg);
+-
+-  return;
+ }
+ void debugaz(char *head, char *msg)
+ {
+   fprintf(stderr, "SARG: (util) %s=%s\n",head, msg);
+-
+-  return;
+ }
+@@ -384,8 +370,6 @@
+    }
+    ip[0]='\0';
+    sprintf(ip,"%s%s%s%s%s%s%s",n1,sep,n2,sep,n3,sep,wip);
+-
+-   return;
+ }
+@@ -499,9 +483,6 @@
+    strcpy(href,"<a href='");
+    strcat(href,whref);
+    strcat(href,"/");
+-
+-   return;
+-
+ }
+@@ -541,9 +522,6 @@
+    fgets(data,80,fp_in);
+    fclose(fp_in);
+    data[strlen(data)-1]='\0';
+-
+-   return;
+-
+ }
+@@ -562,9 +540,6 @@
+    fgets(tuser,20,fp_in);
+    tuser[strlen(tuser)-1]='\0';
+    fclose(fp_in);
+-
+-   return;
+-
+ }
+@@ -603,9 +578,6 @@
+    wtuser=my_atoll(tuser);
+    med=my_atoll(warea) / wtuser;
+    sprintf(media,"%s",fixnum(med,1));
+-
+-   return;
+-
+ }
+@@ -631,9 +603,6 @@
+    if(debug)
+       debuga((char *)text[50]);
+- 
+-   return;
+- 
+ }
+ void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form)
+@@ -733,10 +702,6 @@
+    }
+    (void) rewinddir(dirp);
+    (void) closedir(dirp);
+-
+-   return;
+-
+-
+ }
+@@ -752,9 +717,6 @@
+       strcat(warea,line);
+       strcpy(line,warea);
+    }
+-
+-   return;
+-
+ }
+ void zdate(char *ftime, char *DateFormat)
+@@ -771,8 +733,6 @@
+       strftime(ftime, 127, "%d/%b/%Y-%H:%M", local);
+    if(strcmp(DateFormat,"w") == 0)
+       strftime(ftime, 127, "%V-%H-%M", local);
+-
+-   return;
+ }
+@@ -839,7 +799,6 @@
+    sprintf(dfrom,"%s%s%s",anof,mesf,diaf);
+    sprintf(duntil,"%s%s%s",anou,mesu,diau);
+-   return;
+ }
+@@ -928,8 +887,6 @@
+       sprintf(warea,"%s/periodo",outdir);
+       unlink(warea);
+    }
+-  
+-   return;
+ }
+ void load_excludecodes()
+@@ -951,8 +908,6 @@
+    }
+    fclose(fp_in);
+-   return;
+-
+ }
+ int vercode(char *code)
+@@ -976,8 +931,6 @@
+       str[strlen(str)-1]='\0';
+    if(strcmp(str,"none") == 0)
+       str[0]='\0';
+-
+-   return;
+ }
+ #ifdef LEGACY_TESTVALIDUSERCHAR
+@@ -1111,8 +1064,6 @@
+       w2[y]=w[x];
+       y++;
+    }
+-
+-   return;
+ }
+ void version()
+
+--Boundary-00=_BrreCrvUGWRZVaY--
+
diff --git a/patches/oleg2 b/patches/oleg2
new file mode 100644 (file)
index 0000000..33a8712
--- /dev/null
@@ -0,0 +1,322 @@
+From xsov@mail.ru Fri May  6 04:30:56 2005
+Received: 194.67.23.149 / smx2.brturbo.com
+Received: from [212.48.201.194] (port=40725 helo=[192.168.0.77]) by
+       mx3.mail.ru with asmtp  id 1DTqX4-0008GO-00 for orso@brturbo.com.br; Fri,
+       06 May 2005 04:17:31 +0400
+From: Oleg <xsov@mail.ru>
+To: Pedro Lineu Orso <orso@brturbo.com.br>
+Subject: Re: sarg-2.0.6 new patches
+Date: Fri, 6 May 2005 04:30:56 +0400
+User-Agent: KMail/1.7.2
+References: <200504241642.06841.xsov@mail.ru>
+        <1115290770.4499.7.camel@lcaklds49>
+In-Reply-To: <1115290770.4499.7.camel@lcaklds49>
+MIME-Version: 1.0
+Content-Type: Multipart/Mixed; boundary="Boundary-00=_BrreCrvUGWRZVaY"
+Message-Id: <200505060430.57213.xsov@mail.ru>
+X-Evolution-Source: pop://orso@pop.brturbo.com.br
+
+
+--Boundary-00=_BrreCrvUGWRZVaY
+Content-Type: text/plain; charset="koi8-r"
+Content-Disposition: inline
+Content-Transfer-Encoding: 8bit
+
+Hello Pedro!
+
+PL > I have implemented your patches on sarg-2.0.7 and there are some sarg
+PL > users asking me
+PL > about this one:
+PL >
+PL > . Fixes segfault, produced by inproper use of strncpy functions, look -
+PL > strncpy
+PL >
+PL > Can you please explain when segfault happens?
+PL >
+PL > I've seen that the forth characted of month[] in index.c is set to null
+PL > to avoid strcat to segfault, but I cannot understand when this is
+PL > needed.
+
+I have big-big squid.log file, and this error is produced only when I use 
+"LongUrl=yes" option in configuration file, I deeply debug code and see, that 
+error was at that place of code. I also can assume that overrun of '\0' 
+symbol was produced by error in other part of code. If you want I can get 
+part of my squid.log file, which produce this error and send it to you with 
+my squid.conf file (but I can do this not so fast, because file is very 
+large, and I can't send sensitive information from it to anybody).
+
+I include here another my patches for new sarg 2.0.7 version:
+1) topuser.diff:
+URL size is too small for URL with coded symbols, like %2f for slash ('/') 
+symbol, I see URLs in my squid.log file with length about 1400 characters. So 
+because there was number 1024 (I don't know where you get it, may be from 
+some RFC?), and one symbol can be 3-times longer, I enlarge buffer to 3072 
+characters (3 x 1024).
+
+2) util.diff
+There I replace all '<=12' condition to '<12' because array of months has 12 
+elements, which are numbered from 0, so:
+0 - 1st (January)
+1 - 2nd (February)
+...
+11 - 12th (December)
+and condition <=12 will loop for 13 elements, that is wrong.
+
+I also remove unneeded 'return;' at the ends of some functions (I don't think 
+it is required for other operating systems).
+
+Regards, Oleg.
+
+--Boundary-00=_BrreCrvUGWRZVaY
+Content-Type: text/x-diff; charset="koi8-r"; name="topuser.diff"
+Content-Disposition: attachment; filename="topuser.diff"
+Content-Transfer-Encoding: 8bit
+
+--- sarg-2.0.7/topuser.c       2005-05-02 17:55:04.000000000 +0400
++++ sarg-2.0.7rbs/topuser.c    2005-05-04 03:53:48.000000000 +0400
+@@ -38,7 +38,7 @@
+    int posicao=0;
+    char olduser[MAXLEN], csort[MAXLEN], periodo[MAXLEN], arqper[MAXLEN];
+    char wger[MAXLEN], top1[MAXLEN], top2[MAXLEN], top3[MAXLEN];
+-   char user[MAXLEN], nacc[20], nbytes[20], url[1024], preg[8000], tusr[MAXLEN];
++   char user[MAXLEN], nacc[20], nbytes[20], url[3072], preg[8000], tusr[MAXLEN];
+    char ip[MAXLEN], hora[9], data[11], elap[15], incac[15], oucac[15], html[MAXLEN];
+    char ipantes[MAXLEN], nameantes[MAXLEN];
+    char sfield[10]="2,2";
+
+--Boundary-00=_BrreCrvUGWRZVaY
+Content-Type: text/x-diff; charset="koi8-r"; name="util.diff"
+Content-Disposition: attachment; filename="util.diff"
+Content-Transfer-Encoding: 8bit
+
+--- sarg-2.0.7/util.c  2005-05-02 17:55:04.000000000 +0400
++++ sarg-2.0.7rbs/util.c       2005-05-04 04:04:01.000000000 +0400
+@@ -246,7 +246,7 @@
+    ndia[0]='\0';
+    nmes[0]='\0';
+-   for(x=0; x<=12; x++) {
++   for(x=0; x<12; x++) {
+       if(strcmp(mtab1[x],mes) == 0) {
+          strncpy(nmes,mtab2[x],sizeof(nmes)-1);
+          nmes[sizeof(nmes)-1]=0;
+@@ -262,9 +262,6 @@
+    strncpy(dia,ndia,sizeof(dia)-1);
+    dia[sizeof(dia)-1]=0;
+-
+-   return;
+-
+ }
+@@ -275,15 +272,12 @@
+    nmes[0]='\0';
+-   for(x=0; x<=12; x++) {
++   for(x=0; x<12; x++) {
+       if(strcmp(mtab1[x],mes) == 0)
+          strcpy(nmes,mtab2[x]);
+    }
+    sprintf(wdata,"%s%s%s",ano,nmes,dia);
+-
+-   return;
+-
+ }
+@@ -291,13 +285,10 @@
+ {
+    int  x;
+-   for(x=0; x<=12; x++) {
++   for(x=0; x<12; x++) {
+       if(strcmp(mtab1[x],month) == 0)
+          strcpy(month,mtab2[x]);
+    }
+-
+-   return;
+-
+ }
+@@ -305,7 +296,7 @@
+ {
+    int x;
+-   for(x=0; x<=12; x++) {
++   for(x=0; x<12; x++) {
+       if(strcmp(mtab2[x],month) == 0)
+          strcpy(month,mtab1[x]);
+    }
+@@ -328,7 +319,7 @@
+    strncpy(ano,duntil,4);
+    ano[4]='\0';
+-   for(x=0; x<=12; x++) {
++   for(x=0; x<12; x++) {
+       if(strcmp(mtab2[x],mes) == 0)
+          strcpy(mes,mtab1[x]);
+    }
+@@ -339,23 +330,18 @@
+       sprintf(warea,"%s%s%s",ano,mes,dia);
+    strcat(periodo,warea);
+-   return;
+ }
+ void debuga(char *msg)
+ {
+   fprintf(stderr, "SARG: %s\n",msg);
+-
+-  return;
+ }
+ void debugaz(char *head, char *msg)
+ {
+   fprintf(stderr, "SARG: (util) %s=%s\n",head, msg);
+-
+-  return;
+ }
+@@ -384,8 +370,6 @@
+    }
+    ip[0]='\0';
+    sprintf(ip,"%s%s%s%s%s%s%s",n1,sep,n2,sep,n3,sep,wip);
+-
+-   return;
+ }
+@@ -499,9 +483,6 @@
+    strcpy(href,"<a href='");
+    strcat(href,whref);
+    strcat(href,"/");
+-
+-   return;
+-
+ }
+@@ -541,9 +522,6 @@
+    fgets(data,80,fp_in);
+    fclose(fp_in);
+    data[strlen(data)-1]='\0';
+-
+-   return;
+-
+ }
+@@ -562,9 +540,6 @@
+    fgets(tuser,20,fp_in);
+    tuser[strlen(tuser)-1]='\0';
+    fclose(fp_in);
+-
+-   return;
+-
+ }
+@@ -603,9 +578,6 @@
+    wtuser=my_atoll(tuser);
+    med=my_atoll(warea) / wtuser;
+    sprintf(media,"%s",fixnum(med,1));
+-
+-   return;
+-
+ }
+@@ -631,9 +603,6 @@
+    if(debug)
+       debuga((char *)text[50]);
+- 
+-   return;
+- 
+ }
+ void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form)
+@@ -733,10 +702,6 @@
+    }
+    (void) rewinddir(dirp);
+    (void) closedir(dirp);
+-
+-   return;
+-
+-
+ }
+@@ -752,9 +717,6 @@
+       strcat(warea,line);
+       strcpy(line,warea);
+    }
+-
+-   return;
+-
+ }
+ void zdate(char *ftime, char *DateFormat)
+@@ -771,8 +733,6 @@
+       strftime(ftime, 127, "%d/%b/%Y-%H:%M", local);
+    if(strcmp(DateFormat,"w") == 0)
+       strftime(ftime, 127, "%V-%H-%M", local);
+-
+-   return;
+ }
+@@ -839,7 +799,6 @@
+    sprintf(dfrom,"%s%s%s",anof,mesf,diaf);
+    sprintf(duntil,"%s%s%s",anou,mesu,diau);
+-   return;
+ }
+@@ -928,8 +887,6 @@
+       sprintf(warea,"%s/periodo",outdir);
+       unlink(warea);
+    }
+-  
+-   return;
+ }
+ void load_excludecodes()
+@@ -951,8 +908,6 @@
+    }
+    fclose(fp_in);
+-   return;
+-
+ }
+ int vercode(char *code)
+@@ -976,8 +931,6 @@
+       str[strlen(str)-1]='\0';
+    if(strcmp(str,"none") == 0)
+       str[0]='\0';
+-
+-   return;
+ }
+ #ifdef LEGACY_TESTVALIDUSERCHAR
+@@ -1111,8 +1064,6 @@
+       w2[y]=w[x];
+       y++;
+    }
+-
+-   return;
+ }
+ void version()
+
+--Boundary-00=_BrreCrvUGWRZVaY--
+
diff --git a/patches/oleg4 b/patches/oleg4
new file mode 100644 (file)
index 0000000..2adbaf1
--- /dev/null
@@ -0,0 +1,740 @@
+From xsov@mail.ru Wed May 11 23:30:30 2005
+Received: 194.67.23.149 / smx1.brturbo.com
+Received: from [212.48.205.42] (port=32246 helo=[192.168.0.77]) by
+       mx3.mail.ru with asmtp  id 1DVwh2-0005nc-00 for orso@brturbo.com.br; Wed,
+       11 May 2005 23:16:29 +0400
+From: Oleg <xsov@mail.ru>
+To: Pedro Lineu Orso <orso@brturbo.com.br>
+Subject: Re: sarg-2.0.6 new patches
+Date: Wed, 11 May 2005 23:30:30 +0400
+User-Agent: KMail/1.7.2
+References: <200504241642.06841.xsov@mail.ru>
+        <200505060430.57213.xsov@mail.ru> <1115814131.8900.1.camel@lcaklds49>
+In-Reply-To: <1115814131.8900.1.camel@lcaklds49>
+MIME-Version: 1.0
+Content-Type: Multipart/Mixed; boundary="Boundary-00=_W1lgCFYB9s7BJUS"
+Message-Id: <200505112330.30670.xsov@mail.ru>
+X-Evolution-Source: pop://orso@pop.brturbo.com.br/
+
+
+--Boundary-00=_W1lgCFYB9s7BJUS
+Content-Type: text/plain; charset="koi8-r"
+Content-Disposition: inline
+Content-Transfer-Encoding: 8bit
+
+Hello Pedro!
+
+I found the bugplace, it is already fixed by me in previous topuser.diff patch 
+for 2.0.7 (not by those 6 patches for 2.0.6), howeverer I include my log file 
+example here with configuration files:
+- sarg.conf;
+- exclude_codes;
+- access.log.
+
+It looks like in this access.log example the one symbol is replaced by 6 (for 
+example: %u049F), so in previous topuser.diff patch there must be 1024*6 = 
+6144 size for array url (I include new, modified topuser.diff patch for 
+2.0.7, which will fix this bug). So, for now, the part of old my patch for 
+2.0.6, which adds '\0' at the end of line is not necessary.
+
+I also include here my recommendations for "download_suffix" option default 
+value (look at extensions-was.txt for old values and extensions-be.txt for 
+new). I mark with star "(*)" symbol most important changes.
+
+Regards, Oleg.
+
+÷ ÓÏÏÂÝÅÎÉÉ ÏÔ óÒÅÄÁ 11 íÁÊ 2005 16:22 ×Ù ÎÁÐÉÓÁÌÉ:
+PL > Hello Oleg,
+PL >
+PL > May I have some of that log file to try to hack sarg, and you sarg.conf
+PL > file too, please?
+PL >
+PL > Thanks
+
+--Boundary-00=_W1lgCFYB9s7BJUS
+Content-Type: text/plain; charset="koi8-r"; name="extensions-be.txt"
+Content-Disposition: attachment; filename="extensions-be.txt"
+Content-Transfer-Encoding: 8bit
+
+tgz   - archive
+tar   - archive(*)
+cpio  - archive
+zip   - archive
+arj   - archive
+bzip  - archive
+bz2   - archive
+gz    - archive
+rar   - archive
+ace   - archive
+lha   - archive
+lzh   - archive
+cab   - archive
+7z    - archive
+tar   - archive
+cpio  - archive
+
+doc   - office suite document
+mdb   - office suite document
+ppt   - office suite document
+rtf   - office suite document
+mso   - office suite document(?)
+dot   - office suite document(?)
+
+bin   - conatain binary executable
+com   - conatain binary executable
+sys   - conatain binary executable
+exe   - conatain binary executable
+dll   - conatain binary executable
+bin   - conatain binary executable
+scr   - conatain binary executable(*)
+bat   - conatain binary executable
+
+iso   - cd/dvd image
+nrg   - cd/dvd image
+vcd   - cd/dvd image(*)
+vob   - cd/dvd image(*)
+
+mp3   - multimedia
+avi   - multimedia
+mpg   - multimedia
+mpeg  - multimedia
+wma   - multimedia
+wmv   - multimedia(*)
+ogg   - multimedia
+mov   - multimedia
+
+===================================
+adt   - don't know
+drv$  - don't know
+src   - don't know
+shs   - don't know
+
+--Boundary-00=_W1lgCFYB9s7BJUS
+Content-Type: text/x-diff; charset="koi8-r"; name="topuser.diff"
+Content-Disposition: attachment; filename="topuser.diff"
+Content-Transfer-Encoding: 8bit
+
+--- sarg-2.0.7/topuser.c       2005-05-02 17:55:04.000000000 +0400
++++ sarg-2.0.7rbs/topuser.c    2005-05-04 03:53:48.000000000 +0400
+@@ -38,7 +38,7 @@
+    int posicao=0;
+    char olduser[MAXLEN], csort[MAXLEN], periodo[MAXLEN], arqper[MAXLEN];
+    char wger[MAXLEN], top1[MAXLEN], top2[MAXLEN], top3[MAXLEN];
+-   char user[MAXLEN], nacc[20], nbytes[20], url[1024], preg[8000], tusr[MAXLEN];
++   char user[MAXLEN], nacc[20], nbytes[20], url[6144], preg[8000], tusr[MAXLEN];
+    char ip[MAXLEN], hora[9], data[11], elap[15], incac[15], oucac[15], html[MAXLEN];
+    char ipantes[MAXLEN], nameantes[MAXLEN];
+    char sfield[10]="2,2";
+
+--Boundary-00=_W1lgCFYB9s7BJUS
+Content-Type: text/plain; charset="koi8-r"; name="extensions-was.txt"
+Content-Disposition: attachment; filename="extensions-was.txt"
+Content-Transfer-Encoding: 8bit
+
+tgz   - archive
+zip   - archive
+arj   - archive
+bzip  - archive
+bz2   - archive
+gz    - archive
+rar   - archive
+ace   - archive
+lha   - archive
+lzh   - archive
+cab   - archive
+
+doc   - office suite document
+mdb   - office suite document
+ppt   - office suite document
+rtf   - office suite document
+mso   - office suite document(?)
+dot   - office suite document(?)
+
+bin   - conatain binary executable
+com   - conatain binary executable
+sys   - conatain binary executable
+exe   - conatain binary executable
+dll   - conatain binary executable
+bin   - conatain binary executable
+
+iso   - cd/dvd image
+
+mp3   - multimedia
+avi   - multimedia
+mpg   - multimedia
+mpeg  - multimedia
+
+===================================
+adt   - don't know
+drv$  - don't know
+src   - don't know
+shs   - don't know
+
+--Boundary-00=_W1lgCFYB9s7BJUS
+Content-Type: text/plain; charset="koi8-r"; name="sarg.conf"
+Content-Disposition: attachment; filename="sarg.conf"
+Content-Transfer-Encoding: 8bit
+
+# sarg.conf
+#
+# TAG:  language 
+#      Available languages:
+#              Bulgarian_windows1251
+#              Catalan
+#              Czech
+#              Dutch
+#              English
+#              French
+#              German
+#              Hungarian
+#              Indonesian
+#              Italian
+#              Japanese
+#              Latvian
+#              Polish
+#              Portuguese
+#              Romanian
+#              Russian_koi8
+#              Russian_windows1251
+#              Serbian
+#              Spanish
+#              Turkish
+#
+language Russian_koi8
+
+# TAG:  access_log file
+#       Where is the access.log file
+#       sarg -l file
+#
+access_log /mnt/access.log
+
+# TAG: graphs yes|no
+#      Use graphics where is possible.
+#           graph_days_bytes_bar_color blue|green|yellow|orange|brown|red
+#
+graphs yes
+graph_days_bytes_bar_color orange
+
+# TAG: title
+#      Especify the title for html page.
+#
+
+# TAG: font_face
+#      Especify the font for html page.
+#
+font_face Tahoma,Verdana,Arial
+
+# TAG: header_color
+#      Especify the header color
+#
+header_color darkblue
+
+# TAG: header_bgcolor
+#      Especify the header bgcolor
+#
+header_bgcolor blanchedalmond
+
+# TAG: font_size
+#      Especify the text font size
+#
+font_size 10px
+
+# TAG: header_font_size
+#      Especify the header font size
+#
+header_font_size 10px
+
+# TAG: title_font_size
+#      Especify the title font size
+#
+title_font_size 20px
+
+# TAG: background_color
+# TAG: background_color
+#      Html page background color
+#
+background_color white
+
+# TAG: text_color
+#      Html page text color
+#
+text_color #000000
+
+# TAG: text_bgcolor
+#      Html page text background color
+#
+text_bgcolor lavender
+
+# TAG: title_color
+#      Html page title color
+#
+title_color green
+
+# TAG: logo_image
+#      Html page logo.
+#
+
+# TAG: logo_text
+#      Html page logo text.
+#
+#logo_text ""
+
+# TAG: logo_text_color
+#      Html page logo texti color.
+#
+#logo_text_color #000000
+
+# TAG: logo_image_size
+#      Html page logo image size. 
+#       width height
+#
+image_size 253 35
+
+# TAG: background_image
+#      Html page background image
+#
+#background_image none
+
+# TAG:  password
+#       User password file used by authentication
+#       If used here, reports will be generated only for that users.
+#
+password none
+
+# TAG:  temporary_dir
+#       Temporary directory name for work files
+#       sarg -w dir
+#
+temporary_dir /tmp
+
+# TAG:  output_dir
+#       The reports will be saved in that directory
+#       sarg -o dir
+#
+output_dir /xxx
+
+# TAG:  output_email
+#       Email address to send the reports. If you use this tag, no html reports will be generated.
+#       sarg -e email
+#
+output_email none
+
+# TAG:  resolve_ip yes/no
+#       Convert ip address to dns name
+#       sarg -n
+resolve_ip no
+
+# TAG:  user_ip yes/no
+#       Use Ip Address instead userid in reports.
+#       sarg -p
+user_ip no
+
+# TAG:  topuser_sort_field field normal/reverse
+#       Sort field for the Topuser Report.
+#       Allowed fields: USER CONNECT BYTES TIME
+#
+topuser_sort_field BYTES reverse
+
+# TAG:  user_sort_field field normal/reverse
+#       Sort field for the User Report.
+#       Allowed fields: SITE CONNECT BYTES TIME
+#
+user_sort_field BYTES reverse
+
+# TAG:  exclude_users file
+#       users within the file will be excluded from reports.
+#       you can use indexonly to have only index.html file.
+#
+exclude_users none
+
+# TAG:  exclude_hosts file
+#       Hosts, domains or subnets will be excluded from reports.
+#
+#       Eg.: 192.168.10.10 - exclude ip address only
+#            192.168.10.0  - exclude full C class
+#            s1.acme.foo   - exclude hostname only
+#            acme.foo      - exclude full domain name
+#
+exclude_hosts none
+
+# TAG:  useragent_log file
+#       Put here where is useragent.log to nable useragent report.
+#
+#useragent_log none
+
+# TAG:  date_format
+#       Date format in reports: e (European=dd/mm/yy), u (American=mm/dd/yy), w (Weekly=yy.ww)
+#       
+date_format e
+
+# TAG:  per_user_limit file MB
+#       Saves userid on file if download exceed n MB.
+#       This option allow you to disable user access if user exceed a download limit.
+#       
+per_user_limit none
+
+# TAG: lastlog n
+#      How many reports files must be keept in reports directory.
+#      The oldest report file will be automatically removed.
+#      0 - no limit.
+#
+lastlog 0
+
+# TAG: remove_temp_files yes
+#      Remove temporary files: geral, usuarios, top, periodo from root report directory.
+#
+remove_temp_files yes
+
+# TAG: index yes|no|only
+#      Generate the main index.html.
+#      only - generate only the main index.html
+#
+index yes
+
+# TAG: overwrite_report yes|no
+#      yes - if report date already exist then will be overwrited.
+#       no - if report date already exist then will be renamed to filename.n, filename.n+1
+#
+overwrite_report yes
+
+# TAG: records_without_userid ignore|ip|everybody
+#      What can I do with records without user id (no authentication) in access.log file ?
+#
+#      ignore - This record will be ignored.
+#          ip - Use ip address instead. (default)
+#   everybody - Use "everybody" instead.
+#
+records_without_userid ip
+
+# TAG: use_comma no|yes
+#      Use comma instead point in reports.
+#      Eg.: use_comma yes => 23,450,110
+#           use_comma no  => 23.450.110
+#
+use_comma no
+
+# TAG: mail_utility mail|mailx
+#      Mail command to use to send reports via SMTP
+#
+#mail_utility mailx
+
+# TAG: topsites_num n
+#      How many sites in topsites report.
+#
+topsites_num 100
+
+# TAG: topsites_sort_order CONNECT|BYTES A|D
+#      Sort for topsites report, where A=Ascendent, D=Descendent
+#
+topsites_sort_order BYTES D
+
+# TAG: index_sort_order A/D
+#      Sort for index.html, where A=Ascendent, D=Descendent
+#
+index_sort_order D
+
+# TAG: exclude_codes file
+#      Ignore records with these codes. Eg.: NONE/400
+#
+exclude_codes /xxx/exclude_codes
+
+# TAG: replace_index string
+#      Replace "index.html" in the main index file with this string
+#      If null "index.html" is used 
+#
+#replace_index <?php echo str_replace(".", "_", $REMOTE_ADDR); echo ".html"; ?>
+
+# TAG: max_elapsed milliseconds
+#      If elapsed time is recorded in log is greater than max_elapsed use 0 for elapsed time.
+#      Use 0 for no checking 
+#
+max_elapsed 0
+# 8 Hours
+#max_elapsed 28800000
+
+# TAG: report_type type
+#      What kind of reports to generate.
+#      topsites                   - shows the site, connect and bytes
+#      sites_users        - shows which users were accessing a site
+#      users_sites        - shows sites accessed by the user
+#      date_time          - shows the amount of bytes used by day and hour
+#      denied             - shows all denied sites with full URL
+#      auth_failures       - shows autentication failures
+#      site_user_time_date - shows sites, dates, times and bytes
+#
+#      Eg.: report_type topsites denied 
+#
+#report_type topsites sites_users users_sites date_time denied auth_failures site_user_time_date
+report_type topsites sites_users users_sites date_time denied auth_failures site_user_time_date
+
+# TAG: usertab filename
+#      You can change the "userid" or the "ip address" to be a real user name on the rpeorts.
+#      Table syntax:
+#              userid name   or   ip address name
+#      Eg:
+#              SirIsaac Isaac Newton
+#              vinci Leonardo da Vinci
+#              192.168.10.1 Karol Wojtyla
+#      
+#      Each line must be terminated with '\n'
+#
+
+# TAG: long_url yes|no
+#      If yes, the full url is showed in report.
+#      If no, only the site will be showed
+#
+#      YES option generate very big sort files and reports.
+#
+long_url yes
+
+# TAG: date_time_by bytes|elap
+#      Date/Time reports will use bytes or elapsed time?
+#
+date_time_by bytes
+
+# TAG: charset name
+#      ISO 8859 is a full series of 10 standardized multilingual single-byte coded (8bit)
+#      graphic character sets for writing in alphabetic languages
+#      You can use the following charsets:
+#              Latin1          - West European
+#              Latin2          - East European 
+#              Latin3          - South European 
+#              Latin4          - North European 
+#              Cyrillic 
+#              Arabic 
+#              Greek 
+#              Hebrew 
+#              Latin5          - Turkish 
+#              Latin6
+#              Windows-1251
+#              Koi8-r
+#
+charset KOI8-R
+
+# TAG: user_invalid_char "&/"
+#      Records that contain invalid characters in userid will be ignored by Sarg.
+#
+#user_invalid_char "&/"
+
+# TAG: privacy yes|no
+#      privacy_string "***.***.***.***"
+#      privacy_string_color blue
+#      In some countries the sysadm cannot see the visited sites by a restrictive law.
+#      Using privacy yes the visited url will be changes by privacy_string and the link
+#      will be removed from reports.
+#
+privacy no
+#privacy_string "***.***.***.***"
+#privacy_string_color blue
+
+# TAG: include_users "user1:user2:...:usern"
+#      Reports will be generated only for listed users.
+#
+#include_users none
+
+# TAG: exclude_string "string1:string2:...:stringn"
+#      Records from access.log file that contain one of listed strings will be ignored.
+#
+#exclude_string none
+
+# TAG: show_successful_message yes|no
+#      Shows "Successful report generated on dir" at end of process.
+#
+show_successful_message no
+
+# TAG: show_read_statistics yes|no
+#      Shows some reading statistics.
+#
+show_read_statistics no
+
+# TAG: topuser_fields
+#      Which fields must be in Topuser report.
+#
+topuser_fields NUM DATE_TIME USERID CONNECT BYTES %BYTES TOTAL AVERAGE
+
+# TAG: user_report_fields
+#      Which fields must be in User report.
+#
+user_report_fields CONNECT BYTES %BYTES TOTAL AVERAGE
+
+# TAG: topuser_num n
+#      How many users in topsites report. 0 = no limit
+#
+topuser_num 0
+
+# TAG: site_user_time_date_type list|table
+#      generate reports for site_user_time_date in list or table format
+#
+site_user_time_date_type table
+
+# TAG: datafile file
+#      Save the report results in a file to populate some database
+#
+#datafile none
+#datafile /tmp/p8
+
+# TAG: datafile_delimiter ";"
+#      ascii character to use as a field separator in datafile
+#
+#datafile_delimiter ";"
+
+# TAG: datafile_fields all
+#      Which data fields must be in datafile
+#      user;date;time;url;connect;bytes;in_cache;out_cache;elapsed
+#
+#datafile_fields user;date;time;url;connect;bytes;in_cache;out_cache;elapsed
+
+# TAG: weekdays
+#      The weekdays to take account ( Sunday->0, Saturday->6 )
+# Example:
+#weekdays 1-3,5
+# Default:
+weekdays 0-6
+
+# TAG: hours
+#      The hours to take account
+# Example:
+#hours 7-12,14,16,18-20
+# Default:
+hours 0-23
+
+# TAG: squidguard_conf file
+#      path to squidGuard.conf file
+#      Generate reports from SquidGuard logs.
+#      Use 'none' to disable.
+#      squidguard_conf /usr/local/squidGuard/squidGuard.conf
+#
+#squidguard_conf none
+
+# TAG: squidguard_log_format
+#      Format string SquidGuard logs.
+#      REJIK       #year#-#mon#-#day# #hour# #list#:#tmp# #ip# #user# #tmp#/#tmp#/#url#/#end#
+#      SQUIDGUARD  #year#-#mon#-#day# #hour# #tmp#/#list#/#tmp#/#tmp#/#url#/#tmp# #ip#/#tmp# #user# #end#
+#squidguard_log_format #year#-#mon#-#day# #hour# #tmp#/#list#/#tmp#/#tmp#/#url#/#tmp# #ip#/#tmp# #user# #end#
+
+# TAG: show_sarg_info yes|no
+#      shows sarg information and site path on each report bottom
+#
+show_sarg_info no
+
+# TAG: show_sarg_logo yes|no
+#      shows sarg logo
+#
+show_sarg_logo no
+
+# TAG: parsed_output_log directory
+#      Saves the processed log in a sarg format after parsing the squid log file.
+#      This is a way to dump all of the data structures out, after parsing from 
+#      the logs (presumably this data will be much smaller than the log files themselves),
+#      and pull them back in for later processing and merging with data from previous logs.
+#
+#parsed_output_log none
+
+# TAG parsed_output_log_compress /bin/gzip|/usr/bin/bzip2|nocompress
+#      sarg logs compress util
+#
+#parsed_output_log_compress /bin/gzip
+
+# TAG displayed_values bytes|abbreviation
+#      how the values will be displayed in reports.
+#      eg. bytes       -  209.526
+#          abbreviation -  210K
+#
+displayed_values bytes
+
+# Report limits
+# TAG authfail_report_limit n
+# TAG denied_report_limit n
+# TAG siteusers_report_limit n
+# TAG squidguard_report_limit n
+# TAG user_report_limit n
+#      report limits (lines).
+#      '0' no limit
+#
+authfail_report_limit 0
+denied_report_limit 0
+siteusers_report_limit 0
+squidguard_report_limit 0
+user_report_limit 0
+
+# TAG www_document_root dir
+#     Where is your Web DocumentRoot
+#     Sarg will create sarg-php directory with some PHP modules:
+#     - sarg-squidguard-block.php - add urls from user reports to squidGuard DB
+#
+www_document_root /xxx
+
+# TAG block_it module_url
+#     This tag allow you to pass urls from user reports to a cgi or php module,
+#     to be blocked by some Squid acl
+#
+#     Eg.: block_it /sarg-php/sarg-block-it.php
+#     sarg-block-it is a php that will append a url to a flat file.
+#     You must change /var/www/html/sarg-php/sarg-block-it to point to your file
+#     in $filename variable, and chown to a httpd owner.
+#
+#     sarg will pass http://module_url?url=url
+#
+block_it none
+
+# TAG external_css_file path
+#     This tag allow internal sarg css override.
+#     Sarg use theses style classes:
+#      .body           body class
+#      .info           sarg information class, align=center
+#      .title          title class, align=center
+#      .header         header class, align:left
+#      .header2        header class, align:right
+#      .header3        header class, align:right
+#      .text           text class, align:left
+#      .data           table text class, align:right
+#      .data2          table text class, align:right, border colors
+#      .link           link class
+#
+#     There is a sample in /usr/local/sarg/etc/css.tpl
+#
+#external_css_file none
+
+# TAG user_authentication yes|no
+#     Allow user authentication in User Reports using .htaccess
+#     Parameters:  
+#      AuthUserFile    - where the user password file is
+#      AuthName        - authentication realm. Eg "Members Only"
+#      AuthType        - authenticaion type - basic
+#      Require         - authorized users to see the report.
+#                                          %u - user report
+#
+# user_authentication no
+# AuthUserFile /usr/local/sarg/passwd
+# AuthName "SARG, Restricted Access"
+# AuthType Basic
+# Require user admin %u
+
+# TAG download_suffix "suffix,suffix,...,suffix"
+#    file suffix to be considered as "download" in Download report.
+#    Use 'none' to disable.    
+#
+download_suffix "tgz,zip,arj,bzip,bz2,gz,rar,ace,doc,iso,adt,bin,cab,com,dot,drv$,lha,lzh,mdb,mso,ppt,rtf,src,shs,sys,exe,dll,mp3,avi,mpg,mpeg"
+
+--Boundary-00=_W1lgCFYB9s7BJUS
+Content-Type: text/x-log; charset="koi8-r"; name="access.log"
+Content-Disposition: attachment; filename="access.log"
+Content-Transfer-Encoding: 8bit
+
+1112196006.509    265 192.168.77.15 TCP_MISS/200 296 GET http://kmindex.ru/c/?id=313791&id2=48&v=30&l=http%3A//www.alkonvvs.ru/&r=http%3A//www.yandex.ru/yandsearch%3Ftext%3D%25D2%25EE%25F0%25E3%25EE%25E2%25FB%25E5+%25E2%25E8%25F2%25F0%25E8%25ED%25FB%26holdreq%3D%25D2%25EE%25F0%25E3%25EE%25E2%25EE%25E5+%25EE%25E1%25EE%25F0%25F3%25E4%25EE%25E2%25E0%25ED%25E8%25E5%26stype%3Dwww&t=%u0422%u043E%u0440%u0433%u043E%u0432%u043E%u0435%20%u043E%u0431%u043E%u0440%u0443%u0434%u043E%u0432%u0430%u043D%u0438%u0435%2C%20%u043F%u0440%u043E%u0434%u0430%u0436%u0430%20%u0442%u043E%u0440%u0433%u043E%u0432%u043E%u0433%u043E%20%u043E%u0431%u043E%u0440%u0443%u0434%u043E%u0432%u0430%u043D%u0438%u044F%3A%20%u0432%u0438%u0442%u0440%u0438%u043D%u0430%20%u0438%20%u0432%u0438%u0442%u0440%u0438%u043D%u044B%20%u0438%u0437%20%u0430%u043B%u044E%u043C%u0438%u043D%u0438%u0435%u0432%u043E%u0433%u043E%20%u043F%u0440%u043E%u0444%u0438%u043B%u044F%2C%20%u043F%u0440%u043E%u0441%u0442%u043E%20%u0430%u043B%u044E%u043C%u0438%u043D%u0438%u0435%u0432%u044B%u0439%20%u043F%u0440%u043E%u0444%u0438%u043B%u044C%20%u0434%u043B%u044F%20%u0432%u044B%u0441%u0442%u0430%u0432%u043E%u0447%u043D%u043E%u0433%u043E%20%u043E%u0431%u043E%u0440%u0443%u0434%u043E%u0432%u0430%u043D%u0438%u044F%20-%20%u043E%u0442%20%u043A%u043E%u043C%u043F%u0430%u043D%u0438%u0438%20ALCON-BBC&f=0&d=0.95783290883686160.014756022435909899 - DIRECT/217.174.98.3 image/gif
+
+--Boundary-00=_W1lgCFYB9s7BJUS
+Content-Type: text/plain; charset="koi8-r"; name="exclude_codes"
+Content-Disposition: attachment; filename="exclude_codes"
+Content-Transfer-Encoding: 8bit
+
+NONE/400
+TCP_MEM_HIT/200
+TCP_REFRESH_HIT/304
+TCP_REFRESH_HIT/200
+TCP_IMS_HIT/304
+TCP_HIT/200
+TCP_NEGATIVE_HIT/404
+
+--Boundary-00=_W1lgCFYB9s7BJUS--
+
diff --git a/repday.c b/repday.c
new file mode 100644 (file)
index 0000000..f478a30
--- /dev/null
+++ b/repday.c
@@ -0,0 +1,233 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+extern numlist hours;
+
+void report_day(char *user, int *iprel, int *ipuser)
+{
+
+   FILE *fp_in, *fp_ou;
+
+   char data[20];
+   char dia[3];
+   char mes[3];
+   char ano[3];
+   char odata[20];
+   char hora[20];
+   char elap[20];
+   char oelap[20];
+   char whora[3];
+   char html[8000];
+   char arqout[MAXLEN];
+   char wdirname[MAXLEN];
+   char wuser[255];
+   char c[ 24 ][20];
+   int  count=0;
+   int  ihora=0;
+   long long int telap=0;
+   long long int v[ 24 ] = { 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
+                            0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L };
+   long long int t[ 24 ] = { 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
+                            0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L };
+   long long int tt=0, ttt=0;
+   char ftime[128];
+   int i;
+
+   sprintf(arqout,"%s/%s/d%s.html",dirname,user,user);
+   sprintf(wdirname,"%s/%s.day",tmp,user);
+
+   if(access(wdirname, R_OK) != 0)
+      return;
+
+   if((fp_in=fopen(wdirname,"r"))==NULL) {
+     fprintf(stderr, "SARG: (repday) %s: %s\n",text[8],wdirname);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(arqout,"w"))==NULL) {
+     fprintf(stderr, "SARG: (repday) %s: %s\n",text[8],arqout);
+     exit(1);
+   }
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);
+   fputs("<html>\n",fp_ou);
+   fputs("<head>\n",fp_ou);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ou);
+   css(fp_ou);
+   fputs("</head>\n",fp_ou);
+
+   if(strlen(FontFace) > 0) {
+      sprintf(html,"<font face=%s>\n",FontFace);
+      fputs(html,fp_ou);
+   }
+
+   sprintf(html,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   fputs(html,fp_ou);
+
+   if(strlen(LogoImage) > 0) {
+      fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+      sprintf(html,"<tr><th align=left><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText); 
+      fputs(html,fp_ou);
+      fputs("</table>\n",fp_ou);
+   }
+
+   show_sarg(fp_ou,"../..");
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+   sprintf(html,"<tr><th class=\"title\" colspan=2>%s</th></tr>\n",Title);
+   fputs(html,fp_ou);
+   
+   fputs("</table></center>\n",fp_ou);
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+
+   sprintf(html,"<tr><td class=\"header3\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[89],periodo);
+   fputs(html,fp_ou);
+
+   strcpy(wuser,user);
+   if(strstr(wuser,"_") != 0)
+      fixip(wuser);
+
+   if(strcmp(Ip2Name,"yes") == 0)
+      if((str=(char *) strstr(name, ".")) != (char *) NULL) {
+         if((str=(char *) strstr(str+1, ".")) != (char *) NULL)
+            ip2name(wuser);
+   }
+
+   if(UserTabFile[0] != '\0') {
+      sprintf(warea,":%s:",wuser);
+      if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+         z1=0;
+         str2=(char *) strstr(str+1,":");
+         str2++;
+         bzero(name, MAXLEN);
+         while(str2[z1] != ':') {
+            name[z1]=str2[z1];
+            z1++;
+         }
+      } else strcpy(name,wuser);
+   } else strcpy(name,user);
+     
+   sprintf(html,"<tr><td class=\"header3\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[90],name);
+   fputs(html,fp_ou);
+
+   fputs("<tr><td></td></tr><tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr><tr><td></td></tr></table>\n",fp_ou);
+
+   fputs("<table cellpadding=0 cellspacing=2>\n", fp_ou);
+
+   fputs( "<tr><td border=0></td>\n", fp_ou );
+
+   if(strcmp(datetimeby,"bytes") == 0)
+     strcpy( html, "BYTES" );
+   else
+     strcpy( html, "H:M:S" );
+
+   for( i = 0; i < hours.len; i++ )
+     fprintf( fp_ou,
+       "<td class=\"header3\">%02dH<br>%s</td>\n", hours.list[ i ], html );
+   fprintf( fp_ou,
+     "<td class=\"header3\">%s<br>%s</td></tr>\n", text[107], html );
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(data,buf,' ');
+      if(!count) {
+         strcpy(odata,data);
+         count++;
+      }
+
+      getword(hora,buf,' ');
+      getword(elap,buf,' ');
+      elap[strlen(elap)-1]='\0';
+
+      if(strcmp(data,odata) != 0) {
+         strcpy(oelap,elap);
+
+        for( i = 0; i < hours.len; i++ )
+          sprintf(c[ hours.list[ i ] ],"%s",fixtime(v[ hours.list[ i ] ]));
+
+        for( i = 8; i <= 17; i++ )
+          if(strcmp(c[ hours.list[ i ] ],"00:00:00") == 0)
+               bzero(c[ hours.list[ i ] ],12);
+
+         fprintf( fp_ou,
+       "<tr><td class=\"data\">%s</td>\n", odata );
+        for( i = 0; i < hours.len; i++ )
+          fprintf( fp_ou,
+            "<td class=\"data\">%s</td>\n", c[ hours.list[ i ] ] );
+        fprintf( fp_ou,
+          "<td class=\"data\">%s</td>\n", fixtime(tt) );
+        
+         tt=0;
+        for( i = 0; i < hours.len; i++ ) v[ hours.list[ i ] ]=0;
+         strcpy(odata,data);
+         strcpy(elap,oelap);
+      }
+
+      ihora=atoi(hora);
+
+      v[ ihora ]+=my_atoll(elap);
+      tt+=my_atoll(elap);
+      t[ ihora ]+=my_atoll(elap);
+      ttt+=my_atoll(elap);
+
+   }
+
+   for( i = 0; i < hours.len; i++ )
+     sprintf(c[ hours.list[ i ] ],"%s",fixtime(v[ hours.list[ i ] ]));
+
+   for( i = 0; i < hours.len; i++ )
+     if(strcmp(c[ hours.list[ i ] ],"00:00:00") == 0) bzero(c[ hours.list[ i ] ],12);
+   fprintf( fp_ou,
+     "<tr><td class=\"data\">%s</td>\n", data );
+   for( i = 0; i < hours.len; i++ )
+     fprintf( fp_ou,
+       "<td class=\"data\">%s</td>\n", c[ hours.list[ i ] ] );
+   fprintf( fp_ou,
+     "<td class=\"data\">%s</td></tr>\n", fixtime(tt) );
+
+   for( i = 0; i < hours.len; i++ )
+     sprintf(c[ hours.list[ i ] ],"%s",fixtime(t[ hours.list[ i ] ]));
+
+   fprintf( fp_ou,
+     "<tr><td class=\"header\">%s</td>\n", text[107] );
+   for( i = 0; i < hours.len; i++ )
+     fprintf( fp_ou,
+       "<td class=\"header2\">%s</td>\n", c[ hours.list[ i ] ] );
+   fprintf( fp_ou,
+     "<td class=\"header2\">%s</td></tr>\n", fixtime(ttt) );
+
+   fputs("</body>\n</html>\n",fp_ou);
+
+   show_info(fp_ou);
+
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   return;
+}
diff --git a/report.c b/report.c
new file mode 100644 (file)
index 0000000..d1a0d0c
--- /dev/null
+++ b/report.c
@@ -0,0 +1,654 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+#include "include/defs.h"
+
+void gerarel()
+{
+
+   FILE *fp_in, *fp_ou;
+
+   char accdia[11], acchora[9], accuser[MAXLEN], accip[MAXLEN], accurl[MAXLEN], accbytes[12], accelap[10];
+   char oldaccdia[11], oldacchora[9], oldaccip[MAXLEN], wdir[MAXLEN], per1[MAXLEN];
+   char wdirname[MAXLEN], oldurl[MAXLEN], oldaccuser[MAXLEN];
+   char olduser[MAXLEN], oldmsg[50], acccode[50], oldaccelap[10], oldacccode[50], user[MAXLEN];
+   char ipantes[MAXLEN], nameantes[MAXLEN], wdname[MAXLEN], wname2[MAXLEN]; 
+   char accsmart[MAXLEN];
+   char wcrc[50];
+   char crc2[50];
+   char u2[255];
+   long long int nbytes=0; 
+   long long int nelap=0; 
+   long long int nacc=0;
+   long long int rtotal=0;
+   long long int incache=0;
+   long long int oucache=0;
+   char *s;
+   DIR *dirp;
+   struct dirent *direntp;
+
+   ipantes[0]='\0';
+   nameantes[0]='\0';
+   smartfilter=0;
+
+   sprintf(dirname, "%s%s", outdir, periodo);
+   sprintf(wdir, "%s%s", outdir, periodo);
+   strcpy(per1,periodo);
+   vrfydir(wdir, per1, addr, site, us, email);
+
+   if(debugz){
+      debugaz("dirname",dirname);
+      debugaz("wdir",wdir);
+   }
+   strcpy(wdirname,dirname);
+   gperiodo();
+
+   if(strlen(UserAgentLog) > 0 && email[0] == '\0') 
+      useragent();
+
+   olduser[0]='\0';
+   strncat(tmp,"/sarg",5);
+
+   dirp = opendir(tmp);
+   while ((direntp = readdir( dirp )) != NULL ) {
+      if(strstr(direntp->d_name,".log") == 0)
+         continue;
+      if(strncmp(direntp->d_name,"download.log",12) == 0)
+         continue;
+      sprintf(tmp3,"%s/%s",tmp,direntp->d_name);
+      if((fp_in=fopen(tmp3,"r"))==NULL){
+         fprintf(stderr, "SARG: (report) %s: %s\n",text[45],tmp);
+         exit(1);
+      }
+    
+      strcpy(wdname,direntp->d_name);
+      strip_prefix:
+      getword(wname2,wdname,'.');
+      strcat(user,wname2);
+   
+      if(strcmp(wdname,"log") !=0) {
+         strcat(user,".");
+         goto strip_prefix;
+      }
+      strcpy(wdirname,dirname);
+      maketmp(user,tmp,debug,indexonly);
+      maketmp_hour(user,tmp,indexonly);
+   
+      ttopen=0;
+      bzero(html_old, MAXLEN);
+   
+      while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+         getword(accdia,buf,' ');
+         getword(acchora,buf,' ');
+         getword(accuser,buf,' ');
+         getword(accip,buf,' ');
+         getword(accurl,buf,' ');
+         getword(accbytes,buf,' ');
+         getword(acccode,buf,' ');
+         if(strncmp(acccode,"TCP_DENIED/407",14) == 0)
+            continue;
+         getword(accelap,buf,' ');
+         getword(accsmart,buf,' ');
+         getword(accsmart,buf,'"');
+   
+         if(strlen(accsmart) > 0) {
+            smartfilter++;
+            strcpy(wdirname,dirname);
+            grava_SmartFilter(wdirname,accuser,accip,accdia,acchora,accurl,accsmart);
+         }
+
+         if(strcmp(Ip2Name,"yes") == 0) {
+            if(strcmp(accip,ipantes) != 0) {
+               strcpy(ipantes,accip);
+               ip2name(accip);
+               strcpy(nameantes,accip);
+            } else strcpy(accip,nameantes);
+         }
+     
+         strcpy(wdirname,dirname);
+         gravatmp_hora(wdirname,accuser,accdia,acchora,accelap,accbytes,indexonly);
+
+         if(iprel){
+            strcpy(wdirname,dirname);
+            gravaporuser(accuser,wdirname,accurl,accip,accdia,acchora,accbytes,accelap,indexonly);
+         }
+
+         if(!rtotal){
+            strcpy(oldurl,accurl);
+            strcpy(oldacccode,acccode);
+            strcpy(oldaccelap,accelap);
+            strcpy(oldaccuser,accuser);
+            strcpy(oldaccip,accip);
+            strcpy(oldaccdia,accdia);
+            strcpy(oldacchora,acchora);
+            rtotal++;
+         }
+
+         if(site[0] != '\0') {
+            if(strcmp(oldaccuser,accuser) != 0){
+               strcpy(oldmsg,"OK");
+               if(strstr(oldacccode,"DENIED") != 0)
+                  sprintf(oldmsg,"%s",text[46]);
+               gravatmp(oldaccuser,wdirname,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
+               gravager(wdirname,oldaccuser,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,
+                               incache,oucache);
+               nacc=0;
+               nbytes=0;
+               nelap=0;
+               incache=0;
+               oucache=0;
+            }
+         } else {     
+            if(strcmp(oldurl,accurl) != 0 || strcmp(oldaccuser,accuser) != 0){
+               strcpy(oldmsg,"OK");
+               if(strstr(oldacccode,"DENIED") != 0)
+                  sprintf(oldmsg,"%s",text[46]);
+               strcpy(wdirname,dirname);
+               gravatmp(oldaccuser,wdirname,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
+               strcpy(wdirname,dirname);
+               gravager(wdirname,oldaccuser,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache);
+               nacc=0;
+               nbytes=0;
+               nelap=0;
+               incache=0;
+               oucache=0;
+           if(strcmp(oldaccuser,accuser) != 0)
+              ind2=0;
+            }
+      }
+      nacc++;
+      nbytes+=my_atoll(accbytes);
+      nelap+=my_atoll(accelap);
+
+      if(strstr(ReportType,"site_user_time_date") != 0) {
+         if(!ttopen) {
+            ind2++;
+           strcpy(siteind,accurl);
+           str=siteind;
+           for(z1=0; z1<strlen(str); z1++) {
+           if(str[z1]=='?' || str[z1]=='-' || str[z1]=='.' || str[z1]==':' || str[z1]=='/' || str[z1]=='\\')
+                            str[z1]='_';
+            }
+           sprintf(arqtt,"%s/%s",dirname,accuser);
+           if(access(arqtt, R_OK) != 0)
+               my_mkdir(arqtt);
+           sprintf(arqtt,"%s/%s/tt%s-%s.html",dirname,accuser,accuser,siteind);
+            if(strlen(arqtt) > 255) {
+               strncpy(val7,arqtt,255);
+               bzero(arqtt,MAXLEN);
+               strcpy(arqtt,val7);
+            }            
+            if ((fp_tt = fopen(arqtt, "w")) == 0) {
+               fprintf(stderr, "SARG: (report) %s: %s\n",text[45],arqtt);
+               exit(1);
+            }
+           ttopen=1;
+
+           if(strcmp(Privacy,"yes") == 0)
+               sprintf(httplink,"<font size=%s color=%s><href=http://%s>%s",   \
+                         FontSize,PrivacyStringColor,PrivacyString,PrivacyString);
+            else
+               sprintf(httplink,"<font size=%s><a href=http://%s>%s</A>",FontSize,accurl,accurl);
+
+            sprintf(ltext110,"%s",text[110]);
+            if(ltext110){
+               for(s=ltext110; *s; ++s)
+                  *s=tolower(*s);
+            }
+
+            fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_tt);
+            fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_tt);
+            fputs("<html>\n",fp_tt);
+            fputs("<head>\n",fp_tt);
+            sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+            fputs(html,fp_tt);
+            css(fp_tt);
+            fputs("</head>\n",fp_tt);
+
+            sprintf(html,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+            fputs(html,fp_tt);
+
+            fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_tt);
+
+            if(strlen(LogoImage) > 0) {
+               sprintf(html,"<tr><th align=left><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+               fputs(html,fp_tt);
+            }
+
+           show_sarg(fp_tt, "../..");
+
+            sprintf(html,"<tr><th class=\"title\" colspan=\"2\">%s</th></tr>\n",Title);
+            fputs(html,fp_tt);
+
+            strcpy(u2,user);
+            if(strcmp(Ip2Name,"yes") == 0)
+               ip2name(u2);
+            if(UserTabFile[0] != '\0') {
+               sprintf(warea,":%s:",u2);
+               if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+                  z1=0;
+                  str2=(char *) strstr(str+1,":");
+                  str2++;
+                  bzero(name, MAXLEN);
+                  while(str2[z1] != ':') {
+                     name[z1]=str2[z1];
+                     z1++;
+                  }
+               } else strcpy(name,u2);
+            } else strcpy(name,u2);
+
+            sprintf(html,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[89],periodo);
+            fputs(html,fp_tt);
+            sprintf(html,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[90],name);
+            fputs(html,fp_tt);
+            sprintf(html,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s, %s</td></tr>\n",text[104],UserSortField,UserSortOrder);
+            fputs(html,fp_tt);
+            sprintf(html,"<tr><td class=\"header3\" colspan=2>%s %s</td></tr>\n",text[32],text[55]);
+            fputs(html,fp_tt);
+
+            fputs("</table></center>\n",fp_tt);
+            fputs("<center><table cellpadding=\"0\" cellspacing=\"2\">\n",fp_tt);
+            fputs("<tr><td></td><td></td></tr>",fp_tt);
+            bzero(tmp4, MAXLEN);
+            bzero(tmp5, MAXLEN);
+            strncpy(tmp4,text[110],4);
+            strncpy(tmp5,text[110]+5,4);
+            sprintf(html,"<tr><th class=\"data\">%s</th><th class=\"data\">%s</th><th class=\"data\">%s</th></tr>\n",text[91],tmp4,tmp5);
+            fputs(html,fp_tt);
+        }
+
+         sprintf(html,"<tr><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",accurl,accdia,acchora);
+
+        if(strcmp(html,html_old) != 0)
+            fputs(html,fp_tt);
+        strcpy(html_old, html);
+      } else {
+         bzero(ltext110, 50);
+      } 
+
+      strcpy(wcrc,acccode);
+      getword(crc2,wcrc,'/');
+
+      if(strstr(crc2,"MISS") != 0)
+         oucache+=my_atoll(accbytes);
+       else incache+=my_atoll(accbytes);
+
+      strcpy(oldurl,accurl);
+
+      if(strcmp(accuser,oldaccuser) != 0) {
+         strcpy(wdirname,dirname);
+         totaliza_day(tmp,oldaccuser,indexonly);
+      }
+
+      strcpy(oldaccuser,accuser);
+      strcpy(oldacccode,acccode);
+      strcpy(oldaccelap,accelap);
+      strcpy(oldaccip,accip);
+      strcpy(oldaccdia,accdia);
+      strcpy(oldacchora,acchora);
+
+   }
+   bzero(user,MAXLEN);
+   fclose(fp_in);
+   unlink(tmp3);
+}
+
+   strcpy(oldmsg,"OK");
+   if(strstr(oldacccode,"DENIED") != 0)
+      sprintf(oldmsg,"%s",text[46]);
+   strcpy(wdirname,dirname);
+   gravatmpf(oldaccuser,wdirname,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
+   strcpy(wdirname,dirname);
+   gravager(wdirname,oldaccuser,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache);
+   strcpy(wdirname,dirname);
+   totaliza_day(tmp,oldaccuser,indexonly);
+
+   tmpsort();
+
+   strcpy(wdirname,dirname);
+   totalger(wdirname, debug, outdir);
+
+   if(strlen(email) == 0) {
+      download_report();
+
+      if(strlen(DansGuardianConf) > 0) {
+         strcpy(wdirname,dirname);
+         dansguardian_log();
+      }
+
+      if(strlen(SquidGuardConf) > 0) {
+         strcpy(wdirname,dirname);
+         squidguard_log();
+      }
+
+      strcpy(wdirname,dirname);
+      topuser();
+
+      if(strstr(ReportType,"topsites") != 0)
+         topsites();
+
+      if(strstr(ReportType,"sites_users") != 0)
+         siteuser();
+      gen_denied_report();
+
+      strcpy(wdirname,dirname);
+      authfail_report();
+
+      if(smartfilter)
+         smartfilter_report();
+
+      if(strlen(DansGuardianConf) > 0)
+         dansguardian_report();
+
+      if(strlen(SquidGuardConf) > 0)
+         squidguard_report();
+
+      if(strstr(ReportType,"users_sites") != 0)
+         htmlrel();
+
+      geraindex();
+
+      if(strncmp(SuccessfulMsg,"yes",3) == 0)
+         fprintf(stderr, "SARG: %s %s\n",text[47],dirname);
+    } else {
+      strcpy(wdirname,dirname);
+      geramail(wdirname, debug, outdir, userip, email, TempDir);
+
+      if(strcmp(email,"stdout") != 0) {
+         if(strncmp(SuccessfulMsg,"yes",3) == 0)
+            fprintf(stderr, "SARG: %s %s\n",text[48],email);
+      }
+   }
+
+   if(indexonly) {
+      strcpy(wdirname,dirname);
+      index_only(wdirname, debug);
+   }
+
+   removetmp(dirname);
+
+   return;
+}
+
+
+void maketmp(char *user, char *dirname, int debug, int indexonly)
+{
+
+   FILE *fp_ou;
+
+   char wdirname[MAXLEN];
+
+   if(indexonly) return;
+   if(strstr(ReportType,"users_sites") == 0) return;
+
+   strcpy(wdirname,tmp);
+   strcat(wdirname,"/");
+   strcat(wdirname,user);
+
+   if(debug){
+      sprintf(msg,"%s: %s",text[49],wdirname);
+      debuga(msg);
+   }
+
+   strcat(wdirname,".utmp");
+   if((fp_ou=fopen(wdirname,"w"))==NULL){
+      fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
+      exit(1);
+   }
+
+   fclose(fp_ou);
+   return;
+}
+
+
+void maketmp_hour(char *user, char *dirname, int indexonly)
+{
+
+   FILE *fp_ou;
+
+   char wdirname[MAXLEN];
+
+   if(indexonly) return;
+   if(strstr(ReportType,"users_sites") == 0) return;
+
+   strcpy(wdirname,tmp);
+   strcat(wdirname,"/");
+   strcat(wdirname,user);
+
+   strcat(wdirname,".htmp");
+   if((fp_ou=fopen(wdirname,"w"))==NULL){
+      fprintf(stderr, "SARG: (report-1) %s: %s - %s\n",text[45],wdirname,strerror(errno));
+      exit(1);
+   }
+
+   fclose(fp_ou);
+   return;
+}
+
+
+void gravatmp(char *oldaccuser, char *dirname, char *oldurl, long long int nacc, long long int nbytes, char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache)
+{
+
+   FILE *fp_ou;
+
+   char reg[MAXLEN];
+   char wdirname[MAXLEN];
+
+   if(indexonly) return;
+   if(strstr(ReportType,"users_sites") == 0) return;
+
+   strcpy(wdirname,tmp);
+   strcat(wdirname,"/");
+   strcat(wdirname,oldaccuser);
+   strcat(wdirname,".utmp");
+
+   if((fp_ou=fopen(wdirname,"a"))==NULL){
+      fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
+      exit(1);
+   } 
+
+   my_lltoa(nacc,val1,15);
+   my_lltoa(nbytes,val2,15);
+   my_lltoa(nelap,val3,15);
+   my_lltoa(incache,val4,15);
+   my_lltoa(oucache,val5,15);
+   sprintf(reg,"%s %s %s %s %s %s %s\n",val1,val2,oldurl,oldmsg,val3,val4,val5);
+   fputs(reg,fp_ou);
+
+   fclose(fp_ou);
+   ttopen=0;
+
+   if(fp_tt) {
+      fputs("</table>\n",fp_tt);
+      fputs("</body>\n</html>\n",fp_tt);
+      fclose(fp_tt);
+   }
+
+   return;
+
+}
+
+
+void gravatmp_hora(char *dirname, char *user, char *data, char *hora, char *elap, char *bytes, int indexonly)
+{
+
+   FILE *fp_ou;
+
+   char reg[MAXLEN];
+   char wdirname[MAXLEN];
+
+   if(indexonly) return;
+   if(strstr(ReportType,"users_sites") == 0) return;
+
+   strcpy(wdirname,tmp);
+   strcat(wdirname,"/");
+   strcat(wdirname,user);
+   strcat(wdirname,".htmp");
+
+   if((fp_ou=fopen(wdirname,"a"))==NULL){
+      fprintf(stderr, "SARG: (report-2) %s: %s - %s\n",text[45],wdirname,strerror(errno));
+      exit(1);
+   }
+
+   if(strcmp(datetimeby,"bytes") == 0)
+      sprintf(reg,"%s %s %s\n",data,hora,bytes);
+   else sprintf(reg,"%s %s %s\n",data,hora,elap);
+   fputs(reg,fp_ou);
+
+   fclose(fp_ou);
+
+   return;
+}
+
+
+void gravaporuser(char *user, char *dirname, char *url, char *ip, char *data, char *hora, char *tam, char *elap, int indexonly)
+{
+
+   FILE *fp_ou;
+
+   char reg[MAXLEN];
+   char wdirname[MAXLEN];
+
+   if(indexonly) return;
+   if(strstr(ReportType,"users_sites") == 0) return;
+
+   strcpy(wdirname,tmp);
+   strcat(wdirname,"/");
+   strcat(wdirname,user);
+   strcat(wdirname,".ip");
+
+   if((fp_ou=fopen(wdirname,"a"))==NULL){
+      fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
+      exit(1);
+   } 
+
+   sprintf(reg,"%s %s %s %s %s %s\n",ip,url,data,hora,tam,elap);
+   fputs(reg,fp_ou);
+
+   fclose(fp_ou);
+
+   return;
+
+}
+
+
+void gravatmpf(char *oldaccuser, char *dirname, char *oldurl, long long int nacc, long long int nbytes, char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache)
+{
+
+   FILE *fp_ou;
+
+   char reg[MAXLEN];
+   char wdirname[MAXLEN];
+
+   if(indexonly) return;
+   if(strstr(ReportType,"users_sites") == 0) return;
+
+   strcpy(wdirname,tmp);
+   strcat(wdirname,"/");
+   strcat(wdirname,oldaccuser);
+   strcat(wdirname,".utmp");
+
+   if((fp_ou=fopen(wdirname,"a"))==NULL){
+      fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
+      exit(1);
+   }
+
+   my_lltoa(nacc,val1,15);
+   my_lltoa(nbytes,val2,15);
+   my_lltoa(nelap,val3,15);
+   my_lltoa(incache,val4,15);
+   my_lltoa(oucache,val5,15);
+   sprintf(reg,"%s %s %s %s %s %s %s\n",val1,val2,oldurl,oldmsg,val3,val4,val5);
+   fputs(reg,fp_ou);
+
+   fclose(fp_ou);
+   ttopen=0;
+   ind2=0;
+
+   if(fp_tt) {
+      fputs("</table>\n",fp_tt);
+      fputs("</html>\n",fp_tt);
+      fclose(fp_tt);
+   }
+
+   return;
+     
+}
+
+
+void gravager(char *dirname, char *user, long long int nacc, char *url, long long int nbytes, char *ip, char *hora, char *dia, long long int nelap, long long int incache, long long int oucache)
+{
+
+   FILE *fp_ou;
+   char reg[MAXLEN];
+
+   strcat(dirname,"/");
+   strcat(dirname,"geral");
+   
+   if((fp_ou=fopen(dirname,"a"))==NULL){
+      fprintf(stderr, "SARG: (report) %s: %s\n",text[45],dirname);
+      exit(1);
+   }
+
+   my_lltoa(nacc,val1,15);
+   my_lltoa(nbytes,val2,15);
+   my_lltoa(nelap,val3,15);
+   my_lltoa(incache,val4,15);
+   my_lltoa(oucache,val5,15);
+   sprintf(reg,"%s %s %s %s %s %s %s %s %s %s\n",user,val1,val2,url,ip,hora,dia,val3,val4,val5);
+   fputs(reg,fp_ou);
+
+   fclose(fp_ou);
+   return;
+
+}
+
+void grava_SmartFilter(char *dirname, char *user, char *ip, char *data, char *hora, char *url, char *smart)
+{
+
+   FILE *fp_ou;
+
+   char reg[MAXLEN];
+   char wdirname[MAXLEN];
+
+   sprintf(wdirname,"%s/smartfilter.unsort",dirname);
+
+   if((fp_ou=fopen(wdirname,"a"))==NULL){
+      fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
+      exit(1);
+   }
+
+   sprintf(reg,"%s %s %s %s %s %s\n",user,data,hora,ip,url,smart);
+   fputs(reg,fp_ou);
+   fputs("</body>\n</html>\n",fp_tt);
+
+   fclose(fp_ou);
+
+   return;
+
+}
diff --git a/sarg-php/COPYING b/sarg-php/COPYING
new file mode 100644 (file)
index 0000000..a43ea21
--- /dev/null
@@ -0,0 +1,339 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+       Appendix: How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/sarg-php/INSTALL b/sarg-php/INSTALL
new file mode 100644 (file)
index 0000000..e3e887b
--- /dev/null
@@ -0,0 +1,9 @@
+*
+To use sarg-squidGuard you need to change:
+
+1. These two variables on sarg-squidguard-block.php file:
+$SargConf = "/usr/local/sarg/sarg.conf";
+$squidGuardConf = "/usr/local/squidGuard/squidGuard.conf";
+
+2.change the squidGuard db file to the same httpd process owner:
+chown apache /var/www/html/sarg-php
diff --git a/sarg-php/LANGUAGES b/sarg-php/LANGUAGES
new file mode 100644 (file)
index 0000000..b71e69e
--- /dev/null
@@ -0,0 +1,16 @@
+This PHP modules is under i18n. 
+Available languages:
+
+       English                 Pedro Orso <orso@brturbo.com.br>
+       Brazilian_Portuguese    Pedro Orso <orso@brturbo.com.br>
+       French                  Jacques GRILLOT <Jacques.Grillot@grouperdi.com>
+       Russian                 Michael Stepanenko <mistic@ecolines.ru>
+
+Thank you, my friends.
+
+If you want to traslate, follow this steps:
+
+1. edit translation.this file
+2. translate every msgid sentence in msgstr tag
+3. send to orso@brturbo.com to implement
+   * plase send your name and email address.
diff --git a/sarg-php/language.php b/sarg-php/language.php
new file mode 100755 (executable)
index 0000000..f5bc8b9
--- /dev/null
@@ -0,0 +1,58 @@
+<?php
+
+/*
+ * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+global $language;
+global $SargConf;
+
+function sarg_config($line,$clave) {
+   if ( 0 == strncmp("#", $line, 1))
+      return;
+   if (preg_match("/language/i", $line)) {
+      global $language;
+      $l = explode(' ', $line);
+      list(, $lang) = $l;
+      $lang=preg_replace('/\s+/','',$lang);
+      if ( 0 == strcmp("English", $lang))
+         $language = "en-EN";
+      else if ( 0 == strcmp("Portuguese", $lang))
+         $language = "pt_BR";
+      return;
+   }
+}
+
+
+$lines=file($SargConf);
+array_walk($lines,'sarg_config');
+
+putenv("LANG=$language");
+setlocale(LC_ALL, $language);
+$domain = 'messages';
+bindtextdomain($domain, "./locale");
+textdomain($domain);
+return;
+
+?>
diff --git a/sarg-php/sarg-block-it.php b/sarg-php/sarg-block-it.php
new file mode 100755 (executable)
index 0000000..925b827
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+
+/*
+ * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+$filename = "/usr/local/squid/etc/block.txt";
+
+$url = $_GET['url'];
+$url = $url."\n";
+
+$ha = fopen($filename, 'a');
+if ($filename == false) {
+   print (gettext ("Could not open the filename"));
+   echo '&nbsp;'.$filename;
+   exit;
+}
+else {
+   $written = fwrite($ha, $url);
+   fclose($ha);
+   if ($written != strlen($url)) {
+      print (gettext ("Write error"));
+      exit;
+   }
+   print (gettext ("Done!"));
+   echo "<br><br>\n";
+   echo "<a href=\"javascript:history.go(-1)\">";
+   print (gettext("Return"));
+   echo "</a>&nbsp;";
+   print (gettext (" to Sarg."));
+}
diff --git a/sarg-php/sarg-squidguard-block.php b/sarg-php/sarg-squidguard-block.php
new file mode 100755 (executable)
index 0000000..2104bfc
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+
+/*
+ * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+// Change to squidGuard and sarg config files path
+$SargConf = "/usr/local/sarg/sarg.conf";
+$squidGuardConf = "/usr/local/squidGuard/squidGuard.conf";
+
+global $SargConf;
+global $dbhome;
+global $language;
+
+include_once("language.php");
+include_once("style.php");
+
+$url = $_GET['url'];
+$squidGuard_conf = '/usr/local/squidGuard/squidGuard.conf';
+
+function parse_config($line,$clave) {
+   if (preg_match("/dbhome/i", $line)) {
+      global $dbhome;
+      $l = explode(' ', $line);
+      list(, $dbhome) = $l;
+      $dbhome=preg_replace('/\s+/','',$dbhome);
+   }
+}
+
+echo "<center>\n";
+echo "<table>\n";
+echo "<tr><td class=\"title\">";
+print(gettext ("Sarg-SquidGuard - URL Blocking"));
+echo "</td></tr>\n";
+echo "<tr><td class=\"header2\">";
+print(gettext ("Choose the rule set where"));
+echo "<a href=\"http://$url\">&nbsp;$url</a> ";
+print(gettext ("will by added"));
+echo "</td></tr>\n";
+echo "</table>\n";
+echo "<table>\n";
+
+$lines=file($squidGuardConf);
+array_walk($lines,'parse_config');
+
+if (is_dir($dbhome)) {
+   if ($ha1 = opendir($dbhome)) {
+      while (false !== ($file = readdir($ha1))) {
+         if ($file == '.' || $file == '..') continue;
+         echo "<tr><td class=\"header\">$file</td></tr>\n";
+         $dir2 = $dbhome.'/'.$file;
+         if (is_dir($dir2)) {
+            if ($ha2 = opendir($dir2)) {
+               while (false !== ($file2 = readdir($ha2))) {
+                  if ($file2 == '.' || $file2 == '..') continue;
+                     echo "<tr><td class=\"data2\"><a href=\"sarg-squidguard-block2.php?file=$dir2/$file2&url=$url&lang=$language\">$file2</a></td></tr>\n";
+               }
+            }
+            closedir($ha2);
+         }
+      }
+      closedir($ha1);
+   }
+}
+
+echo "</table>\n";
+echo "</html>\n";
+?>
diff --git a/sarg-php/sarg-squidguard-block2.php b/sarg-php/sarg-squidguard-block2.php
new file mode 100755 (executable)
index 0000000..46a568c
--- /dev/null
@@ -0,0 +1,58 @@
+<?php
+
+/*
+ * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+$file = $_GET['file'];
+$url = $_GET['url'];
+$language = $_GET['lang'];
+$url = $url."\n";
+
+putenv("LANG=$language");
+setlocale(LC_ALL, $language);
+$domain = 'messages';
+bindtextdomain($domain, "./locale");
+textdomain($domain);
+
+$ha = fopen($file, 'a');
+if ($file == false) {
+   print (gettext ("Could not open the file"));
+   echo '&nbsp;'.$file;
+   exit;
+}
+else {
+   $written = fwrite($ha, $url);
+   fclose($ha);
+   if ($written != strlen($url)) {
+      print (gettext ("Write error"));
+      exit;
+   }
+   print (gettext ("Done!"));
+   echo "<br><br>\n";
+   echo "<a href=\"javascript:history.go(-2)\">";
+   print (gettext("Return"));
+   echo "</a>&nbsp;";
+   print (gettext (" to Sarg."));
+}
diff --git a/sarg-php/style.php b/sarg-php/style.php
new file mode 100755 (executable)
index 0000000..cb63b26
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+/*
+ * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+echo ("<style>");
+echo (".title {font-family:Verdana,Tahoma,Arial;font-size:11px;color:#006699;background-color:#FFFFFF;text-align:center;}");
+echo (".header {font-family:Verdana,Tahoma,Arial;font-size:9px;color:darkblue;background-color:#DDDDDD;text-align:left;}");
+echo (".header2 {font-family:Verdana,Tahoma,Arial;font-size:10px;color:red;}");
+echo (".data {font-family:Verdana,Tahoma,Arial;color:#000000;font-size:9px;text-align:right;}");
+echo (".data a:link,a:visited {font-family:Verdana,Tahoma,Arial;color:#0000FF;font-size:9px;text-align:right;text-decoration:none;}");
+echo (".data2 {font-family:Verdana,Tahoma,Arial;color:#000000;font-size:9px;}");
+echo (".data2 a:link,a:visited{font-family:Verdana,Tahoma,Arial;color:#0000FF;font-size:9px;background-color:lavender;text-decoration:none;}");
+echo ("</style>");
+
+echo ("<html>");
+echo ("<head>");
+echo ("  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">");
+echo ("</head>");
+?>
diff --git a/sarg-php/translate.this b/sarg-php/translate.this
new file mode 100644 (file)
index 0000000..f8621d6
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+msgid ""
+msgstr ""
+"Project-Id-Version: sarg-squidGuard 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2004-08-12 11:14-0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sarg-squidguard-block2.php:10
+msgid "Could not open the file"
+msgstr ""
+
+#: sarg-squidguard-block2.php:19
+msgid "Write error"
+msgstr ""
+
+#: sarg-squidguard-block2.php:23
+msgid "Done!"
+msgstr ""
+
+#: sarg-squidguard-block2.php:27
+msgid "Return"
+msgstr ""
+
+#: sarg-squidguard-block2.php:30
+msgid " to Sarg."
+msgstr ""
+
+#: sarg-squidguard-block.php:29
+msgid "Sarg-SquidGuard - URL Blocking"
+msgstr ""
+
+#: sarg-squidguard-block.php:33
+msgid "Choose the rule set where"
+msgstr ""
+
+#: sarg-squidguard-block.php:36
+msgid "will by added"
+msgstr ""
diff --git a/sarg.1 b/sarg.1
new file mode 100644 (file)
index 0000000..65d4ea2
--- /dev/null
+++ b/sarg.1
@@ -0,0 +1,144 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH SARG 1 "September 25, 2004"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+sarg \- Squid Analysis Report Generator
+.SH SYNOPSIS
+.B sarg
+.RI [ options ]
+.SH DESCRIPTION
+\fBsarg\fP is a logfile parser and anylizer for the \fBSquid Web Proxy Cache\fP,
+which can be found at \fBhttp://www.squid-cache.org/\fP.
+This manual page documents briefly the
+.B sarg
+command.  More information is available at \fBhttp://sarg.sourceforge.net/\fP.
+This manual page was originally written for the Debian distribution
+because the author didn't include one in favor of documentation
+in the GNU Info format; see below.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics, 
+.\" respectively.
+\fBsarg\fP is a tool that allows you to view "where" your users are going to on
+the Internet. \fBsarg\fP generates reports in HTML, with fields such as: users,
+IP Addresses, bytes, sites, and times.  These HTML files can appear in your
+web server's directory for browsing by users or administrators.  You may also
+have \fBsarg\fP email the reports to the Squid Cache administrator.
+.PP
+\fBsarg\fP can take the \fBsquid\fP access log as its input, or optionally the
+\fBsquidGuard http://www.squidguard.org/\fP Squid filter/redirector logfile format.
+.SH OPTIONS
+A summary of options is included below.
+.TP
+.B \-h
+Show summary of options.
+.TP
+.B \-a [hostname|ip address]
+Limits report to records containing the specified hostname/ip address
+.TP
+.B \-b filename
+Enables UserAgent log and writes it to
+.IR "filename".
+.TP
+.B \-c filename
+Uses
+.IR "filename"
+as the exclude files to select records that are not counted.
+.TP
+.B \-d date
+Uses
+.IR "date"
+as the timelimit during logfile processing. Format for
+.IR "date"
+is
+.B dd/mm/yyyy-dd/mm/yyyy
+.TP
+.B \-e email
+Sends report to
+.IR "email"
+(stdout for console).
+.TP
+.B \-f filename
+Reads configuration from
+.IR "filename".
+.TP
+.B \-g e|u
+Sets date format in generated reports.
+.br
+\fBe\fP = Europe -> dd/mm/yy
+.br
+\fBu\fP = USA    -> mm/dd/yy
+.TP
+.B \-i
+Generates reports by user and ip address.
+.br
+\fBNOTE:\fP This requires the 'report_type'
+option in config file to contain "users_sites".
+.TP
+.B \-l filename
+Uses
+.IR "filename"
+as the input log.
+.TP
+.B \-n
+Enables ip address resolution.
+.TP
+.B \-o dir
+Writes report in
+.IR "dir".
+.TP
+.B \-p
+Generates reports using ip address instead of userid.
+.TP
+.B \-s string
+Limits report to the site specified by
+.IR "string
+[eg. www.debian.org]
+.TP
+.B \-t string
+Limits records counted in statistics based on time-of-day. Format for
+\fIstring\fP is \fBHH\fP or \fBHH:MM\fP or \fBHH:MM:SS\fP.
+.TP
+.B \-u user
+Limits reports to \fIuser\fP activities.
+.TP
+.B \-w dir
+Uses \fIdir\fP for temporary files.
+.TP
+.B \-x
+Writes messages on processes to \fBSTDOUT\fP
+.TP
+.B \-x
+Writes debug messages to \fBSTDOUT\fP
+.TP
+.B \-convert
+Convert the logfile's date/time field to human-readable.
+.TP
+.B \-split
+Split the log file by date in \fB-d\fP parameter.
+.SH FILES
+.BR /usr/local/sarg/sarg.conf
+.br
+.B /usr/local/squid/logs/access.log
+.br
+.B /usr/local/squidGuard/logs/squidGuard.log
+.SH SEE ALSO
+squid(8)
+.SH AUTHOR
+This manual page was written by Luigi Gangitano <gangitano@lugroma3.org>,
+for the Debian GNU/Linux system (but may be used by others).  Revised
+by Billy Newsom.
diff --git a/sarg.conf b/sarg.conf
new file mode 100644 (file)
index 0000000..86c86c9
--- /dev/null
+++ b/sarg.conf
@@ -0,0 +1,563 @@
+# sarg.conf
+#
+# TAG:  language 
+#      Available languages:
+#              Bulgarian_windows1251
+#              Catalan
+#              Czech
+#              Dutch
+#              English
+#              French
+#              German
+#              Greek
+#              Hungarian
+#              Indonesian
+#              Italian
+#              Japanese
+#              Latvian
+#              Polish
+#              Portuguese
+#              Romanian
+#              Russian_koi8
+#              Russian_windows1251
+#              Serbian
+#              Slovak
+#              Spanish
+#              Turkish
+#
+#language English
+
+# TAG:  access_log file
+#       Where is the access.log file
+#       sarg -l file
+#
+#access_log /usr/local/squid/var/logs/access.log
+
+# TAG: graphs yes|no
+#      Use graphics where is possible.
+#           graph_days_bytes_bar_color blue|green|yellow|orange|brown|red
+#
+#graphs yes
+#graph_days_bytes_bar_color orange
+
+# TAG: title
+#      Especify the title for html page.
+#
+#title "Squid User Access Reports"
+
+# TAG: font_face
+#      Especify the font for html page.
+#
+#font_face Tahoma,Verdana,Arial
+
+# TAG: header_color
+#      Especify the header color
+#
+#header_color darkblue
+
+# TAG: header_bgcolor
+#      Especify the header bgcolor
+#
+#header_bgcolor blanchedalmond
+
+# TAG: font_size
+#      Especify the text font size
+#
+#font_size 9px
+
+# TAG: header_font_size
+#      Especify the header font size
+#
+#header_font_size 9px
+
+# TAG: title_font_size
+#      Especify the title font size
+#
+#title_font_size 11px
+
+# TAG: background_color
+# TAG: background_color
+#      Html page background color
+#
+# background_color white
+
+# TAG: text_color
+#      Html page text color
+#
+#text_color #000000
+
+# TAG: text_bgcolor
+#      Html page text background color
+#
+#text_bgcolor lavender
+
+# TAG: title_color
+#      Html page title color
+#
+#title_color green
+
+# TAG: logo_image
+#      Html page logo.
+#
+#logo_image none
+
+# TAG: logo_text
+#      Html page logo text.
+#
+#logo_text ""
+
+# TAG: logo_text_color
+#      Html page logo texti color.
+#
+#logo_text_color #000000
+
+# TAG: logo_image_size
+#      Html page logo image size. 
+#       width height
+#
+#image_size 80 45
+
+# TAG: background_image
+#      Html page background image
+#
+#background_image none
+
+# TAG:  password
+#       User password file used by authentication
+#       If used here, reports will be generated only for that users.
+#
+#password none
+
+# TAG:  temporary_dir
+#       Temporary directory name for work files
+#       sarg -w dir
+#
+#temporary_dir /tmp
+
+# TAG:  output_dir
+#       The reports will be saved in that directory
+#       sarg -o dir
+#
+#output_dir /var/www/html/squid-reports
+
+# TAG:  output_email
+#       Email address to send the reports. If you use this tag, no html reports will be generated.
+#       sarg -e email
+#
+#output_email none
+
+# TAG:  resolve_ip yes/no
+#       Convert ip address to dns name
+#       sarg -n
+#resolve_ip no
+
+# TAG:  user_ip yes/no
+#       Use Ip Address instead userid in reports.
+#       sarg -p
+#user_ip no
+
+# TAG:  topuser_sort_field field normal/reverse
+#       Sort field for the Topuser Report.
+#       Allowed fields: USER CONNECT BYTES TIME
+#
+#topuser_sort_field BYTES reverse
+
+# TAG:  user_sort_field field normal/reverse
+#       Sort field for the User Report.
+#       Allowed fields: SITE CONNECT BYTES TIME
+#
+#user_sort_field BYTES reverse
+
+# TAG:  exclude_users file
+#       users within the file will be excluded from reports.
+#       you can use indexonly to have only index.html file.
+#
+#exclude_users none
+
+# TAG:  exclude_hosts file
+#       Hosts, domains or subnets will be excluded from reports.
+#
+#       Eg.: 192.168.10.10 - exclude ip address only
+#            192.168.10.0  - exclude full C class
+#            s1.acme.foo   - exclude hostname only
+#            acme.foo      - exclude full domain name
+#
+#exclude_hosts none
+
+# TAG:  useragent_log file
+#       Put here where is useragent.log to nable useragent report.
+#
+#useragent_log none
+
+# TAG:  date_format
+#       Date format in reports: e (European=dd/mm/yy), u (American=mm/dd/yy), w (Weekly=yy.ww)
+#       
+#date_format u
+
+# TAG:  per_user_limit file MB
+#       Saves userid on file if download exceed n MB.
+#       This option allow you to disable user access if user exceed a download limit.
+#       
+#per_user_limit none
+
+# TAG: lastlog n
+#      How many reports files must be keept in reports directory.
+#      The oldest report file will be automatically removed.
+#      0 - no limit.
+#
+#lastlog 0
+
+# TAG: remove_temp_files yes
+#      Remove temporary files: geral, usuarios, top, periodo from root report directory.
+#
+#remove_temp_files yes
+
+# TAG: index yes|no|only
+#      Generate the main index.html.
+#      only - generate only the main index.html
+#
+#index yes
+
+# TAG: overwrite_report yes|no
+#      yes - if report date already exist then will be overwrited.
+#       no - if report date already exist then will be renamed to filename.n, filename.n+1
+#
+#overwrite_report no
+
+# TAG: records_without_userid ignore|ip|everybody
+#      What can I do with records without user id (no authentication) in access.log file ?
+#
+#      ignore - This record will be ignored.
+#          ip - Use ip address instead. (default)
+#   everybody - Use "everybody" instead.
+#
+#records_without_userid ip
+
+# TAG: use_comma no|yes
+#      Use comma instead point in reports.
+#      Eg.: use_comma yes => 23,450,110
+#           use_comma no  => 23.450.110
+#
+#use_comma no
+
+# TAG: mail_utility mail|mailx
+#      Mail command to use to send reports via SMTP
+#
+#mail_utility mailx
+
+# TAG: topsites_num n
+#      How many sites in topsites report.
+#
+#topsites_num 100
+
+# TAG: topsites_sort_order CONNECT|BYTES A|D
+#      Sort for topsites report, where A=Ascendent, D=Descendent
+#
+#topsites_sort_order CONNECT D
+
+# TAG: index_sort_order A/D
+#      Sort for index.html, where A=Ascendent, D=Descendent
+#
+#index_sort_order D
+
+# TAG: exclude_codes file
+#      Ignore records with these codes. Eg.: NONE/400
+#
+#exclude_codes /usr/local/sarg/exclude_codes
+
+# TAG: replace_index string
+#      Replace "index.html" in the main index file with this string
+#      If null "index.html" is used 
+#
+#replace_index <?php echo str_replace(".", "_", $REMOTE_ADDR); echo ".html"; ?>
+
+# TAG: max_elapsed milliseconds
+#      If elapsed time is recorded in log is greater than max_elapsed use 0 for elapsed time.
+#      Use 0 for no checking 
+#
+#max_elapsed 0
+# 8 Hours
+max_elapsed 28800000
+
+# TAG: report_type type
+#      What kind of reports to generate.
+#      topsites                   - shows the site, connect and bytes
+#      sites_users        - shows which users were accessing a site
+#      users_sites        - shows sites accessed by the user
+#      date_time          - shows the amount of bytes used by day and hour
+#      denied             - shows all denied sites with full URL
+#      auth_failures       - shows autentication failures
+#      site_user_time_date - shows sites, dates, times and bytes
+#
+#      Eg.: report_type topsites denied 
+#
+#report_type topsites sites_users users_sites date_time denied auth_failures site_user_time_date
+
+# TAG: usertab filename
+#      You can change the "userid" or the "ip address" to be a real user name on the reports.
+#      Table syntax:
+#              userid name   or   ip address name
+#      Eg:
+#              SirIsaac Isaac Newton
+#              vinci Leonardo da Vinci
+#              192.168.10.1 Karol Wojtyla
+#      
+#      Each line must be terminated with '\n'
+#
+#usertab none
+
+# TAG: long_url yes|no
+#      If yes, the full url is showed in report.
+#      If no, only the site will be showed
+#
+#      YES option generate very big sort files and reports.
+#
+#long_url no
+
+# TAG: date_time_by bytes|elap
+#      Date/Time reports will use bytes or elapsed time?
+#
+#date_time_by bytes
+
+# TAG: charset name
+#      ISO 8859 is a full series of 10 standardized multilingual single-byte coded (8bit)
+#      graphic character sets for writing in alphabetic languages
+#      You can use the following charsets:
+#              Latin1          - West European
+#              Latin2          - East European 
+#              Latin3          - South European 
+#              Latin4          - North European 
+#              Cyrillic 
+#              Arabic 
+#              Greek 
+#              Hebrew 
+#              Latin5          - Turkish 
+#              Latin6
+#              Windows-1251
+#              Koi8-r
+#
+#charset Latin1
+
+# TAG: user_invalid_char "&/"
+#      Records that contain invalid characters in userid will be ignored by Sarg.
+#
+#user_invalid_char "&/"
+
+# TAG: privacy yes|no
+#      privacy_string "***.***.***.***"
+#      privacy_string_color blue
+#      In some countries the sysadm cannot see the visited sites by a restrictive law.
+#      Using privacy yes the visited url will be changes by privacy_string and the link
+#      will be removed from reports.
+#
+#privacy no
+#privacy_string "***.***.***.***"
+#privacy_string_color blue
+
+# TAG: include_users "user1:user2:...:usern"
+#      Reports will be generated only for listed users.
+#
+#include_users none
+
+# TAG: exclude_string "string1:string2:...:stringn"
+#      Records from access.log file that contain one of listed strings will be ignored.
+#
+#exclude_string none
+
+# TAG: show_successful_message yes|no
+#      Shows "Successful report generated on dir" at end of process.
+#
+#show_successful_message yes
+
+# TAG: show_read_statistics yes|no
+#      Shows some reading statistics.
+#
+#show_read_statistics yes
+
+# TAG: topuser_fields
+#      Which fields must be in Topuser report.
+#
+#topuser_fields NUM DATE_TIME USERID CONNECT BYTES %BYTES IN-CACHE-OUT USED_TIME MILISEC %TIME TOTAL AVERAGE
+
+# TAG: user_report_fields
+#      Which fields must be in User report.
+#
+#user_report_fields CONNECT BYTES %BYTES IN-CACHE-OUT USED_TIME MILISEC %TIME TOTAL AVERAGE
+
+# TAG: topuser_num n
+#      How many users in topsites report. 0 = no limit
+#
+#topuser_num 0
+
+# TAG: site_user_time_date_type list|table
+#      generate reports for site_user_time_date in list or table format
+#
+#site_user_time_date_type table
+
+# TAG: datafile file
+#      Save the report results in a file to populate some database
+#
+#datafile none
+#datafile /tmp/p8
+
+# TAG: datafile_delimiter ";"
+#      ascii character to use as a field separator in datafile
+#
+#datafile_delimiter ";"
+
+# TAG: datafile_fields all
+#      Which data fields must be in datafile
+#      user;date;time;url;connect;bytes;in_cache;out_cache;elapsed
+#
+#datafile_fields user;date;time;url;connect;bytes;in_cache;out_cache;elapsed
+
+# TAG: weekdays
+#      The weekdays to take account ( Sunday->0, Saturday->6 )
+# Example:
+#weekdays 1-3,5
+# Default:
+#weekdays 0-6
+
+# TAG: hours
+#      The hours to take account
+# Example:
+#hours 7-12,14,16,18-20
+# Default:
+#hours 0-23
+
+# TAG: dansguardian_conf file
+#      DansGuardian.conf file path
+#      Generate reports from DansGuardian logs.
+#      Use 'none' to disable it.
+#      dansguardian_conf /usr/dansguardian/dansguardian.conf
+#
+#dansguardian_conf none
+
+# TAG: squidguard_conf file
+#      path to squidGuard.conf file
+#      Generate reports from SquidGuard logs.
+#      Use 'none' to disable.
+#      squidguard_conf /usr/local/squidGuard/squidGuard.conf
+#
+#squidguard_conf none
+
+# TAG: squidguard_log_format
+#      Format string SquidGuard logs.
+#      REJIK       #year#-#mon#-#day# #hour# #list#:#tmp# #ip# #user# #tmp#/#tmp#/#url#/#end#
+#      SQUIDGUARD  #year#-#mon#-#day# #hour# #tmp#/#list#/#tmp#/#tmp#/#url#/#tmp# #ip#/#tmp# #user# #end#
+#squidguard_log_format #year#-#mon#-#day# #hour# #tmp#/#list#/#tmp#/#tmp#/#url#/#tmp# #ip#/#tmp# #user# #end#
+
+# TAG: show_sarg_info yes|no
+#      shows sarg information and site path on each report bottom
+#
+#show_sarg_info yes
+
+# TAG: show_sarg_logo yes|no
+#      shows sarg logo
+#
+#show_sarg_logo yes
+
+# TAG: parsed_output_log directory
+#      Saves the processed log in a sarg format after parsing the squid log file.
+#      This is a way to dump all of the data structures out, after parsing from 
+#      the logs (presumably this data will be much smaller than the log files themselves),
+#      and pull them back in for later processing and merging with data from previous logs.
+#
+#parsed_output_log none
+
+# TAG parsed_output_log_compress /bin/gzip|/usr/bin/bzip2|nocompress
+#      sarg logs compress util
+#
+#parsed_output_log_compress /bin/gzip
+
+# TAG displayed_values bytes|abbreviation
+#      how the values will be displayed in reports.
+#      eg. bytes       -  209.526
+#          abbreviation -  210K
+#
+#displayed_values bytes
+
+# Report limits
+# TAG authfail_report_limit n
+# TAG denied_report_limit n
+# TAG siteusers_report_limit n
+# TAG squidguard_report_limit n
+# TAG user_report_limit n
+#      report limits (lines).
+#      '0' no limit
+#
+#authfail_report_limit 10
+#denied_report_limit 10
+#siteusers_report_limit 0
+#squidguard_report_limit 10
+#user_report_limit 0
+
+# TAG www_document_root dir
+#     Where is your Web DocumentRoot
+#     Sarg will create sarg-php directory with some PHP modules:
+#     - sarg-squidguard-block.php - add urls from user reports to squidGuard DB
+#
+#www_document_root /var/www/html
+
+# TAG block_it module_url
+#     This tag allow you to pass urls from user reports to a cgi or php module,
+#     to be blocked by some Squid acl
+#
+#     Eg.: block_it /sarg-php/sarg-block-it.php
+#     sarg-block-it is a php that will append a url to a flat file.
+#     You must change /var/www/html/sarg-php/sarg-block-it to point to your file
+#     in $filename variable, and chown to a httpd owner.
+#
+#     sarg will pass http://module_url?url=url
+#
+#block_it none
+
+# TAG external_css_file path
+#     This tag allow internal sarg css override.
+#     Sarg use theses style classes:
+#      .body           body class
+#      .info           sarg information class, align=center
+#      .title          title class, align=center
+#      .header         header class, align:left
+#      .header2        header class, align:right
+#      .header3        header class, align:right
+#      .text           text class, align:left
+#      .data           table text class, align:right
+#      .data2          table text class, align:right, border colors
+#      .link           link class
+#
+#     There is a sample in /usr/local/sarg/etc/css.tpl
+#
+#external_css_file none
+
+# TAG user_authentication yes|no
+#     Allow user authentication in User Reports using .htaccess
+#     Parameters:  
+#      AuthUserFile    - where the user password file is
+#      AuthName        - authentication realm. Eg "Members Only"
+#      AuthType        - authenticaion type - basic
+#      Require         - authorized users to see the report.
+#                                          %u - user report
+#
+# user_authentication no
+# AuthUserFile /usr/local/sarg/passwd
+# AuthName "SARG, Restricted Access"
+# AuthType Basic
+# Require user admin %u
+
+# TAG download_suffix "suffix,suffix,...,suffix"
+#    file suffix to be considered as "download" in Download report.
+#    Use 'none' to disable.    
+#
+#download_suffix "7z,ace,arj,avi,bat,bin,bz2,bzip,cab,com,cpio,dll,doc,dot,exe,gz,iso,lha,lzh,mdb,mov,mp3,mpeg,mpg,mso,nrg,ogg,ppt,rar,rtf,shs,src,sys,tar,tgz,vcd,vob,wma,wmv,zip"
+
+# ulimit n
+#    The maximum number of open file descriptors to avoid "Too many open files" error message.
+#    You need to run sarg as root to use ulimit tag.
+#
+#ulimit 20000
+
+# TAG:  ntlm_user_format username|domainname+username
+#       NTLM users format.
+#
+#ntlm_user_format domainname+username
diff --git a/siteuser.c b/siteuser.c
new file mode 100644 (file)
index 0000000..9213f04
--- /dev/null
@@ -0,0 +1,213 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void siteuser()
+{
+
+   FILE *fp_in, *fp_ou;
+      
+   char user[MAXLEN];
+   char url[MAXLEN];
+   char wuser[MAXLEN];
+   char ourl[MAXLEN];
+   char nacc[20];
+   char nbytes[20];
+   char csort[255];
+   char geral[MAXLEN];
+   char geral2[MAXLEN];
+   char per[MAXLEN];
+   char html[MAXLEN];
+   char sites[MAXLEN];
+   char report[MAXLEN];
+   char periodo[100];
+   char ftime[128];
+   int regs=0;
+   int ucount=0;
+   char *users;
+
+   sprintf(geral,"%s/geral",dirname);
+   sprintf(sites,"%s/sites",dirname);
+   sprintf(geral2,"%s/geral2",dirname);
+   sprintf(per,"%s/periodo",dirname);
+   sprintf(report,"%s/siteuser.html",dirname);
+
+   if ((fp_in = fopen(per, "r")) == 0) {
+      fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],per);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   sprintf(csort,"sort -k 4,4 -k 1,1 -o %s %s",geral2,geral);
+   system(csort);
+
+   if((fp_in=fopen(geral2,"r"))==NULL) {
+     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],geral2);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(report,"w"))==NULL) {
+     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],report);
+     exit(1);
+   }
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);
+   fputs("<html>\n",fp_ou);
+   fputs("<head>\n",fp_ou);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ou);
+   css(fp_ou);
+   fputs("</head>\n",fp_ou);
+
+   if(strlen(FontFace) > 0) {
+      sprintf(url,"<font face=%s>\n",FontFace);
+      fputs(url,fp_ou);
+   }
+
+   sprintf(url,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   fputs(url,fp_ou);
+
+   if(strlen(LogoImage) > 0) {
+      fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+      sprintf(url,"<tr><th align=\"center\"><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(url,fp_ou);
+      fputs("</table>\n",fp_ou);
+   }
+
+   show_sarg(fp_ou, "..");
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+   sprintf(url,"<tr><th class=\"title\">%s</th></tr>\n",Title);
+   fputs(url,fp_ou);
+
+   sprintf(url,"<tr><td class=\"header3\">%s: %s</td></tr>\n",text[89],periodo);
+   fputs(url,fp_ou);
+   sprintf(url,"<tr><td class=\"header3\">%s</td></tr>\n",text[85]);
+   fputs(url,fp_ou);
+   fputs("</table></center>\n",fp_ou);
+
+   fputs("<center><table cellpadding=0 cellspacing=2>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   sprintf(url,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[100],text[91],text[103]);
+   fputs(url,fp_ou);
+  
+   user[0]='\0';
+   ourl[0]='\0';
+
+   if((users=(char *) malloc(204800))==NULL){
+      fprintf(stderr, "SARG: ERROR: %s",text[87]);
+      exit(1);
+   }
+   strcat(users," ");
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(user,buf,' ');
+      if(strcmp(user,"TOTAL") == 0)
+         continue;
+      if(userip)
+         fixip(user);
+
+       if(UserTabFile[0] != '\0') {
+           sprintf(warea,":%s:",user);
+           if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+               z1=0;
+               str2=(char *) strstr(str+1,":");
+               str2++;
+               bzero(name, MAXLEN);
+                while(str2[z1] != ':') {
+                   name[z1]=str2[z1];
+                   z1++;
+               }
+           } else strcpy(name,user);
+       } else strcpy(name,user);
+
+      if(strcmp(Ip2Name,"yes") == 0)
+         ip2name(user);
+
+      if(strcmp(Ip2Name,"yes") == 0)
+         ip2name(user);
+
+      getword(nacc,buf,' ');
+      getword(nbytes,buf,' ');
+      getword(url,buf,' ');
+
+      if(!regs) {
+         strcpy(ourl,url);
+         regs++;
+      }
+      
+      sprintf(wuser," %s ",name);
+      if(strstr(users,wuser) == 0 && strcmp(url,ourl) == 0) {
+         strcat(users,name);
+         strcat(users," ");
+         ucount++;
+         if(ucount>4) {
+            strcat(users,"<br>");
+            ucount=0;
+         }
+      }
+
+      if(SiteUsersReportLimit) {
+         if(regs >= SiteUsersReportLimit)
+            continue;
+      }
+
+      if(strlen(BlockIt) > 0)
+         sprintf(BlockImage,"<a href=\"%s%s?url=%s\"><img src=\"../images/sarg-squidguard-block.png\" border=\"0\"></a>&nbsp;",wwwDocumentRoot,BlockIt,ourl);
+      else BlockImage[0]='\0';
+
+      if(strcmp(url,ourl) != 0) {
+         sprintf(html,"<tr><td class=\"data\">%d</td><td class=\"data2\">%s<a href=\"http://%s\">%s</td><td class=\"data2\">%s</td></tr>\n",regs,BlockImage,ourl,ourl,users);
+         fputs(html,fp_ou);
+         regs++;
+         ucount=0;
+        strcpy(users,name);
+         strcat(users," ");
+         strcpy(ourl,url);
+      }
+   }
+
+   sprintf(html,"<tr><td class=\"data\">%d</td><td class=\"data2\"><a href=\"http://%s\">%s</td><td class=\"data2\">%s</td></tr>\n",regs,ourl,ourl,users);
+   fputs(html,fp_ou);
+
+   unlink(geral2);
+
+   fputs("</table></center>\n",fp_ou);
+
+   show_info(fp_ou);
+
+   fputs("</body>\n</html>\n",fp_ou);
+   
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   return;
+
+}
diff --git a/smartfilter.c b/smartfilter.c
new file mode 100644 (file)
index 0000000..ce16185
--- /dev/null
@@ -0,0 +1,223 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void smartfilter_report()
+{
+
+   FILE *fp_in = NULL, *fp_ou = NULL, *fp_user = NULL;
+      
+   char url[MAXLEN];
+   char html[MAXLEN];
+   char html2[MAXLEN];
+   char csort[255];
+   char smart_in[MAXLEN];
+   char smart_ou[MAXLEN];
+   char per[MAXLEN];
+   char sites[MAXLEN];
+   char report[MAXLEN];
+   char periodo[100];
+   char ip[MAXLEN];
+   char user[MAXLEN];
+   char ouser[MAXLEN];
+   char data[15];
+   char hora[15];
+   char smartcat[256];
+   char smartheader[15];
+   char ftime[128];
+   char smartuser[MAXLEN];
+   char *str;
+   int  fuser=0;
+
+   ouser[0]='\0';
+
+   sprintf(smartheader,"%s",text[116]);
+   strup(smartheader);
+
+   sprintf(smart_in,"%s/smartfilter.unsort",dirname);
+   sprintf(sites,"%s/sites",dirname);
+   sprintf(smart_ou,"%s/smartfilter.log",dirname);
+   sprintf(per,"%s/periodo",dirname);
+   sprintf(report,"%s/smartfilter.html",dirname);
+
+   if ((fp_in = fopen(per, "r")) == 0) {
+      fprintf(stderr, "SARG: (smartfilter) %s: %s\n",text[45],per);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   sprintf(csort,"sort -n -k 1,1 -k 2,2 -k 3,3 -o %s %s",smart_ou,smart_in);
+   system(csort);
+   unlink(smart_in);
+
+   if((fp_in=fopen(smart_ou,"r"))==NULL) {
+     fprintf(stderr, "SARG: (smartfilter) %s: %s\n",text[8],smart_ou);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(report,"w"))==NULL) {
+     fprintf(stderr, "SARG: (smartfilter) %s: %s\n",text[8],report);
+     exit(1);
+   }
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);   
+   fputs("<html>\n",fp_ou);
+   fputs("<head>\n",fp_ou);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ou);
+   fputs("</head>\n",fp_ou);
+
+   if(strlen(FontFace) > 0) {
+      sprintf(url,"<font face=%s>\n",FontFace);
+      fputs(url,fp_ou);
+   }
+
+   sprintf(url,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   fputs(url,fp_ou);
+
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+
+   if(strlen(LogoImage) > 0) {
+      sprintf(url,"<tr><th><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(url,fp_ou);
+   }
+
+   sprintf(url,"<tr><th align=center><b><font color=%s size=+1>%s</font></b></th></tr>\n",TiColor,Title);
+   fputs(url,fp_ou);
+
+   sprintf(url,"<tr><td align=center bgcolor=%s><font size=%s>%s: %s</font></td></tr>\n",HeaderBgColor,FontSize,text[89],periodo);
+   fputs(url,fp_ou);
+   sprintf(url,"<tr><th bgcolor=%s align=center><font size=%s>%s %s</font></th></tr>\n",HeaderBgColor,FontSize,text[116],text[55]);
+   fputs(url,fp_ou);
+   fputs("</table></center>\n",fp_ou);
+
+   fputs("<center><table cellpadding=0 cellspacing=2>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   sprintf(url,"<tr><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th></tr>\n",HeaderBgColor,FontSize,text[98],HeaderBgColor,FontSize,text[111],HeaderBgColor,FontSize,text[110],HeaderBgColor,FontSize,text[91],HeaderBgColor,FontSize,smartheader);
+   fputs(url,fp_ou);
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(user,buf,' ');
+      getword(data,buf,' ');
+      getword(hora,buf,' ');
+      getword(ip,buf,' ');
+      getword(url,buf,' ');
+      getword(smartcat,buf,'\n');
+
+      if((str=(char *) strstr(user, "_")) != (char *) NULL ) {
+         if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
+            fixip(user);
+      }
+
+      if(strcmp(ouser,user) != 0) {
+         strcpy(ouser,user);
+         sprintf(smartuser,"%s/denied_%s.html",dirname,user);
+         if(fuser) {
+            fuser=0;
+            fputs("</table>\n",fp_user);
+            if(strcmp(ShowSargInfo,"yes") == 0) {
+               zdate(ftime, DateFormat);
+               sprintf(html2,"<br><br><center><font size=-2>%s <a href='%s'>%s-%s</a> %s %s</font></center>\n",text[108],URL,PGM,VERSION,text[109],ftime);
+               fputs(html2,fp_user);
+           }
+            fputs("</body>\n</html>\n",fp_user);
+            fclose(fp_user);
+         }
+         if ((fp_user = fopen(smartuser, "a")) == 0) {
+            fprintf(stderr, "SARG: (smartfilter) %s: %s\n",text[45],smartuser);
+            exit(1);
+         }
+         fuser=1;
+
+         fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+         fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);
+         fputs("<html>\n",fp_user);
+         fputs("<head>\n",fp_user);
+         sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+         fputs(html,fp_user);
+         fputs("</head>\n",fp_user);
+
+         if(strlen(FontFace) > 0) {
+            sprintf(html2,"<font face=%s>\n",FontFace);
+            fputs(url,fp_user);
+         }
+         sprintf(html2,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+         fputs(html2,fp_user);
+         fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_user);
+         if(strlen(LogoImage) > 0) {
+            sprintf(html2,"<tr><th align=left><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+            fputs(html2,fp_user);
+         }
+         sprintf(html2,"<tr><th align=center><b><font color=%s size=+1>%s</font></b></th></tr>\n",TiColor,Title);
+         fputs(html2,fp_user);
+         sprintf(html2,"<tr><td align=center bgcolor=%s><font size=%s>%s: %s</font></td></tr>\n",HeaderBgColor,FontSize,text[89],periodo);
+         fputs(html2,fp_user);
+         sprintf(html2,"<tr><td align=center bgcolor=%s><font size=%s>%s:</font><font size=%s> %s</font></td></tr>\n",HeaderBgColor,FontSize,text[90],FontSize,user);
+         fputs(html2,fp_user);
+         fputs("</table></center>\n",fp_user);
+         fputs("<center><table cellpadding=0 cellspacing=2>\n",fp_user);
+         fputs("<tr><td></td></tr>\n",fp_user);
+         fputs("<tr><td></td></tr>\n",fp_user);
+         fputs("<tr><td></td></tr>\n",fp_user);
+         sprintf(html2,"<tr><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th></tr>\n",HeaderBgColor,FontSize,text[98],HeaderBgColor,FontSize,text[111],HeaderBgColor,FontSize,text[110],HeaderBgColor,FontSize,text[91],HeaderBgColor,FontSize,smartheader);
+         fputs(html2,fp_user);
+      }
+      sprintf(html2,"<tr><td bgcolor=%s align=center><font size=%s>%s</font></td><td bgcolor=%s align=center><font size=%s>%s</font></td><td bgcolor=%s align=center><font size=%s>%s-%s</font></td><td bgcolor=%s><font size=%s>%s</font></td><td bgcolor=%s><font size=%s>%s</font></td></th>\n",TxBgColor,FontSize,user,TxBgColor,FontSize,ip,TxBgColor,FontSize,data,hora,TxBgColor,FontSize,url,TxBgColor,FontSize,smartcat);
+      fputs(html2,fp_user);
+
+      sprintf(html,"<tr><td bgcolor=%s align=center><font size=%s>%s</font></td><td bgcolor=%s align=center><font size=%s>%s</font></td><td bgcolor=%s align=center><font size=%s>%s-%s</font></td><td bgcolor=%s><font size=%s>%s</font></td><td bgcolor=%s><font size=%s>%s</font></td></th>\n",TxBgColor,FontSize,user,TxBgColor,FontSize,ip,TxBgColor,FontSize,data,hora,TxBgColor,FontSize,url,TxBgColor,FontSize,smartcat);
+      fputs(html,fp_ou);
+   }
+
+   fputs("</table>\n",fp_ou);
+
+   if(strcmp(ShowSargInfo,"yes") == 0) {
+      zdate(ftime, DateFormat);
+      sprintf(html,"<br><br><center><font size=-2>%s <a href='%s'>%s-%s</a> %s %s</font></center>\n",text[108],URL,PGM,VERSION,text[109],ftime);
+      fputs(html,fp_ou);
+   }
+
+   fputs("</body>\n</html>\n",fp_user);
+
+   fclose(fp_ou);
+   if(fp_user) {
+      fputs("</table>\n",fp_user);
+      if(strcmp(ShowSargInfo,"yes") == 0) {
+         zdate(ftime, DateFormat);
+         sprintf(html2,"<br><br><center><font size=-2>%s <a href='%s'>%s-%s</a> %s %s</font></center>\n",text[108],URL,PGM,VERSION,text[109],ftime);
+         fputs(html2,fp_user);
+      }
+      fputs("</body>\n</html>\n",fp_user);
+      fclose(fp_user);
+   }
+
+   return;
+}
diff --git a/sort.c b/sort.c
new file mode 100644 (file)
index 0000000..1f5669c
--- /dev/null
+++ b/sort.c
@@ -0,0 +1,155 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void tmpsort()
+{
+
+   DIR *dirp;
+   struct dirent *direntp;
+
+   char csort[MAXLEN];
+   char arqou[MAXLEN], arqin[MAXLEN], wnome[MAXLEN], wnome2[MAXLEN];
+   char field1[10]="2,2";
+   char field2[10]="1,1";
+   char field3[10]="3,3";
+   char order[4]="-r";
+
+   if(indexonly) return;
+   if(strstr(ReportType,"users_sites") == 0) return;
+
+   wnome[0]='\0';
+   wnome2[0]='\0';
+
+   dirp = opendir(tmp);
+   while ((direntp = readdir( dirp )) != NULL ){
+      if(strstr(direntp->d_name,".utmp") == 0)
+         continue;
+
+      strcpy(wentp,direntp->d_name);
+      wnome[0]='\0'; 
+      striptmp:
+      getword(wnome2,wentp,'.');
+      strcat(wnome,wnome2);
+
+      if(strcmp(wentp,"utmp") !=0) {
+         strcat(wnome,".");
+         goto striptmp;
+      }
+
+      strcpy(arqou,tmp);
+      strcat(arqou,"/");
+      strcpy(arqin,arqou);
+      strcat(arqou,wnome);
+      strcat(arqin,direntp->d_name);
+
+      if(debug) {
+         sprintf(msg,"%s: %s",text[54],arqou);
+         debuga(msg);
+      }
+
+      strup(UserSortField);
+      strlow(UserSortOrder);
+
+      if(strcmp(UserSortField,"CONNECT") == 0) {
+         strcpy(field1,"1,1");
+         strcpy(field2,"2,2");
+         strcpy(field3,"3,3");
+      }
+
+      if(strcmp(UserSortField,"SITE") == 0) {
+         strcpy(field1,"3,3");
+         strcpy(field2,"2,2");
+         strcpy(field3,"1,1");
+      }
+
+      if(strcmp(UserSortField,"TIME") == 0) {
+         strcpy(field1,"5,5");
+         strcpy(field2,"2,2");
+         strcpy(field3,"1,1");
+      }
+
+      if(strcmp(UserSortOrder,"normal") == 0)
+         order[0]='\0';
+        
+      strcat(arqou,".txt");
+      sprintf(csort,"sort -n -T %s %s -k %s -k %s -k %s -o %s %s",TempDir,order,field1,field2,field3,arqou,arqin);
+      system(csort);
+      unlink(arqin);
+
+   }
+
+   (void)rewinddir( dirp );
+   (void)closedir( dirp );
+   return;
+}
+
+void sort_users_log(char *tmp, int debug)
+{
+
+   DIR *dirp;
+   struct dirent *direntp;
+   char csort[MAXLEN];
+   char wtmp[MAXLEN];
+   char wname2[MAXLEN];
+   char wdname[MAXLEN];
+
+   sprintf(wtmp,"%s/sarg",tmp);
+
+   dirp = opendir(wtmp);
+   while ( (direntp = readdir( dirp )) != NULL ){
+      if(strstr(direntp->d_name,".unsort") == 0)
+         continue;
+      strcpy(wdname,direntp->d_name);
+
+      bzero(user, MAXLEN);
+      strip_unsort:
+      getword(wname2,wdname,'.');
+      strcat(user,wname2);
+
+      if(strcmp(wdname,"unsort") !=0) {
+         strcat(user,".");
+         goto strip_unsort;
+      }
+
+      if(strcmp(direntp->d_name,"download.unsort") == 0)
+         sprintf(csort,"sort -T %s -k 3,3 -k 1,1 -k 2,2 -k 5,5 -o %s/%s.log %s/%s.unsort",
+                                       tmp, wtmp, user, wtmp, user);
+      else
+         sprintf(csort,"sort -T %s -k 5,5 -k 1,1 -k 2,2 -o %s/%s.log %s/%s.unsort", 
+                                       tmp, wtmp, user, wtmp, user);
+      system(csort);
+      sprintf(wdname,"%s/%s.unsort",wtmp,user);
+      unlink(wdname);
+      bzero(user, MAXLEN);
+
+   }
+   (void)rewinddir( dirp );
+   (void)closedir( dirp );
+
+   return;
+}
diff --git a/splitlog.c b/splitlog.c
new file mode 100644 (file)
index 0000000..208dcb3
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void splitlog(char *arq, char *df, int dfrom, int duntil, char *convert)
+{
+
+   FILE *fp_in;
+   char buf[MAXLEN];
+   char data[30];
+   char dia[11];
+   char hora[9];
+   char wdata[20];
+   time_t tt;
+   int idata=0;
+   struct tm *t;
+
+   if(arq[0] == '\0')
+      strcpy(arq,"/usr/local/squid/logs/access.log");
+
+   if((fp_in=fopen(arq,"r"))==NULL) {
+      fprintf(stderr, "SARG: (splitlog) %s: %s\n",text[8],arq);
+      exit(1);
+   }
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(data,buf,' ');
+      tt=atoi(data);
+      t=localtime(&tt);
+
+      if(dfrom) {
+         strftime(wdata, 127, "%Y%m%d", t);
+         idata=atoi(wdata);
+        if(idata < dfrom || idata > duntil)
+         continue;
+      }
+
+      if(strcmp(convert,"onvert") != 0) {
+         printf("%s %s",data,buf);
+         continue;
+      }
+
+      if(strncmp(df,"e",1) == 0)
+         strftime(dia, 127, "%d/%m/%Y", t);
+       else
+         strftime(dia, 127, "%m/%d/%Y", t);
+
+      sprintf(hora,"%02d:%02d:%02d",t->tm_hour,t->tm_min,t->tm_sec);
+      printf("%s %s %s",dia,hora,buf);
+   }
+
+   fclose(fp_in);
+}
diff --git a/squidguard_log.c b/squidguard_log.c
new file mode 100644 (file)
index 0000000..cc80be4
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+int squidguard_log()
+{
+
+   FILE *fp_in = NULL, *fp_ou = NULL, *fp_guard = NULL;
+   char guard_in[MAXLEN];
+   char guard_ou[MAXLEN];
+   char logdir[MAXLEN];
+   char year[10], mon[10], day[10], hour[15];
+   char list[MAXLEN];
+   char user[MAXLEN];
+   char ip[30];
+   char wdata[127];
+   char bufbsf[255];
+   char leks[5], sep[2], res[MAXLEN];
+   int  idata=0;
+   int  x, y;
+
+   if(strlen(SquidGuardConf) < 1)
+     return;
+
+   bzero(day, 3);
+   bzero(mon, 4);
+   bzero(year, 5);
+
+   if(strcmp(df,"e") == 0) {
+      strncpy(day,periodo,2);
+      strncpy(mon,periodo+2,3);
+      strncpy(year,periodo+5,4);
+      conv_month(mon);
+      sprintf(warea,"%s%s%s",year,mon,day);
+      dfrom=atoi(warea);
+      strncpy(day,periodo+10,2);
+      strncpy(mon,periodo+12,3);
+      strncpy(year,periodo+15,4);
+      conv_month(mon);
+      sprintf(warea,"%s%s%s",year,mon,day);
+      duntil=atoi(warea);
+   } else {
+      strncpy(day,periodo+7,2);
+      strncpy(mon,periodo+4,3);
+      strncpy(year,periodo,4);
+      conv_month(mon);
+      sprintf(warea,"%s%s%s",year,mon,day);
+      dfrom=atoi(warea);
+      strncpy(day,periodo+17,2);
+      strncpy(mon,periodo+14,3);
+      strncpy(year,periodo+10,4);
+      conv_month(mon);
+      sprintf(warea,"%s%s%s",year,mon,day);
+      duntil=atoi(warea);
+   }
+
+   sprintf(guard_in,"%s/squidguard.unsort",tmp);
+   sprintf(guard_ou,"%s/squidguard.log",tmp);
+
+   if(access(SquidGuardConf, R_OK) != 0) {
+      sprintf(msg,"Cannot open squidGuard config file: %s",SquidGuardConf);
+      debuga(msg);
+      exit(1);
+   }
+
+   if((fp_guard=fopen(SquidGuardConf,"r"))==NULL) {
+      fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],SquidGuardConf);
+      exit(1);
+   }
+
+   if((fp_ou=fopen(guard_in,"a"))==NULL) {
+      fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],guard_in);
+      exit(1);
+   }
+
+   while(fgets(buf,sizeof(buf),fp_guard)!=NULL) {
+      if(strstr(buf,"\n") != 0)
+         buf[strlen(buf)-1]='\0';
+      if(strstr(buf,"logdir ") != 0) {
+         getword(logdir,buf,' ');
+         getword(logdir,buf,' ');
+      }
+      if((str=(char *) strstr(buf, "log")) != (char *) NULL )  {
+         str=str+3;
+         str2[0]='\0';
+         y=0;
+         for (x=0; x<=strlen(str); x++) {
+            if (str[x] != ' ' && str[x] != '\t') {
+               str2[y] = str[x];
+               y++;
+            }
+         }
+   
+         sprintf(wentp,"%s/%s",logdir,str2);
+
+         if(debug) {
+            strcpy(buf,text[7]);
+
+        getword(urly,buf,' ');
+        getword(href,buf,' ');
+            sprintf(msg,"%s squidGuard %s: %s",urly,buf,wentp);
+            debuga(msg);
+         }
+   
+         if((fp_in=fopen(wentp,"r"))==NULL) {
+            fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],wentp);
+            exit(1);
+         }
+   
+         while(fgets(buf,sizeof(buf),fp_in) != NULL) {
+
+            if(strlen(SquidGuardLogFormat) > 0) {
+               strcpy(bufbsf,SquidGuardLogFormat);
+               leks[0]='\0';
+               getword(leks,bufbsf,'#');
+               while(strcmp(leks,"end") != 0) {
+                  getword(leks,bufbsf,'#');
+                  getword(sep,bufbsf,'#');
+                  if(strcmp(leks,"end") != 0) {
+                     getword(res,buf,sep[0]);
+                     if(strcmp(leks,"year") == 0)
+                        strcpy(year,res);
+                    else if(strcmp(leks,"year") == 0)
+                        strcpy(year,res);
+                    else if(strcmp(leks,"mon") == 0)
+                        strcpy(mon,res);
+                    else if(strcmp(leks,"day") == 0)
+                        strcpy(day,res);
+                    else if(strcmp(leks,"hour") == 0)
+                        strcpy(hour,res);
+                    else if(strcmp(leks,"list") == 0)
+                        strcpy(list,res);
+                    else if(strcmp(leks,"ip") == 0)
+                        strcpy(ip,res);
+                    else if(strcmp(leks,"user") == 0)
+                        strcpy(user,res);
+                    else if(strcmp(leks,"url") == 0)
+                        strcpy(url,res);
+                  }
+               }
+            }
+   
+            sprintf(warea,"%s%s%s",year,mon,day);
+            sprintf(wdata,"%s%s%s",year,mon,day);
+            idata = atoi(wdata);
+
+            if(idata >= dfrom && idata <= duntil) {
+               if(strcmp(user,"-") == 0) {
+                  strcpy(user,ip);
+                   bzero(ip, 30);
+               }
+               sprintf(tmp6,"%s %s%s%s %s %s %s %s\n",user,year,mon,day,hour,ip,url,list);
+               fputs(tmp6, fp_ou);
+               squidguard_count++;
+            }
+         }
+         fclose(fp_in);
+      }
+   }
+
+   fclose(fp_guard);
+   fclose(fp_ou);
+   sprintf(tmp6,"sort -k 1,1 -k 2,2 -k 4,4 %s -o %s",guard_in, guard_ou);
+   system(tmp6);
+   unlink(guard_in);
+   return;
+}
diff --git a/squidguard_report.c b/squidguard_report.c
new file mode 100644 (file)
index 0000000..0dad8db
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void squidguard_report()
+{
+
+   FILE *fp_in = NULL, *fp_ou = NULL;
+      
+   char url[MAXLEN];
+   char html[MAXLEN];
+   char html2[MAXLEN];
+   char squidguard_in[MAXLEN];
+   char squidguard_ou[MAXLEN];
+   char per[MAXLEN];
+   char report[MAXLEN];
+   char periodo[100];
+   char ip[MAXLEN];
+   char rule[255];
+   char oip[MAXLEN];
+   char user[MAXLEN];
+   char ouser[MAXLEN];
+   char data[15];
+   char data2[15];
+   char hora[15];
+   char ftime[128];
+   char *str;
+   int  z=0;
+   int  count=0;
+
+   ouser[0]='\0';
+
+   sprintf(squidguard_in,"%s/squidguard.log",tmp);
+   if(!squidguard_count) {
+      unlink(squidguard_in);
+      return;
+   }
+
+   sprintf(per,"%s/periodo",dirname);
+   sprintf(report,"%s/squidguard.html",dirname);
+
+   if ((fp_in = fopen(per, "r")) == 0) {
+      fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[45],per);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   if((fp_in=fopen(squidguard_in,"r"))==NULL) {
+     fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],squidguard_in);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(report,"w"))==NULL) {
+     fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],report);
+     exit(1);
+   }
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);
+   fputs("<html>\n",fp_ou);
+   fputs("<head>\n",fp_ou);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ou);
+   css(fp_ou);
+   fputs("</head>\n",fp_ou);
+
+   if(strlen(FontFace) > 0) {
+      sprintf(url,"<font face=%s>\n",FontFace);
+      fputs(url,fp_ou);
+   }
+
+   sprintf(url,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   fputs(url,fp_ou);
+
+   if(strlen(LogoImage) > 0) {
+      fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+      sprintf(url,"<tr><th><img src='%s' border=0 align=absmiddle width=%s height=%s> \
+         <font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(url,fp_ou);
+      fputs("</table>\n",fp_ou);
+   }
+
+   show_sarg(fp_ou,"..");
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+   sprintf(url,"<tr><th class=\"title\">%s</th></tr>\n",Title);
+   fputs(url,fp_ou);
+
+   sprintf(url,"<tr><td class=\"header\">%s: %s</td></tr>\n",text[89],periodo);
+   fputs(url,fp_ou);
+   sprintf(url,"<tr><th class=\"header3\">%s %s</th></tr>\n",text[120],text[55]);
+   fputs(url,fp_ou);
+   fputs("</table></center>\n",fp_ou);
+
+   fputs("<center><table cellpadding=1 cellspacing=2>\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   sprintf(url,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[98],text[111],text[110],text[91],text[121]);
+   fputs(url,fp_ou);
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(user,buf,' ');
+      getword(data2,buf,' ');
+      getword(hora,buf,' ');
+      getword(ip,buf,' ');
+      getword(url,buf,' ');
+      getword(rule,buf,'\n');
+
+      if(strcmp(UserIp,"yes") == 0)
+           strcpy(user,ip);
+
+      bzero(data, 15);
+      if(strncmp(df,"u",1) != 0) {
+         strncpy(data,data2+6,2);
+         strcat(data,"/");
+         strncat(data,data2+4,2);
+         strcat(data,"/");
+         strncat(data,data2,4);
+      } else {
+         strncpy(data,data2+4,2);
+         strcat(data,"/");
+         strncat(data,data2+6,2);
+         strcat(data,"/");
+         strncat(data,data2,4);
+      }
+
+      if((str=(char *) strstr(user, "_")) != (char *) NULL ) {
+         if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
+            fixip(user);
+      }
+
+      if(strcmp(Ip2Name,"yes") == 0) 
+         ip2name(ip);
+
+      if(!z) {
+         strcpy(ouser,user);
+         strcpy(oip,ip);
+         z++;
+      } else {
+         if(strcmp(ouser,user) == 0)
+            user[0]='\0';
+         if(user[0] != '\0')
+            strcpy(ouser,user);
+         if(strcmp(oip,ip) == 0) 
+            ip[0]='\0';
+         if(ip[0] != '\0')
+            strcpy(oip,ip);
+      }
+
+      if(UserTabFile[0] != '\0') {
+         sprintf(warea,":%s:",user);
+         if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+            z1=0;
+            str2=(char *) strstr(str+1,":");
+            str2++;
+            bzero(name, MAXLEN);
+            while(str2[z1] != ':') {
+               name[z1]=str2[z1];
+               z1++;
+            }
+         } else strcpy(name,user);
+      } else strcpy(name,user);
+
+     if(SquidGuardReportLimit) {
+         if(strcmp(ouser2,name) == 0) {
+            count++;
+         } else {
+            count=1;
+            strcpy(ouser2,name);
+         }
+         if(count >= SquidGuardReportLimit)
+            continue;
+      }
+
+      sprintf(html2,"<tr><td class=\"data2\">%s</td><td class=\"data2\">%s</td><td class=\"data2\">%s-%s</td><td class=\"data2\"><a href=\"http://%s\">%s</a></td><td class=\"data2\">%s</td></th>\n",name,ip,data,hora,url,url,rule);
+      fputs(html2,fp_ou);
+   }
+
+   fputs("</table>\n",fp_ou);
+
+   show_info(fp_ou);
+   
+   fputs("</body>\n</html>\n",fp_ou);
+
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   unlink(squidguard_in);
+
+   return;
+}
diff --git a/topsites.c b/topsites.c
new file mode 100644 (file)
index 0000000..7ed40e0
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void topsites()
+{
+
+   FILE *fp_in, *fp_ou;
+      
+   char url[MAXLEN];
+   char ourl[MAXLEN];
+   char nacc[20];
+   char nbytes[20];
+   char ntime[20];
+   char ntemp[20];
+   char ttnacc[20];
+   char ttnbytes[20];
+   char ttntime[20];
+   char csort[255];
+   char geral[MAXLEN];
+   char geral2[MAXLEN];
+   char geral3[MAXLEN];
+   char per[MAXLEN];
+   char sites[MAXLEN];
+   char report[MAXLEN];
+   char periodo[100];
+   char ftime[128];
+   char sortf[10];
+   char sortt[10];
+   long long int tnacc=0;
+   long long int tnbytes=0;
+   long long int tntime=0;
+   long long int twork1=0, twork2=0, twork3=0;
+   int regs=0;
+
+
+   sprintf(geral,"%s/geral",dirname);
+   sprintf(sites,"%s/sites",dirname);
+   sprintf(geral2,"%s/geral2",dirname);
+   sprintf(geral3,"%s/geral3",dirname);
+   sprintf(per,"%s/periodo",dirname);
+   sprintf(report,"%s/topsites.html",dirname);
+
+   if ((fp_in = fopen(per, "r")) == 0) {
+      fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],per);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   sprintf(csort,"sort -k 4,4 -o %s %s",geral2,geral);
+   system(csort);
+
+   if((fp_in=fopen(geral2,"r"))==NULL) {
+     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],geral2);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(geral3,"w"))==NULL) {
+     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],geral3);
+     exit(1);
+   }
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(url,buf,' ');
+      if(strcmp(url,"TOTAL") == 0) {
+         getword(ttnacc,buf,' ');
+         getword(ttnbytes,buf,' ');
+         getword(ttntime,buf,' ');
+         continue;
+      }
+      getword(nacc,buf,' ');
+      getword(nbytes,buf,' ');
+      getword(url,buf,' ');
+      getword(ntemp,buf,' ');
+      getword(ntemp,buf,' ');
+      getword(ntemp,buf,' ');
+      getword(ntime,buf,' ');
+
+      if(!regs) {
+         strcpy(ourl,url);
+         regs++;
+      }
+
+      if(strcmp(url,ourl) != 0) {
+         my_lltoa(tnacc,val1,15);
+         my_lltoa(tnbytes,val2,15);
+         my_lltoa(tntime,val3,15);
+         sprintf(buf,"%s %s %s %s\n",val1,val2,val3,ourl);
+         fputs(buf, fp_ou);
+         strcpy(ourl,url);
+         tnacc=0;
+         tnbytes=0;
+         tntime=0;
+      }
+
+      tnacc+=my_atoll(nacc);
+      tnbytes+=my_atoll(nbytes);
+      tntime+=my_atoll(ntime);
+   }
+
+   my_lltoa(tnacc,val1,15);
+   my_lltoa(tnbytes,val2,15);
+   my_lltoa(tntime,val3,15);
+   sprintf(buf,"%s %s %s %s\n",val1,val2,val3,ourl);
+   fputs(buf, fp_ou);
+
+   fclose(fp_in);
+   fclose(fp_ou);
+   unlink(geral2);
+
+   strlow(TopsitesSortField);
+   strlow(TopsitesSortType);
+
+   if(strcmp(TopsitesSortField,"connect") == 0)
+      strcpy(sortf,"1,1");
+   if(strcmp(TopsitesSortField,"bytes") == 0)
+      strcpy(sortf,"2,2");
+   if(strcmp(TopsitesSortType,"a") == 0)
+      strcpy(sortt," ");
+   if(strcmp(TopsitesSortType,"d") == 0)
+      strcpy(sortt,"-r");
+
+   sprintf(csort,"sort %s -k %s -o %s %s",sortt,sortf,sites,geral3);
+   system(csort);
+
+   unlink(geral2);
+   unlink(geral3);
+
+   if((fp_in=fopen(sites,"r"))==NULL) {
+     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],sites);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(report,"w"))==NULL) {
+     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],report);
+     exit(1);
+   }
+
+   regs=0;
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ou);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ou);
+   fputs("<html>\n",fp_ou);
+   fputs("<head>\n",fp_ou);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ou);
+   css(fp_ou);
+   fputs("</head>\n",fp_ou);
+
+   sprintf(url,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   fputs(url,fp_ou);
+
+   if(strlen(LogoImage) > 0) {
+      fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou);
+      sprintf(url,"<tr><th align=\"center\"><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(url,fp_ou);
+      fputs("</table>\n",fp_ou);
+   }
+
+   show_sarg(fp_ou,"..");
+   fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou);
+   sprintf(url,"<tr><th class=\"title\">%s</th></tr>\n",Title);
+   fputs(url,fp_ou);
+
+   sprintf(url,"<tr><td class=\"header3\">%s: %s</td></tr>\n",text[89],periodo);
+   fputs(url,fp_ou);
+   sprintf(url,"<tr><td class=\"header3\">%s %s %s</td></tr>\n",text[83],TopSitesNum,text[84]);
+   fputs(url,fp_ou);
+   fputs("</table></center>\n",fp_ou);
+
+   fputs("<center><table cellpadding=\"1\" cellspacing=\"2\">\n",fp_ou);
+   fputs("<tr><td></td></tr>\n",fp_ou);
+   sprintf(url,"<tr><td class=\"header\">%s</td><th class=\"header\">%s</th> \
+               <th class=\"header\">%s</th><th class=\"header\">%s</th> \
+               <th class=\"header\">%s</th></tr>\n", \
+               text[100],text[91],text[92],text[93],text[99]);
+   fputs(url,fp_ou);
+
+   regs=1;
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      if(regs>atoi(TopSitesNum))
+         break;
+      getword(nacc,buf,' ');
+      getword(nbytes,buf,' ');
+      getword(ntime,buf,' ');
+      getword(url,buf,' ');
+
+      twork1=my_atoll(nacc);
+      twork2=my_atoll(nbytes);
+      twork3=my_atoll(ntime);
+
+      sprintf(wwork1,"%s",fixnum(twork1,1));
+      sprintf(wwork2,"%s",fixnum(twork2,1));
+      sprintf(wwork3,"%s",fixnum(twork3,1));
+
+      if(strlen(BlockIt) > 0)
+         sprintf(BlockImage,"<a href=\"%s%s?url=%s\"><img src=\"../images/sarg-squidguard-block.png\" border=\"0\"></a>&nbsp;",wwwDocumentRoot,BlockIt,url);
+      else BlockImage[0]='\0';
+
+
+      sprintf(ourl,"<tr><td class=\"data\">%d</td><td class=\"data2\">%s<a href=\"http://%s\"><font class=\"link\">%s</font></td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",regs,BlockImage,url,url,wwork1,wwork2,wwork3);
+      fputs(ourl,fp_ou);
+      regs++;
+   }
+
+
+   fputs("</table></center>\n",fp_ou);
+
+   show_info(fp_ou);
+
+   fputs("</body>\n</html>\n",fp_ou);
+   
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   return;
+
+}
diff --git a/topuser.c b/topuser.c
new file mode 100644 (file)
index 0000000..e173ec7
--- /dev/null
+++ b/topuser.c
@@ -0,0 +1,678 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+int topuser()
+{
+
+   FILE *fp_in, *fp_ou, *fp_top1, *fp_top2, *fp_top3;
+   long long int ttnbytes=0, ttnacc=0, tnacc=0;
+   long long int tnbytes=0, ttnelap=0, tnelap=0;
+   long long int tnincache=0, tnoucache=0, ttnincache=0, ttnoucache=0;
+   float perc=0.00;
+   float perc2=0.00;
+   float inperc=0.00, ouperc=0.00;
+   int posicao=0;
+   char olduser[MAXLEN], csort[MAXLEN], periodo[MAXLEN], arqper[MAXLEN];
+   char wger[MAXLEN], top1[MAXLEN], top2[MAXLEN], top3[MAXLEN];
+   char user[MAXLEN], nacc[20], nbytes[20], preg[MAXLEN], tusr[MAXLEN];
+   char ip[MAXLEN], hora[9], data[11], elap[15], incac[15], oucac[15], html[MAXLEN];
+   char ipantes[MAXLEN], nameantes[MAXLEN];
+   char sfield[10]="2,2";
+   char order[3]="-r";
+   char wheader[512];
+   char ftime[128];
+   int  totuser=0;
+   int  topcount=0;
+   char *s;
+
+   ipantes[0]='\0';
+   nameantes[0]='\0';
+
+   strcpy(wger,dirname);
+   strcpy(top1,dirname);
+   strcpy(top2,dirname);
+   strcpy(top3,dirname);
+   strcpy(tusr,dirname);
+   strcat(wger,"/geral");
+   strcat(top1,"/top");
+   strcat(top2,"/top.tmp");
+   strcat(tusr,"/usuarios");
+   strcat(top3,"/index.html");
+
+   if((fp_in=fopen(wger,"r"))==NULL) {
+    fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],wger);
+    exit(1);
+   }
+
+   if((fp_top2=fopen(top2,"w"))==NULL) {
+    fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],top2);
+    exit(1);
+   }
+
+   fscanf(fp_in,"%s",user);
+   fscanf(fp_in,"%s",nacc);
+   fscanf(fp_in,"%s",nbytes);
+   fscanf(fp_in,"%s",url);
+   fscanf(fp_in,"%s",ip);
+   fscanf(fp_in,"%s",hora);
+   fscanf(fp_in,"%s",data);
+   fscanf(fp_in,"%s",elap);
+   fscanf(fp_in,"%s",incac);
+   fscanf(fp_in,"%s",oucac);
+
+   strcpy(olduser,user);
+   totuser=1;
+
+   while(!feof(fp_in)) {
+      if(strcmp(olduser,user) != 0) {
+         if(strcmp(user,"TOTAL") != 0)
+            totuser++;
+
+         my_lltoa(tnbytes,val1,15);
+         my_lltoa(tnacc,val2,15);
+         my_lltoa(tnelap,val3,15);
+         my_lltoa(tnincache,val4,15);
+         my_lltoa(tnoucache,val5,15);
+         sprintf(preg,"%s %s %s %s %s %s\n",olduser,val1,val2,val3,val4,val5);
+         fputs(preg,fp_top2);
+
+        strcpy(olduser,user);
+         ttnbytes+=tnbytes;
+        ttnacc+=tnacc;
+        ttnelap+=tnelap;
+         ttnincache+=tnincache;
+         ttnoucache+=tnoucache;
+         tnbytes=0;
+         tnacc=0;
+         tnelap=0; 
+         tnincache=0;
+         tnoucache=0;
+      }
+
+      tnbytes+=my_atoll(nbytes);
+      tnacc+=my_atoll(nacc);
+      tnelap+=my_atoll(elap);
+      tnincache+=my_atoll(incac);
+      tnoucache+=my_atoll(oucac);
+
+      fscanf(fp_in,"%s",user);
+      fscanf(fp_in,"%s",nacc);
+      fscanf(fp_in,"%s",nbytes);
+      fscanf(fp_in,"%s",url);
+      fscanf(fp_in,"%s",ip);
+      fscanf(fp_in,"%s",hora);
+      fscanf(fp_in,"%s",data);
+      fscanf(fp_in,"%s",elap);
+      fscanf(fp_in,"%s",incac);
+      fscanf(fp_in,"%s",oucac);
+
+      if(strcmp(user,"TOTAL") == 0)
+         continue;
+   }
+
+   my_lltoa(tnbytes,val1,15);
+   my_lltoa(tnacc,val2,15);
+   my_lltoa(tnelap,val3,15);
+   my_lltoa(tnincache,val4,15);
+   my_lltoa(tnoucache,val5,15);
+   sprintf(preg,"%s %s %s %s %s %s\n",olduser,val1,val2,val3,val4,val5);
+   fputs(preg,fp_top2);
+
+   ttnbytes+=tnbytes;
+   ttnacc+=tnacc;
+   ttnelap+=tnelap;
+   ttnincache+=tnincache;
+   ttnoucache+=tnoucache;
+
+   my_lltoa(ttnbytes,val1,15);
+   my_lltoa(ttnacc,val2,15);
+   my_lltoa(ttnelap,val3,15);
+   my_lltoa(ttnincache,val4,15);
+   my_lltoa(ttnoucache,val5,15);
+   sprintf(preg,"TOTAL %s %s %s %s %s\n",val1,val2,val3,val4,val5);
+   fclose(fp_in);
+   fclose(fp_top2);
+
+   strup(TopuserSortField);
+   strlow(TopuserSortOrder);
+
+   if(strcmp(TopuserSortField,"USER") == 0)
+      strcpy(sfield,"1,1");
+
+   if(strcmp(TopuserSortField,"CONNECT") == 0)
+      strcpy(sfield,"3,3");
+
+   if(strcmp(TopuserSortField,"TIME") == 0)
+      strcpy(sfield,"4,4");
+
+   if(strcmp(TopuserSortOrder,"normal") == 0)
+      order[0]='\0';
+
+   sprintf(csort,"sort -n -T %s %s -k %s -o %s %s", TempDir, order, sfield, top1, top2);
+   system(csort);
+
+   unlink(top2);
+
+   if((fp_top1=fopen(top1,"a"))==NULL) {
+    fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],top1);
+    exit(1);
+   }
+   fputs(preg,fp_top1);
+   fclose(fp_top1);
+
+   if((fp_top1=fopen(top1,"r"))==NULL) {
+      fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],top1);
+      exit(1);
+   }
+
+   if((fp_top3=fopen(top3,"w"))==NULL) {
+      fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],top3);
+      exit(1);
+   }
+
+ /*
+ * get period
+ */
+
+   strcpy(arqper,dirname);
+   strcat(arqper,"/periodo");
+
+   if ((fp_in = fopen(arqper, "r")) == 0) {
+      fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],arqper);
+      exit(1);
+   }
+
+   fgets(periodo,sizeof(periodo),fp_in);
+   fclose(fp_in);
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_top3);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_top3);
+   fputs("<html>\n",fp_top3);
+   fputs("<head>\n",fp_top3);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_top3);
+   fputs("</head>\n",fp_top3);
+
+   css(fp_top3);
+
+   sprintf(preg,"<body class=\"body\">");
+   fputs(preg,fp_top3);
+
+   if(strlen(LogoImage) > 0) {
+      fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_top3);
+      sprintf(preg,"<tr><th align=\"center\"><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font></th></tr>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(preg,fp_top3);
+      fputs("</table>\n",fp_top3);
+   }
+
+   show_sarg(fp_top3, "..");
+   fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_top3);
+   sprintf(preg,"<tr><th align=\"center\" class=\"title\">%s</th></tr>\n",Title);
+   fputs(preg,fp_top3);
+
+   sprintf(preg,"<tr><td class=\"header3\">%s: %s</td></tr>\n",text[89],periodo);
+   fputs(preg,fp_top3);
+   strcat(wheader,(char *)text[104]);
+   strcat(wheader,": ");
+   strcat(wheader,TopuserSortField);
+   strcat(wheader,", ");
+   strcat(wheader,TopuserSortOrder);
+   sprintf(preg,"<tr><td class=\"header3\">%s</td></tr>\n",wheader);
+   fputs(preg,fp_top3);
+   sprintf(preg,"<tr><td class=\"header3\">Topuser %s</td></tr>\n",text[55]);
+   fputs(preg,fp_top3);
+
+   fputs("</table></center>\n",fp_top3);
+   fputs("<center><table cellpadding=\"1\" cellspacing=\"2\">\n",fp_top3);
+   fputs("<tr><td><br></td><td></td></tr>\n",fp_top3);
+
+   if(strstr(ReportType,"topsites") != 0) {
+      sprintf(preg,"<tr><td class=\"link\" colspan=11><a href=\"topsites.html\"><font class=\"link\">%s</font></a><font class=\"text\"> %s</font></td></tr>\n",text[119],text[55]);
+      fputs(preg,fp_top3);
+   }
+
+   if(strstr(ReportType,"sites_users") != 0) {
+      sprintf(preg,"<tr><td class=\"link\" colspan=11><a href=\"siteuser.html\"><font class=\"link\">%s</font></a><font class=\"text\"> %s</font></td></tr>\n",text[85],text[55]);
+      fputs(preg,fp_top3);
+   }
+
+   if(dansguardian_count) {
+     sprintf(preg,"<tr><td class=\"link\" colspan=11><a href=\"dansguardian.html\"><font class=\"link\">%s</font></a><font class=\"text\"> %s</font></td></tr>\n",text[128],text[55]);
+     fputs(preg,fp_top3);
+   }
+
+   if(squidguard_count) {
+     sprintf(preg,"<tr><td class=\"link\" colspan=11><a href=\"squidguard.html\"><font class=\"link\">%s</font></a><font class=\"text\"> %s</font></td></tr>\n",text[122],text[55]);
+     fputs(preg,fp_top3);
+   }
+
+   if(download_count) {
+      sprintf(preg,"<tr><td class=\"link\" colspan=11><a href=\"download.html\"><font class=\"link\">%s</font></a><font class=\"text\"> %s</font></td></tr>\n",text[125],text[55]);
+      fputs(preg,fp_top3);
+   }
+
+   if(denied_count) {
+      sprintf(preg,"<tr><td class=\"link\" colspan=11><a href=\"denied.html\"><font class=\"link\">%s</font></a><font class=\"text\"> %s</font></td></tr>\n",text[118],text[55]);
+      fputs(preg,fp_top3);
+   }
+
+   if(authfail_count) {
+      sprintf(preg,"<tr><td class=\"link\" colspan=11><a href=\"authfail.html\"><font class=\"link\">%s</font></a><font class=\"text\"> %s</font></td></tr>\n",text[117],text[55]);
+      fputs(preg,fp_top3);
+   }
+
+   if(smartfilter) {
+      sprintf(preg,"<tr><td class=\"link\" colspan=11><a href=\"smartfilter.html\"><font class=\"link\">%s</font></a><font class=\"text\"> %s</font></td></tr>\n",text[116],text[55]);
+      fputs(preg,fp_top3);
+   }
+   strcpy(preg,"<tr><td></td></tr>\n");
+   fputs(preg,fp_top3);
+
+   strcpy(val1,text[100]);
+   strcpy(val2,text[98]);
+   strcpy(val3,text[92]);
+   strcpy(val4,text[93]);
+   sprintf(val11,"%%%s",text[93]);
+   sprintf(val5,"%s-%s-%s",text[113],text[114],text[112]);
+   strcpy(val6,text[94]);
+   strcpy(val7,text[95]);
+   sprintf(val8,"%%%s",text[99]);
+   strcpy(val9,"colspan=2");
+   bzero(val10, 255);
+   strcpy(hbc1,"class=\"header\"");
+   strcpy(hbc2,"class=\"header\"");
+   strcpy(hbc3,"class=\"header\"");
+   strcpy(hbc4,"class=\"header\"");
+   strcpy(hbc5,"class=\"header3\"");
+   strcpy(hbc6,"class=\"header\"");
+   strcpy(hbc7,"class=\"header\"");
+   strcpy(hbc8,"class=\"header\"");
+   strcpy(hbc9,"class=\"header\"");
+   strcpy(hbc10,"class=\"header\"");
+
+   if(strstr(TopUserFields,"NUM") == 0) {
+      bzero(val1, 255);
+      bzero(hbc1, 30);
+   }
+   if(strstr(TopUserFields,"USERID") == 0) {
+      bzero(val2, 255);
+      bzero(hbc2, 30);
+   }
+   if(strstr(TopUserFields,"CONNECT") == 0) {
+      bzero(val3, 255);
+      bzero(hbc3, 30);
+   }
+   if(strstr(TopUserFields,"BYTES") == 0) {
+      bzero(val4, 255);
+      bzero(hbc4, 30);
+   }
+   if(strstr(TopUserFields,"SETYB") == 0) {
+      bzero(val11, 255);
+      bzero(hbc9, 30);
+   }
+   if(strstr(TopUserFields,"IN-CACHE-OUT") == 0) {
+      bzero(val5, 255);
+      bzero(hbc5, 30);
+      bzero(val9, 255);
+      strcpy(val10,"<td></td>");
+   }
+   if(strstr(TopUserFields,"USED_TIME") == 0) {
+      bzero(val6, 255);
+      bzero(hbc6, 30);
+   }
+   if(strstr(TopUserFields,"MILISEC") == 0) { 
+      bzero(val7, 255);
+      bzero(hbc7, 30);
+   }
+   if(strstr(TopUserFields,"%TIME") == 0) {
+      bzero(val8, 255);
+      bzero(hbc8, 30);
+   }
+
+     sprintf(preg,"<tr><th %s>%s</th><th %s></th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s %s>%s%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th></tr>\n",hbc1,val1,hbc1,hbc2,val2,hbc3,val3,hbc4,val4,hbc9,val11,hbc5,val9,val5,val10,hbc6,val6,hbc7,val7,hbc8,val8);
+
+   fputs(preg,fp_top3);
+
+   fscanf(fp_top1,"%s",user);
+   fscanf(fp_top1,"%s",nbytes);
+   fscanf(fp_top1,"%s",nacc);
+   fscanf(fp_top1,"%s",elap);
+   fscanf(fp_top1,"%s",incac);
+   fscanf(fp_top1,"%s",oucac);
+
+   while(!feof(fp_top1)) {
+      if(atoi(TopUsersNum) > 0 && topcount >= atoi(TopUsersNum)) goto final;
+      strcpy(user2,user);
+      tnbytes=my_atoll(nbytes);
+
+      if(tnbytes) {
+         perc=tnbytes * 100;
+         perc=perc / ttnbytes;
+      } else perc = 0;
+
+      if(atol(elap)) {
+         perc2=atol(elap);
+         perc2=((perc2 * 100) / ttnelap);
+      } else perc2 = 0;
+
+      if(atol(incac)) {
+         inperc=atol(incac);
+         inperc=((inperc * 100) / tnbytes);
+      } else inperc = 0;
+
+      if(atol(oucac)) {
+         ouperc=atol(oucac);
+         ouperc=((ouperc * 100) / tnbytes);
+      } else ouperc = 0;
+
+      strcpy(href," ");
+      strcpy(href2," ");
+      strcpy(href3," ");
+
+      if(strcmp(user,"TOTAL") != 0){
+         sprintf(href,"<a href='%s/",user);
+         sprintf(href2,"<a href='%s/d",user);
+         sprintf(href3,"<a href='%s/graph_day.png'>",user);
+         strcat(href,user);
+         strcat(href2,user);
+         strcat(href,".html'>");
+         strcat(href2,".html'>");
+      }
+
+      if(strcmp(Graphs,"yes") != 0)
+         bzero(href3,MAXLEN);
+
+      posicao++;
+
+      tnelap=my_atoll(elap);
+
+      if(userip) {
+         fixip(user2);
+         if(strcmp(Ip2Name,"yes") == 0) {
+            if(strcmp(user2,ipantes) != 0) {
+               strcpy(ipantes,user2);
+               ip2name(user2);
+               strcpy(nameantes,user2);
+            } else strcpy(user2,nameantes);
+         }
+      }
+    
+      if(strstr(ReportType,"date_time") != 0) {
+         sprintf(ltext110,"%s",text[110]);
+         if(ltext110){
+            for(s=ltext110; *s; ++s)
+               *s=tolower(*s);
+         }
+      } else {
+         bzero(href2, MAXLEN);
+         bzero(ltext110, 50);
+         sprintf(val1,"%s/d%s.html",dirname,user);
+        unlink(val1);
+      }
+
+      if(UserTabFile[0] != '\0' && strstr(user2,".") != 0) {
+         sprintf(warea,":%s:",user2);
+         if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
+            z1=0;
+            str2=(char *) strstr(str+1,":");
+            str2++;
+            bzero(name, MAXLEN);
+            while(str2[z1] != ':') {
+               name[z1]=str2[z1];
+               z1++;
+            }
+         } else strcpy(name,user2);
+      } else strcpy(name,user2);
+
+      if(strcmp(Ip2Name,"yes") == 0) {
+         if((str=(char *) strstr(name, ".")) != (char *) NULL) {
+            if((str=(char *) strstr(str+1, ".")) != (char *) NULL)
+               ip2name(name);
+         }
+      }
+
+      twork=my_atoll(nacc);
+      my_lltoa(twork,nacc,0);
+      sprintf(wwork1,"%s",fixnum(twork,1));
+      sprintf(wwork2,"%s",fixnum(tnbytes,1));
+      sprintf(wwork3,"%s",fixnum(tnelap,1));
+
+      sprintf(val1,"%d",posicao);
+#ifdef HAVE_GD
+      sprintf(val2,"%s<img src=\"../images/graph.png\" border=\"0\" title=\"%s %s\"></a>&nbsp;%s<img src=\"../images/datetime.png\" border=\"0\" title=\"%s %s\">\n",href3,text[126],text[55],href2,ltext110,text[55]);
+#else
+      sprintf(val2,"%s<img src=\"../images/datetime.png\" border=\"0\" title=\"%s %s\">\n",href2,ltext110,text[55]);
+#endif
+
+      sprintf(val3,"%3.2f%%",perc);
+      sprintf(val4,"%3.2f%%",inperc);
+      sprintf(val5,"%3.2f%%",ouperc);
+      sprintf(val6,"%s",buildtime(tnelap));
+      sprintf(val7,"%3.2f%%",perc2);
+
+      strcpy(hbc1,"class=\"data\"");
+      strcpy(hbc2,"class=\"data2\"");
+      strcpy(hbc3,"class=\"data\"");
+      strcpy(hbc4,"class=\"data\"");
+      strcpy(hbc5,"class=\"data\"");
+      strcpy(hbc6,"class=\"data\"");
+      strcpy(hbc7,"class=\"data\"");
+      strcpy(hbc8,"class=\"data\"");
+      strcpy(hbc9,"class=\"data\"");
+      strcpy(hbc10,"class=\"data\"");
+
+      if(strstr(TopUserFields,"NUM") == 0) {
+         bzero(val1, 255);
+         bzero(hbc1, 30);
+      }
+      if(strstr(TopUserFields,"USERID") == 0) {
+         bzero(val2, 255);
+         bzero(hbc2, 30);
+      }
+      if(strstr(TopUserFields,"CONNECT") == 0) {
+         bzero(wwork1, 255);
+         bzero(hbc3, 30);
+      }
+      if(strstr(TopUserFields,"BYTES") == 0) { 
+         bzero(wwork2, 255);
+         bzero(hbc4, 30);
+      }
+      if(strstr(TopUserFields,"SETYB") == 0) {
+         bzero(val3, 255);
+         bzero(hbc5, 30);
+      }
+      if(strstr(TopUserFields,"IN-CACHE-OUT") == 0) {
+         bzero(val4, 255);
+         bzero(hbc6, 30);
+      }
+      if(strstr(TopUserFields,"IN-CACHE-OUT") == 0) {
+         bzero(val5, 255);
+         bzero(hbc7, 30);
+      }
+      if(strstr(TopUserFields,"USED_TIME") == 0) {
+         bzero(val6, 255);
+         bzero(hbc8, 30);
+      }
+      if(strstr(TopUserFields,"MILISEC") == 0) {
+         bzero(wwork3, 255);
+         bzero(hbc9, 30);
+      }
+      if(strstr(TopUserFields,"%TIME") == 0) {
+         bzero(val7, 255);
+         bzero(hbc10, 30);
+      }
+
+      if(strstr(ReportType,"users_sites") == 0)
+         href[0]='\0';
+
+      sprintf(preg,"<tr><td %s>%s</td><td %s>%s</td><td %s>%s%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s</td><td %s>%s<td %s>%s</td></tr>\n",hbc1,val1,hbc2,val2,hbc2,href,name,hbc3,wwork1,hbc4,wwork2,hbc5,val3,hbc6,val4,hbc7,val5,hbc8,val6,hbc9,wwork3,hbc10,val7);
+
+      if(strstr(user,"TOTAL") != 0) {
+
+         if(atol(incac)) {
+            inperc=ttnbytes / 100;
+            inperc=atol(incac) / inperc;
+         } else inperc = 0;
+
+         if(atol(oucac)) {
+            ouperc=ttnbytes / 100;
+            ouperc=atol(oucac) / ouperc;
+         } else ouperc = 0;
+
+        sprintf(wwork1,"%s",fixnum(ttnacc,1));
+        sprintf(wwork2,"%s",fixnum(ttnbytes,1));
+        sprintf(wwork3,"%s",fixnum(ttnelap,1));
+
+         strcpy(hbc1,"class=\"header2\"");
+         strcpy(hbc2,"class=\"header2\"");
+         strcpy(hbc3,"class=\"header2\"");
+         strcpy(hbc4,"class=\"header2\"");
+         strcpy(hbc5,"class=\"header2\"");
+         strcpy(hbc6,"class=\"header2\""); 
+         strcpy(hbc7,"class=\"header2\"");
+         strcpy(hbc8,"class=\"header2\"");
+         strcpy(hbc9,"class=\"header2\"");
+         strcpy(hbc10,"class=\"header\"");
+
+         sprintf(val4,"%3.2f%%",inperc);
+         sprintf(val5,"%3.2f%%",ouperc);
+         sprintf(val6,"%s",buildtime(ttnelap));
+         sprintf(val7,"%3.2f%%",perc2);
+
+         if(strstr(TopUserFields,"CONNECT") == 0) {
+            bzero(wwork1, 255);
+            bzero(hbc1, 30);
+         }
+         if(strstr(TopUserFields,"BYTES") == 0) {
+            bzero(wwork2, 255);
+            bzero(hbc2, 30);
+         }
+         if(strstr(TopUserFields,"IN-CACHE-OUT") == 0) {
+            bzero(val4, 255);
+            bzero(val5, 255);
+            bzero(hbc3, 30);
+            bzero(hbc4, 30);
+         }
+         if(strstr(TopUserFields,"USED_TIME") == 0) {
+            bzero(val6, 255);
+            bzero(hbc5, 30);
+         }
+         if(strstr(TopUserFields,"MILISEC") == 0) {
+            bzero(wwork3, 255);
+            bzero(hbc6, 30);
+         }
+
+         if(strstr(ReportType,"date_time") != 0) {
+           if(strstr(TopUserFields,"TOTAL") != 0)
+               sprintf(preg,"<tr><td></td><td></td><th %s>%s</th><th %s>%s</th><th %s>%15s</th><td></td><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th></tr>\n",hbc10,text[107],hbc1,wwork1,hbc2,wwork2,hbc3,val4,hbc4,val5,hbc5,val6,hbc6,wwork3);
+        } else if(strstr(TopUserFields,"TOTAL") != 0)
+            sprintf(preg,"<tr><td></td><td></td><th %s>%s</th><th %s>%s</th><th %s>%15s</th><td></td><th %s>%s</th><th %s>%s</th><th %s>%s</th><th %s>%s</th></tr>\n",hbc10,text[107],hbc1,wwork1,hbc2,wwork2,hbc3,val4,hbc4,val5,hbc5,val6,hbc6,wwork3);
+      }
+
+      fputs(preg,fp_top3);
+
+      topcount++;
+
+      fscanf(fp_top1,"%s",user);
+      fscanf(fp_top1,"%s",nbytes);
+      fscanf(fp_top1,"%s",nacc);
+      fscanf(fp_top1,"%s",elap);
+      fscanf(fp_top1,"%s",incac);
+      fscanf(fp_top1,"%s",oucac);
+   }
+
+   if(ttnbytes) {
+      tnbytes=ttnbytes / totuser;
+   } else tnbytes=0;
+
+   twork=ttnacc/totuser;
+   twork2=ttnelap/totuser;
+   sprintf(wwork1,"%s",fixnum(twork,1));
+   sprintf(wwork2,"%s",fixnum(tnbytes,1));
+   sprintf(wwork3,"%s",fixnum(twork2,1));
+
+   if(strstr(TopUserFields,"CONNECT") == 0) {
+      bzero(wwork1, 255);
+      bzero(hbc1, 30);
+   }
+   if(strstr(TopUserFields,"BYTES") == 0) {
+      bzero(wwork2, 255);
+      bzero(hbc2, 30);
+   }
+   if(strstr(TopUserFields,"IN-CACHE-OUT") == 0) {
+      bzero(val4, 255);
+      bzero(val5, 255);
+      bzero(hbc3, 30);
+      bzero(hbc4, 30);
+   }
+   if(strstr(TopUserFields,"USED_TIME") == 0) {
+      bzero(val6, 255);
+      bzero(hbc5, 30);
+   }
+   if(strstr(TopUserFields,"MILISEC") == 0) {
+      bzero(wwork3, 255);
+      bzero(hbc6, 30);
+   }
+
+   if((strstr(ReportType,"date_time") != 0 && strstr(TopUserFields,"AVERAGE") != 0)) {
+      sprintf(preg,"<tr><td></td><th></th><th %s>%s</th><th %s>%s</th><th %s>%15s</th><td></td><td></td><td></td><th %s>%s</th><th %s>%s</th></tr>\n",hbc10,text[96],hbc1,wwork1,hbc2,wwork2,hbc3,buildtime(ttnelap/totuser),hbc4,wwork3);
+      fputs(preg,fp_top3);
+    } else if(strstr(TopUserFields,"AVERAGE") != 0) {
+         sprintf(preg,"<tr><td></td><th></th><td></td><th %s>%s</th><th %s>%s</th><th %s>%15s</th><td></td><td></td><td></td><th %s>%s</th><th %s>%s</th></tr>\n",hbc10,text[96],hbc1,wwork1,hbc2,wwork2,hbc3,buildtime(ttnelap/totuser),hbc4,wwork3);
+         fputs(preg,fp_top3);
+   }
+
+   if(strlen(UserAgentLog) > 0) {
+      fputs("<tr><td></td></tr>\n",fp_top3);
+      fputs("<tr><td></td></tr>\n",fp_top3);
+      fputs("<td align=\"left\" colspan=8><font size=-1><a href='useragent.html'>Useragent</a> Report</td>\n",fp_top3);
+   }
+
+   strcpy(preg,"</table></center>");
+   fputs(preg,fp_top3);
+
+   show_info(fp_top3);
+
+final:
+   fclose(fp_top1);
+   unlink(top1);
+
+   if((fp_ou=fopen(tusr,"w"))==NULL) {
+      fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],tusr);
+      exit(1);
+   }
+
+   sprintf(preg,"%d\n",totuser);
+   fputs(preg,fp_ou);
+
+   fputs("</body>\n</html>\n",fp_top3);
+   fclose(fp_top3);
+   fclose(fp_ou);
+
+   return;
+}
diff --git a/totday.c b/totday.c
new file mode 100644 (file)
index 0000000..02c6156
--- /dev/null
+++ b/totday.c
@@ -0,0 +1,128 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void totaliza_day(const char *tmp, char *user, int indexonly)
+{
+
+   FILE *fp_in, *fp_ou;
+      
+   char data[20];
+   char hora[20];
+   char min[20];
+   char elap[20];
+   char odata[20];
+   char ohora[20];
+   char oelap[20];
+   char hm[20];
+   char ohm[20];
+   char csort[255];
+   char wdirname[MAXLEN];
+   char sortout[MAXLEN];
+   char arqout[MAXLEN];
+   int  regs=0;
+   long long int telap=0;
+   long long int tused=0;
+
+   if(indexonly) return;
+   if(strstr(ReportType,"users_sites") == 0) return;
+
+   sprintf(wdirname,"%s/%s.htmp",tmp,user);
+   sprintf(arqout,"%s/%s.day",tmp,user);
+   sprintf(sortout,"%s/%s.sort",tmp,user);
+
+   sprintf(csort,"sort -k 1,1 -k 2,2 -o %s %s",sortout,wdirname);
+   system(csort);
+
+   unlink(wdirname);
+
+   if((fp_in=fopen(sortout,"r"))==NULL) {
+     fprintf(stderr, "SARG: (totday) %s: %s\n",text[8],sortout);
+     exit(1);
+   }
+
+   if((fp_ou=fopen(arqout,"w"))==NULL) {
+     fprintf(stderr, "SARG: (totday) %s: %s\n",text[8],arqout);
+     exit(1);
+   }
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      if(strstr(buf,"\n") != 0)
+         buf[strlen(buf)-1]='\0';
+         
+      getword(data,buf,' ');
+      getword(hora,buf,':');
+      getword(min,buf,':');
+      getword(elap,buf,' ');
+      strcpy(elap,buf);
+      sprintf(hm,"%s%s",hora,min);
+
+      if(!regs) {
+         strcpy(odata,data);
+         strcpy(ohora,hora);
+         strcpy(oelap,elap);
+         strcpy(ohm,hm);
+         regs++;
+      }
+
+      if(strcmp(hora,ohora) != 0) {
+         if(tused > telap)
+            tused=telap;
+
+         my_lltoa(telap,val1,15);
+         sprintf(buf,"%s %s %s\n",odata,ohora,val1);
+         fputs(buf, fp_ou);
+         strcpy(odata,data);
+         strcpy(ohora,hora);
+         strcpy(ohm,hm);
+         telap=0;
+         tused=0;
+      }
+
+      if(strcmp(ohm,hm) != 0) {
+         tused+=60000;
+         strcpy(ohm,hm);
+      }
+
+      telap+=my_atoll(elap);
+          
+   }
+
+   if(tused > telap)
+      tused=telap;
+
+   my_lltoa(telap,val1,15);
+   sprintf(buf,"%s %s %s\n",data,hora,val1);
+   fputs(buf, fp_ou);
+
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   unlink(sortout);
+
+   return;
+
+}
diff --git a/totger.c b/totger.c
new file mode 100644 (file)
index 0000000..71ca364
--- /dev/null
+++ b/totger.c
@@ -0,0 +1,104 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+int totalger(const char *dirname, int debug, const char *outdir)
+
+{
+
+
+   FILE *fp_in, *fp_ou;
+   long long int tnacc=0;
+   long long int tnbytes=0;
+   long long int telap=0;
+   long long int tincache=0, toucache=0;
+   char wger[MAXLEN], user[MAXLEN], nacc[10], nbytes[10], url[1024];
+   char ip[MAXLEN], hora[9], data[11], elap[15];
+   char incac[15], oucac[15];
+
+   strcpy(wger,dirname);
+   strcat(wger,"/geral");
+
+   if((fp_in=fopen(wger,"r"))==NULL) {
+      fprintf(stderr, "SARG: (totger) %s: %s\n",text[45],wger);
+      exit(1);
+   }
+
+   fscanf(fp_in,"%s",user);
+   fscanf(fp_in,"%s",nacc);
+   fscanf(fp_in,"%s",nbytes);
+   fscanf(fp_in,"%s",url);
+   fscanf(fp_in,"%s",ip);
+   fscanf(fp_in,"%s",hora);
+   fscanf(fp_in,"%s",data);
+   fscanf(fp_in,"%s",elap);
+   fscanf(fp_in,"%s",incac);
+   fscanf(fp_in,"%s",oucac);
+
+   while(!feof(fp_in))
+   {
+
+      tnacc+=my_atoll(nacc);
+      tnbytes+=my_atoll(nbytes);
+      telap+=my_atoll(elap);
+      tincache+=my_atoll(incac);
+      toucache+=my_atoll(oucac);
+
+      fscanf(fp_in,"%s",user);
+      fscanf(fp_in,"%s",nacc);
+      fscanf(fp_in,"%s",nbytes);
+      fscanf(fp_in,"%s",url);
+      fscanf(fp_in,"%s",ip);
+      fscanf(fp_in,"%s",hora);
+      fscanf(fp_in,"%s",data);
+      fscanf(fp_in,"%s",elap);
+      fscanf(fp_in,"%s",incac);
+      fscanf(fp_in,"%s",oucac);
+   }
+
+   fclose(fp_in);
+
+   strcpy(wger,dirname);
+   strcat(wger,"/geral");
+
+   if((fp_ou=fopen(wger,"a"))==NULL) {
+    fprintf(stderr, "SARG: (totger) %s: %s\n",text[45],wger);
+    exit(1);
+   }
+
+   url[0]='\0';
+
+   my_lltoa(tnacc,val1,15);
+   my_lltoa(tnbytes,val2,15);
+   my_lltoa(telap,val3,15);
+   my_lltoa(tincache,val4,15);
+   my_lltoa(toucache,val5,15);
+   sprintf(url,"TOTAL %s %s %s %s %s\n",val1,val2,val3,val4,val5);
+   fputs(url,fp_ou);
+   fclose(fp_ou);
+
+   return (0);
+}
diff --git a/usage.c b/usage.c
new file mode 100644 (file)
index 0000000..1ce2071
--- /dev/null
+++ b/usage.c
@@ -0,0 +1,58 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void usage(char *prog)
+{
+  fprintf(stderr, "%s: %s [%s...]\n", prog,text[39],text[40]);
+  fprintf(stderr, "%5s-a %s\n"," ",text[23]);
+  fprintf(stderr, "%5s-b %s\n"," ",text[71]);
+  fprintf(stderr, "%5s-c %s\n"," ",text[69]);
+  fprintf(stderr, "%5s-d %s dd/mm/yyyy-dd/mm/yyyy\n"," ",text[24]);
+  fprintf(stderr, "%5s-e %s (%s)\n"," ",text[41],text[42]);
+  fprintf(stderr, "%5s-f %s (%s/sarg.conf)\n"," ",text[70],SYSCONFDIR);
+  fprintf(stderr, "%5s-g %s [e=%s -> dd/mm/yy, u=%s -> mm/dd/yy]\n"," ",text[25],text[26],text[27]);
+  fprintf(stderr, "%5s-h Help (this...)\n"," ");
+  fprintf(stderr, "%5s-i %s\n"," ",text[43]);
+  fprintf(stderr, "%5s-l %s\n"," ",text[37]);
+  fprintf(stderr, "%5s-n %s\n"," ",text[65]);
+  fprintf(stderr, "%5s-o %s\n"," ",text[38]);
+  fprintf(stderr, "%5s-p %s (%s)\n"," ",text[29],text[44]);
+  fprintf(stderr, "%5s-s %s [Eg. www.microsoft.com, www.netscape.com]\n"," ",text[30]);
+  fprintf(stderr, "%5s-t %s [HH, HH:MM]\n"," ",text[31]);
+  fprintf(stderr, "%5s-u %s\n"," ",text[32]);
+  fprintf(stderr, "%5s-w %s\n"," ",text[34]);
+  fprintf(stderr, "%5s-x %s\n"," ",text[36]);
+  fprintf(stderr, "%5s-z %s\n"," ",text[35]);
+  fprintf(stderr, "%5s-convert %s\n"," ",text[76]);
+  fprintf(stderr, "%5s-split %s\n"," ",text[77]);
+  fprintf(stderr, "\n\t%s-%s %s Pedro Lineu Orso - orso@brturbo.com.br\n",PGM,VERSION,text[78]);
+  fprintf(stderr, "\thttp://www.sarg-squid.org\n");
+  fprintf(stderr, "\n\tPease donate to the sarg project:");
+  fprintf(stderr, "\n\t\thttp://sarg.sourceforge.net/donations.php\n\n");
+
+  return;
+}
diff --git a/useragent.c b/useragent.c
new file mode 100644 (file)
index 0000000..effe721
--- /dev/null
@@ -0,0 +1,310 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void useragent()
+{
+
+   FILE *fp_in = NULL, *fp_ou = NULL, *fp_ht = NULL;
+   char tmp[MAXLEN], tmp2[MAXLEN];
+   char ip[MAXLEN], data[255], agent[255], user[255];
+   char ipantes[MAXLEN], nameantes[MAXLEN];
+   char tagent[7];
+   char csort[120];
+   char msg[255];
+   char ftime[128];
+   char user_old[255]="$#%0a3bc6";
+   char agent_old[255]="$#%0a3bc6";
+   char html[255];
+   char hfile[MAXLEN];
+   char idate[MAXLEN], fdate[MAXLEN];
+   int  agentot=0, agentot2=0, agentdif=0, cont=0;
+   float perc=0;
+   unsigned long totregsl=0;
+
+   ip[0]='\0';
+   data[0]='\0';
+   agent[0]='\0';
+   user[0]='\0';
+   user_old[0]='\0';
+   agent_old[0]='\0';
+   ipantes[0]='\0';
+   nameantes[0]='\0';
+
+   sprintf(hfile,"%s/%s/useragent.html", outdir,periodo);
+
+   sprintf(tmp,"%s/squagent.unsort",TempDir);
+   sprintf(tmp2,"%s/squagent.log",TempDir);
+
+   if((fp_in=fopen(UserAgentLog,"r"))==NULL) {
+      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],UserAgentLog);
+      exit(1);
+   }
+
+   if((fp_ou=fopen(tmp,"w"))==NULL) {
+      fprintf(stderr, "SARG: (email) %s: %s\n",text[45],tmp);
+      exit(1);
+   }
+
+   if(debug) {
+      sprintf(msg,"%s: %s",text[66],UserAgentLog);
+      debuga(msg);
+   }
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      totregsl++;
+      getword(ip,buf,' ');
+      getword(data,buf,'[');
+      getword(data,buf,' ');
+      if(totregsl == 1)
+         strcpy(idate,data);
+      getword(agent,buf,'"');
+      getword(agent,buf,'"');
+
+      if(strlen(buf)) {
+         getword(user,buf,' ');
+         getword(user,buf,'\n');
+      }
+
+      if(user[0] == '-')
+         strcpy(user,ip);
+      if(strlen(user) == 0)
+         strcpy(user,ip);
+
+      sprintf(buf,"%s\\%s\\%s\\%s\\\n",ip,data,agent,user);
+      fputs(buf,fp_ou);
+      user[0]='\0';
+   }
+
+   strcpy(fdate,data);
+
+   if(debug) {
+      sprintf(msg, "   %s: %ld",text[10],totregsl);
+      debuga(msg);
+   }
+
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   if (fp_ht) {
+      fclose(fp_ht);
+   }
+
+   if(debug) {
+      sprintf(msg,"%s: %s",text[54],tmp2);
+      debuga(msg);
+   }
+
+   sprintf(csort,"sort -n -t '\\' -k 4,4 -k 3,3 -k 2,2 -k 1,1 -o %s %s",tmp2,tmp);
+   system(csort);
+
+   unlink(tmp);
+
+   if((fp_in=fopen(tmp2,"r"))==NULL) {
+      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp2);
+      exit(1);
+   }
+
+   if((fp_ht=fopen(hfile,"w"))==NULL) {
+      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],hfile);
+      exit(1);
+   }
+   if(debug)
+      debuga(text[72]);
+
+   fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"",fp_ht);
+   fputs(" \"http://www.w3.org/TR/html4/loose.dtd\">\n",fp_ht);
+   fputs("<html>\n",fp_ht);
+   fputs("<head>\n",fp_ht);
+   sprintf(html,"  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+   fputs(html,fp_ht);
+   fputs("</head>\n",fp_ht);
+
+   if(strlen(FontFace) > 0) {
+      sprintf(html,"<font face=%s>\n",FontFace);
+      fputs(html,fp_ht);
+   }
+
+   sprintf(html,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   fputs(html,fp_ht);
+
+
+   if(strlen(LogoImage) > 0) {
+      fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ht);
+      sprintf(html,"<tr><th align=left><img src='%s' border=0 align=absmiddle width=%s height=%s><font color=%s>%s</font>\n",LogoImage,Width,Height,LogoTextColor,LogoText);
+      fputs(html,fp_ht);
+      fputs("</table>\n",fp_ht);
+   }
+
+   show_sarg(fp_ht,"..");
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ht);
+   sprintf(html,"<tr><th align=center colspan=2><b><font color=%s size=+1>%s</font></b></th></tr>\n",TiColor,text[105]);
+   fputs(html,fp_ht);
+
+   fputs("<tr><td></td></tr><tr><td></td></tr>",fp_ht);
+   fputs("</table></center>\n",fp_ht);
+
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ht);
+
+   sprintf(html,"<tr><td align=right bgcolor=%s><font size=%s>%s:</font><td align=left bgcolor=%s><font size=%s>%s - %s</font></td></td></tr>\n",HeaderBgColor,FontSize,text[89],TxBgColor,FontSize,idate,fdate);
+   fputs(html,fp_ht);
+
+   fputs("</table></center>\n",fp_ht);
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ht);
+   fputs("<tr><td></td><td></td></tr>",fp_ht);
+
+   sprintf(html,"<tr><th align=left bgcolor=%s><font size=%s color=%s>%s</font></th><th bgcolor=%s align=left><font size=%s color=%s>%s</font></th></tr>\n",HeaderBgColor,FontSize,HeaderColor,text[98],HeaderBgColor,FontSize,HeaderColor,text[106]);
+   fputs(html,fp_ou);
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(ip,buf,'\\');
+
+      if(strcmp(Ip2Name,"yes") == 0) {
+         if(strcmp(ip,ipantes) != 0) {
+            strcpy(ipantes,ip);
+            ip2name(ip);
+            strcpy(nameantes,ip);
+         } else strcpy(ip,nameantes);
+      }
+
+      getword(data,buf,'\\');
+      getword(agent,buf,'\\');
+      getword(user,buf,'\\');
+
+      if(strcmp(user,user_old) != 0) {
+         sprintf(html,"<tr><td align=left bgcolor=%s><font size=%s>%s</td><td align=left bgcolor=%s><font size=%s>%s</td></tr>\n",TxBgColor,FontSize,user,TxBgColor,FontSize,agent);
+         fputs(html,fp_ht);
+         strcpy(user_old,user);
+         strcpy(agent_old,agent);
+      } else {
+         if(strcmp(agent,agent_old) != 0) {
+            sprintf(html,"<tr><td></td><td align=left bgcolor=%s><font size=%s>%s</td></tr>\n",TxBgColor,FontSize,agent);
+            fputs(html,fp_ht);
+            strcpy(agent_old,agent);
+         }
+      }
+   }
+  
+   fputs("</table>\n",fp_ht);
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   sprintf(csort,"sort -n -t '\\' -k 3,3 -o %s %s",tmp,tmp2);
+   system(csort);
+
+   unlink(tmp2);
+
+   if((fp_in=fopen(tmp,"r"))==NULL) {
+      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp);
+      exit(1);
+   }
+
+   if((fp_ou=fopen(tmp2,"w"))==NULL) {
+      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp2);
+      exit(1);
+   }
+
+   agent_old[0]='\0';
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(ip,buf,'\\');
+      getword(data,buf,'\\');
+      getword(agent,buf,'\\');
+
+      if(!cont) {
+         cont++;
+         strcpy(agent_old,agent);
+      }
+     
+      agentot++;
+
+      if(strcmp(agent,agent_old) != 0) {
+         agentdif++;
+         sprintf(html,"%06d %s\n",agentot,agent_old);
+         fputs(html,fp_ou);
+         strcpy(agent_old,agent);
+         agentot2+=agentot;
+         agentot=1;
+      }
+   }
+   agentdif++;
+   sprintf(html,"%06d %s\n",agentot,agent);
+   fputs(html,fp_ou);
+   agentot2+=agentot;
+
+   fclose(fp_in);
+   fclose(fp_ou);
+
+   unlink(tmp);
+
+   sprintf(csort,"sort -n -r -k 1,1 -o %s %s",tmp,tmp2);
+   system(csort);
+
+   unlink(tmp2);
+
+   if((fp_in=fopen(tmp,"r"))==NULL) {
+      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp);
+      exit(1);
+   }
+
+   if((fp_ht=fopen(hfile,"a"))==NULL) {
+      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],hfile);
+      exit(1);
+   }
+
+   fputs("<br><br>\n",fp_ht);
+
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ht);
+   sprintf(html,"<tr><th align=left bgcolor=%s><font size=%s color=%s>%s</font></th><th bgcolor=%s align=left><font size=%s color=%s>%s</font></th><th align=center bgcolor=%s><font size=%s color=%s>%%</font></th></tr>\n",HeaderBgColor,FontSize,HeaderColor,text[106],HeaderBgColor,FontSize,HeaderColor,text[107],HeaderBgColor,FontSize,HeaderColor);
+   fputs(html,fp_ht);
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      buf[strlen(buf)-1]='\0';
+      getword(tagent,buf,' ');
+      perc=atoi(tagent) * 100;
+      perc=perc / agentot2;
+
+      sprintf(html,"<tr><td align=left bgcolor=%s><font size=%s>%s</td><td align=right bgcolor=%s><font size=%s>%d</td><td align=right bgcolor=%s><font size=%s>%3.2f</td></tr>\n",TxBgColor,FontSize,buf,TxBgColor,FontSize,atoi(tagent),TxBgColor,FontSize,perc);
+      fputs(html,fp_ht);
+   }
+
+   fputs("</table></html>\n",fp_ht);
+   if(strcmp(ShowSargInfo,"yes") == 0) {
+      zdate(ftime, DateFormat);
+      sprintf(html,"<br><br><center><font size=-2>%s <a href='%s'>%s-%s</a> %s %s</font></center>\n",text[108],URL,PGM,VERSION,text[109],ftime);
+      fputs(html,fp_ht);
+   }
+
+   fputs("</table>\n</body>\n</html>\n",fp_ht);
+   fclose(fp_in);
+   fclose(fp_ht);
+
+   unlink(tmp); 
+
+   return;
+      
+}
diff --git a/util.c b/util.c
new file mode 100644 (file)
index 0000000..2d21c5a
--- /dev/null
+++ b/util.c
@@ -0,0 +1,1114 @@
+/*
+ * AUTHOR: Pedro Lineu Orso                          orso@brturbo.com.br
+ *                                                            1998, 2005
+ * SARG Squid Analysis Report Generator            http://sarg-squid.org
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+// #define LEGACY_MY_ATOLL
+// #define LEGACY_TESTVALIDUSERCHAR
+
+#include "include/conf.h"
+
+static char mtab1[12][4]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
+static char mtab2[12][3]={"01","02","03","04","05","06","07","08","09","10","11","12"};
+
+void getword(char *word, char *line, int stop)
+{
+  int x = 0,y;
+  int loop=0;
+  int limit=10000;
+  char wline[MAXLEN];
+
+  strcpy(wline,line);
+
+  if(strlen(line) < 3) {
+     word[0]='\0';
+     return;
+  }
+
+  for(x=0;((line[x]) && (line[x] != stop ));x++) {
+     loop++;
+     if(loop>=limit) {
+        printf("SARG: getword loop detected.\n");
+        printf("SARG: Record=\"%s\"\n",wline);
+        printf("SARG: searching for \'x%x\'\n",stop);
+        printf("SARG: Maybe you have a broken record or garbage in your access.log file.\n");
+        word[0]='\0';
+        exit(1);
+     }
+     word[x] = line[x];
+  }
+
+  word[x] = '\0';
+  if(line[x]) ++x;
+    y=0;
+
+  while((line[y++] = line[x++]));
+}
+
+char *  getword2(char *word, char *line, int stop)
+{
+  int x = 0 , y;
+  int limit=MAXLEN;
+
+  if(strlen(line) < 3) {
+     word[0]='\0';
+     return( line ) ;
+  }
+
+  // printf( "IN Buffer <%s>\n" , line ) ;
+  for(x=0;((line[x]) && (line[x] != stop && limit ));x++ , limit-- ) {
+     word[x] = line[x];
+  }
+  if(  ! limit) {
+        printf("SARG: getword2 loop detected.\n");
+        printf("SARG: Buffer=\"%s\"\n",line);
+        printf("SARG: searching for \'x%x\'\n",stop);
+        printf("SARG: Maybe you have a broken record or garbage in your access.log file.\n");
+        exit(1);
+  }
+
+  word[x] = '\0';
+  // printf( "Value <%s>\n" , word ) ;
+  // printf( "OUT Buffer <%s>\n" , line+x+1 ) ;
+  return( line + x +1) ;
+}
+
+void getword3(char *word, char *line, int stop)
+{
+  int x = 0,y;
+  int loop=0;
+
+  for(x=0;((line[x]) && (line[x] != stop ));x++)
+     word[x] = line[x];
+  word[x] = '\0';
+  if(line[x]) ++x;
+    y=0;
+  while((line[y++] = line[x++]));
+}
+
+
+#ifdef LEGACY_MY_ATOLL
+
+// BMG (bguillory@email.com)
+// 3 August 1999
+long long int my_atoll (const char *nptr)
+#define MAXLLL 30 //maximum number of digits in long long (a guess)
+{
+  int offset=0, x;
+  long long int returnval=0;
+  char one_digit[2];
+
+  one_digit[1]='\0';
+
+  // Soak up all the white space
+  while (isspace(nptr[offset])) {
+    offset++;
+  } //while
+
+  //For each character left to right
+  //change the character to a single digit
+  //multiply what we had before by 10 and add the new digit
+  for(x=offset; x<=MAXLLL+offset && isdigit(nptr[x]); x++) {
+    sprintf(one_digit, "%c", nptr[x]); //I don't know how else to do this
+    returnval = (returnval * 10) + atoi(one_digit);
+  } //for
+
+  return returnval;
+
+} //my_atoll
+
+#else
+
+#define MAXLLL 30 //maximum number of digits in long long (a guess)
+long long int my_atoll (const char *nptr)
+{
+  long long int returnval=0;
+  char * t = nptr ;
+  int max_digits = MAXLLL ;
+
+  // Soak up all the white space
+  while (isspace( *t )) {
+    t++;
+  } //while
+
+  //For each character left to right
+  //change the character to a single digit
+  //multiply what we had before by 10 and add the new digit
+
+  for( ; --max_digits && isdigit( *t ) ; t++ )
+  {
+     returnval = ( returnval * 10 ) + ( *t - '0' ) ;
+  }
+
+  return returnval;
+
+} //my_atoll
+
+#endif
+
+
+void my_mkdir(char *name)
+{
+   char w0[255];
+   char w1[255];
+   char w2[255];
+
+   if(strncmp(name,".",1) == 0 || strncmp(name,"/",1) != 0) {
+      fprintf(stderr,"SARG: Ivalid path (%s). Please, use absolute paths only.\n",name);
+      fprintf(stderr,"SARG: process aborted.\n");
+      exit(1);
+   }
+
+   strcpy(w0,name);
+   strcpy(w2,"/");
+   getword(w1,w0,'/');
+   while(strstr(w0,"/") != 0) {
+      getword(w1,w0,'/');
+      strcat(w2,w1);
+      if(access(w2, R_OK) != 0) {
+         if(mkdir(w2,0755)) {
+            fprintf(stderr,"SARG: mkdir %s %s\n",w2,strerror(errno));
+            fprintf(stderr,"SARG: process aborted.\n");
+            exit(1);
+         }
+      }
+      strcat(w2,"/");
+   }
+   strcat(w2,w0);
+   if(access(w2, R_OK) != 0) {
+      if(mkdir(w2,0755)) {
+         fprintf(stderr,"SARG: mkdir %s %s\n",w2,strerror(errno));
+         fprintf(stderr,"SARG: process aborted.\n");
+         exit(1);
+      }
+   }
+}
+
+
+void my_lltoa(unsigned long long int n, char s[], int len)
+{
+  int i = 0;
+  int x = 0;
+  char ww[50];
+  do {
+    s[i++] = (n % 10) + '0';
+  } while ((n /= 10) > 0);
+  s[i] = '\0';
+  {
+    int c,i,j;
+    for (i = 0, j = strlen(s)-1; i<j; i++, j--)
+      {
+        c = s[i];
+        s[i] = s[j];
+        s[j] = c;
+      }
+  }
+  
+  if(len) {
+     bzero(ww,sizeof(ww));
+     i=len-strlen(s)-1;
+     for(x=0; x<=i; x++)
+        ww[x]='0';
+     i=strlen(s);
+     strncat(ww,s,i>sizeof(ww)?sizeof(ww):i);
+     strcpy(s,ww);
+  }
+    
+}
+
+
+void builddia(char *dia, char *mes, char *ano, char *df, char *wdata)
+{
+   char ndia[11];
+   char nmes[3];
+   int  x;
+
+   if(strlen(dia) < 1) return;
+
+   ndia[0]='\0';
+   nmes[0]='\0';
+
+   for(x=0; x<12; x++) {
+      if(strcmp(mtab1[x],mes) == 0) {
+         strncpy(nmes,mtab2[x],sizeof(nmes)-1);
+         nmes[sizeof(nmes)-1]=0;
+         break;
+      }
+   }
+
+   snprintf(wdata,9,"%s%s%s",ano,nmes,dia);
+
+   if(strncmp(df,"u",1) != 0)
+      snprintf(ndia,sizeof(ndia),"%s/%s/%s",dia,nmes,ano);
+    else
+      snprintf(ndia,sizeof(ndia),"%s/%s/%s",nmes,dia,ano);
+
+   strcpy(dia,ndia);
+
+}
+
+
+void buildymd(char *dia, char *mes, char *ano, char *wdata)
+{
+   char nmes[3];
+   int  x;
+
+   nmes[0]='\0';
+
+   for(x=0; x<12; x++) {
+      if(strcmp(mtab1[x],mes) == 0)
+         strcpy(nmes,mtab2[x]);
+   }
+
+   sprintf(wdata,"%s%s%s",ano,nmes,dia);
+
+}
+
+
+void conv_month(char *month)
+{
+   int  x;
+
+   for(x=0; x<12; x++) {
+      if(strcmp(mtab1[x],month) == 0)
+         strcpy(month,mtab2[x]);
+   }
+
+}
+
+
+void conv_month_name(char *month)
+{
+   int x;
+
+   for(x=0; x<12; x++) {
+      if(strcmp(mtab2[x],month) == 0)
+         strcpy(month,mtab1[x]);
+   }
+}
+
+
+void fixper(char *tbuf, char *periodo, char *duntil)
+{
+
+   char warea[50];
+   char dia[5], mes[5], ano[5];
+   int  x;
+
+   warea[0]='\0';
+
+   strncpy(dia,duntil+6,2);
+   dia[2]='\0';
+   strncpy(mes,duntil+4,2);
+   mes[2]='\0';
+   strncpy(ano,duntil,4);
+   ano[4]='\0';
+
+   for(x=0; x<12; x++) {
+      if(strcmp(mtab2[x],mes) == 0)
+         strcpy(mes,mtab1[x]);
+   }
+
+   if(strcmp(df,"e") == 0)
+      sprintf(warea,"%s%s%s",dia,mes,ano);
+   if(strcmp(df,"u") == 0)
+      sprintf(warea,"%s%s%s",ano,mes,dia);
+
+   strcat(periodo,warea);
+}
+
+
+void debuga(char *msg)
+{
+  fprintf(stderr, "SARG: %s\n",msg);
+
+}
+
+
+void debugaz(char *head, char *msg)
+{
+  fprintf(stderr, "SARG: (util) %s=%s\n",head, msg);
+
+}
+
+
+void fixip(char *ip)
+{
+   char n1[MAXLEN], n2[MAXLEN], n3[MAXLEN];
+   char wip[MAXLEN];
+   char sep[2]=".";
+   int iflag=0;
+
+   strcpy(wip,ip);
+
+   if(strstr(ip,".") != 0) {
+      strcpy(sep,"_");
+      iflag++;
+   }
+
+   if(iflag) {
+      getword(n1,wip,'.');
+      getword(n2,wip,'.');
+      getword(n3,wip,'.');
+   } else {
+      getword(n1,wip,'_');
+      getword(n2,wip,'_');
+      getword(n3,wip,'_');
+   }
+   ip[0]='\0';
+   sprintf(ip,"%s%s%s%s%s%s%s",n1,sep,n2,sep,n3,sep,wip);
+
+}
+
+
+char *fixnum(long long int value, int n)
+#define MAXIMO 1024
+{
+   char num[MAXIMO];
+   char buf[MAXIMO * 2];
+   char *pbuf;
+   char ret[MAXIMO * 2];
+   char *pret;
+   float perc=0;
+   register int i, j, k;
+   static char abbrev[30];
+      
+   my_lltoa(value, num, 0);
+
+   if(strcmp(DisplayedValues,"abbreviation") == 0) {
+      if(strlen(num) <= 3)
+         sprintf(abbrev,"%s",num);
+      if(strlen(num) == 4 || strlen(num) == 7 || strlen(num) == 10 || strlen(num) == 13) {
+         snprintf(abbrev,2,"%s",num);
+         strncat(abbrev,".",1);
+         strncat(abbrev,num+1,2);
+         if(!n) return(abbrev);
+         if(strlen(num) == 4)
+            strncat(abbrev,"K",1);
+         else if(strlen(num) == 7)
+            strncat(abbrev,"M",1);
+         else if(strlen(num) == 10)
+            strncat(abbrev,"G",1);
+         else if(strlen(num) == 13)
+            strncat(abbrev,"T",1);
+      }
+      if(strlen(num) == 5 || strlen(num) == 8 || strlen(num) == 11 || strlen(num) == 14) {
+         snprintf(abbrev,3,"%s",num);
+         strncat(abbrev,".",1);
+         strncat(abbrev,num+2,2);
+         if(!n) return(abbrev);
+         if(strlen(num) == 5)
+            strncat(abbrev,"K",1);
+         else if(strlen(num) == 8)
+            strncat(abbrev,"M",1);
+         else if(strlen(num) == 11)
+            strncat(abbrev,"G",1);
+         else if(strlen(num) == 14)
+            strncat(abbrev,"T",1);
+      }
+      if(strlen(num) == 6 || strlen(num) == 9 || strlen(num) == 12 || strlen(num) == 15) {
+         snprintf(abbrev,4,"%s",num);
+         strncat(abbrev,".",1);
+         strncat(abbrev,num+3,2);
+         if(!n) return(abbrev);
+         if(strlen(num) == 6)
+            strncat(abbrev,"K",1);
+         else if(strlen(num) == 9)
+            strncat(abbrev,"M",1);
+         else if(strlen(num) == 12)
+            strncat(abbrev,"G",1);
+         else if(strlen(num) == 15)
+            strncat(abbrev,"T",1);
+      }
+
+      return(abbrev);
+   }
+
+   bzero(buf, MAXIMO*2);
+
+   pbuf = buf;
+   pret = ret;
+   k = 0;
+
+   for ( i = strlen(num) - 1, j = 0 ; i > -1; i--) {
+      if ( k == 2 && i != 0 )  {
+         k = 0;
+         pbuf[j++] = num[i];
+         if(strcmp(UseComma,"yes") == 0)
+            pbuf[j++] = ',';
+         else pbuf[j++] = '.';
+         continue;
+      }
+      pbuf[j] = num[i];
+      j++;
+      k++;
+   }
+
+   pret[0]='\0';
+
+   for ( i = strlen(pbuf) - 1, j = 0 ; i > -1; i--, j++)
+      pret[j] = pbuf[i];
+
+      pret[j] = '\0';
+
+      return pret;
+}
+
+
+void buildhref(char * href)
+{
+   char whref[MAXLEN];
+
+   if(strcmp(href,"./") == 0){
+      href[0]='\0';
+      strcat(href,"<a href='");
+      return;
+   }
+
+   href[strlen(href)-1]='\0';
+   sprintf(whref,"%s",strrchr(href,'/'));
+
+   strcpy(href,"<a href='");
+   strcat(href,whref);
+   strcat(href,"/");
+
+   return;
+
+}
+
+
+char *buildtime(long long int elap)
+{
+
+   int num = elap / 1000;
+   int hor = 0;
+   int min = 0;
+   int sec = 0;
+   static char buf[12];
+
+   buf[0]='\0';
+
+   hor=num / 3600;
+   min=(num % 3600) / 60;
+   sec=num % 60;
+   sprintf(buf,"%02d:%02d:%02d",hor,min,sec);
+
+   return(buf);
+
+}
+
+
+void obtdate(char *dirname, char *name, char *data)
+{
+
+   FILE *fp_in;
+   char wdir[MAXLEN];
+
+   sprintf(wdir,"%s%s/date",dirname,name);
+   if ((fp_in = fopen(wdir, "r")) == 0) {
+      data[0]='\0';
+      return;
+   }
+
+   fgets(data,80,fp_in);
+   fclose(fp_in);
+   data[strlen(data)-1]='\0';
+
+   return;
+
+}
+
+
+void obtuser(char *dirname, char *name, char *tuser)
+{
+
+   FILE *fp_in;
+   char wdir[MAXLEN];
+
+   sprintf(wdir,"%s%s/usuarios",dirname,name);
+   if((fp_in=fopen(wdir,"r"))==NULL){    
+      tuser[0]='\0';
+      return;
+   }
+
+   fgets(tuser,20,fp_in);
+   tuser[strlen(tuser)-1]='\0';
+   fclose(fp_in);
+
+   return;
+
+}
+
+
+void obttotal(char *dirname, char *name, char *tbytes, char *tuser, char *media)
+{
+
+   FILE *fp_in;
+   char wdir[MAXLEN];
+   long long int med=0;
+   long long int wtuser=0;
+
+   sprintf(wdir,"%s%s/geral",dirname,name);
+
+   if ((fp_in = fopen(wdir, "r")) == 0) {
+      tbytes=0;
+      return;
+   }
+
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      getword(warea,buf,' ');
+      if(strcmp(warea,"TOTAL") != 0)
+         continue;
+      getword(warea,buf,' ');
+      getword(warea,buf,' ');
+      twork=my_atoll(warea);
+      sprintf(tbytes,"%s",fixnum(twork,1));
+   }
+   fclose(fp_in);
+
+   if(tuser[0] == '\0') {
+      wtuser=0;
+      sprintf(media,"%s","0");
+      return;
+   }
+   
+   wtuser=my_atoll(tuser);
+   med=my_atoll(warea) / wtuser;
+   sprintf(media,"%s",fixnum(med,1));
+
+   return;
+
+}
+
+
+//void gperiodo(char *dirname, const char *periodo)
+void gperiodo()
+{
+   FILE *fp_ou;
+   char wdirname[MAXLEN];
+
+   strcpy(wdirname,dirname);
+   strcat(wdirname,"/");
+   strcat(wdirname,"periodo");
+
+   if((fp_ou=fopen(wdirname,"w"))==NULL){
+      fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
+      exit(1);
+   }
+   fputs(periodo,fp_ou);
+   fclose(fp_ou);
+
+   if(debug)
+      debuga((char *)text[50]);
+   return;
+}
+
+void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form)
+{
+   FILE *img_in, *img_ou;
+   int  num=1, count=0;
+   int  c;
+   char wdir[MAXLEN];
+   char per2[MAXLEN];
+   char dirname2[MAXLEN];
+   char buffer[1024];
+   char images[512];
+   DIR *dirp;
+   struct dirent *direntp;
+
+   sprintf(wdir,"%s",dir);
+
+   if(strlen(us) > 0) {
+      strcat(wdir,"-");
+      strcat(wdir,us);
+   }
+   if(strlen(addr) > 0) {
+      strcat(wdir,"-");
+      strcat(wdir,addr);
+   }
+   if(strlen(site) > 0) {
+      strcat(wdir,"-");
+      strcat(wdir,site);
+   }
+
+   if(strcmp(dirname,wdir) != 0)
+      strcpy(dirname,wdir);
+
+   strcpy(dirname2,dirname);
+
+   if(strcmp(OverwriteReport,"no") == 0) {
+      while(num) {
+         if(access(wdir,R_OK) == 0) {
+            sprintf(wdir,"%s.%d",dirname,num);
+            sprintf(per2,"%s.%d",per1,num);
+            num++;
+            count++;
+         } else
+            break;
+      }
+
+      if(count > 0) {
+         if(debug)
+            fprintf(stderr, "SARG: %s: %s %s %s\n",text[51],dirname2,text[52],wdir);
+         rename(dirname2,wdir);
+      }
+   } else {
+      if(access(dir,R_OK) == 0) {
+         sprintf(csort,"rm -r %s",dir);
+         system(csort);
+      }
+   }
+
+   my_mkdir(dirname);
+
+   strcpy(dirname2,wdir);
+   sprintf(images,"%simages",outdir);
+   mkdir(images,0755);
+
+   sprintf(wdir,"date >%s/%s",dirname,"date");
+   system(wdir);
+
+   sprintf(per2,"%s/images",SYSCONFDIR);
+
+   dirp = opendir(per2);
+   if(dirp==NULL) {
+      fprintf(stderr, "SARG: (util) %s %s: %s\n","Can't open directory", per2,strerror(errno));
+      return;
+   }
+   while ((direntp = readdir( dirp )) != NULL ){
+      if(strncmp(direntp->d_name,".",1) == 0)
+         continue;
+      sprintf(val10,"%s/%s",per2,direntp->d_name);
+      sprintf(val11,"%s/%s",images,direntp->d_name);
+      img_in = fopen(val10, "rb");
+      if(img_in!=NULL) {
+         img_ou = fopen(val11, "wb");
+         if(img_ou!=NULL) {
+            while (c!=EOF) {
+               c = fgetc(img_in);
+               if(c==EOF) break;
+               fputc(c,img_ou);
+            }
+            c=0;
+            fclose(img_ou);
+         } else
+            fprintf(stderr,"SARG: (util): %s %s: %s\n", text[45]?text[45]:"Can't open/create file", val11, strerror(errno));
+      } else
+         fprintf(stderr,"SARG: (util): %s %s: %s\n", text[45]?text[45]:"Can't open file", val10, strerror(errno));
+
+      fclose(img_in);
+   }
+   (void) rewinddir(dirp);
+   (void) closedir(dirp);
+
+   return;
+
+
+}
+
+
+void strip_latin(char *line)
+{
+   char buf[255];
+   char warea[255];
+
+   while(strstr(line,"&") != 0){
+      getword(warea,line,'&');
+      strncat(warea,line,1);
+      getword(buf,line,';');
+      strcat(warea,line);
+      strcpy(line,warea);
+   }
+
+   return;
+
+}
+
+void zdate(char *ftime, char *DateFormat)
+{
+
+   time_t t;
+   struct tm *local;
+
+   t = time(NULL);
+   local = localtime(&t);
+   if(strcmp(DateFormat,"u") == 0)
+      strftime(ftime, 127, "%b/%d/%Y %H:%M", local);
+   if(strcmp(DateFormat,"e") == 0)
+      strftime(ftime, 127, "%d/%b/%Y-%H:%M", local);
+   if(strcmp(DateFormat,"w") == 0)
+      strftime(ftime, 127, "%V-%H-%M", local);
+
+   return;
+}
+
+
+char *fixtime(long int elap)
+{
+
+   int num = elap / 1000;
+   int hor = 0;
+   int min = 0;
+   int sec = 0;
+   static char buf[12];
+
+   if(strcmp(datetimeby,"bytes") == 0) {
+      sprintf(buf,"%s",fixnum(elap,1));
+      return buf;
+   }
+
+   buf[0]='\0';
+
+   if(num<1) {
+      sprintf(buf,"00:00:%02ld",elap);
+      return buf;
+   }
+
+   hor=num / 3600;
+   min=(num % 3600) / 60;
+   sec=num % 60;
+
+   sprintf(buf,"%01d:%02d:%02d",hor,min,sec);
+
+   if(strcmp(buf,"0:00:00") == 0)
+      strcpy(buf,"0");
+
+   return buf;
+
+}
+
+
+void date_from(char *date, char *dfrom, char *duntil)
+{
+
+   char diaf[10];
+   char mesf[10];
+   char anof[10];
+   char diau[10];
+   char mesu[10];
+   char anou[10];
+   static char wdate[50];
+
+
+   strcpy(wdate,date);
+   if(strstr(wdate,"-") == 0) {
+      strcat(wdate,"-");
+      strcat(wdate,date);
+      strcpy(date,wdate);
+   }
+
+   getword(diaf,wdate,'/');
+   getword(mesf,wdate,'/');
+   getword(anof,wdate,'-');
+   getword(diau,wdate,'/');
+   getword(mesu,wdate,'/');
+   strcpy(anou,wdate);
+
+   sprintf(dfrom,"%s%s%s",anof,mesf,diaf);
+   sprintf(duntil,"%s%s%s",anou,mesu,diau);
+   return;
+}
+
+
+char *strlow(char *string)
+{
+      char *s;
+
+      if (string)
+      {
+            for (s = string; *s; ++s)
+                  *s = tolower(*s);
+      }
+
+      return string;
+}
+
+
+
+
+char *strup(char *string)
+{
+      char *s;
+
+      if (string)
+      {
+            for (s = string; *s; ++s)
+                  *s = toupper(*s);
+      }
+
+      return string;
+}
+
+
+char *subs(char *str, char *from, char *to)
+{
+   char *tmp;
+   char *ret;
+   unsigned int ss, st;
+
+   if(strstr(str,from) == 0)
+      return (char *) str;
+
+    ss = strlen(str); st = strlen(to);
+    ret = (char *) malloc(ss + st);
+    bzero(ret,ss+st);
+
+    tmp = strstr(str, from);
+    if ( tmp == (char *) NULL )
+       return (char *) NULL;
+    strncpy(ret, str, ss - strlen(tmp));
+    strcat(ret, to);
+    strcat(ret, (tmp+strlen(from)));
+    return (char *) ret;
+}
+
+
+void removetmp(char *outdir)
+{
+
+   FILE *fp_in;
+   char warea[256];
+
+   if(strcmp(RemoveTempFiles,"yes") != 0) {
+      return;
+   } else {
+      if(debug) {
+         sprintf(msg,"%s: geral, periodo",text[82]);
+         debuga(msg);
+      }
+      sprintf(warea,"%s/geral",outdir);
+      if((fp_in=fopen(warea,"r"))==NULL){
+         fprintf(stderr, "SARG: (removetmp) %s: %s\n",text[45],warea);
+         exit(1);
+      }
+      while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+         if(strncmp(buf,"TOTAL",5) == 0)
+            break;
+      }
+      fclose(fp_in);
+      if((fp_in=fopen(warea,"w"))==NULL){
+         fprintf(stderr, "SARG: (removetmp) %s: %s\n",text[45],warea);
+         exit(1);
+      }
+      fputs(buf,fp_in);
+      fclose(fp_in);
+      sprintf(warea,"%s/periodo",outdir);
+      unlink(warea);
+   }
+  
+   return;
+}
+
+void load_excludecodes()
+{
+
+   FILE *fp_in;
+   char data[80];
+
+   if((fp_in=fopen(ExcludeCodes,"r"))==NULL) {
+     fprintf(stderr, "SARG: (util) Cannot open file: %s (exclude_codes)\n",ExcludeCodes);
+     exit(1);
+   }
+
+   while(fgets(data,80,fp_in)!=NULL) {
+      data[strlen(data)-1]='\0';
+      strcat(excludecode,data);
+      strcat(excludecode,";");
+      excode++;
+   }
+
+   fclose(fp_in);
+   return;
+
+}
+
+int vercode(char *code)
+{
+   char warea[1024];
+   char cod[80];
+   int z;
+
+   strcpy(warea,excludecode);
+   for(z=0; z<=excode-1; z++) {
+      getword(cod,warea,';');
+      if(strcmp(code,cod) == 0) 
+         return 1;
+   }
+   return 0;
+}
+
+void fixnone(char *str)
+{
+   if(strstr(str,"\n") != 0)
+      str[strlen(str)-1]='\0';
+   if(strcmp(str,"none") == 0)
+      str[0]='\0';
+
+   return;
+}
+
+#ifdef LEGACY_TESTVALIDUSERCHAR
+int testvaliduserchar(char *user)
+{
+
+   int x=0;
+   int y=0;
+
+   for (y=0; y<strlen(UserInvalidChar); y++) {
+      for (x=0; x<strlen(user); x++) {
+         if(user[x] == UserInvalidChar[y])
+            return 1;
+      }
+   }
+   return 0;
+}
+#else
+int testvaliduserchar(char *user)
+{
+
+   char * p_UserInvalidChar = UserInvalidChar ;
+   char * p_user ;
+
+   while( *p_UserInvalidChar ) {
+      p_user = user ;
+      while ( *p_user ) {
+         if( *p_UserInvalidChar == *p_user )
+            return 1;
+         p_user++ ;
+      }
+      p_UserInvalidChar++ ;
+   }
+   return 0;
+}
+#endif
+
+int compar( const void *a, const void *b )
+{ if( *(int *)a > *(int *)b ) return 1;
+  if( *(int *)a < *(int *)b ) return -1;
+  return 0;
+}
+
+int getnumlist( char *buf, numlist *list, const int len, const int maxvalue )
+{ int i, j, d, flag, r1, r2;
+  char *pbuf, **bp, *strbufs[ 24 ];
+  
+  bp = strbufs;
+  strtok( buf, " \t" );
+  for( *bp = strtok( NULL, "," ), list->len = 0; *bp; *bp = strtok( NULL, "," ) )
+   { if( ++bp >= &strbufs[ 24 ] )
+       break;
+     list->len++;
+   }
+  if( ! list->len )      
+     return -1;
+  d = 0;
+  for( i = 0; i < list->len; i++ )  
+   { if( strstr( strbufs[ i ], "-" ) != 0 )
+      { pbuf = strbufs[ i ];
+        strtok( pbuf, "-" );
+        pbuf = strtok( NULL, "\0" );
+        r1 = atoi( strbufs[ i ] );
+        if( ( r2 = atoi( pbuf ) ) >= maxvalue || r1 >= r2 )
+          return -1;
+        if( i + d + ( r2 - r1 ) + 1 <= len )
+         { for( j = r1; j <= r2; j++ )
+             list->list[ i + d++ ] = j;
+           d--;
+         }
+      }
+     else
+       if( ( list->list[ i + d ] = atoi( strbufs[ i ] ) ) >= maxvalue )
+          return 1;
+   }
+  list->len += d;
+  qsort( list->list, list->len, sizeof( int ), compar );
+  do
+   { flag = 0;
+     for( i = 0; i < list->len - 1; i++ )
+       if( list->list[ i ] == list->list[ i + 1 ] )
+        { for( j = i + 1; j < list->len; j++ )
+            list->list[ j - 1 ] = list->list[ j ];
+          list->len--;
+          flag = 1;
+          break;
+        }
+   } while( flag );
+  return 0;
+}
+
+
+void show_info(FILE *fp_ou)
+{
+
+   if(strcmp(ShowSargInfo,"yes") == 0) {
+      zdate(ftime, DateFormat);
+      sprintf(html,"<center><table><tr><td><br><br></td><td class=\"info\">%s <a href='%s'><font class=\"info\">%s-%s</font></a> %s %s</td></tr></table></center>\n",text[108],URL,PGM,VERSION,text[109],ftime);
+      fputs(html,fp_ou);
+   }
+}
+
+void show_sarg(FILE *fp_ou, char *ind)
+{
+   if(strcmp(ShowSargLogo,"yes") == 0) {
+      fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+      sprintf(html,"<tr><th class=\"logo\"><a href=\"http://www.sarg-squid.org\"><img src=\"%s/images/sarg.png\" border=\"0\" align=\"absmiddle\" title=\"SARG, Squid Analysis Report Generator. Logo by Osamu Matsuzaki\"></a>&nbsp;<font class=\"logo\">Squid Analysis Report Generator</font></th></tr>\n",ind,Title);
+      fputs(html,fp_ou);
+      sprintf(html,"<tr><th class=\"title\">&nbsp</th></tr>\n",Title);
+      fputs(html,fp_ou);
+      fputs("<table>\n",fp_ou);
+   }
+}
+
+char url_module(char *url, char *w2)
+{
+   int x, y;
+   char w[255];
+
+   bzero(w, 255);
+   bzero(w2, 255);
+   y=0;
+   for(x=strlen(url)-1; x>=0; x--) {
+      if(url[x] == '/' || y>255) break;
+      w[y]=url[x];
+      y++;
+   }
+
+   y=0;
+   for(x=strlen(w)-1; x>=0; x--) {
+      w2[y]=w[x];
+      y++;
+   }
+
+   return;
+}
+
+void version()
+{
+   printf("SARG Version: %s\n",VERSION);
+   exit(0);
+}