]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Mass commit of all the changes made between version 2.1 and 2.2.5. See ChangeLog...
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Thu, 25 Jun 2009 09:39:47 +0000 (09:39 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Thu, 25 Jun 2009 09:39:47 +0000 (09:39 +0000)
91 files changed:
CONTRIBUTORS
ChangeLog
Makefile.in
README
authfail.c
cfgaux/compile [new file with mode: 0755]
cfgaux/config.guess
cfgaux/config.rpath [new file with mode: 0755]
cfgaux/config.sub
cfgaux/depcomp [new file with mode: 0755]
cfgaux/install-sh
cfgaux/ll.novo [deleted file]
cfgaux/missing [new file with mode: 0755]
cfgaux/mkinstalldirs [new file with mode: 0755]
charset.c
configure
configure.in
css.c
dansguardian_log.c
dansguardian_report.c
datafile.c
denied.c
download.c
email.c
exclude.c
fonts/DejaVuSans.ttf [new file with mode: 0644]
fonts/FreeSans.ttf
fonts/README
getconf.c
grepday.c
html.c
include/conf.h
include/info.h
index.c
languages/Bulgarian_windows1251
languages/Catalan
languages/Czech
languages/Czech_UTF8 [new file with mode: 0644]
languages/Dutch
languages/English
languages/French
languages/German
languages/Greek
languages/Hungarian
languages/Indonesian
languages/Italian
languages/Japanese
languages/Latvian
languages/Polish
languages/Portuguese
languages/Romanian
languages/Russian_UTF-8
languages/Russian_koi8
languages/Russian_windows1251
languages/Serbian
languages/Slovak
languages/Spanish
languages/Turkish
languages/Ukrainian_windows1251
log.c
realtime.c
repday.c
report.c
sarg-php/LANGUAGES
sarg-php/language.php
sarg-php/locale/en_EN/LC_MESSAGES/messages.mo [new file with mode: 0755]
sarg-php/locale/en_EN/LC_MESSAGES/messages.po [new file with mode: 0755]
sarg-php/locale/fr/LC_MESSAGES/messages.mo [new file with mode: 0755]
sarg-php/locale/fr/LC_MESSAGES/messages.po [new file with mode: 0755]
sarg-php/locale/pt_BR/LC_MESSAGES/messages.mo [new file with mode: 0755]
sarg-php/locale/pt_BR/LC_MESSAGES/messages.po [new file with mode: 0755]
sarg-php/locale/ru/LC_MESSAGES/messages.mo [new file with mode: 0755]
sarg-php/locale/ru/LC_MESSAGES/messages.po [new file with mode: 0755]
sarg-php/sarg-block-it.php
sarg-php/sarg-squidguard-block.php
sarg-php/sarg-squidguard-block2.php
sarg-php/style.php
sarg-php/translate.this
sarg.conf
siteuser.c
smartfilter.c
sort.c
squidguard_log.c
squidguard_report.c
topsites.c
topuser.c
totday.c
totger.c
usage.c
useragent.c
util.c

index 225739ab72aa725d835c07a8b2dbffe0274662f2..3fae467e784963269d0a185b03cab56c81835790 100644 (file)
@@ -49,3 +49,4 @@ Andreu Sanchez <tanis@lleida.com>
 Joe Cooper <joe@swelltech.com>
 Guilherme Veloso Neves Oliveira <velosologan@gmail.com>
 Filippo Grassilli
+l4teral@gmail.com
index 4107633ad88b3cbc03003b5872d0a5afb0f32dc4..8b075df8e6297384c44cb959983110306b4d1fe6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,134 @@
 SARG ChangeLog
 
+Mar-03-2008    Version 2.2.5
+               - new fix to the script insertion vulnerability via user-agent
+                 report. javascript can still be executed via e.g. the "<BODY onload=function();>" scheme
+                    Thanks to Alin Rad Pop, Security Specialist, Secunia, Denmark
+
+Mar-02-2008    version 2.2.4
+               - security issues can be exploited to execute arbitrary code when sarg
+                 is used with malicious input files.
+                 The vulnerability within the processing of the useragent.log is rather
+                 critical, as this can be exploited by passing a long user agent string
+                 when browsing via a squid proxy. the manipulated GET request in the
+                 access log would not be accepted by squid, so that file has to be specially crafted.
+                    Thank you to L4teral l4teral@gmail.com
+
+               - French language fixed.
+                   Thanks to Nicod <smlpnicod@orange.fr>
+               - Fixed: Segfault in x86_64
+
+Jan-02-2007     version 2.2.3.1
+               - fixed -m option to show all the used tags
+               - date period invalid in download reports
+               - wrong results when userid contain '%20' character
+               - previous reports info wrong in index.html
+
+Dez/23/2006    Version 2.2.3
+               - gd graph font change from FreeSans.ttf to DejaVuSans.ttf
+               - minor fixes when only denied records in access.log file.
+               - ulimit tag changed. If you run sarg with a low privilege user, 
+                 set to 'none' to disable ulimit.
+                    Thanks to Jorge Morgado <jorge@morgado.ch>
+               - Russian_UTF-8 language fixed by Igor Ageikin <iageikin@lipen.elektra.ru>
+               - realtime_unauthenticated_records tag changed to show by default.
+               - chmod 755 in sarg-php due to errors in rpmbuild.
+                    Thanks to Davide Madrisan <davide.madrisan@gmail.com>
+               - when the keyword "anonymous" is used in squidGuard.conf, Sarg does
+                 not find the log-files anymore. 
+                    Thanks to Daniel Vogel <daniel_vogel@t-online.de>
+               - after reading the squidGuard configuration, the data read from the
+                 usertab file was corrupted. 
+                    Thanks to Daniel Vogel <daniel_vogel@t-online.de>
+               - milisec values showed as bytes. Thanks to Carlos <ke09@terra.com.br> 
+               - with squidGuard, you can log groups in only one log file.
+                 We must parse each log files only one time. 
+                    Thanks to Christophe BADINA <christophe.badina@ch-moulins-yzeure.fr>
+               - error message(removetmp) Cannot open /tmp/sarg_tmp/../general
+                 when sending report by email. Thanks to Peter Volkov <pva@gentoo.org>
+               - incorrect off_t size in printf. In FreeBSD off_t is 64bit long long,
+                 but sarg always use %d to display off_t in log processing. This cause garbage
+                 while reading log files on a freebsd, and possible crash.
+                    Thanks to Alex Samorukov <samm@os2.kiev.ua>
+               - squid24 on/off tag added in sarg.conf to implement compatibility if using
+                 squid <= 2.4 and using squid common logs.
+                    Thanks to Valter Dal Bo <dalbo@tesco.it>
+               - exclude_hosts and some code errors fixed by 
+                    Alexander Kozlov <avk@post.eao.ru>. Many thanks.
+               - temporary file names changed to sarg-... to avoid conflicts
+                 with usernames. Thanks to Ukrainian Elephant <superlamer@users.sourceforge.net>
+               - SARG support Japanese wordset but not support charset.
+                    submited by anonymous at sourceforge.net  Many thanks.
+               - support for utf-8 character set added by Peter Warasin
+                    <peter-endian@users.sourceforge.net>. Many thanks.
+               - if all the data is at the hour each day, totaliza_day() treates it all as being 
+                 on the last day. This is observed for users which only download via a cron job
+                 at the same time each day. Now the date and time will be
+                 checked to see if changed. 
+                    Thanks to Ian Dall <iandall@users.sourceforge.net>
+               - greport_day() doesn't add the volume for the first hour of each day to the total.
+                    Thanks to Ian Dall <iandall@users.sourceforge.net>
+               - Russian_koi8 and Russian_windows1251 languages updated by 
+                 Stas Degteff <stas.grumbler@gmail.com>. Many thanks
+               - realtime reporting is sorted by URL, and not by Date/Time.
+                   Thanks tp Puce-Xcit <puce-xcit@users.sourceforge.net>
+
+Aug/29/2006    Version 2.2.2
+               - malloc test implemented to avoid high-memory consuming.
+                       Thanks to Rodrigo Rubira Branco <rodrigo@kernelhacking.com>
+               - Czech UTF8 language added by Josef Karliak <karliak@ajetaci.cz>
+               - fixed: parsed mismatch in realtime_access_log_lines and 
+                       access_log_lines tags.
+                       Thanks to Kuznetsov Andrey <pm_kan@mail.ru>
+               - changed: realtime report sort changed by date/time
+                       Thanks to Leonardo Buonsanti <leonardo.buonsanti@gmail.com>
+               - GD minor fixes added.
+               - bug fixed. *** buffer overflow detected ***: sarg terminated
+                 in Fedora Core 5 when using -D FORTIFY_SOURCE in gcc or in kernel.
+
+May/19/2006    Version 2.2.1
+               - iconv problems fixed in Freebsd and Slackware.
+                       Thanks to Grigory Trenin <gtrenin@gmail.com>.
+               - new word added to languages: Topuser
+               - missing fclose fp-in in css.c
+                       Thanks to Renato Botelho <rbgarga@gmail.com>.
+               - index.c fixed. Missing -r in reverse sort.
+                       Thanks to Fernando Lemes da Silva <fernando@koho.com.br>
+               - wrong values in columns in-cache and out-cache.
+                       Thanks to Hugo P S Costa <hpcosta@nutron.com.br>
+
+May/17/2006    Version 2.2
+               - sarg ported to 64 bits.
+                       Thanks to Antonio F. Zago <zagolinux@uol.com.br>
+                       to share your Fedora Core 5 64 bits with me. 
+               - fixed conflict types for 'saverecs2' in .configure
+               - fixed no index.html when lastlog tag is greather then 0,
+                 caused by some debug messages.
+               - removed some development debug message
+               - user_limit_block script added to block users when limit exceeded
+               - fixed wrong sort in index.html
+               - removed '+' argument to sort utility.
+                       Thanks to Julio Cesar Covolato <julio@psi.com.br>
+               - fixed "file too long" messages when using long_url
+                       Thanks to Fabio Lo Votrico <fabio@link.it>
+               - fixes and improvements from Oleg <xsov@mail.ru> - Tanks.
+                 . fprintf faster than sprintf+fputs (fixed in some places);
+                 . strcpy+strcat is faster than sprintf (fixed in some places);
+                 . unused variables removed;
+                 . fixed headers look and feel (<th class="header3">);
+                 . fixed word 'BYTES' localisation for datetime user report;
+                 . fixed corrupted top header on index, denied, download and tt-reports;
+                 . fixed "No" table header in topsites;
+                 . fixed user report table look;
+                 . fixed floating point exception on long url (added checks 
+                   for division by zero);
+                 . fixed incorrect long url view;
+                 . fixed too wide table entries in user report by adding url_limit 
+                   internal parameter in html.c (default 40);
+                 . fixed charset.c file (was in MS-DOS text format);
+                 . also included all previous fixes by other people (from 
+                   datafile.patch and lastlog.patch files).
+
 Nov/29/2005    version 2.1
                - index_tree tag added.
                        Look at TAG: index_tree in sarg.conf file
@@ -33,7 +162,7 @@ Nov/29/2005  version 2.1
                  in url when using datafile tag.  Thanks to Calvin Muller <calvin@siryn.co.za>
                - wronk link point in Generated by sarg-2..
                        Thanks to Markus Hoffmann <ipcop@mh-lantech.de> 
-               - Russian_UFT-8 language added by Alex Deiter <tiamat@komi.mts.ru>
+               - Russian_UTF-8 language added by Alex Deiter <tiamat@komi.mts.ru>
 
 Aug/04/2005    version 2.0.9
                - dansguardian_report_limit missing in sarg.conf file.
index 7ddebcba84275f2fc7d830e59f5049219f80e873..711bcfde3148bccc954f7a9c09eadc7a4cb8fc24 100644 (file)
@@ -9,6 +9,7 @@ HTMLDIR         = @HTMLDIR@
 ISYSCONFDIR    = -DSYSCONFDIR=\"@SYSCONFDIR@\"
 IHTMLDIR       = -DHTMLDIR=\"@HTMLDIR@\"
 CFLAGS                 = @CFLAGS@
+CPPFLAGS       = @CPPFLAGS@
 LDFLAGS        = @LDFLAGS@
 DEFS            = @DEFS@ 
 LIBS            = @LIBS@ 
@@ -76,6 +77,7 @@ install: all
        fi
        cp -r ./languages $(SYSCONFDIR);
        cp ./exclude_codes $(SYSCONFDIR);
+       cp ./user_limit_block $(SYSCONFDIR);
        cp -r ./images $(SYSCONFDIR);
        cp -r ./sarg-php $(SYSCONFDIR);
        cp -r ./fonts $(SYSCONFDIR);
diff --git a/README b/README
index b1d9e0f17d22cf5af26afa907d8b92b698e21ace..2688d302d16a3d68044219340261589470583b3f 100644 (file)
--- a/README
+++ b/README
@@ -32,13 +32,14 @@ Antonis Maglaras <vegos@magla.gr>                   - Greek language
 Dusan Woletz <Dusan.WOLETZ@orange.sk>                  - Slovak Language
 Jose Luis Hernandez <jhdz@simbiotica.net>              - Spanish language fix
 Theo kastermans <t.kastermans@zandvoort.nl>            - Dutch language fix
-Alex Deiter <tiamat@komi.mts.ru>                       - Russian UFT-8 language added
-
+Alex Deiter <tiamat@komi.mts.ru>                       - Russian UTF-8 language
+Josef Karliak <karliak@ajetaci.cz>                     - Czech UTF-8
+Igor Ageikin <iageikin@lipen.elektra.ru>               - Russian UTF-8 fix
 
 Translating
    . Copy include/English to YourLanguage
    . Translate YourLanguage
-   . Send YourLanguage to orso@penguintech.com.br to be implemented.
+   . Send YourLanguage to    pedro.orso@gmail.com to be implemented.
 
 
 If you use native squid log format, the elapsed time will be in reports (emulate_httpd_log off).
@@ -75,4 +76,4 @@ Usage: sarg -h
 
 Source: http://www.sarg-squid.org
 
-Any suggests and/or comments, please: orso@penguintech.com.br
+Any suggests and/or comments, please:    pedro.orso@gmail.com
index 09505208a0d46b970503de629206cf705f0083d3..469f7ebbe8cdba284dfc28ca0bb026c4f8a178b5 100644 (file)
@@ -31,12 +31,11 @@ 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 period[100];
    char ip[MAXLEN];
    char oip[MAXLEN];
    char user[MAXLEN];
@@ -44,7 +43,6 @@ void authfail_report()
    char ouser2[MAXLEN];
    char data[15];
    char hora[15];
-   char ftime[128];
    char *str;
    int  z=0;
    int  count=0;
@@ -61,7 +59,7 @@ void authfail_report()
    }
 
    sprintf(authfail_in,"%s/authfail.log",TempDir);
-   sprintf(per,"%s/periodo",dirname);
+   sprintf(per,"%s/sarg-period",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);
@@ -73,7 +71,7 @@ void authfail_report()
       exit(1);
    }
 
-   fgets(periodo,sizeof(periodo),fp_in);
+   fgets(period,sizeof(period),fp_in);
    fclose(fp_in);
 
    if((fp_in=fopen(authfail_in,"r"))==NULL) {
@@ -86,30 +84,12 @@ void authfail_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);
+   fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
    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 class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(url,fp_ou);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou);
-      fputs("</table>\n",fp_ou);
-   }
+   if(strlen(FontFace) > 0) fprintf(fp_ou,"<font face=%s>\n",FontFace);
+   fprintf(fp_ou,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   if(strlen(LogoImage) > 0) fprintf(fp_ou, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
    if(strcmp(IndexTree,"date") == 0)
       show_sarg(fp_ou, "../../..");
@@ -119,9 +99,9 @@ void authfail_report()
    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);
+   sprintf(url,"<tr><td class=\"header\">%s: %s</td></tr>\n",text[89],period);
    fputs(url,fp_ou);
-   sprintf(url,"<tr><th class=\"header\">%s %s</th></tr>\n",text[117],text[55]);
+   sprintf(url,"<tr><th class=\"header3\">%s</th></tr>\n",text[117]);
    fputs(url,fp_ou);
    fputs("</table></center>\n",fp_ou);
 
diff --git a/cfgaux/compile b/cfgaux/compile
new file mode 100755 (executable)
index 0000000..9bb997a
--- /dev/null
@@ -0,0 +1,99 @@
+#! /bin/sh
+
+# Wrapper for compilers which do not understand `-c -o'.
+
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# 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, 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.
+
+# Usage:
+# compile PROGRAM [ARGS]...
+# `-o FOO.o' is removed from the args passed to the actual compile.
+
+prog=$1
+shift
+
+ofile=
+cfile=
+args=
+while test $# -gt 0; do
+   case "$1" in
+    -o)
+       # configure might choose to run compile as `compile cc -o foo foo.c'.
+       # So we do something ugly here.
+       ofile=$2
+       shift
+       case "$ofile" in
+       *.o | *.obj)
+          ;;
+       *)
+          args="$args -o $ofile"
+          ofile=
+          ;;
+       esac
+       ;;
+    *.c)
+       cfile=$1
+       args="$args $1"
+       ;;
+    *)
+       args="$args $1"
+       ;;
+   esac
+   shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+   # If no `-o' option was seen then we might have been invoked from a
+   # pattern rule where we don't need one.  That is ok -- this is a
+   # normal compilation that the losing compiler can handle.  If no
+   # `.c' file was seen then we are probably linking.  That is also
+   # ok.
+   exec "$prog" $args
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
+while true; do
+   if mkdir $lockdir > /dev/null 2>&1; then
+      break
+   fi
+   sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir $lockdir; exit 1" 1 2 15
+
+# Run the compile.
+"$prog" $args
+status=$?
+
+if test -f "$cofile"; then
+   mv "$cofile" "$ofile"
+fi
+
+rmdir $lockdir
+exit $status
index b0f5dca307d6b81cf6591eb94b3952b452dcbdc0..f32079abda668e5fc8f8de6f226e7b26384e8a03 100755 (executable)
@@ -1,7 +1,11 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
-#
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
+
+timestamp='2008-01-23'
+
 # 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
 #
 # 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.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, 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.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
 #
 # 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).
-#
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 8/24/94.)
+# (ghazi@noc.rutgers.edu 1994-08-24)
 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_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
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           sh5el) machine=sh5le-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep __ELF__ >/dev/null
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit ;;
+    *:OpenBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+       exit ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit ;;
+    *:SolidBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+       exit ;;
+    macppc:MirBSD:*:*)
+       echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
     alpha:OSF1:*:*)
+       case $UNAME_RELEASE in
+       *4.0)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
+       # A Pn.n version is a patched version.
        # 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 ;;
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       exit ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit ;;
     21064:Windows_NT:50:3)
        echo alpha-dec-winnt3.5
-       exit ;;
+       exit ;;
     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 ;;
+       echo m68k-unknown-sysv4
+       exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit ;;
+    *:z/VM:*:*)
+       echo s390-ibm-zvmoe
+       exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+       exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
        echo arm-acorn-riscix${UNAME_RELEASE}
-       exit 0;;
-    Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+       exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+       echo arm-unknown-riscos
+       exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-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 ;;
-    NILE:*:*:dcosx)
+       exit ;;
+    NILE*:*:*:dcosx)
        echo pyramid-pyramid-svr4
-       exit 0 ;;
+       exit ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7; exit ;;
+       esac ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
        echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
-    i86pc:SunOS:5.*:*)
+       exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
        echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     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 ;;
+       exit ;;
     sun4*:SunOS:*:*)
        case "`/usr/bin/arch -k`" in
            Series*|S4*)
@@ -104,46 +347,78 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        esac
        # Japanese Language versions have a version number like `4.1.3-JL'.
        echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-       exit ;;
+       exit ;;
     sun3*:SunOS:*:*)
        echo m68k-sun-sunos${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit ;;
     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 ;;
+       exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit ;;
     powerpc:machten:*:*)
        echo powerpc-apple-machten${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     RISC*:Mach:*:*)
        echo mips-dec-mach_bsd4.3
-       exit ;;
+       exit ;;
     RISC*:ULTRIX:*:*)
        echo mips-dec-ultrix${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     VAX*:ULTRIX*:*:*)
        echo vax-dec-ultrix${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
-       sed 's/^        //' << EOF >dummy.c
-       int main (argc, argv) int argc; char **argv; {
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
        #if defined (host_mips) && defined (MIPSEB)
        #if defined (SYSTYPE_SYSV)
          printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
@@ -158,62 +433,83 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
          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
+       $CC_FOR_BUILD -o $dummy $dummy.c &&
+         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+         SYSTEM_NAME=`$dummy $dummyarg` &&
+           { echo "$SYSTEM_NAME"; exit; }
        echo mips-mips-riscos${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit ;;
     Night_Hawk:Power_UNIX:*:*)
        echo powerpc-harris-powerunix
-       exit ;;
+       exit ;;
     m88k:CX/UX:7*:*)
        echo m88k-harris-cxux7
-       exit ;;
+       exit ;;
     m88k:*:4*:R4*)
        echo m88k-motorola-sysv4
-       exit ;;
+       exit ;;
     m88k:*:3*:R3*)
        echo m88k-motorola-sysv3
-       exit ;;
+       exit ;;
     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
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
                echo m88k-dg-dgux${UNAME_RELEASE}
-       else
+           else
                echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
        fi
-        else echo i586-dg-dgux${UNAME_RELEASE}
-        fi
-       exit 0 ;;
+       exit ;;
     M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
        echo m88k-dolphin-sysv3
-       exit ;;
+       exit ;;
     M88*:*:R3*:*)
        # Delta 88k system running SVR3
        echo m88k-motorola-sysv3
-       exit ;;
+       exit ;;
     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
        echo m88k-tektronix-sysv3
-       exit ;;
+       exit ;;
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
        echo m68k-tektronix-bsd
-       exit ;;
+       exit ;;
     *:IRIX*:*:*)
        echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-       exit ;;
+       exit ;;
     ????????: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 romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
        echo i386-ibm-aix
-       exit 0 ;;
+       exit ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit ;;
     *:AIX:2:3)
        if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-               sed 's/^                //' << EOF >dummy.c
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
                #include <sys/systemcfg.h>
 
                main()
@@ -224,17 +520,21 @@ EOF
                        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
+               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               then
+                       echo "$SYSTEM_NAME"
+               else
+                       echo rs6000-ibm-aix3.2.5
+               fi
        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
+       exit ;;
+    *:AIX:*:[456])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
                IBM_ARCH=rs6000
        else
                IBM_ARCH=powerpc
@@ -242,43 +542,120 @@ EOF
        if [ -x /usr/bin/oslevel ] ; then
                IBM_REV=`/usr/bin/oslevel`
        else
-               IBM_REV=4.${UNAME_RELEASE}
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
        fi
        echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-       exit ;;
+       exit ;;
     *:AIX:*:*)
        echo rs6000-ibm-aix
-       exit ;;
+       exit ;;
     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
        echo romp-ibm-bsd4.4
-       exit ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
+       exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
        echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-       exit 0 ;;                           # report: romp-ibm BSD 4.3
+       exit ;;                             # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
        echo rs6000-bull-bosx
-       exit ;;
+       exit ;;
     DPX/2?00:B.O.S.:*:*)
        echo m68k-bull-sysv3
-       exit ;;
+       exit ;;
     9000/[34]??:4.3bsd:1.*:*)
        echo m68k-hp-bsd
-       exit ;;
+       exit ;;
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
        echo m68k-hp-bsd4.4
-       exit 0 ;;
-    9000/[3478]??:HP-UX:*:*)
+       exit ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
        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 ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+               {
+               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+               case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+                   switch (bits)
+                       {
+                       case 64: puts ("hppa2.0w"); break;
+                       case 32: puts ("hppa2.0n"); break;
+                       default: puts ("hppa2.0"); break;
+                       } break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+                   puts ("hppa2.0"); break;
+              #endif
+               default: puts ("hppa1.0"); break;
+               }
+                  exit (0);
+              }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
        esac
-       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       if [ ${HP_ARCH} = "hppa2.0w" ]
+       then
+           eval $set_cc_for_build
+
+           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+           # generating 64-bit code.  GNU and HP use different nomenclature:
+           #
+           # $ CC_FOR_BUILD=cc ./config.guess
+           # => hppa2.0w-hp-hpux11.23
+           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+           # => hppa64-hp-hpux11.23
+
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+               grep __LP64__ >/dev/null
+           then
+               HP_ARCH="hppa2.0w"
+           else
+               HP_ARCH="hppa64"
+           fi
+       fi
        echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-       exit 0 ;;
+       exit ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit ;;
     3050*:HI-UX:*:*)
-       sed 's/^        //' << EOF >dummy.c
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
        #include <unistd.h>
        int
        main ()
@@ -303,224 +680,491 @@ EOF
          exit (0);
        }
 EOF
-       ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
-       rm -f dummy.c dummy
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
        echo unknown-hitachi-hiuxwe2
-       exit ;;
+       exit ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
        echo hppa1.1-hp-bsd
-       exit ;;
+       exit ;;
     9000/8??:4.3bsd:*:*)
        echo hppa1.0-hp-bsd
-       exit 0 ;;
+       exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit ;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
        echo hppa1.1-hp-osf
-       exit ;;
+       exit ;;
     hp8??:OSF1:*:*)
        echo hppa1.0-hp-osf
-       exit ;;
-    i?86:OSF1:*:*)
+       exit ;;
+    i*86:OSF1:*:*)
        if [ -x /usr/sbin/sysversion ] ; then
            echo ${UNAME_MACHINE}-unknown-osf1mk
        else
            echo ${UNAME_MACHINE}-unknown-osf1
        fi
-       exit ;;
+       exit ;;
     parisc*:Lites*:*:*)
        echo hppa1.1-hp-lites
-       exit ;;
+       exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
        echo c1-convex-bsd
-        exit ;;
+        exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
        if getsysinfo -f scalar_acc
        then echo c32-convex-bsd
        else echo c2-convex-bsd
        fi
-        exit ;;
+        exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
        echo c34-convex-bsd
-        exit ;;
+        exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
        echo c38-convex-bsd
-        exit ;;
+        exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
        echo c4-convex-bsd
-        exit 0 ;;
-    CRAY*X-MP:*:*:*)
-       echo xmp-cray-unicos
-        exit 0 ;;
+        exit ;;
     CRAY*Y-MP:*:*:*)
-       echo ymp-cray-unicos${UNAME_RELEASE}
-       exit ;;
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
     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 ;;
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit ;;
     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/\///'`
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    *:UNICOS/mp:*:*)
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | 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 "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
        echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
     *: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 ;;
+       case ${UNAME_MACHINE} in
+           pc98)
+               echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           amd64)
+               echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           *)
+               echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+       esac
+       exit ;;
     i*:CYGWIN*:*)
-       echo i386-pc-cygwin32
-       exit 0 ;;
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit ;;
+    *:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit ;;
+    *:Interix*:[3456]*)
+       case ${UNAME_MACHINE} in
+           x86)
+               echo i586-pc-interix${UNAME_RELEASE}
+               exit ;;
+           EM64T | authenticamd)
+               echo x86_64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+           IA64)
+               echo ia64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+       esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+       echo x86_64-unknown-cygwin
+       exit ;;
     p*:CYGWIN*:*)
-       echo powerpcle-unknown-cygwin32
-       exit ;;
+       echo powerpcle-unknown-cygwin
+       exit ;;
     prep*:SunOS:5.*:*)
        echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     *: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
+       # the GNU system
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       exit ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit ;;
+    arm*:Linux:*:*)
+       eval $set_cc_for_build
+       if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+           | grep -q __ARM_EABI__
+       then
+           echo ${UNAME_MACHINE}-unknown-linux-gnu
        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;
-}
+           echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+       fi
+       exit ;;
+    avr32*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    cris:Linux:*:*)
+       echo cris-axis-linux-gnu
+       exit ;;
+    crisv32:Linux:*:*)
+       echo crisv32-axis-linux-gnu
+       exit ;;
+    frv:Linux:*:*)
+       echo frv-unknown-linux-gnu
+       exit ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    mips:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips
+       #undef mipsel
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mipsel
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^CPU/{
+               s: ::g
+               p
+           }'`"
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips64
+       #undef mips64el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mips64el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips64
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^CPU/{
+               s: ::g
+               p
+           }'`"
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    or32:Linux:*:*)
+       echo or32-unknown-linux-gnu
+       exit ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
+       exit ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-gnu ;;
+         PA8*) echo hppa2.0-unknown-linux-gnu ;;
+         *)    echo hppa-unknown-linux-gnu ;;
+       esac
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux
+       exit ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    vax:Linux:*:*)
+       echo ${UNAME_MACHINE}-dec-linux-gnu
+       exit ;;
+    x86_64:Linux:*:*)
+       echo x86_64-unknown-linux-gnu
+       exit ;;
+    xtensa*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    i*86:Linux:*:*)
+       # The BFD linker knows what the default object file format is, so
+       # first see if it will tell us. cd to the root directory to prevent
+       # problems with other programs or directories called `ld' in the path.
+       # Set LC_ALL=C to ensure ld outputs messages in English.
+       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+                        | sed -ne '/supported targets:/!d
+                                   s/[         ][      ]*/ /g
+                                   s/.*supported targets: *//
+                                   s/ .*//
+                                   p'`
+        case "$ld_supported_targets" in
+         elf32-i386)
+               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+               ;;
+         a.out-i386-linux)
+               echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+               exit ;;
+         coff-i386)
+               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+               exit ;;
+         "")
+               # Either a pre-BFD a.out linker (linux-gnuoldld) or
+               # one that does not give us useful --help.
+               echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+               exit ;;
+       esac
+       # Determine whether the default compiler is a.out or elf
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #ifdef __ELF__
+       # ifdef __GLIBC__
+       #  if __GLIBC__ >= 2
+       LIBC=gnu
+       #  else
+       LIBC=gnulibc1
+       #  endif
+       # else
+       LIBC=gnulibc1
+       # endif
+       #else
+       #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+       LIBC=gnu
+       #else
+       LIBC=gnuaout
+       #endif
+       #endif
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
 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*:*)
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^LIBC/{
+               s: ::g
+               p
+           }'`"
+       test x"${LIBC}" != x && {
+               echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+               exit
+       }
+       test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+       ;;
+    i*86:DYNIX/ptx:4*:*)
+       # 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.
        echo i386-sequent-sysv4
-       exit 0 ;;
-    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+       exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit ;;
+    i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
        if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-               echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
        else
-               echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
        fi
-       exit 0 ;;
-    i?86:*:3.2:*)
+       exit ;;
+    i*86:*:5:[678]*)
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit ;;
+    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_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
                        && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
                echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
        else
                echo ${UNAME_MACHINE}-pc-sysv32
        fi
-       exit 0 ;;
+       exit ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+       echo i386-pc-msdosdjgpp
+        exit ;;
     Intel:Mach:3*:*)
        echo i386-pc-mach3
-       exit ;;
+       exit ;;
     paragon:*:*:*)
        echo i860-intel-osf1
-       exit ;;
+       exit ;;
     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 ;;
+       exit ;;
     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)
+       exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*: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
+         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-         && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     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 i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
        echo m68k-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     mc68030:UNIX_System_V:4.*:*)
        echo m68k-atari-sysv4
-       exit 0 ;;
-    i?86:LynxOS:2.*:*)
-       echo i386-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
     TSUNAMI:LynxOS:2.*:*)
        echo sparc-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
-    rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+       exit ;;
+    rs6000:LynxOS:2.*:*)
        echo rs6000-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
     SM[BE]S:UNIX_SV:*:*)
        echo mips-dde-sysv${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
     RM*:SINIX-*:*:*)
        echo mips-sni-sysv4
-       exit ;;
+       exit ;;
     *:SINIX-*:*:*)
        if uname -p 2>/dev/null >/dev/null ; then
                UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -528,39 +1172,165 @@ EOF
        else
                echo ns32k-sni-sysv
        fi
-       exit 0 ;;
+       exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
     *:UNIX_System_V:4*:FTX*)
        # From Gerald Hewes <hewes@openmarket.com>.
        # How about differentiating between stratus architectures? -djm
        echo hppa1.1-stratus-sysv4
-       exit ;;
+       exit ;;
     *:*:*:FTX*)
        # From seanf@swdc.stratus.com.
        echo i860-stratus-sysv4
-       exit 0 ;;
+       exit ;;
+    i*86:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo ${UNAME_MACHINE}-stratus-vos
+       exit ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit ;;
     mc68*:A/UX:*:*)
        echo m68k-apple-aux${UNAME_RELEASE}
-       exit 0 ;;
-    R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+       exit ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
        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 ;;
+        exit ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-7:SUPER-UX:*:*)
+       echo sx7-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8:SUPER-UX:*:*)
+       echo sx8-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8R:SUPER-UX:*:*)
+       echo sx8r-nec-superux${UNAME_RELEASE}
+       exit ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Darwin:*:*)
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       case $UNAME_PROCESSOR in
+           unknown) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+       exit ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms ; exit ;;
+           I*) echo ia64-dec-vms ; exit ;;
+           V*) echo vax-dec-vms ; exit ;;
+       esac ;;
+    *:XENIX:*:SysV)
+       echo i386-pc-xenix
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       exit ;;
+    i*86:rdos:*:*)
+       echo ${UNAME_MACHINE}-pc-rdos
+       exit ;;
 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
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
 # include <sys/types.h>
 # include <sys/utsname.h>
@@ -585,7 +1355,7 @@ main ()
 #endif
 
 #if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix"); exit (0);
+  printf ("arm-acorn-riscix\n"); exit (0);
 #endif
 
 #if defined (hp300) && !defined (hpux)
@@ -598,7 +1368,10 @@ main ()
 #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);
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
   exit (0);
 #endif
 
@@ -643,11 +1416,24 @@ main ()
 #endif
 
 #if defined (vax)
-#if !defined (ultrix)
-  printf ("vax-dec-bsd\n"); exit (0);
-#else
-  printf ("vax-dec-ultrix\n"); exit (0);
-#endif
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
 #endif
 
 #if defined (alliant) && defined (i860)
@@ -658,12 +1444,12 @@ main ()
 }
 EOF
 
-${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+       { echo "$SYSTEM_NAME"; exit; }
 
 # Apollos put the system type in the environment.
 
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
 
 # Convex versions that predate uname can use getsysinfo(1)
 
@@ -672,25 +1458,69 @@ then
     case `getsysinfo -f cpu_type` in
     c1*)
        echo c1-convex-bsd
-       exit ;;
+       exit ;;
     c2*)
        if getsysinfo -f scalar_acc
        then echo c32-convex-bsd
        else echo c2-convex-bsd
        fi
-       exit ;;
+       exit ;;
     c34*)
        echo c34-convex-bsd
-       exit ;;
+       exit ;;
     c38*)
        echo c38-convex-bsd
-       exit ;;
+       exit ;;
     c4*)
        echo c4-convex-bsd
-       exit ;;
+       exit ;;
     esac
 fi
 
-#echo '(Unable to guess system type)' 1>&2
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+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`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
 
 exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/cfgaux/config.rpath b/cfgaux/config.rpath
new file mode 100755 (executable)
index 0000000..4db13e5
--- /dev/null
@@ -0,0 +1,548 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+#   Copyright 1996-2003 Free Software Foundation, Inc.
+#   Taken from GNU libtool, 2001
+#   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+#   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-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.
+#
+# The first argument passed to this file is the canonical host specification,
+#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+#   than 256 bytes, otherwise the compiler driver will dump core. The only
+#   known workaround is to choose shorter directory names for the build
+#   directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+  wl='-Wl,'
+else
+  case "$host_os" in
+    aix*)
+      wl='-Wl,'
+      ;;
+    mingw* | pw32* | os2*)
+      ;;
+    hpux9* | hpux10* | hpux11*)
+      wl='-Wl,'
+      ;;
+    irix5* | irix6* | nonstopux*)
+      wl='-Wl,'
+      ;;
+    newsos6)
+      ;;
+    linux*)
+      case $CC in
+        icc|ecc)
+          wl='-Wl,'
+          ;;
+        ccc)
+          wl='-Wl,'
+          ;;
+      esac
+      ;;
+    osf3* | osf4* | osf5*)
+      wl='-Wl,'
+      ;;
+    sco3.2v5*)
+      ;;
+    solaris*)
+      wl='-Wl,'
+      ;;
+    sunos4*)
+      wl='-Qoption ld '
+      ;;
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      wl='-Wl,'
+      ;;
+    sysv4*MP*)
+      ;;
+    uts4*)
+      ;;
+  esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  case "$host_os" in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+        ld_shlibs=no
+      fi
+      ;;
+    amigaos*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can use
+      # them.
+      ld_shlibs=no
+      ;;
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    cygwin* | mingw* | pw32*)
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    netbsd*)
+      ;;
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+        ld_shlibs=no
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    sunos4*)
+      hardcode_direct=yes
+      ;;
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+  esac
+  if test "$ld_shlibs" = yes; then
+    # Unlike libtool, we use -rpath here, not --rpath, since the documented
+    # option of GNU ld is called -rpath, not --rpath.
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+  fi
+else
+  case "$host_os" in
+    aix3*)
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes; then
+        # Neither direct hardcoding nor static linking is supported with a
+        # broken collect2.
+        hardcode_direct=unsupported
+      fi
+      ;;
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+        # On IA64, the linker does run time linking by default, so we don't
+        # have to do anything special.
+        aix_use_runtimelinking=no
+      else
+        aix_use_runtimelinking=no
+        # Test if we are trying to use run time linking or normal
+        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+        # need to do runtime linking.
+        case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+          for ld_flag in $LDFLAGS; do
+            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+              aix_use_runtimelinking=yes
+              break
+            fi
+          done
+        esac
+      fi
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      if test "$GCC" = yes; then
+        case $host_os in aix4.[012]|aix4.[012].*)
+          collect2name=`${CC} -print-prog-name=collect2`
+          if test -f "$collect2name" && \
+            strings "$collect2name" | grep resolve_lib_name >/dev/null
+          then
+            # We have reworked collect2
+            hardcode_direct=yes
+          else
+            # We have old collect2
+            hardcode_direct=unsupported
+            hardcode_minus_L=yes
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_libdir_separator=
+          fi
+        esac
+      fi
+      # Begin _LT_AC_SYS_LIBPATH_AIX.
+      echo 'int main () { return 0; }' > conftest.c
+      ${CC} ${LDFLAGS} conftest.c -o conftest
+      aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      if test -z "$aix_libpath"; then
+        aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      fi
+      if test -z "$aix_libpath"; then
+        aix_libpath="/usr/lib:/lib"
+      fi
+      rm -f conftest.c conftest
+      # End _LT_AC_SYS_LIBPATH_AIX.
+      if test "$aix_use_runtimelinking" = yes; then
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+      else
+        if test "$host_cpu" = ia64; then
+          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+        else
+          hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        fi
+      fi
+      ;;
+    amigaos*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+    bsdi4*)
+      ;;
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      libext=lib
+      ;;
+    darwin* | rhapsody*)
+      if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
+        hardcode_direct=no
+      fi
+      ;;
+    dgux*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+    freebsd2.2*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    freebsd2*)
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    freebsd*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    hpux9*)
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      ;;
+    hpux10* | hpux11*)
+      if test "$with_gnu_ld" = no; then
+        case "$host_cpu" in
+          hppa*64*)
+            hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+            hardcode_libdir_separator=:
+            hardcode_direct=no
+            ;;
+          ia64*)
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_direct=no
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+          *)
+            hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+            hardcode_libdir_separator=:
+            hardcode_direct=yes
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+        esac
+      fi
+      ;;
+    irix5* | irix6* | nonstopux*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    netbsd*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    newsos6)
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    openbsd*)
+      hardcode_direct=yes
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      else
+        case "$host_os" in
+          openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+            hardcode_libdir_flag_spec='-R$libdir'
+            ;;
+          *)
+            hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+            ;;
+        esac
+      fi
+      ;;
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      ;;
+    osf3*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    osf4* | osf5*)
+      if test "$GCC" = yes; then
+        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+        # Both cc and cxx compiler support -rpath directly
+        hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+    sco3.2v5*)
+      ;;
+    solaris*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      ;;
+    sunos4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    sysv4)
+      case $host_vendor in
+        sni)
+          hardcode_direct=yes # is this really true???
+          ;;
+        siemens)
+          hardcode_direct=no
+          ;;
+        motorola)
+          hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+          ;;
+      esac
+      ;;
+    sysv4.3*)
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+        ld_shlibs=yes
+      fi
+      ;;
+    sysv4.2uw2*)
+      hardcode_direct=yes
+      hardcode_minus_L=no
+      ;;
+    sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[78]* | unixware7*)
+      ;;
+    sysv5*)
+      hardcode_libdir_flag_spec=
+      ;;
+    uts4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    *)
+      ld_shlibs=no
+      ;;
+  esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+libname_spec='lib$name'
+case "$host_os" in
+  aix3*)
+    ;;
+  aix4* | aix5*)
+    ;;
+  amigaos*)
+    ;;
+  beos*)
+    ;;
+  bsdi4*)
+    ;;
+  cygwin* | mingw* | pw32*)
+    shrext=.dll
+    ;;
+  darwin* | rhapsody*)
+    shrext=.dylib
+    ;;
+  dgux*)
+    ;;
+  freebsd1*)
+    ;;
+  freebsd*)
+    ;;
+  gnu*)
+    ;;
+  hpux9* | hpux10* | hpux11*)
+    case "$host_cpu" in
+      ia64*)
+        shrext=.so
+        ;;
+      hppa*64*)
+        shrext=.sl
+        ;;
+      *)
+        shrext=.sl
+        ;;
+    esac
+    ;;
+  irix5* | irix6* | nonstopux*)
+    case "$host_os" in
+      irix5* | nonstopux*)
+        libsuff= shlibsuff=
+        ;;
+      *)
+        case $LD in
+          *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+          *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+          *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+          *) libsuff= shlibsuff= ;;
+        esac
+        ;;
+    esac
+    ;;
+  linux*oldld* | linux*aout* | linux*coff*)
+    ;;
+  linux*)
+    ;;
+  netbsd*)
+    ;;
+  newsos6)
+    ;;
+  nto-qnx)
+    ;;
+  openbsd*)
+    ;;
+  os2*)
+    libname_spec='$name'
+    shrext=.dll
+    ;;
+  osf3* | osf4* | osf5*)
+    ;;
+  sco3.2v5*)
+    ;;
+  solaris*)
+    ;;
+  sunos4*)
+    ;;
+  sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+    ;;
+  sysv4*MP*)
+    ;;
+  uts4*)
+    ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
index 67d8f39aabc44f38f94baea8348d20abc4554186..6759825a5b7fcf64476b4398dc0e30b3090b925c 100755 (executable)
@@ -1,6 +1,11 @@
 #! /bin/sh
-# Configuration validation subroutine script, version 1.1.
-#   Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
+
+timestamp='2008-01-16'
+
 # 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.
 #
 # 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.
-
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, 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.
 
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
 # 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.
 #      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
+me=`echo "$0" | sed -e 's,.*/,,'`
 
-# First pass through any local machine types.
-case $1 in
-       *local*)
-               echo $1
-               exit 0
-               ;;
-       *)
-       ;;
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
 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*)
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -94,15 +148,37 @@ case $os in
        -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
        -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
        -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-       -apple)
+       -apple | -axis | -knuth | -cray)
+               os=
+               basic_machine=$1
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
                os=
                basic_machine=$1
                ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
        -hiux*)
                os=-hiuxwe2
                ;;
+       -sco6)
+               os=-sco5v6
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
        -sco5)
-               os=sco3.2v5
+               os=-sco3.2v5
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco4)
@@ -117,10 +193,17 @@ case $os in
                # Don't forget version if it is 3.2v4 or newer.
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
+       -sco5v6*)
+               # 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/'`
                ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
        -isc)
                os=-isc2.2
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -143,25 +226,84 @@ case $os in
        -psos*)
                os=-psos
                ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
 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)
+       1750a | 580 \
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+       | bfin \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | fido | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k | iq2000 \
+       | m32c | m32r | m32rle | m68000 | m68k | m88k \
+       | maxq | mb | microblaze | mcore | mep \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64vr | mips64vrel \
+       | mips64orion | mips64orionel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | mt \
+       | msp430 \
+       | nios | nios2 \
+       | ns16k | ns32k \
+       | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | pyramid \
+       | score \
+       | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+       | spu | strongarm \
+       | tahoe | thumb | tic4x | tic80 | tron \
+       | v850 | v850e \
+       | we32k \
+       | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+       | z8k)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12)
+               # Motorola 68HC11/12.
                basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+       ms1)
+               basic_machine=mt-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)
+       i*86 | x86_64)
          basic_machine=$basic_machine-pc
          ;;
        # Object if more than one company name word.
@@ -170,23 +312,94 @@ case $basic_machine in
                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-*)
+       580-* \
+       | a29k-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* | avr32-* \
+       | bfin-* | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+       | clipper-* | craynv-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* | iq2000-* \
+       | m32c-* | m32r-* | m32rle-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | mt-* \
+       | msp430-* \
+       | nios-* | nios2-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | pyramid-* \
+       | romp-* | rs6000-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+       | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+       | tahoe-* | thumb-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tron-* \
+       | v850-* | v850e-* | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+       | xstormy16-* | xtensa*-* \
+       | ymp-* \
+       | z8k-*)
+               ;;
+       # Recognize the basic CPU types without company name, with glob match.
+       xtensa*)
+               basic_machine=$basic_machine-unknown
                ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
        3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
                basic_machine=m68000-att
                ;;
        3b*)
                basic_machine=we32k-att
                ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
        alliant | fx80)
                basic_machine=fx80-alliant
                ;;
@@ -197,25 +410,35 @@ case $basic_machine in
                basic_machine=a29k-none
                os=-bsd
                ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        amdahl)
                basic_machine=580-amdahl
                os=-sysv
                ;;
        amiga | amiga-*)
-               basic_machine=m68k-cbm
+               basic_machine=m68k-unknown
                ;;
-       amigados)
-               basic_machine=m68k-cbm
-               os=-amigados
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
                ;;
        amigaunix | amix)
-               basic_machine=m68k-cbm
+               basic_machine=m68k-unknown
                os=-sysv4
                ;;
        apollo68)
                basic_machine=m68k-apollo
                os=-sysv
                ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
        aux)
                basic_machine=m68k-apple
                os=-aux
@@ -224,6 +447,18 @@ case $basic_machine in
                basic_machine=ns32k-sequent
                os=-dynix
                ;;
+       blackfin)
+               basic_machine=bfin-unknown
+               os=-linux
+               ;;
+       blackfin-*)
+               basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
        convex-c1)
                basic_machine=c1-convex
                os=-bsd
@@ -244,27 +479,45 @@ case $basic_machine in
                basic_machine=c38-convex
                os=-bsd
                ;;
-       cray | ymp)
-               basic_machine=ymp-cray
+       cray | j90)
+               basic_machine=j90-cray
                os=-unicos
                ;;
-       cray2)
-               basic_machine=cray2-cray
-               os=-unicos
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
                ;;
-       [ctj]90-cray)
-               basic_machine=c90-cray
-               os=-unicos
+       cr16)
+               basic_machine=cr16-unknown
+               os=-elf
                ;;
        crds | unos)
                basic_machine=m68k-crds
                ;;
+       crisv32 | crisv32-* | etraxfs*)
+               basic_machine=crisv32-axis
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
        da30 | da30-*)
                basic_machine=m68k-da30
                ;;
        decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
                basic_machine=mips-dec
                ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
        delta | 3300 | motorola-3300 | motorola-delta \
              | 3300-motorola | delta-motorola)
                basic_machine=m68k-motorola
@@ -273,6 +526,10 @@ case $basic_machine in
                basic_machine=m88k-motorola
                os=-sysv3
                ;;
+       djgpp)
+               basic_machine=i586-pc
+               os=-msdosdjgpp
+               ;;
        dpx20 | dpx20-*)
                basic_machine=rs6000-bull
                os=-bosx
@@ -292,6 +549,10 @@ case $basic_machine in
        encore | umax | mmax)
                basic_machine=ns32k-encore
                ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
        fx2800)
                basic_machine=i860-alliant
                ;;
@@ -302,6 +563,10 @@ case $basic_machine in
                basic_machine=tron-gmicro
                os=-sysv
                ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
        h3050r* | hiux*)
                basic_machine=hppa1.1-hitachi
                os=-hiuxwe2
@@ -310,6 +575,14 @@ case $basic_machine in
                basic_machine=h8300-hitachi
                os=-hms
                ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
        harris)
                basic_machine=m88k-harris
                os=-sysv3
@@ -325,13 +598,30 @@ case $basic_machine in
                basic_machine=m68k-hp
                os=-hpux
                ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
        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)
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
                basic_machine=hppa1.1-hp
                ;;
        hp9k8[0-9][0-9] | hp8[0-9][0-9])
@@ -340,27 +630,42 @@ case $basic_machine in
        hppa-next)
                os=-nextstep3
                ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
        i370-ibm* | ibm*)
                basic_machine=i370-ibm
-               os=-mvs
                ;;
 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-       i[3456]86v32)
+       i*86v32)
                basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
                os=-sysv32
                ;;
-       i[3456]86v4*)
+       i*86v4*)
                basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
                os=-sysv4
                ;;
-       i[3456]86v)
+       i*86v)
                basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
                os=-sysv
                ;;
-       i[3456]86sol2)
+       i*86sol2)
                basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
                os=-solaris2
                ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
        iris | iris4d)
                basic_machine=mips-sgi
                case $os in
@@ -375,12 +680,17 @@ case $basic_machine in
                basic_machine=m68k-isi
                os=-sysv
                ;;
+       m68knommu)
+               basic_machine=m68k-unknown
+               os=-linux
+               ;;
+       m68knommu-*)
+               basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
        m88k-omron*)
                basic_machine=m88k-omron
                ;;
-       mab-next)
-               os=-nextstep3
-               ;;
        magnum | m3230)
                basic_machine=mips-mips
                os=-sysv
@@ -389,19 +699,58 @@ case $basic_machine in
                basic_machine=ns32k-utek
                os=-sysv
                ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       mingw32ce)
+               basic_machine=arm-unknown
+               os=-mingw32ce
+               ;;
        miniframe)
                basic_machine=m68000-convergent
                ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
        mips3*-*)
                basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
                ;;
        mips3*)
                basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
                ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       ms1-*)
+               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
        ncr3000)
                basic_machine=i486-ncr
                os=-sysv4
                ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
        news | news700 | news800 | news900)
                basic_machine=m68k-sony
                os=-newsos
@@ -414,6 +763,10 @@ case $basic_machine in
                basic_machine=mips-sony
                os=-newsos
                ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
        next | m*-next )
                basic_machine=m68k-next
                case $os in
@@ -439,9 +792,39 @@ case $basic_machine in
                basic_machine=i960-intel
                os=-nindy
                ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
        np1)
                basic_machine=np1-gould
                ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       openrisc | openrisc-*)
+               basic_machine=or32-unknown
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
        pa-hitachi)
                basic_machine=hppa1.1-hitachi
                os=-hiuxwe2
@@ -450,59 +833,123 @@ case $basic_machine in
                basic_machine=i860-intel
                os=-osf
                ;;
+       parisc)
+               basic_machine=hppa-unknown
+               os=-linux
+               ;;
+       parisc-*)
+               basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
        pbd)
                basic_machine=sparc-tti
                ;;
        pbb)
                basic_machine=m68k-tti
                ;;
-        pc532 | pc532-*)
+       pc532 | pc532-*)
                basic_machine=ns32k-pc532
                ;;
-       pentium | p5)
-               basic_machine=i586-intel
+       pc98)
+               basic_machine=i386-pc
+               ;;
+       pc98-*)
+               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
-       pentiumpro | p6)
-               basic_machine=i686-intel
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
                ;;
-       pentium-* | p5-*)
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
                basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
-       pentiumpro-* | p6-*)
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
                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
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
-       nexen)
-               # We don't have specific support for Nexgen yet, so just call it a Pentium
-               basic_machine=i586-nexgen
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
        pn)
                basic_machine=pn-gould
                ;;
-       power)  basic_machine=rs6000-ibm
+       power)  basic_machine=power-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/^[^-]*-//'`
                ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        ps2)
                basic_machine=i386-ibm
                ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rdos)
+               basic_machine=i386-pc
+               os=-rdos
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
        rm[46]00)
                basic_machine=mips-siemens
                ;;
        rtpc | rtpc-*)
                basic_machine=romp-ibm
                ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sde)
+               basic_machine=mipsisa32-sde
+               os=-elf
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
        sequent)
                basic_machine=i386-sequent
                ;;
@@ -510,6 +957,16 @@ case $basic_machine in
                basic_machine=sh-hitachi
                os=-hms
                ;;
+       sh5el)
+               basic_machine=sh5le-unknown
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
        sps7)
                basic_machine=m68k-bull
                os=-sysv2
@@ -517,6 +974,13 @@ case $basic_machine in
        spur)
                basic_machine=spur-unknown
                ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
        sun2)
                basic_machine=m68000-sun
                ;;
@@ -557,13 +1021,55 @@ case $basic_machine in
        sun386 | sun386i | roadrunner)
                basic_machine=i386-sun
                ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
        symmetry)
                basic_machine=i386-sequent
                os=-dynix
                ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       tic54x | c54x*)
+               basic_machine=tic54x-unknown
+               os=-coff
+               ;;
+       tic55x | c55x*)
+               basic_machine=tic55x-unknown
+               os=-coff
+               ;;
+       tic6x | c6x*)
+               basic_machine=tic6x-unknown
+               os=-coff
+               ;;
+       tile*)
+               basic_machine=tile-unknown
+               os=-linux-gnu
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
        tower | tower-32)
                basic_machine=m68k-ncr
                ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
        udi29k)
                basic_machine=a29k-amd
                os=-udi
@@ -572,6 +1078,10 @@ case $basic_machine in
                basic_machine=a29k-nyu
                os=-sym1
                ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
        vaxv)
                basic_machine=vax-dec
                os=-sysv
@@ -580,9 +1090,9 @@ case $basic_machine in
                basic_machine=vax-dec
                os=-vms
                ;;
-       vpp*|vx|vx-*)
-               basic_machine=f301-fujitsu
-               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
        vxworks960)
                basic_machine=i960-wrs
                os=-vxworks
@@ -595,13 +1105,29 @@ case $basic_machine in
                basic_machine=a29k-wrs
                os=-vxworks
                ;;
-       xmp)
-               basic_machine=xmp-cray
-               os=-unicos
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
                ;;
-        xps | xps100)
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xbox)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
+       xps | xps100)
                basic_machine=xps100-honeywell
                ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
        none)
                basic_machine=none-none
                os=-none
@@ -609,28 +1135,44 @@ case $basic_machine in
 
 # 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
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
                ;;
        romp)
                basic_machine=romp-ibm
                ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
        rs6000)
                basic_machine=rs6000-ibm
                ;;
        vax)
                basic_machine=vax-dec
                ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
        pdp11)
                basic_machine=pdp11-dec
                ;;
        we32k)
                basic_machine=we32k-att
                ;;
-       sparc)
+       sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
                basic_machine=sparc-sun
                ;;
-        cydra)
+       cydra)
                basic_machine=cydra-cydrome
                ;;
        orion)
@@ -639,6 +1181,15 @@ case $basic_machine in
        orion105)
                basic_machine=clipper-highlevel
                ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
        *)
                echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
                exit 1
@@ -671,9 +1222,12 @@ case $os in
        -solaris)
                os=-solaris2
                ;;
-       -unixware* | svr4*)
+       -svr4*)
                os=-sysv4
                ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
        -gnu/linux*)
                os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
                ;;
@@ -684,17 +1238,53 @@ case $os in
        -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* \
+             | -amigaos* | -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* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+             | -openbsd* | -solidbsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-             | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -linux-gnu* | -uxpv*)
+             | -chorusos* | -chorusrdb* \
+             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+             | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux-dietlibc)
+               os=-linux-dietlibc
+               ;;
        -linux*)
                os=`echo $os | sed -e 's|linux|linux-gnu|'`
                ;;
@@ -704,6 +1294,15 @@ case $os in
        -sunos6*)
                os=`echo $os | sed -e 's|sunos6|solaris3|'`
                ;;
+       -opened*)
+               os=-openedition
+               ;;
+        -os400*)
+               os=-os400
+               ;;
+       -wince*)
+               os=-wince
+               ;;
        -osfrose*)
                os=-osfrose
                ;;
@@ -719,11 +1318,26 @@ case $os in
        -acis*)
                os=-aos
                ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -syllable*)
+               os=-syllable
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
        -ctix* | -uts*)
                os=-sysv
                ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
        -ns2 )
-               os=-nextstep2
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
                ;;
        # Preserve the version number of sinix5.
        -sinix5.*)
@@ -732,6 +1346,9 @@ case $os in
        -sinix*)
                os=-sysv4
                ;;
+        -tpf*)
+               os=-tpf
+               ;;
        -triton*)
                os=-sysv3
                ;;
@@ -750,9 +1367,27 @@ case $os in
        # This must come after -sysvr4.
        -sysv*)
                ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
        -xenix)
                os=-xenix
                ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
+       -zvmoe)
+               os=-zvmoe
+               ;;
        -none)
                ;;
        *)
@@ -775,13 +1410,29 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
+        score-*)
+               os=-elf
+               ;;
+        spu-*)
+               os=-elf
+               ;;
        *-acorn)
                os=-riscix1.2
                ;;
+       arm*-rebel)
+               os=-linux
+               ;;
        arm*-semi)
                os=-aout
                ;;
-        pdp11-*)
+        c4x-* | tic4x-*)
+               os=-coff
+               ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
                os=-none
                ;;
        *-dec | vax-*)
@@ -799,15 +1450,48 @@ case $basic_machine in
                # default.
                # os=-sunos4
                ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+        mep-*)
+               os=-elf
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
        *-tti)  # must be before sparc entry or we get the wrong os.
                os=-sysv3
                ;;
        sparc-* | *-sun)
                os=-sunos4.1.1
                ;;
+       *-be)
+               os=-beos
+               ;;
+       *-haiku)
+               os=-haiku
+               ;;
        *-ibm)
                os=-aix
                ;;
+       *-knuth)
+               os=-mmixware
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
        *-hp)
                os=-hpux
                ;;
@@ -818,7 +1502,7 @@ case $basic_machine in
                os=-sysv
                ;;
        *-cbm)
-               os=-amigados
+               os=-amigaos
                ;;
        *-dg)
                os=-dgux
@@ -850,27 +1534,39 @@ case $basic_machine in
        *-next)
                os=-nextstep3
                ;;
-        *-gould)
+       *-gould)
                os=-sysv
                ;;
-        *-highlevel)
+       *-highlevel)
                os=-bsd
                ;;
        *-encore)
                os=-bsd
                ;;
-        *-sgi)
+       *-sgi)
                os=-irix
                ;;
-        *-siemens)
+       *-siemens)
                os=-sysv4
                ;;
        *-masscomp)
                os=-rtu
                ;;
-       f301-fujitsu)
+       f30[01]-fujitsu | f700-fujitsu)
                os=-uxpv
                ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
        *)
                os=-none
                ;;
@@ -892,9 +1588,15 @@ case $basic_machine in
                        -aix*)
                                vendor=ibm
                                ;;
+                       -beos*)
+                               vendor=be
+                               ;;
                        -hpux*)
                                vendor=hp
                                ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
                        -hiux*)
                                vendor=hitachi
                                ;;
@@ -910,21 +1612,47 @@ case $basic_machine in
                        -genix*)
                                vendor=ns
                                ;;
-                       -mvs*)
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -os400*)
                                vendor=ibm
                                ;;
                        -ptx*)
                                vendor=sequent
                                ;;
-                       -vxsim* | -vxworks*)
+                       -tpf*)
+                               vendor=ibm
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
                                vendor=wrs
                                ;;
                        -aux*)
                                vendor=apple
                                ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
                esac
                basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
                ;;
 esac
 
 echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/cfgaux/depcomp b/cfgaux/depcomp
new file mode 100755 (executable)
index 0000000..6589965
--- /dev/null
@@ -0,0 +1,411 @@
+#! /bin/sh
+
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+
+# 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, 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.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+# `libtool' can also be set to `yes' or `no'.
+
+depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  This file always lives in the current directory.
+  # Also, the AIX compiler puts `$object:' at the start of each line;
+  # $object doesn't have directory information.
+  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  outname="$stripped.o"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 AIX compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+
+   tmpdepfile1="$object.d"
+   tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` 
+   if test "$libtool" = yes; then
+      "$@" -Wc,-MD
+   else
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2"
+      exit $stat
+   fi
+
+   if test -f "$tmpdepfile1"; then
+      tmpdepfile="$tmpdepfile1"
+   else
+      tmpdepfile="$tmpdepfile2"
+   fi
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a space and a tab in the [].
+      sed -e 's,^.*\.[a-z]*:[  ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  test -z "$dashmflag" && dashmflag=-M
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*) # this is libtool, let us make it quiet
+      for arg
+      do # cycle over the arguments
+        case "$arg" in
+       "--mode=compile")
+         # insert --quiet before "--mode=compile"
+         set fnord "$@" --quiet
+         shift # fnord
+         ;;
+       esac
+       set fnord "$@" "$arg"
+       shift # fnord
+       shift # "$arg"
+      done
+      ;;
+    esac
+    "$@" $dashmflag | sed 's:^[^:]*\:[         ]*:'"$object"'\: :' > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  # X makedepend
+  (
+    shift
+    cleared=no
+    for arg in "$@"; do
+      case $cleared in no)
+        set ""; shift
+       cleared=yes
+      esac
+      case "$arg" in
+        -D*|-I*)
+         set fnord "$@" "$arg"; shift;;
+       -*)
+         ;;
+       *)
+         set fnord "$@" "$arg"; shift;;
+      esac
+    done
+    obj_suffix="`echo $object | sed 's/^.*\././'`"
+    touch "$tmpdepfile"
+    ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tail +3 "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*)
+      for arg
+      do # cycle over the arguments
+        case $arg in
+       "--mode=compile")
+         # insert --quiet before "--mode=compile"
+         set fnord "$@" --quiet
+         shift # fnord
+         ;;
+       esac
+       set fnord "$@" "$arg"
+       shift # fnord
+       shift # "$arg"
+      done
+      ;;
+    esac
+    "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*)
+      for arg
+      do # cycle over the arguments
+        case $arg in
+       "--mode=compile")
+         # insert --quiet before "--mode=compile"
+         set fnord "$@" --quiet
+         shift # fnord
+         ;;
+       esac
+       set fnord "$@" "$arg"
+       shift # fnord
+       shift # "$arg"
+      done
+      ;;
+    esac
+    "$@" -E |
+    sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::   \1 \\:p' >> "$depfile"
+  echo "       " >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
index ebc66913e94018bd82ce82789525e7f67ff340b8..e9de23842dcd44d2953129c866b1ad25f7e1f1d9 100755 (executable)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 #
 # install - install a program, script, or datafile
 # This comes from X11R5 (mit/util/scripts/install.sh).
@@ -118,6 +118,7 @@ if [ x"$dir_arg" != x ]; then
        
        if [ -d $dst ]; then
                instcmd=:
+               chmodcmd=""
        else
                instcmd=mkdir
        fi
diff --git a/cfgaux/ll.novo b/cfgaux/ll.novo
deleted file mode 100755 (executable)
index e69de29..0000000
diff --git a/cfgaux/missing b/cfgaux/missing
new file mode 100755 (executable)
index 0000000..0a7fb5a
--- /dev/null
@@ -0,0 +1,283 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# 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, 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.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing 0.3 - GNU automake"
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+  aclocal)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+          sed 's/\.am$/.in/' |
+          while read f; do touch "$f"; done
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.y)
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.c
+           fi
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.h
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f y.tab.h ]; then
+       echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+       echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.l)
+           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" lex.yy.c
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+       echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+        you modified a dependency of a manual page.  You may need the
+        \`Help2man' package in order for those modifications to take
+        effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+       file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo ".ab help2man is required to generate this page"
+       exit 1
+    fi
+    ;;
+
+  makeinfo)
+    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
+       # We have makeinfo, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+    fi
+    touch $file
+    ;;
+
+  tar)
+    shift
+    if test -n "$run"; then
+      echo 1>&2 "ERROR: \`tar' requires --run"
+      exit 1
+    fi
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar ${1+"$@"} && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar ${1+"$@"} && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+       case "$firstarg" in
+       *o*)
+           firstarg=`echo "$firstarg" | sed s/o//`
+           tar "$firstarg" ${1+"$@"} && exit 0
+           ;;
+       esac
+       case "$firstarg" in
+       *h*)
+           firstarg=`echo "$firstarg" | sed s/h//`
+           tar "$firstarg" ${1+"$@"} && exit 0
+           ;;
+       esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequirements for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
diff --git a/cfgaux/mkinstalldirs b/cfgaux/mkinstalldirs
new file mode 100755 (executable)
index 0000000..4a06bf3
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.1 2009-06-25 09:39:47 fmarchal Exp $
+
+errstatus=0
+
+for file
+do
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d
+   do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp"
+
+        mkdir "$pathcomp" || lasterr=$?
+
+        if test ! -d "$pathcomp"; then
+         errstatus=$lasterr
+        fi
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
index 8d1f6cd34b641ff89efecd35fbaaba6c61972b23..d5d94ee3554754f969f9ff2cfdec05fd46d1b6d6 100644 (file)
--- a/charset.c
+++ b/charset.c
 
 void ccharset()
 {
-
-   if(strcmp(CharSet,"Latin2") == 0)
-      strcpy(CharSet,"ISO-8859-2");
-
-   if(strcmp(CharSet,"Latin3") == 0)
-      strcpy(CharSet,"ISO-8859-3");
-
-   if(strcmp(CharSet,"Latin4") == 0)
-      strcpy(CharSet,"ISO-8859-4");
-
-   if(strcmp(CharSet,"Cyrillic") == 0)
-      strcpy(CharSet,"ISO-8859-5");
-
-   if(strcmp(CharSet,"Arabic") == 0)
-      strcpy(CharSet,"ISO-8859-6");
-
-   if(strcmp(CharSet,"Greek") == 0)
-      strcpy(CharSet,"ISO-8859-7");
-
-   if(strcmp(CharSet,"Hebrew") == 0)
-      strcpy(CharSet,"ISO-8859-8");
-
-   if(strcmp(CharSet,"Latin5") == 0)
-      strcpy(CharSet,"ISO-8859-9");
-
-   if(strcmp(CharSet,"Latin6") == 0)
-      strcpy(CharSet,"ISO-8859-10");
-
-   if(strcmp(CharSet,"Windows-1251") == 0)
-      strcpy(CharSet,"Windows-1251");
-
-   if(strcmp(CharSet,"Koi8-r") == 0)
-      strcpy(CharSet,"KOI8-R");
-
+   if(strcmp(CharSet,"Latin2") == 0) strcpy(CharSet,"ISO-8859-2");
+   else if(strcmp(CharSet,"Latin3") == 0) strcpy(CharSet,"ISO-8859-3");
+   else if(strcmp(CharSet,"Latin4") == 0) strcpy(CharSet,"ISO-8859-4");
+   else if(strcmp(CharSet,"Cyrillic") == 0) strcpy(CharSet,"ISO-8859-5");
+   else if(strcmp(CharSet,"Arabic") == 0) strcpy(CharSet,"ISO-8859-6");
+   else if(strcmp(CharSet,"Greek") == 0) strcpy(CharSet,"ISO-8859-7");
+   else if(strcmp(CharSet,"Hebrew") == 0) strcpy(CharSet,"ISO-8859-8");
+   else if(strcmp(CharSet,"Latin5") == 0) strcpy(CharSet,"ISO-8859-9");
+   else if(strcmp(CharSet,"Latin6") == 0) strcpy(CharSet,"ISO-8859-10");
+   else if(strcmp(CharSet,"Windows-1251") == 0) strcpy(CharSet,"Windows-1251");
+   else if(strcmp(CharSet,"Japan") == 0) strcpy(CharSet,"EUC-JP");
+   else if(strcmp(CharSet,"Koi8-r") == 0) strcpy(CharSet,"KOI8-R");
+   else if(strcmp(CharSet,"UTF-8") == 0) strcpy(CharSet,"UTF-8");
    return;
-
 }
index 5b213d6879e2594176788120e64509c39c298996..cb1d2276adb682718786ad532e3c68c145d532bd 100755 (executable)
--- a/configure
+++ b/configure
@@ -309,7 +309,7 @@ ac_includes_default="\
 # 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_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 LIBICONV LTLIBICONV BINDIR MANDIR SYSCONFDIR HTMLDIR LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -844,6 +844,7 @@ if test -n "$ac_init_help"; then
 Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-rpath         do not hardcode runtime library paths
   --enable-bindir=bindir
                         Select bindir
   --enable-mandir=mandir
@@ -857,6 +858,9 @@ 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
+  --with-gnu-ld           assume the C compiler uses GNU ld default=no
+  --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
+  --without-libiconv-prefix     don't search for libiconv in includedir and libdir
 
 Some influential environment variables:
   CC          C compiler command
@@ -3095,6 +3099,798 @@ _ACEOF
 fi
 
 
+
+      if test "X$prefix" = "XNONE"; then
+    acl_final_prefix="$ac_default_prefix"
+  else
+    acl_final_prefix="$prefix"
+  fi
+  if test "X$exec_prefix" = "XNONE"; then
+    acl_final_exec_prefix='${prefix}'
+  else
+    acl_final_exec_prefix="$exec_prefix"
+  fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+  prefix="$acl_save_prefix"
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi;
+# Prepare PATH_SEPARATOR.
+# 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
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo "$as_me:$LINENO: checking for ld used by GCC" >&5
+echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${acl_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      acl_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break ;;
+      *)
+       test "$with_gnu_ld" != yes && break ;;
+      esac
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+  echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${acl_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  acl_cv_prog_gnu_ld=yes ;;
+*)
+  acl_cv_prog_gnu_ld=no ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6
+with_gnu_ld=$acl_cv_prog_gnu_ld
+
+
+
+                                                echo "$as_me:$LINENO: checking for shared library run path origin" >&5
+echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6
+if test "${acl_cv_rpath+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+    . ./conftest.sh
+    rm -f ./conftest.sh
+    acl_cv_rpath=done
+
+fi
+echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5
+echo "${ECHO_T}$acl_cv_rpath" >&6
+  wl="$acl_cv_wl"
+  libext="$acl_cv_libext"
+  shlibext="$acl_cv_shlibext"
+  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  hardcode_direct="$acl_cv_hardcode_direct"
+  hardcode_minus_L="$acl_cv_hardcode_minus_L"
+    # Check whether --enable-rpath or --disable-rpath was given.
+if test "${enable_rpath+set}" = set; then
+  enableval="$enable_rpath"
+  :
+else
+  enable_rpath=yes
+fi;
+
+
+
+
+
+
+
+    use_additional=yes
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+
+# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given.
+if test "${with_libiconv_prefix+set}" = set; then
+  withval="$with_libiconv_prefix"
+
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/lib"
+      fi
+    fi
+
+fi;
+      LIBICONV=
+  LTLIBICONV=
+  INCICONV=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='iconv '
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value"
+          else
+                                    :
+          fi
+        else
+                              found_dir=
+          found_la=
+          found_so=
+          found_a=
+          if test $use_additional = yes; then
+            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+              found_dir="$additional_libdir"
+              found_so="$additional_libdir/lib$name.$shlibext"
+              if test -f "$additional_libdir/lib$name.la"; then
+                found_la="$additional_libdir/lib$name.la"
+              fi
+            else
+              if test -f "$additional_libdir/lib$name.$libext"; then
+                found_dir="$additional_libdir"
+                found_a="$additional_libdir/lib$name.$libext"
+                if test -f "$additional_libdir/lib$name.la"; then
+                  found_la="$additional_libdir/lib$name.la"
+                fi
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+                    found_dir="$dir"
+                    found_so="$dir/lib$name.$shlibext"
+                    if test -f "$dir/lib$name.la"; then
+                      found_la="$dir/lib$name.la"
+                    fi
+                  else
+                    if test -f "$dir/lib$name.$libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/lib$name.$libext"
+                      if test -f "$dir/lib$name.la"; then
+                        found_la="$dir/lib$name.la"
+                      fi
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
+                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+              else
+                                                                                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                                if test "$hardcode_direct" = yes; then
+                                                      LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                else
+                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                                                            haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                                                                                haveit=
+                    for x in $LDFLAGS $LIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir"
+                    fi
+                    if test "$hardcode_minus_L" != no; then
+                                                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                    else
+                                                                                                                                                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a"
+              else
+                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name"
+              fi
+            fi
+                        additional_includedir=
+            case "$found_dir" in
+              */lib | */lib/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux*) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INCICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                                            INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+                        if test -n "$found_la"; then
+                                                        save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+                            for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/lib"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux*) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                                                                  haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                                                                  haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$dep"
+                    LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+            LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$hardcode_libdir_separator"; then
+                        alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+      done
+            acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+    else
+            for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+            for found_dir in $ltrpathdirs; do
+      LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir"
+    done
+  fi
+
+
+
+
+
+
+
+          am_save_CPPFLAGS="$CPPFLAGS"
+
+  for element in $INCICONV; do
+    haveit=
+    for x in $CPPFLAGS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+    fi
+  done
+
+
+  echo "$as_me:$LINENO: checking for iconv" >&5
+echo $ECHO_N "checking for iconv... $ECHO_C" >&6
+if test "${am_cv_func_iconv+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    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 <iconv.h>
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+       iconv(cd,NULL,NULL,NULL,NULL);
+       iconv_close(cd);
+  ;
+  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
+  am_cv_func_iconv=yes
+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 "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      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 <iconv.h>
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+         iconv(cd,NULL,NULL,NULL,NULL);
+         iconv_close(cd);
+  ;
+  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
+  am_cv_lib_iconv=yes
+        am_cv_func_iconv=yes
+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
+      LIBS="$am_save_LIBS"
+    fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5
+echo "${ECHO_T}$am_cv_func_iconv" >&6
+  if test "$am_cv_func_iconv" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ICONV 1
+_ACEOF
+
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    echo "$as_me:$LINENO: checking how to link with libiconv" >&5
+echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6
+    echo "$as_me:$LINENO: result: $LIBICONV" >&5
+echo "${ECHO_T}$LIBICONV" >&6
+  else
+            CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+
+
+
+  if test "$am_cv_func_iconv" = yes; then
+    echo "$as_me:$LINENO: checking for iconv declaration" >&5
+echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6
+    if test "${am_cv_proto_iconv+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 <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+
+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
+  am_cv_proto_iconv_arg1=""
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+am_cv_proto_iconv_arg1="const"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
+fi
+
+    am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+    echo "$as_me:$LINENO: result: ${ac_t:-
+         }$am_cv_proto_iconv" >&5
+echo "${ECHO_T}${ac_t:-
+         }$am_cv_proto_iconv" >&6
+
+cat >>confdefs.h <<_ACEOF
+#define ICONV_CONST $am_cv_proto_iconv_arg1
+_ACEOF
+
+  fi
+
+if test -n "$LIBICONV" ; then
+  LIBS="$LIBS $LIBICONV"
+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
+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 iconv.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
@@ -3120,9 +4223,60 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
 
-#include <$ac_header>
+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
@@ -3146,52 +4300,46 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  eval "$as_ac_Header=yes"
+  ac_cv_c_const=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_Header=no"
+ac_cv_c_const=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
+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
 
-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 "$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
-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
+  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>
+#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
@@ -3215,142 +4363,156 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ac_cv_struct_tm=time.h
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+ac_cv_struct_tm=sys/time.h
 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
+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
 
-# 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
+cat >>confdefs.h <<\_ACEOF
+#define TM_IN_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6
+if test "${ac_cv_type_off_t+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 <$ac_header>
+$ac_includes_default
+int
+main ()
+{
+if ((off_t *) 0)
+  return 0;
+if (sizeof (off_t))
+  return 0;
+  ;
+  return 0;
+}
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+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); } >/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
+  (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_type_off_t=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
-
+ac_cv_type_off_t=no
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6
 
-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 "$as_me:$LINENO: checking size of off_t" >&5
+echo $ECHO_N "checking size of off_t... $ECHO_C" >&6
+if test "${ac_cv_sizeof_off_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgd  $LIBS"
+  if test "$ac_cv_type_off_t" = yes; then
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
 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 ();
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= 0)];
+test_array [0] = 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
+  ac_lo=0 ac_mid=0
+  while :; do
+    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
 int
 main ()
 {
-gdImagePng ();
+static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)];
+test_array [0] = 0
+
   ;
   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
+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
@@ -3364,93 +4526,83 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
+        { 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_lib_gd_gdImagePng=yes
+  ac_hi=$ac_mid; break
 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
+ac_lo=`expr $ac_mid + 1`
+                   if test $ac_lo -le $ac_mid; then
+                     ac_lo= ac_hi=
+                     break
+                   fi
+                   ac_mid=`expr 2 '*' $ac_mid + 1`
 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"
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
 else
-  HAVE_GD=""
-fi
-
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-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
+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
 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;
+static int test_array [1 - 2 * !(((long) (sizeof (off_t))) < 0)];
+test_array [0] = 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_hi=-1 ac_mid=-1
+  while :; do
+    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
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= $ac_mid)];
+test_array [0] = 0
 
   ;
   return 0;
@@ -3478,43 +4630,45 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_c_const=yes
+  ac_lo=$ac_mid; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_c_const=no
+ac_hi=`expr '(' $ac_mid ')' - 1`
+                      if test $ac_mid -le $ac_hi; then
+                        ac_lo= ac_hi=
+                        break
+                      fi
+                      ac_mid=`expr 2 '*' $ac_mid`
 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
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+ac_lo= ac_hi=
 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
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
   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>
-
+$ac_includes_default
 int
 main ()
 {
-struct tm *tp; tp->tm_sec;
+static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)];
+test_array [0] = 0
+
   ;
   return 0;
 }
@@ -3541,25 +4695,125 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_struct_tm=time.h
+  ac_hi=$ac_mid
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_struct_tm=sys/time.h
+ac_lo=`expr '(' $ac_mid ')' + 1`
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_off_t=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (off_t), 77
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+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
+long longval () { return (long) (sizeof (off_t)); }
+unsigned long ulongval () { return (long) (sizeof (off_t)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    exit (1);
+  if (((long) (sizeof (off_t))) < 0)
+    {
+      long i = longval ();
+      if (i != ((long) (sizeof (off_t))))
+       exit (1);
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long i = ulongval ();
+      if (i != ((long) (sizeof (off_t))))
+       exit (1);
+      fprintf (f, "%lu\n", i);
+    }
+  exit (ferror (f) || fclose (f) != 0);
+
+  ;
+  return 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
+  ac_cv_sizeof_off_t=`cat conftest.val`
+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 )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (off_t), 77
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
 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
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+  ac_cv_sizeof_off_t=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5
+echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
+_ACEOF
+
+
+if test $ac_cv_sizeof_off_t = "4"; then
 
 cat >>confdefs.h <<\_ACEOF
-#define TM_IN_SYS_TIME 1
+#define OFFSET_STRING "%d"
 _ACEOF
 
-fi
+elif test $ac_cv_sizeof_off_t = "8"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define OFFSET_STRING "%lli"
+_ACEOF
 
+else
+    { { echo "$as_me:$LINENO: error: can not detect the size of your system\'s off_t type" >&5
+echo "$as_me: error: can not detect the size of your system\'s off_t type" >&2;}
+   { (exit 1); exit 1; }; }
+fi
 
 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
 # needs to be defined for it
@@ -4391,6 +5645,8 @@ s,@EXEEXT@,$EXEEXT,;t t
 s,@OBJEXT@,$OBJEXT,;t t
 s,@CPP@,$CPP,;t t
 s,@EGREP@,$EGREP,;t t
+s,@LIBICONV@,$LIBICONV,;t t
+s,@LTLIBICONV@,$LTLIBICONV,;t t
 s,@BINDIR@,$BINDIR,;t t
 s,@MANDIR@,$MANDIR,;t t
 s,@SYSCONFDIR@,$SYSCONFDIR,;t t
index 9a9afc50000e15b59ff734dfbcfe346ea295f38d..f8737d10f58e4f7a0063f885ea96cbdcf44474f9 100644 (file)
@@ -38,9 +38,16 @@ dnl Check for headers
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 
+dnl Check for iconv
+AM_ICONV
+if test -n "$LIBICONV" ; then
+  LIBS="$LIBS $LIBICONV"
+fi
+
 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)
+                ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h \
+                errno.h sys/resource.h)
 
 AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="")
 
@@ -48,6 +55,16 @@ dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_STRUCT_TM
 
+dnl check for the off_t size
+AC_CHECK_SIZEOF(off_t)
+if test $ac_cv_sizeof_off_t = "4"; then
+    AC_DEFINE(OFFSET_STRING, "%d", [Offset string])
+elif test $ac_cv_sizeof_off_t = "8"; then
+    AC_DEFINE(OFFSET_STRING, "%lli", [Offset string])
+else
+    AC_ERROR(can not detect the size of your system\'s off_t type)
+fi
+
 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
 # needs to be defined for it
 AC_MSG_CHECKING([for fopen64])
diff --git a/css.c b/css.c
index 4469190a380b89275e4e6c9c0d731b900bb13b15..bf4e0af570077d787eeafb4f1bde89e1e148dfb5 100644 (file)
--- a/css.c
+++ b/css.c
 
 #include "include/conf.h"
 
-int css(FILE *fp_css)
+void css(FILE *fp_css)
 {
-   FILE *fp_in, *fp_ou;
-   char csstext[512];
+   FILE *fp_in;
 
-   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);
+      fputs("<style>\n",fp_css);
+      while(fgets(buf,MAXLEN,fp_in)!=NULL) 
+         fputs(buf,fp_css);
+      fclose(fp_in);
+      fputs("</style>\n",fp_css);
       return;
    }
 
-   fputs("<style>\n",fp_ou);
-   sprintf(csstext,".logo {font-family:Verdana,Tahoma,Arial;font-size:11px;color:%s;}\n",LogoTextColor);
-   fputs(csstext,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,".title2 {font-family:%s;font-size:%s;color:%s;background-color:%s;text-align:left;}\n",FontFace,TitleFontSize,TiColor,BgColor);
-   fputs(csstext,fp_ou);
-   sprintf(csstext,".title3 {font-family:%s;font-size:%s;color:%s;background-color:%s;text-align:right;}\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 #666666;border-bottom:1px solid #666666;}\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 #666666;border-bottom:1px solid #666666;}\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 #666666;border-bottom:1px solid #666666;}\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,".data3 {font-family:%s;color:%s;font-size:%s;text-align:center;background-color:%s;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}\n", FontFace, TxColor, FontSize, TxBgColor);
-   fputs(csstext,fp_ou);
-   sprintf(csstext,".data3 a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;text-align:center;background-color:%s;text-decoration:none;}\n", FontFace, FontSize, TxBgColor);
-   fputs(csstext,fp_ou);
-   sprintf(csstext,".text {font-family:%s;color:%s;font-size:%s;text-align:right;}\n", FontFace, TxColor, 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);
-
-   return;
-;}
+   fprintf(fp_css,"<style>\n.logo {font-family:Verdana,Tahoma,Arial;font-size:11px;color:%s;}\n",LogoTextColor);
+   fprintf(fp_css,".body {font-family:%s;color:%s;background-color:%s;}\n",FontFace,TxColor,BgColor);
+   fprintf(fp_css,".info {font-family:%s;font-size:10px;}\n", FontFace);
+   fprintf(fp_css,".info a:link,a:visited {font-family:%s;color:#0000FF;font-size:10px;text-decoration:none;}\n", FontFace);
+   fprintf(fp_css,".title {font-family:%s;font-size:%s;color:%s;background-color:%s;}\n",FontFace,TitleFontSize,TiColor,BgColor);
+   fprintf(fp_css,".title2 {font-family:%s;font-size:%s;color:%s;background-color:%s;text-align:left;}\n",FontFace,TitleFontSize,TiColor,BgColor);
+   fprintf(fp_css,".title3 {font-family:%s;font-size:%s;color:%s;background-color:%s;text-align:right;}\n",FontFace,TitleFontSize,TiColor,BgColor);
+   fprintf(fp_css,".header {font-family:%s;font-size:%s;color:%s;background-color:%s;text-align:left;border-right:1px solid #666666;border-bottom:1px solid #666666;}\n",FontFace,HeaderFontSize,HeaderColor,HeaderBgColor);
+   fprintf(fp_css,".header2 {font-family:%s;font-size:%s;color:%s;background-color:%s;text-align:right;border-right:1px solid #666666;border-bottom:1px solid #666666;}\n",FontFace,HeaderFontSize,HeaderColor,HeaderBgColor);
+   fprintf(fp_css,".header3 {font-family:%s;font-size:%s;color:%s;background-color:%s;text-align:center;border-right:1px solid #666666;border-bottom:1px solid #666666;}\n",FontFace,HeaderFontSize,HeaderColor,HeaderBgColor);
+   fprintf(fp_css,".text {font-family:%s;color:%s;font-size:%s;}\n", FontFace, TxColor, FontSize);
+   fprintf(fp_css,".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);
+   fprintf(fp_css,".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);
+   fprintf(fp_css,".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);
+   fprintf(fp_css,".data2 a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;background-color:%s;text-decoration:none;}\n", FontFace, FontSize, TxBgColor);
+   fprintf(fp_css,".data3 {font-family:%s;color:%s;font-size:%s;text-align:center;background-color:%s;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}\n", FontFace, TxColor, FontSize, TxBgColor);
+   fprintf(fp_css,".data3 a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;text-align:center;background-color:%s;text-decoration:none;}\n", FontFace, FontSize, TxBgColor);
+   fprintf(fp_css,".text {font-family:%s;color:%s;font-size:%s;text-align:right;}\n", FontFace, TxColor, FontSize, TxBgColor);
+   fprintf(fp_css,".link {font-family:%s;font-size:%s;color:#0000FF;}\n", FontFace, FontSize);
+   fprintf(fp_css,".link a:link,a:visited {font-family:%s;font-size:%s;color:#0000FF;text-decoration:none;}\n</style>\n", FontFace, FontSize);
+}
index ce690b831676a62f478db0e84fa6312420bd642c..bcabde9ea722954859d552f9279de5e2e0e830e1 100644 (file)
@@ -45,28 +45,28 @@ int dansguardian_log()
    bzero(year, 5);
 
    if(strcmp(df,"e") == 0) {
-      strncpy(day,periodo,2);
-      strncpy(mon,periodo+2,3);
-      strncpy(year,periodo+5,4);
+      strncpy(day,period,2);
+      strncpy(mon,period+2,3);
+      strncpy(year,period+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);
+      strncpy(day,period+10,2);
+      strncpy(mon,period+12,3);
+      strncpy(year,period+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);
+      strncpy(day,period+7,2);
+      strncpy(mon,period+4,3);
+      strncpy(year,period,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);
+      strncpy(day,period+17,2);
+      strncpy(mon,period+14,3);
+      strncpy(year,period+10,4);
       conv_month(mon);
       sprintf(warea,"%s%s%s",year,mon,day);
       duntil=atoi(warea);
index d87b8e90fc1379388f3b52a6ae339a1f79af7e54..a3c85d49be79e4f2cb1f352125a1c7f8f06b24ff 100644 (file)
@@ -37,7 +37,7 @@ void dansguardian_report()
    char dansguardian_ou[MAXLEN];
    char per[MAXLEN];
    char report[MAXLEN];
-   char periodo[100];
+   char period[100];
    char ip[MAXLEN];
    char rule[255];
    char oip[MAXLEN];
@@ -59,7 +59,7 @@ void dansguardian_report()
       return;
    }
 
-   sprintf(per,"%s/periodo",dirname);
+   sprintf(per,"%s/sarg-period",dirname);
    sprintf(report,"%s/dansguardian.html",dirname);
 
    if ((fp_in = fopen(per, "r")) == 0) {
@@ -67,7 +67,7 @@ void dansguardian_report()
       exit(1);
    }
 
-   fgets(periodo,sizeof(periodo),fp_in);
+   fgets(period,sizeof(period),fp_in);
    fclose(fp_in);
 
    if((fp_in=fopen(dansguardian_in,"r"))==NULL) {
@@ -80,31 +80,13 @@ void dansguardian_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);
+   fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
    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 class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(url,fp_ou);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou);
-      fputs("</table>\n",fp_ou);
-   }
-
+   if(strlen(FontFace) > 0) fprintf(fp_ou,"<font face=%s>\n",FontFace);
+   fprintf(fp_ou,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   if(strlen(LogoImage) > 0) fprintf(fp_ou, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
+   
    if(strcmp(IndexTree,"date") == 0)
       show_sarg(fp_ou, "../../..");
    else
@@ -113,9 +95,9 @@ void dansguardian_report()
    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);
+   sprintf(url,"<tr><td class=\"header\">%s: %s</td></tr>\n",text[89],period);
    fputs(url,fp_ou);
-   sprintf(url,"<tr><th class=\"header3\">%s %s</th></tr>\n",text[128],text[55]);
+   sprintf(url,"<tr><th class=\"header3\">%s</th></tr>\n",text[128]);
    fputs(url,fp_ou);
    fputs("</table></center>\n",fp_ou);
 
index e2b2ef361909c924383e5844f38bb190315e8425..f8533ddc4dded90a241e5c54a44669af5ef35cf2 100644 (file)
@@ -34,13 +34,12 @@ 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 oldaccdia[11], oldacchora[9], oldaccip[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];
@@ -53,7 +52,6 @@ void data_file(char *tmp)
    long long int rtotal=0;
    long long int incache=0;
    long long int oucache=0;
-   char *s;
 
    ipantes[0]='\0';
    nameantes[0]='\0';
@@ -94,7 +92,8 @@ void data_file(char *tmp)
                strcpy(ipantes,accip);
                ip2name(accip);
                strcpy(nameantes,accip);
-            } else strcpy(accip,nameantes);
+            } 
+           else strcpy(accip,nameantes);
          }
    
          if(!rtotal){
@@ -110,8 +109,7 @@ void data_file(char *tmp)
    
          if(strcmp(oldurl,accurl) != 0 || strcmp(oldaccuser,accuser) != 0){
             strcpy(oldmsg,"OK");
-            if(strstr(oldacccode,"DENIED") != 0)
-               sprintf(oldmsg,"%s",text[46]);
+            if(strstr(oldacccode,"DENIED") != 0) strcpy(oldmsg,text[46]);
             strcpy(wdirname,dirname);
             gravatmp(oldaccuser,wdirname,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache);
             strcpy(wdirname,dirname);
@@ -121,8 +119,7 @@ void data_file(char *tmp)
             nelap=0;
             incache=0;
             oucache=0;
-            if(strcmp(oldaccuser,accuser) != 0)
-               ind2=0;
+            if(strcmp(oldaccuser,accuser) != 0) ind2=0;
          }
 
          nacc++;
@@ -132,9 +129,8 @@ void data_file(char *tmp)
          strcpy(wcrc,acccode);
          getword(crc2,wcrc,'/');
 
-         if(strstr(crc2,"MISS") != 0)
-            oucache+=my_atoll(accbytes);
-          else incache+=my_atoll(accbytes);
+         if(strstr(crc2,"MISS") != 0) oucache+=my_atoll(accbytes);
+         else incache+=my_atoll(accbytes);
    
          strcpy(oldurl,accurl);
          strcpy(oldaccuser,accuser);
@@ -153,7 +149,6 @@ void data_file(char *tmp)
       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)
@@ -187,8 +182,7 @@ void saverecs(char *dirname, char *user, long long int nacc, char *url, long lon
    }
    if(strstr(DataFileFields,"url") != 0) {
       strcpy(name,url);
-      if (strcmp(DataFileUrl,"ip") == 0)
-         name2ip(name);
+      if (strcmp(DataFileUrl,"ip") == 0) name2ip(name);
       strncat(reg,name,strlen(name));
       strncat(reg,DataFileDelimiter,1);
    }
@@ -217,7 +211,4 @@ void saverecs(char *dirname, char *user, long long int nacc, char *url, long lon
    fputs(reg,fp_ou);
 
    fclose(fp_ou);
-
-   return;
-
 }
index 651f6343409576b335454248eeae01bfd0d139e3..7610f70e43638821f9e83d8d7f9d9b4c07796a9d 100644 (file)
--- a/denied.c
+++ b/denied.c
@@ -31,13 +31,11 @@ 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 period[100];
    char ip[MAXLEN];
    char oip[MAXLEN];
    char user[MAXLEN];
@@ -45,7 +43,6 @@ void gen_denied_report()
    char ouser2[MAXLEN];
    char data[15];
    char hora[15];
-   char ftime[128];
    char *str;
    int  z=0;
    int  count=0;
@@ -58,7 +55,7 @@ void gen_denied_report()
       return;
    }
 
-   sprintf(per,"%s/periodo",dirname);
+   sprintf(per,"%s/sarg-period",dirname);
    sprintf(report,"%s/denied.html",dirname);
 
    if ((fp_in = fopen(per, "r")) == 0) {
@@ -66,7 +63,7 @@ void gen_denied_report()
       exit(1);
    }
 
-   fgets(periodo,sizeof(periodo),fp_in);
+   fgets(period,sizeof(period),fp_in);
    fclose(fp_in);
 
    if((fp_in=fopen(denied_in,"r"))==NULL) {
@@ -79,45 +76,29 @@ void gen_denied_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);
+   fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
    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) {
-      fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou);
-      sprintf(url,"<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(url,fp_ou);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou);
-      fputs("</table>\n",fp_ou);
-   }
+   fprintf(fp_ou,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   if(strlen(LogoImage) > 0) fprintf(fp_ou, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
    if(strcmp(IndexTree,"date") == 0)
       show_sarg(fp_ou, "../../..");
    else
       show_sarg(fp_ou, "..");
+
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",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);
+   sprintf(url,"<tr><td class=\"header\">%s: %s</td></tr>\n",text[89],period);
    fputs(url,fp_ou);
-   sprintf(url,"<tr><th class=\"header3\">%s %s</th></tr>\n",text[46],text[55]);
+   sprintf(url,"<tr><th class=\"header3\">%s</th></tr>\n",text[46]);
    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);
 
index 72506a1dbc2b1db81fa160a7dcf73e98064fb184..e8f9387e24805497bd38bcf5953559de33849b9c 100644 (file)
@@ -34,10 +34,9 @@ void download_report()
    char html[MAXLEN];
    char html2[MAXLEN];
    char report_in[MAXLEN];
-   char report_ou[MAXLEN];
    char wdirname[MAXLEN];
    char report[MAXLEN];
-   char periodo[100];
+   char period[100];
    char ip[MAXLEN];
    char oip[MAXLEN];
    char user[MAXLEN];
@@ -45,7 +44,6 @@ void download_report()
    char ouser2[MAXLEN];
    char data[15];
    char hora[15];
-   char ftime[128];
    char *str;
    int  z=0;
    int  count=0;
@@ -59,14 +57,14 @@ void download_report()
    strcpy(wdirname,dirname);
    sprintf(report,"%s/download.html",wdirname);
    strcat(wdirname,"/");
-   strcat(wdirname,"periodo");
+   strcat(wdirname,"sarg-period");
 
    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);
+   fgets(period,sizeof(period),fp_in);
    fclose(fp_in);
 
    if((fp_in=fopen(report_in,"r"))==NULL) {
@@ -89,33 +87,25 @@ void download_report()
    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) {
-      fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou);
-      sprintf(url,"<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(url,fp_ou);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou);
-      fputs("</table>\n",fp_ou);
-   }
+   if(strlen(LogoImage) > 0) fprintf(fp_ou, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
    if(strcmp(IndexTree,"date") == 0)
       show_sarg(fp_ou, "../../..");
    else
       show_sarg(fp_ou, "..");
+      
+   fputs("<center><table cellpadding=0 cellspacing=0>\n",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);
+   sprintf(url,"<tr><td class=\"header\">%s: %s</td></tr>\n",text[89],period);
    fputs(url,fp_ou);
-   sprintf(url,"<tr><th class=\"header3\">%s %s</th></tr>\n",text[125],text[55]);
+   sprintf(url,"<tr><th class=\"header3\">%s</th></tr>\n",text[125]);
    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);
 
@@ -125,7 +115,7 @@ void download_report()
       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);
diff --git a/email.c b/email.c
index 160679945a980abc4efdc6fbe4f50e04e17856f5..7f5d71808b264acaae23337cabba7d65754a7799 100644 (file)
--- a/email.c
+++ b/email.c
@@ -34,7 +34,7 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, cha
    float perc=0.00;
    float perc2=0.00;
    int posicao=0;
-   char olduser[MAXLEN], csort[MAXLEN], periodo[MAXLEN], arqper[MAXLEN];
+   char olduser[MAXLEN], csort[MAXLEN], period[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];
@@ -48,11 +48,11 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, cha
    strcpy(top2,dirname);
    strcpy(top3,dirname);
    strcpy(tusr,dirname);
-   strcat(wger,"/geral");
+   strcat(wger,"/sarg-general");
    strcat(top1,"/top");
    strcat(top2,"/top.tmp");
    strcat(top3,"/report");
-   strcat(tusr,"/users");
+   strcat(tusr,"/sarg-users");
 
    if((fp_in=fopen(wger,"r"))==NULL) {
       fprintf(stderr, "SARG: (email) %s: %s\n",text[45],wger);
@@ -172,18 +172,18 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, cha
    }
 
  /*
- * Obtem o periodo
+ * Obtem o period
  */
 
    strcpy(arqper,dirname);
-   strcat(arqper,"/periodo");
+   strcat(arqper,"/sarg-period");
 
    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);
+   fgets(period,sizeof(period),fp_in);
    fclose(fp_in);
 
    sprintf(strip1,"%s",text[88]);
@@ -198,7 +198,7 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, cha
 
    sprintf(strip1,"%s",text[89]);
    strip_latin(strip1);
-   sprintf(preg,"%s %s\n\n",strip1,periodo);
+   sprintf(preg,"%s %s\n\n",strip1,period);
    fputs(preg,fp_top3);
 
    sprintf(strip1,"%s",text[100]);
@@ -316,7 +316,7 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, cha
       system(buf);
    }
  
-   sprintf(csort,"rm -r %s/sarg_tmp",TempDir);
+   sprintf(csort,"rm -rf %s/sarg",TempDir);
    system(csort);
 
    return (0);
index d1ff83d97d14b160a66db2fc222fd2e229b1039f..9c9afc317914ac70a67cd7267f8db330ca5acd03 100644 (file)
--- a/exclude.c
+++ b/exclude.c
 
 #include "include/conf.h"
 
-int vhexclude(char *excludefile, char *ip)
+int vhexclude(char *excludefile, char *url)
 {
 
    char whost[1024];
-   char wip1[1024], wip2[1024];
-   char sn1[4], sn2[4], sn3[4];
-   char str[strlen(excludefile)];
+   char *str;
+   char *wurl;
+   int len = strlen(excludefile);
 
+   if((str=(char *) malloc(len+1))==NULL) {
+         fprintf(stderr, "SARG: %s (%ld):\n",text[59], len);
+         exit(1);
+   }
+   len = strlen(url);
+   if((wurl=(char *) malloc(len+1))==NULL) {
+         fprintf(stderr, "SARG: %s (%ld):\n",text[59], len);
+         exit(1);
+   }
    whost[0]='\0';
    strcpy(str,excludefile);
+   strcpy(wurl,url);
+
    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(strchr(wurl,':') != 0) {
+      getword(warea,wurl,':');
+      strcpy(wurl,warea);
+   }
 
-      if(strstr(whost,wip2) !=0)
+   while(strcmp(whost,"*END*") != 0) {
+      if(strcmp(wurl,whost) == 0) {
+        free(wurl);
+        free(str);
          return(0);
-
+      }
+      if(strchr(whost,'*') != 0) {
+         getword(warea,whost,'.');
+         getword(warea,wurl,'.');
+         if(strcmp(wurl,whost) == 0) {
+           free(wurl);
+           free(str);
+            return(0);
+        }
+      }
       getword(whost,str,' ');
    }
-
+   free(wurl);
+   free(str);
    return(1);
 }
 
diff --git a/fonts/DejaVuSans.ttf b/fonts/DejaVuSans.ttf
new file mode 100644 (file)
index 0000000..62f2d9b
Binary files /dev/null and b/fonts/DejaVuSans.ttf differ
index 46f5532d307c3c7bb61710de841ea3a606cf9d57..457314573e8722ea148043e579152f73ffab670a 100644 (file)
Binary files a/fonts/FreeSans.ttf and b/fonts/FreeSans.ttf differ
index cd9ee102caa18323b813d0524d3a4dfa71222bb7..ff23ad2c746af9425fbe0fdc08b0610e3f96b51b 100644 (file)
@@ -1,3 +1,4 @@
 # Note from the author
 
-FreeSans.ttf is a GPL font and comes from http://savannah.gnu.org/
+FreeSans.ttf   is a GPL font and comes from http://savannah.gnu.org
+DejaVuSans.ttf is a GPL font and comes from http://dejavu.sourceforge.net
index 0718add453b6dc079ff756b615ca3242bdabc757..2d755301bad5ae4536db48f902ca648d0206a5a7 100644 (file)
--- a/getconf.c
+++ b/getconf.c
@@ -30,43 +30,7 @@ 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)
+void parmtest(char *buf)
 {
 
       if(strstr(buf,"background_color") != 0) {
@@ -226,7 +190,7 @@ int parmtest(char *buf)
 
       if(strstr(buf,"date_format") != 0) {
          getword(wbuf,buf,' ');
-         strcpy(DateFormat,buf);
+         strncpy(DateFormat,buf,1);
          fixnone(DateFormat);
          return;
       }
@@ -262,10 +226,12 @@ int parmtest(char *buf)
       }
 
       if(strstr(buf,"access_log") != 0) {
-         getword(wbuf,buf,' ');
-         strcpy(AccessLog,buf);
-         fixnone(AccessLog);
-         return;
+        if(strstr(buf,"realtime_access_log_lines") == 0) {
+            getword(wbuf,buf,' ');
+            strcpy(AccessLog,buf);
+            fixnone(AccessLog);
+            return;
+         }
       }
 
       if(strstr(buf,"useragent_log") != 0) {
@@ -557,6 +523,13 @@ int parmtest(char *buf)
          return;
       }
 
+      if(strstr(buf,"bytes_in_sites_users_report") != 0) {
+         getword(wbuf,buf,' ');
+         strcpy(BytesInSitesUsersReport,buf);
+         fixnone(BytesInSitesUsersReport);
+         return;
+      }
+
       if(strstr(buf,"user_report_fields") != 0) {
          getword(wbuf,buf,' ');
          strcpy(UserReportFields,buf);
@@ -564,10 +537,10 @@ int parmtest(char *buf)
          return;
       }
 
-      if(strstr(buf,"site_user_time_date_type") != 0) {
+      if(strstr(buf,"bytes_in_sites_users_report") != 0) {
          getword(wbuf,buf,' ');
-         strcpy(SiteUserTimeDateType,buf);
-         fixnone(SiteUserTimeDateType);
+         strcpy(BytesInSitesUsersReport,buf);
+         fixnone(BytesInSitesUsersReport);
          return;
       }
 
@@ -803,6 +776,11 @@ int parmtest(char *buf)
          return;
       }
 
+      if(strstr(buf,"squid24") != 0) {
+         squid24++;
+         return;
+      }
+
       if(strstr(buf,"byte_cost") != 0) {
          getword(wbuf,buf,' ');
          cost=atol(buf);
@@ -810,6 +788,42 @@ int parmtest(char *buf)
          nocost=my_atoll(buf);
          return;
       }
-    
-      return;
+}
+
+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]='\0';
+
+      if(debugm)
+         printf("SYSCONFDIR %s",buf);
+
+      if(strncmp(buf,"#",1) == 0 || strlen(buf) < 1)
+         continue;
+
+      if(debugz)
+         printf("SARG: TAG: %s\n",buf);
+
+      parmtest(buf);
+
+   }
+
+   fclose(fp_in);
+   language_load(language);
+   return;
 }
index 5e53679f12d1a8beb1034c06f45925d5ad31d43d..3c5596b4c2b7be1a3c45d69496f9d613bef01e0c 100644 (file)
--- a/grepday.c
+++ b/grepday.c
@@ -36,16 +36,16 @@ int gray;
 int silver;
 int black;
 int x1;
-char *font1 = SYSCONFDIR"/fonts/FreeSans.ttf";
+//char *font1 = SYSCONFDIR"/fonts/FreeSans.ttf";
+char *font1 = SYSCONFDIR"/fonts/DejaVuSans.ttf";
 char s[15];
 
-#ifdef HAVE_ICONV_H
+#if defined(HAVE_GD) && defined(HAVE_ICONV_H) && defined(gdFTEX_Unicode)
 #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)
+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;
@@ -59,7 +59,7 @@ BGD_DECLARE(char *) I18NgdImageStringFT (gdImage * im, int *brect, int fg, char
  sstr = (char *) sstring;
 
  localtoutf = iconv_open ("UTF-8", CharSet);
- iconv (localtoutf, &str, &slen, &sstr, &sslen);
+ iconv (localtoutf, (ICONV_CONST char **)&str, &slen, &sstr, &sslen); 
  iconv_close (localtoutf);
 
  retval = gdImageStringFTEx (im, brect, fg, fontlist, ptsize, angle, x, y, sstring, gdFTEX_Unicode);
@@ -77,7 +77,6 @@ void *bar(long long int *n)
    gdPoint points[4];
    int brect[8];
    int val=0, x;
-   float f=0;
    long long int lim, num;
    char v[15];
 
@@ -232,7 +231,7 @@ void *bar(long long int *n)
 void greport_day(char *user, int *iprel, int *ipuser)
 {
    FILE *fp_in, *pngout;
-   int x, y, z;
+   int x, y;
    int brect[8];
    char wdirname[MAXLEN];
    char graph[MAXLEN];
@@ -329,7 +328,7 @@ void greport_day(char *user, int *iprel, int *ipuser)
    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);
+   sprintf(warea,"%s: %s",text[89],period);
    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);
@@ -438,8 +437,8 @@ void greport_day(char *user, int *iprel, int *ipuser)
          bar(tot);
          strcpy(oday,day);
          tot=0;
-      } else
-         tot=tot+my_atoll(bytes);
+      }
+      tot=tot+my_atoll(bytes);
    }
 
    if(tot) {
@@ -456,5 +455,6 @@ void greport_day(char *user, int *iprel, int *ipuser)
    unlink(tmp5);
  
 #endif  
+
    return;
 }
diff --git a/html.c b/html.c
index de745962944e7f36277041b371e2f16756a287c7..678fb6890833dcfcacc0408809defc24c59c9ac1 100644 (file)
--- a/html.c
+++ b/html.c
@@ -36,7 +36,7 @@ void htmlrel()
    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[50], tmsg2[50], nelap[20], csort[MAXLEN];
-   char periodo[MAXLEN], usuario[MAXLEN], wusuario[MAXLEN], u2[MAXLEN], duser[MAXLEN];
+   char period[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], name2[MAXLEN];
@@ -49,7 +49,6 @@ void htmlrel()
    char *s;
    int  x, count;
 
-   if(indexonly) return;
    if(strstr(ReportType,"users_sites") == 0) return;
 
    strcpy(tmp2,TempDir);
@@ -59,18 +58,18 @@ void htmlrel()
    strcat(tmp3,"/sargtmp.log");
 
    strcpy(arqper,dirname);
-   strcat(arqper,"/periodo");
+   strcat(arqper,"/sarg-period");
 
    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);
+   fgets(period,sizeof(period),fp_in);
    fclose(fp_in);
 
    strcpy(arqper,dirname);
-   strcat(arqper,"/geral");
+   strcat(arqper,"/sarg-general");
 
    if ((fp_in = fopen(arqper, "r")) == 0){
       fprintf(stderr, "SARG: (html2) %s: %s\n",text[45],arqper);
@@ -232,7 +231,7 @@ void htmlrel()
          strcpy(name2,str2);
       }
    
-      sprintf(html,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[89],periodo);
+      sprintf(html,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[89],period);
       fputs(html,fp_ou);
       sprintf(html,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[90],name2);
       fputs(html,fp_ou);
@@ -243,7 +242,7 @@ void htmlrel()
       fputs("<tr><td></td></tr>\n",fp_ou);
  
       fputs("</table></center>\n",fp_ou);
-      fputs("<center><table cellpadding=\"1\" cellspaging=\"2\">\n",fp_ou);
+      fputs("<center><table cellpadding=\"2\" cellspacing=\"1\">\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]);
@@ -335,7 +334,7 @@ void htmlrel()
          twork=my_atoll(nacc);
          sprintf(wwork1,"%s",fixnum(twork,1));
          sprintf(wwork2,"%s",fixnum(nnbytes,1));
-         sprintf(wwork3,"%s",fixnum(nnelap,1));
+         sprintf(wwork3,"%s",fixnum2(nnelap,1));
 
          if(strcmp(LongUrl,"yes") != 0) {
             getword(warea,url,'/');
@@ -545,7 +544,7 @@ void htmlrel()
    
       sprintf(wwork1,"%s",fixnum(tnacc,1));
       sprintf(wwork2,"%s",fixnum(tnbytes,1));
-      sprintf(wwork3,"%s",fixnum(tnelap,1));
+      sprintf(wwork3,"%s",fixnum2(tnelap,1));
 
       sprintf(val2,"%s%s",href2,ltext110);
       sprintf(val3,"%3.2f%%",perc);
@@ -640,8 +639,14 @@ void htmlrel()
          }
       }
 
+//      if(indexonly) {
+//     unlink(arqou);
+//     continue;
+//      }
+
+   if (strstr(ReportType,"topuser") != 0) {
       strcpy(arqper,dirname);
-      strcat(arqper,"/users");
+      strcat(arqper,"/sarg-users");
  
       if ((fp_in = fopen(arqper, "r")) == 0){
          fprintf(stderr, "SARG: (html11) %s: %s\n",text[45],arqper);
@@ -669,7 +674,7 @@ void htmlrel()
   
       sprintf(wwork1,"%s",fixnum(twork,1));
       sprintf(wwork2,"%s",fixnum(totbytes2,1));
-      sprintf(wwork3,"%s",fixnum(totelap2,1));
+      sprintf(wwork3,"%s",fixnum2(totelap2,1));
 
       sprintf(val6,"%s",buildtime(totelap2));
       sprintf(val7,"%3.2f%%",perc2); 
@@ -706,7 +711,7 @@ void htmlrel()
          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);
       }
-
+} /* added */
       tnacc=0;
       tnbytes=0;
       tnelap=0;
index dfd534accf0136f1c2d5aaabecb63a240a553809..2cb9510253a2b5682c498086a245f0f6cb428273 100755 (executable)
@@ -96,15 +96,18 @@ char buf[MAXLEN];
 char url[MAXLEN];
 char urly[MAXLEN];
 char user[MAXLEN];
-char periodo[MAXLEN];
+char period[MAXLEN];
 char msg[1024];
 char per_hour[128];
+char code[MAXLEN];
+char code2[MAXLEN];
 char tmp[MAXLEN];
 char tmp2[MAXLEN];
 char tmp3[MAXLEN];
 char tmp4[MAXLEN];
 char tmp5[MAXLEN];
 char tmp6[MAXLEN];
+char tmp7[MAXLEN];
 char parse_out[MAXLEN];
 char arqtt[MAXLEN];
 char html[MAXLEN];
@@ -127,6 +130,7 @@ char RemoveTempFiles[4];
 char ReplaceIndex[256];
 char Index[20];
 char OverwriteReport[4];
+char u2[255];
 char RecordsWithoutUser[20];
 char UseComma[4];
 char MailUtility[6];
@@ -142,6 +146,7 @@ char name[MAXLEN];
 char LongUrl[20];
 char Ip2Name[20];
 char language[255];
+char bufy[MAXLEN];
 char AccessLog[MAXLEN];
 char Title[MAXLEN];
 char BgColor[MAXLEN];
@@ -204,6 +209,7 @@ char SquidGuardLogFormat[MAXLEN];
 char SquidGuardLogAlternate[MAXLEN];
 char SquidguardIgnoreDate[10];
 char ShowSargInfo[5];
+char BytesInSitesUsersReport[10];
 char ShowSargLogo[5];
 char ParsedOutputLog[MAXLEN];
 char ParsedOutputLogCompress[255];
@@ -315,6 +321,12 @@ int  realtime_access_log_lines;
 int  realt;
 int  x, y;
 int  rc;
+int  ntopsites;
+int  nsitesusers;
+int  nrepday;
+int  ndownload;
+int  ntopuser;
+int  squid24;
 long l1, l2;
 float perc;
 
index e0b4b0a4e4ef78598ac14c8bbe083dcb650df621..2f266d582b5da5a4a08db6009e2d510570e3896b 100755 (executable)
@@ -1,3 +1,3 @@
-#define VERSION "2.1 Nov-29-2005"
+#define VERSION "2.2.5 Mar-03-2008"
 #define PGM "sarg"
 #define URL "http://sarg.sourceforge.net"
diff --git a/index.c b/index.c
index 32e39f35e35448bcb786e541efeb79725285078d..7a4adf833e7e04132b7343f6b8b759f93ee8b305 100644 (file)
--- a/index.c
+++ b/index.c
@@ -49,8 +49,7 @@ void make_index()
    char day[4], mon[4], year[6], hour[10];
    char h[3], m[3], s[3];
 
-   if(LastLog[0] != '\0')
-      mklastlog(outdir,debug);
+   if(LastLog[0] != '\0') mklastlog(outdir,debug);
 
    sprintf(wdir,"%sindex.html",outdir);
    sprintf(wdir_tmp,"%sindex.unsort",outdir);
@@ -58,20 +57,17 @@ void make_index()
    strcpy(hbc1,"class=\"header\"");
 
    if(strcmp(Index,"no") == 0) {
-      if(access(wdir, R_OK) == 0)
-         unlink(wdir);
+      if(access(wdir, R_OK) == 0) unlink(wdir);
       return;
    }
 
-   if(debug)
-      debuga(text[53]);
+   if(debug) debuga(text[53]);
 
   // Root dir
    dirp = opendir(outdir);
    while ((direntp = readdir( dirp )) != NULL) {
       if(strcmp(IndexTree,"date") == 0) {
-         if(!isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1]))
-            continue;
+         if(!isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1])) continue;
          if(strlen(direntp->d_name) > 4) {
             bzero(y1,5);
             bzero(y2,5);
@@ -98,18 +94,12 @@ void make_index()
             conv_month(m2);
          }
          sprintf(val1,"%s%s",outdir,y1);
-         if(access(val1, R_OK) != 0)
-            mkdir(val1,0755);
-         if(strcmp(m1,m2) != 0)
-            sprintf(val2,"%s/%s-%s",val1,m1,m2);
-         else
-            sprintf(val2,"%s/%s",val1,m1);
-         if(access(val2, R_OK) != 0)
-            mkdir(val2,0755);
-         if(strcmp(d1,d2) != 0)
-            sprintf(val3,"%s/%s-%s",val2,d1,d2);
-         else
-            sprintf(val3,"%s/%s",val2,d1);
+         if(access(val1, R_OK) != 0) mkdir(val1,0755);
+         if(strcmp(m1,m2) != 0) sprintf(val2,"%s/%s-%s",val1,m1,m2);
+         else sprintf(val2,"%s/%s",val1,m1);
+         if(access(val2, R_OK) != 0) mkdir(val2,0755);
+         if(strcmp(d1,d2) != 0) sprintf(val3,"%s/%s-%s",val2,d1,d2);
+         else sprintf(val3,"%s/%s",val2,d1);
          sprintf(val4,"%s%s",outdir,direntp->d_name);
          rename(val4,val3);
          sprintf(val5,"%s/images",val2);
@@ -118,20 +108,17 @@ void make_index()
             system(val5);
          }
       } else {
-         if(!isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1]))
-            continue;
+         if(!isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1])) continue;
          if(strlen(direntp->d_name) == 4) {
             strcpy(y1,direntp->d_name);
             sprintf(val1,"%s%s",outdir,direntp->d_name);
             dirp2 = opendir(val1);
             while ((direntp2 = readdir( dirp2 )) != NULL) {
-               if(!isdigit(direntp2->d_name[0]) && !isdigit(direntp2->d_name[1]))
-                  continue;
+               if(!isdigit(direntp2->d_name[0]) && !isdigit(direntp2->d_name[1])) continue;
                sprintf(val2,"%s/%s",val1,direntp2->d_name);
                dirp3 = opendir(val2);
                while ((direntp3 = readdir( dirp3 )) != NULL) {
-                  if(!isdigit(direntp3->d_name[0]) && !isdigit(direntp3->d_name[1]))
-                     continue;
+                  if(!isdigit(direntp3->d_name[0]) && !isdigit(direntp3->d_name[1])) continue;
                   bzero(newname,512);
                   strcpy(warea,direntp2->d_name);
                   if(strstr(warea,"-") != 0) {
@@ -152,10 +139,8 @@ void make_index()
                      strcpy(d1,warea);
                      strcpy(d2,warea);
                   }
-                  if(strcmp(df,"u") == 0)
-                     sprintf(val4,"%s%s%s%s-%s%s%s",outdir,y1,m1,d1,y1,m2,d2);
-                  else if(strcmp(df,"e") == 0)
-                     sprintf(val4,"%s%s%s%s-%s%s%s",outdir,d1,m1,y1,d2,m2,y1);
+                  if(strcmp(df,"u") == 0) sprintf(val4,"%s%s%s%s-%s%s%s",outdir,y1,m1,d1,y1,m2,d2);
+                  else if(strcmp(df,"e") == 0) sprintf(val4,"%s%s%s%s-%s%s%s",outdir,d1,m1,y1,d2,m2,y1);
                   sprintf(val5,"%s%s/%s/%s",outdir,y1,direntp2->d_name,direntp3->d_name);
                   if(rename(val5,val4)) {
                      fprintf(stderr, "SARG: (index) rename error - %s\n",strerror(errno));
@@ -183,14 +168,11 @@ void make_index()
    dirp = opendir(outdir);
    while ((direntp = readdir( dirp )) != NULL) {
       if(strcmp(IndexTree,"date") == 0) {
-         if(strlen(direntp->d_name) > 4 || !isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1]))
-            continue;
-         sprintf(warea,"%s %s\n",direntp->d_name,get_size(outdir,direntp->d_name));
-         fputs(warea, fp_tmp);
+         if(strlen(direntp->d_name) > 4 || !isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1])) continue;
+         fprintf(fp_tmp,"%s %s\n",direntp->d_name,get_size(outdir,direntp->d_name));
          continue;
       } else {
-         if(strstr(direntp->d_name,"-") == 0)
-            continue;
+         if(strstr(direntp->d_name,"-") == 0) continue;
          bzero(newname, 512);
          if(strcmp(df,"u") == 0) {
             strncat(newname,direntp->d_name,4);
@@ -202,10 +184,8 @@ void make_index()
          month[3]='\0';
          conv_month(month);
          strcat(newname,month);
-         if(strcmp(df,"u") == 0)
-            strncat(newname,direntp->d_name+7,2);
-         else
-            strncat(newname,direntp->d_name,2);
+         if(strcmp(df,"u") == 0) strncat(newname,direntp->d_name+7,2);
+         else strncat(newname,direntp->d_name,2);
          obtdate(outdir,direntp->d_name,data);
          obtuser(outdir,direntp->d_name,tuser);
          obttotal(outdir,direntp->d_name,tbytes,tuser,media);
@@ -221,8 +201,7 @@ void make_index()
          getword(m,html,':');
          strcpy(s,html);
          buildymd(day,mon,year,ftime);
-         sprintf(warea,"%s%s%s%s;%s;%s;%s;%s;%s;%s\n",ftime, h, m, s, direntp->d_name, data, tuser, tbytes, media,newname);
-         fputs(warea, fp_tmp);
+         fprintf(fp_tmp,"%s%s%s%s;%s;%s;%s;%s;%s;%s\n",ftime, h, m, s, direntp->d_name, data, tuser, tbytes, media,newname);
          continue;
       }
    }
@@ -234,10 +213,8 @@ void make_index()
    }
 
    if(strcmp(IndexTree,"date") == 0) {
-      if(strcmp(IndexSortOrder,"A") == 0)
-         sprintf(warea,"sort -k 1,1 '%s' -o '%s'", wdir_tmp, wdir_tmp2);
-      else
-         sprintf(warea,"sort -r -k 1,1 '%s' -o '%s'", wdir_tmp, wdir_tmp2);
+      if(strcmp(IndexSortOrder,"A") == 0) sprintf(warea,"sort -k 1,1 '%s' -o '%s'", wdir_tmp, wdir_tmp2);
+      else sprintf(warea,"sort -r -k 1,1 '%s' -o '%s'", wdir_tmp, wdir_tmp2);
       system(warea);
       unlink(wdir_tmp);
       if((fp_tmp=fopen(wdir_tmp2,"r"))==NULL) {
@@ -249,12 +226,10 @@ void make_index()
          exit(1);
       }
       write_html_header(fp_ou, ".");
-      sprintf(html,"<tr><th %s>%s</th><th %s>%s</th></tr>\n",hbc1,text[130],hbc1,text[132]);
-      fputs(html,fp_ou);
+      fprintf(fp_ou,"<tr><th %s>%s</th><th %s>%s</th></tr>\n",hbc1,text[130],hbc1,text[132]);
       while(fgets(wwork1,MAXLEN,fp_tmp)!=NULL) {
          getword(tmp4,wwork1,' ');
-         sprintf(html,"<tr><td class=\"data2\"><a href=\"%s\">%s</a></td><td class=\"data2\">%s</td></tr>\n",tmp4,tmp4,wwork1);
-         fputs(html,fp_ou);
+         fprintf(fp_ou,"<tr><td class=\"data2\"><a href=\"%s\">%s</a></td><td class=\"data2\">%s</td></tr>\n",tmp4,tmp4,wwork1);
          sprintf(tmp2,"%s%s",outdir,tmp4);
          sprintf(tmp3,"%s%s/index.unsort",outdir,tmp4);
          // Year dir
@@ -264,19 +239,15 @@ void make_index()
          }
          dirp2 = opendir(tmp2);
          while ((direntp2 = readdir( dirp2 )) != NULL) {
-            if(!isdigit(direntp2->d_name[0]) && !isdigit(direntp2->d_name[1]))
-               continue;
-            sprintf(warea,"%s\n",direntp2->d_name);
-            fputs(warea,fp_ou2);
+            if(!isdigit(direntp2->d_name[0]) && !isdigit(direntp2->d_name[1])) continue;
+            fprintf(fp_ou2,"%s\n",direntp2->d_name);
          }
          if(fp_ou2) fclose(fp_ou2);
          (void)rewinddir(dirp2);
          (void)closedir(dirp2);
          sprintf(wdir_tmp3,"%s%s/index.sort",outdir,tmp4);
-         if(strcmp(IndexSortOrder,"A") == 0)
-            sprintf(csort,"sort -n '%s' -o '%s'", tmp3, wdir_tmp3);
-         else
-            sprintf(csort,"sort -n -r '%s' -o '%s'", tmp3, wdir_tmp3);
+         if(strcmp(IndexSortOrder,"A") == 0) sprintf(csort,"sort -n '%s' -o '%s'", tmp3, wdir_tmp3);
+         else sprintf(csort,"sort -n -r '%s' -o '%s'", tmp3, wdir_tmp3);
          system(csort);
          unlink(tmp3);
          if((fp_tmp2=fopen(wdir_tmp3,"r"))==NULL) {
@@ -289,8 +260,7 @@ void make_index()
             exit(1);
          }
          write_html_header(fp_ou2,"..");
-         sprintf(html,"<tr><th %s>%s/%s</th></tr>\n",hbc1,text[130],text[131]);
-         fputs(html,fp_ou2);
+         fprintf(fp_ou2,"<tr><th %s>%s/%s</th></tr>\n",hbc1,text[130],text[131]);
          while(fgets(wwork1,MAXLEN,fp_tmp2)!=NULL) {
             wwork1[strlen(wwork1)-1]='\0';        
             strcpy(tmp5,wwork1);
@@ -304,8 +274,7 @@ void make_index()
                strcpy(nmonth,tmp5);
                name_month(nmonth);
             }
-            sprintf(html,"<tr><td class=\"data2\"><a href=\"%s\">%s %s</a></td></tr>\n",wwork1,tmp4,nmonth);
-            fputs(html,fp_ou2);
+            fprintf(fp_ou2,"<tr><td class=\"data2\"><a href=\"%s\">%s %s</a></td></tr>\n",wwork1,tmp4,nmonth);
          
             sprintf(val1,"%s%s/%s",outdir,tmp4,wwork1);
             sprintf(tmp5,"%s%s/%s/index.unsort",outdir,tmp4,wwork1);
@@ -316,21 +285,16 @@ void make_index()
             // month dir
             dirp3 = opendir(val1);
             while ((direntp3 = readdir( dirp3 )) != NULL) {
-               if(!isdigit(direntp3->d_name[0]) && !isdigit(direntp3->d_name[1]))
-                  continue;
-               sprintf(warea,"%s\n",direntp3->d_name);
-               fputs(warea,fp_ou3);
-
+               if(!isdigit(direntp3->d_name[0]) && !isdigit(direntp3->d_name[1])) continue;
+               fprintf(fp_ou3,"%s\n",direntp3->d_name);
             }
             if(fp_ou3) fclose(fp_ou3);
             (void)rewinddir(dirp3);
             (void)closedir(dirp3);
             unlink(wdir_tmp3);
             sprintf(tmp6,"%s%s/%s/index.sort",outdir,tmp4,wwork1);
-            if(strcmp(IndexSortOrder,"A") == 0)
-               sprintf(csort,"sort -n '%s' -o '%s'", tmp5, tmp6);
-            else
-               sprintf(csort,"sort -n -r '%s' -o '%s'", tmp5, tmp6);
+            if(strcmp(IndexSortOrder,"A") == 0) sprintf(csort,"sort -n '%s' -o '%s'", tmp5, tmp6);
+            else sprintf(csort,"sort -n -r '%s' -o '%s'", tmp5, tmp6);
             system(csort);
             unlink(tmp5);
             sprintf(val2,"%s%s/%s/index.html",outdir,tmp4,wwork1);
@@ -345,12 +309,10 @@ void make_index()
                exit(1);
             }
             write_html_header(fp_ou3,"../..");
-            sprintf(html,"<tr><th %s>%s/%s/%s</th></tr>\n",hbc1,text[130],text[131],text[127]);
-            fputs(html,fp_ou3);
+            fprintf(fp_ou3,"<tr><th %s>%s/%s/%s</th></tr>\n",hbc1,text[130],text[131],text[127]);
             while(fgets(warea,MAXLEN,fp_tmp3)!=NULL) {
                warea[strlen(warea)-1]='\0';
-               sprintf(html,"<tr><td class=\"data2\"><a href=\"%s\">%s %s %s</a></td></tr>\n",warea,tmp4,nmonth,warea);
-               fputs(html,fp_ou3);
+               fprintf(fp_ou3,"<tr><td class=\"data2\"><a href=\"%s\">%s %s %s</a></td></tr>\n",warea,tmp4,nmonth,warea);
             }
             if(fp_tmp3) fclose(fp_tmp3);
             if(fp_ou3) fclose(fp_ou3);
@@ -368,10 +330,8 @@ void make_index()
       unlink(tmp6);
       unlink(wdir_tmp2);
    } else {
-      if(strcmp(IndexSortOrder,"A") == 0)
-         sprintf(warea,"sort -t';' +6.5n +6.2M +6.0n '%s' -o '%s'", wdir_tmp, wdir_tmp2);
-      else
-         sprintf(warea,"sort -t';' +6.5nr +6.2Mr +6.0nr '%s' -o '%s'", wdir_tmp, wdir_tmp2);
+      if(strcmp(IndexSortOrder,"A") == 0) sprintf(warea,"sort -t';' -k 7,7 -k 1,1 '%s' -o '%s'", wdir_tmp, wdir_tmp2);
+      else sprintf(warea,"sort -r -t';' -k 7,7 -k 1,1 '%s' -o '%s'", wdir_tmp, wdir_tmp2);
       system(warea);
       unlink(wdir_tmp);
       if((fp_ou=fopen(wdir,"w"))==NULL) {
@@ -379,8 +339,7 @@ void make_index()
          exit(1);
       }
       write_html_header(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);
+      fprintf(fp_ou,"<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]);
       if((fp_tmp2=fopen(wdir_tmp2,"r"))==NULL) {
          fprintf(stderr, "SARG: (index) %s: %s\n",text[45],wdir_tmp2);
          exit(1);
@@ -392,22 +351,17 @@ void make_index()
          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);
+         fprintf(fp_ou,"<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);
       }
       if(fp_tmp2) fclose(fp_tmp2);
       unlink(wdir_tmp2);
    }
  
-   strcpy(html,"</table></center>");
-   fputs(html,fp_ou);
+   fputs("</table></center>",fp_ou);
 
    zdate(ftime, DateFormat);
 
    show_info(fp_ou);
 
-   strcpy(html,"</body>\n</html>\n");
-   fputs(html,fp_ou);
-
-   return;
+   fputs("</body>\n</html>\n",fp_ou);
 }
index dbd61daa91da59bca2780fb836e210c784eea9f1..c5cc69f3543e495a3a738fdf58a9a835c22e6b24 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 1e32cc38e6c9e9376d3ae08adb315dccef367e5b..3e3365d0a806b3de3ca52e9236fa2d75e6a89549 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 3f7a6c8d694e1dcec0185a19a1897285e4015e4f..591bcafe8cf0a40ed93ef83a3f04bbf6a2267bfe 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
diff --git a/languages/Czech_UTF8 b/languages/Czech_UTF8
new file mode 100644 (file)
index 0000000..79c0608
--- /dev/null
@@ -0,0 +1,131 @@
+# by Josef Karliak <karliak@ajetaci.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"
+"pre-sorting files"
index 7ac2075d49610a4a1cab4b1a3f8a8c22385b9922..b68d9d56fe5217477ef660336ff9f86acb8608ed 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 7241a668d516e65b62c82065681fbe1f7d5f74b8..68d88ea9daaa4931213809fbe33924bafe7b9aef 100644 (file)
@@ -1,4 +1,4 @@
-# by Pedro Lineu Orso <orso@onda.com.br>
+# by Pedro Lineu Orso <pedro.orso@gmail.com>
 "Yes"
 "No"
 "English"
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index ffe7de34031855dc8528700988e6e7d426a74d56..88a68a9473288e3f6c2c8b083b70776a3bed2eb4 100644 (file)
@@ -1,4 +1,4 @@
-# by Fred Pacquier <fredp@dial.oleane.com>
+# by Nicod <smlpnicod@orange.fr>
 "Oui"
 "Non"
 "Français"
@@ -84,8 +84,8 @@
 "Les"
 "sites les plus accédés"
 "Semaines"
-"Loading User table"
-"Cannot load. Memory fault"
+"Chargement de la table des utilisateurs"
+"Chargement impossible. Erreur mémoire"
 "Statistiques des accès utilisateurs de Squid"
 "Période"
 "Utilisateur"
 "CACHE"
 "SitesUsers"
 "SmartFilter"
-"Authentication Failures"
-"Denied"
+"Echecs d'identification"
+"Interdit"
 "Topsites"
 "SQUIDGUARD"
 "RULE"
 "squidGuard"
-"Sarg parsed log saved as"
-"Sarg log format"
-"Downloads"
-"Graphic"
-"DAYS"
+"Journal analyé par Sarg, sauvegardé sous"
+"Format de journal Sarg"
+"Téléchargements"
+"Graphismes"
+"JOURS"
 "DansGuardian"
 "CAUSE"
-"YEAR"
-"MONTH"
-"SIZE"
-"January,February,March,April,May,June,July,August,September,October,November,December"
-"Realtime"
+"ANNEE"
+"MOIS"
+"TAILLE"
+"Janvier,Février,Mars,Avril,Mai,Juin,Juillet,Août,Septembre,Octobre,Novembre,Decembre"
+"Heure réelle"
 "TYPE"
-"Auto refresh"
+"Actualisation automatique"
+"Topuser"
+"Pré triage des fichiers"
index c24a0e788ea6c93957f05d4de50012f3a1dfc535..0ea6cc1da9dc30af17504e989f466e3e1f684055 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 9d4e9cd4dd9515d819f4b3241e5b005a4382f11e..6785f44e81a124d23477d23f9e2080d125c88fd7 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 3e72cc3535fb37419281a16d987043199bb878b9..5053deb4c08f829f4fd8e66daa8bf1a920424c06 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 3ce1cf8950232f5dd20013a6301c32397bc6797c..687be1b63a91ba5d72e90293333204e3f32135ff 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 5533f3bf411a181c2fd73b82106610645d1bbadb..d71a93a6c6fa03c99b7f16a4e1d87c6c711963a7 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index c64e5bff5b3fccd4aa861f089be9e5653a9a5ce1..788a493b43bcdea9d47fc7e2b01fe5384004c597 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index efc41ddc819e3cbe5b72a9a872b8ef30b83be2f1..7100482121dd4acbc84890225afca1fd27ad4f66 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 3dc4ff158db42ab73a5968625d048a95ec922b06..a4075bc586735ce3520d3e7ac6bf26e23cba4072 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index a8cb008d919f787af65d50425ec35f8e4977d565..8b8a58dddbff20cc9eb507c7ed20413187c45a79 100644 (file)
@@ -1,4 +1,4 @@
-# by Pedro Lineu Orso <orso@onda.com.br>
+# by Pedro Lineu Orso <pedro.orso@gmail.com>
 "Sim"
 "Nao"
 "Portuguese"
 "Realtime"
 "TIPO"
 "Auto refresh"
+"Topuser"
+"pre-classificando arquivos"
index 15cd4116a9b6b07bced79c3c75a31e8a5447e08e..740c7e0da6f0bf28ccf07ed2130e5237552dd493 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 1596305df9fab1995f4ddc23c0f94701bd7020f0..9add4eae1d1255b1f92e9d57882cdb94f2f37ab2 100755 (executable)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index e2b6493f97bf1596f6261d45cb21c5bd7a508eb3..a8a19b92255702d2f9d04e8bc5e1c77d50d8ae9e 100644 (file)
@@ -1,4 +1,4 @@
-# by Andrew Okhmat <andy@crgu.com>
+# Russian language file (codepage koi8-r) for the SARG by Palamarchuk Eugen <eugen@cit.od.ukrtel.net> and Dima I. Allaverdov <allav@ur.rags.ru> Updated for SARG 2.9.0 by Stas Degteff <stas.grumbler@gmail.com>
 "äÁ"
 "îÅÔ"
 "Russian"
 "óÏÒÔÉÒÏ×ËÁ ÆÁÊÌÏ×"
 "úÁ×ÅÒÛÅÎÏ"
 "ðÁÒÁÍÅÔÒÙ"
-"éÍÑ ÉÌÉ IP-ÁÄÒÅÓ"
+"éÍÑ ÉÌÉ ÁÄÒÅÓ IP"
 "äÁÔÁ ÏÔ-ÄÏ"
 "æÏÒÍÁÔ ÄÁÔÙ"
 "å×ÒÏÐÁ"
 "áÍÅÒÉËÁ"
 "IP ÏÔÞÅÔ"
-"éÓÐÏÌØÚÏ×ÁÔØ Ip-ÁÄÒÅÓ ×ÍÅÓÔÏ ÉÍÅÎÉ ÐÏÌØÚÏ×ÁÔÅÌÑ"
+"éÓÐÏÌØÚÏ×ÁÔØ ÁÄÒÅÓ IP ×ÍÅÓÔÏ ÉÍÅÎÉ ÐÏÌØÚÏ×ÁÔÅÌÑ"
 "áÄÒÅÓÁ"
 "÷ÒÅÍÑ"
 "éÍÑ"
@@ -57,7 +57,7 @@
 "Squid ÎÅ ÕÓÔÁÎÏ×ÌÅΠÎÁ ÜÔÏÊ ÍÁÛÉÎÅ"
 "ðÏÖÁÌÕÊÓÔÁ, ÉÓÐÏÌØÚÕÊÔÅ ÐÁÒÁÍÅÔÒ -v ÄÌÑ ÚÁÄÁÎÉÑ ×ÅÒÓÉÉ Squid"
 "úÁÇÒÕÚËÁ ËÏÎÆÉÇÕÒÁÃÉÉ ÉÚ"
-"ÏÛÉÂËÁ malloc"
+"ÏÛÉÂËÁ ×ÙÄÅÌÅÎÉÑ ÐÁÍÑÔÉ malloc"
 "úÁÇÒÕÚËÁ ÆÁÊÌÁ ÐÁÒÏÌÅÊ ÉÚ"
 "óÏÚÄÁÎÉÅ ÏÔÞÅÔÁ"
 "òÁÓÐÁËÏ×ËÁ ÆÁÊÌÁ ÖÕÒÎÁÌÁ"
@@ -75,7 +75,7 @@
 "ÌÉÍÉÔ ÐÒÅ×ÙÛÅÎ"
 "äÏÂÁ×ÌÅÎÏ × ÆÁÊÌ"
 "ëÏ×ÅÒÔÉÒÕÊÔÅ ÆÁÊÌ access.log, ÞÔÏÂÙ ÄÁÔÁ ÂÙÌÁ ÐÏÎÑÔÎÏÊ"
-"òÁÚÄÅÌÉÔÅ log ÆÁÊÌ ÐÏ ÄÁÔÅ, ÉÓÐÏÌØÚÕÑ ÐÁÒÁÍÅÔÒ -d"
+"òÁÚÄÅÌÉÔÅ ÌÏÇÆÁÊÌ ÐÏ ÄÁÔÅ, ÉÓÐÏÌØÚÕÑ ÐÁÒÁÍÅÔÒ -d"
 "ÐÏ"
 "× ÏÂÒÁÔÎÏÍ ÐÏÒÑÄËÅ"
 "× ÏÂÙÞÎÏÍ ÐÏÒÑÄËÅ"
@@ -90,7 +90,7 @@
 "ðÅÒÉÏÄ"
 "ðÏÌØÚÏ×ÁÔÅÌØ"
 "áÄÒÅÓÁ"
-"ðÏÄËÌÀÞÅÎÉÊ"
+"úÁÐÒÏÓÏ×"
 "âÁÊÔ"
 "ïÂÝÅÅ ×ÒÅÍÑ"
 "íÉÌÌÉÓÅË."
 "äÁÔÁ ÓÏÚÄÁÎÉÑ"
 "ðÏÌØÚÏ×ÁÔÅÌÅÊ"
 "ïÔÓÏÒÔÉÒÏ×ÁÎÏ"
-"ïÔÞÅÔ Squid ÐÏ ÂÒÏÕÚÅÒÁÍ"
-"âÒÏÕÚÅÒ"
+"ïÔÞÅÔ Squid ÐÏ ÂÒÁÕÚÅÒÁÍ"
+"âÒÁÕÚÅÒ"
 "÷ÓÅÇÏ"
 "óÇÅÎÅÒÉÒÏ×ÁÎ"
 "ÎÁ"
 "äÁÔÁ/÷ÒÅÍÑ"
 "IP/éÍÑ"
-"OUT"
-"IN"
-"CACHE"
-"SitesUsers"
+"ÍÉÍÏ"
+"ËÜÛ"
+"ÉÚ"
+"óÁÊÔÙ+ðÏÌØÚÏ×ÁÔÅÌÉ"
 "SmartFilter"
-"Authentication Failures"
-"Denied"
-"Topsites"
+"ïÛÉÂËÉ ÁÕÔÅÎÔÉÆÉËÁÃÉÉ"
+"úÁÐÒÅÝÅÎÏ"
+"ðÏÐÕÌÑÒÎÙÅ óÁÊÔÙ"
 "SQUIDGUARD"
-"RULE"
+"ðòá÷éìï"
 "squidGuard"
-"Sarg parsed log saved as"
-"Sarg log format"
-"Downloads"
+"ìÏÇ, ÏÂÒÁÂÏÔÁÎÎÙÊ Sarg, ÓÏÈÒÁΣΠËÁË"
+"æÏÒÍÁÔ ÌÏÇÁ Sarg"
+"úÁÇÒÕÚËÉ"
 "Graphic"
-"DAYS"
+"äîé"
 "DansGuardian"
 "CAUSE"
 "YEAR"
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index ceecb744d6aea6fd62c9aaf10d5367616cd65c10..4c30c4b4baad3861b8640212300cb5be5c14111a 100644 (file)
@@ -1,4 +1,4 @@
-# by Palamarchuk Eugen <eugen@cit.od.ukrtel.net> and Dima I. Allaverdov <allav@ur.rags.ru>
+# Russian language file (codepage 1251) for the SARG by Palamarchuk Eugen <eugen@cit.od.ukrtel.net> and Dima I. Allaverdov <allav@ur.rags.ru> Updated for SARG 2.9.0 by Stas Degteff <stas.grumbler@gmail.com>
 "Äà"
 "Íåò"
 "Russian"
 "Ñîðòèðîâêà ôàéëîâ"
 "Çàâåðøåíî"
 "Ïàðàìåòðû"
-"Èìÿ èëè IP-àäðåñ"
+"Èìÿ èëè àäðåñ IP"
 "Äàòà îò-äî"
 "Ôîðìàò äàòû"
 "Åâðîïà"
 "Àìåðèêà"
 "IP îò÷åò"
-"Èñïîëüçîâàòü Ip-àäðåñ âìåñòî èìåíè ïîëüçîâàòåëÿ"
+"Èñïîëüçîâàòü àäðåñ IP âìåñòî èìåíè ïîëüçîâàòåëÿ"
 "Àäðåñà"
 "Âðåìÿ"
 "Èìÿ"
@@ -57,7 +57,7 @@
 "Squid íå óñòàíîâëåí íà ýòîé ìàøèíå"
 "Ïîæàëóéñòà, èñïîëüçóéòå ïàðàìåòð -v äëÿ çàäàíèÿ âåðñèè Squid"
 "Çàãðóçêà êîíôèãóðàöèè èç"
-"îøèáêà malloc"
+"îøèáêà âûäåëåíèÿ ïàìÿòè malloc"
 "Çàãðóçêà ôàéëà ïàðîëåé èç"
 "Ñîçäàíèå îò÷åòà"
 "Ðàñïàêîâêà ôàéëà æóðíàëà"
@@ -75,7 +75,7 @@
 "ëèìèò ïðåâûøåí"
 "Äîáàâëåíî â ôàéë"
 "Êîâåðòèðóéòå ôàéë access.log, ÷òîáû äàòà áûëà ïîíÿòíîé"
-"Ðàçäåëèòå log ôàéë ïî äàòå, èñïîëüçóÿ ïàðàìåòð -d"
+"Ðàçäåëèòå ëîãôàéë ïî äàòå, èñïîëüçóÿ ïàðàìåòð -d"
 "ïî"
 "â îáðàòíîì ïîðÿäêå"
 "â îáû÷íîì ïîðÿäêå"
@@ -90,7 +90,7 @@
 "Ïåðèîä"
 "Ïîëüçîâàòåëü"
 "Àäðåñà"
-"Ïîäêëþ÷åíèé"
+"Çàïðîñîâ"
 "Áàéò"
 "Îáùåå âðåìÿ"
 "Ìèëëèñåê."
 "Äàòà ñîçäàíèÿ"
 "Ïîëüçîâàòåëåé"
 "Îòñîðòèðîâàíî"
-"Îò÷åò Squid ïî áðîóçåðàì"
-"Áðîóçåð"
+"Îò÷åò Squid ïî áðàóçåðàì"
+"Áðàóçåð"
 "Âñåãî"
 "Ñãåíåðèðîâàí"
 "íà"
 "Äàòà/Âðåìÿ"
 "IP/Èìÿ"
-"OUT"
-"IN"
-"CACHE"
-"SitesUsers"
+"ìèìî"
+"êýø"
+"èç"
+"Ñàéòû+Ïîëüçîâàòåëè"
 "SmartFilter"
-"Authentication Failures"
-"Denied"
-"Topsites"
+"Îøèáêè àóòåíòèôèêàöèè"
+"Çàïðåùåíî"
+"Ïîïóëÿðíûå Ñàéòû"
 "SQUIDGUARD"
-"RULE"
+"ÏÐÀÂÈËÎ"
 "squidGuard"
-"Sarg parsed log saved as"
-"Sarg log format"
-"Downloads"
+"Ëîã, îáðàáîòàííûé Sarg, ñîõðàí¸í êàê"
+"Ôîðìàò ëîãà Sarg"
+"Çàãðóçêè"
 "Graphic"
-"DAYS"
+"ÄÍÈ"
 "DansGuardian"
 "CAUSE"
 "YEAR"
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index b2e2bede18e51f157b7bbcd92b0dafb846e89afb..a16354977c5b8f3f7d5ecb35ac9ec0290ab16713 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 8e11cede3d485e68365cb20d97d957ab4327393d..c199e32867b9a6ea28f1ca0d40a0d217f69178ba 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index ba75182097442b3e97a50c57737838392f645a56..c56ca91f7bb327abf739245cbe5ee49c42ebedf9 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index e9c16c50b02fd00b2607b241d4036a34635d47d2..46906274fd1cf5502649dbd449caaeb5cf2d64a9 100644 (file)
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
index 5e402842a471853a338a29b31a4e14a7cac745f8..5359a3693b11cb9413b030239d3ada3284689439 100644 (file)
@@ -135,3 +135,5 @@ DansGuardian"
 "Realtime"
 "TYPE"
 "Auto refresh"
+"Topuser"
+"pre-sorting files"
diff --git a/log.c b/log.c
index e6d84d5b7892216d4d338b19842cd2ee09b69d49..335b102c7aaa168a79e81b6835e709c7844302f8 100644 (file)
--- a/log.c
+++ b/log.c
@@ -73,8 +73,6 @@ int main(argc,argv)
    char tam[255];
    char fun[255];
    char wuser[MAXLEN]; 
-   char code[MAXLEN];
-   char code2[MAXLEN];
    char smartfilter[MAXLEN];
    char dia[128]; 
    char wdata[128];
@@ -102,8 +100,7 @@ int main(argc,argv)
    int  common_log=0;
    int  squid_log=0;
    int  ch;
-   int  d;
-   int  x, l, i;
+   int  x, l;
    int  errflg=0;
    int  puser=0;
    int  fhost=0;
@@ -140,13 +137,13 @@ int main(argc,argv)
    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';
    SquidGuardLogAlternate[0]='\0';
+   arq[0]='\0';
 
    strcpy(AccessLog,"/usr/local/squid/var/logs/access.log");
    sprintf(ExcludeCodes,"%s/exclude_codes",SYSCONFDIR);
@@ -163,7 +160,7 @@ int main(argc,argv)
    strcpy(LogoTextColor,"#006699");
    strcpy(FontSize,"9px");
    strcpy(TempDir,"/tmp");
-   strcpy(OutputDir,"/usr/local/etc/httpd/htdocs/squid-reports");
+   strcpy(OutputDir,"/var/www/html/squid-reports");
    strcpy(Ip2Name,"no");
    strcpy(DateFormat,"u");
    strcpy(OverwriteReport,"no");
@@ -184,7 +181,7 @@ int main(argc,argv)
    strcpy(LongUrl,"no");
    strcpy(language,"English");
    strcpy(FontFace,"Verdana,Tahoma,Arial");
-   strcpy(datetimeby,"bytes");
+   strcpy(datetimeby,"elap");
    strcpy(CharSet,"ISO-8859-1");
    strcpy(Privacy,"no");
    strcpy(PrivacyString,"***.***.***.***");
@@ -214,10 +211,12 @@ int main(argc,argv)
    strcpy(NtlmUserFormat,"domainname+username");
    strcpy(IndexTree,"file");
    strcpy(RealtimeTypes,"GET,PUT,CONNECT");
-   strcpy(RealtimeUnauthRec,"ignore");
+   strcpy(RealtimeUnauthRec,"show");
    strcpy(SquidguardIgnoreDate,"off");
    strcpy(DansguardianIgnoreDate,"off");
    strcpy(DataFileUrl,"ip");
+   strcpy(MaxElapsed,"28800000");
+   strcpy(BytesInSitesUsersReport,"no");
 
    dia[0]='\0';
    mes[0]='\0';
@@ -274,6 +273,8 @@ int main(argc,argv)
    realtime_access_log_lines=1000;
    cost=0.01;
    nocost=50000000;
+   ndownload=0;
+   squid24=0;
 
    bzero(IncludeUsers, MAXLEN);
    bzero(ExcludeString, MAXLEN);
@@ -405,65 +406,23 @@ int main(argc,argv)
       exit(2);
    }
 
-   if(debug)
-      debuga("Init");
+   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(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);
+      getconf();
    
    if(realt) {
       realtime();
       exit(0);
    }
 
-   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");
-   }
    if(strcmp(IndexTree,"file") == 0)
       strcpy(ImageFile,"../images");
    else
@@ -534,60 +493,45 @@ int main(argc,argv)
       if(strstr(excludeuser,"indexonly") != 0)
          indexonly++;
    }
-   if(strcmp(ExcludeUsers,"indexonly") == 0)
-      indexonly++;
-   if(strcmp(Index,"only") == 0)
-      indexonly++;
+   if(strcmp(ExcludeUsers,"indexonly") == 0) indexonly++;
+   if(strcmp(Index,"only") == 0) indexonly++;
 
-   if(dns)
-      strcpy(Ip2Name,"yes");
+   if(dns) strcpy(Ip2Name,"yes");
 
-   if(strcmp(UserIp,"yes") == 0)
-      userip++;
+   if(strcmp(UserIp,"yes") == 0) userip++;
 
-   if(strlen(MaxElapsed)>1)
-      max_elapsed=atol(MaxElapsed);
+   if(strlen(MaxElapsed)>1) max_elapsed=atol(MaxElapsed);
 
-   if(strlen(outdir)<1)
-      strcpy(outdir,OutputDir);
+   if(strlen(outdir)<1) strcpy(outdir,OutputDir);
    strcat(outdir,"/");
 
 
-   if(arq[0] == '\0')
-      strcpy(arq,AccessLog);
+   if(arq[0] == '\0') strcpy(arq,AccessLog);
 
-   if(uagent[0] == '\0')
-      strcpy(uagent,UserAgentLog);
+   if(uagent[0] == '\0') strcpy(uagent,UserAgentLog);
 
-   if(tmp[0] == '\0')
-     strcpy(tmp,TempDir);
-    else
-     strcpy(TempDir,tmp);
+   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,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);
-   }
+   if(strlen(email)<1 && strlen(OutputEmail)>0) strcpy(email,OutputEmail);
 
    strcpy(tmp2,tmp);
 
    if(strlen(email) > 0) {
-      sprintf(wtemp2,"%s/sarg_tmp",tmp2);
+      sprintf(wtemp2,"%s/sarg",tmp2);
       my_mkdir(wtemp2);
-      strcat(tmp2,"/sarg_tmp");
+      strcat(tmp2,"/sarg");
       strcpy(outdir,tmp2);
       strcat(outdir,"/");
-    }
+   }
 
    strcat(tmp2,"/sarg.log");
 
@@ -697,31 +641,36 @@ int main(argc,argv)
       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 (strlen(Ulimit) > 0) {
 #if defined(RLIMIT_NOFILE)
-   if(setrlimit (RLIMIT_NOFILE, &rl) == -1) {
+      getrlimit (RLIMIT_NOFILE, &rl);
 #else #if defined(RLIMIT_OFILE)
-   if(setrlimit (RLIMIT_OFILE, &rl) == -1) {
+      getrlimit (RLIMIT_OFILE, &rl);
 #endif
-      sprintf(msg,"setrlimit error - %s\n",strerror(errno));
-      debuga(msg);
-   }
+      l1 = rl.rlim_cur;
+      l2 = rl.rlim_max;
+
+      if(Ulimit[0] != '\0') {
+         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(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 (UserTabFile[0] != '\0') {
       if(debug) {
          sprintf(msg,"%s: %s",text[86],UserTabFile);
          debuga(msg);
@@ -740,21 +689,20 @@ int main(argc,argv)
       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);
+      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);
    }
@@ -782,16 +730,14 @@ int main(argc,argv)
      exit(1);
    }
    fgets(bufz,sizeof(bufz),fp_in);
-   if(!isalog) {
-      if(strncmp(bufz,"#Software: Mic",14) == 0)
-         isalog++;
-   }
+   if(!isalog && 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);
+      sprintf(period,"%s-%s",val2,val3);
       sarglog=1;
    } else lseek(fileno(fp_in), 0, 0);
 
@@ -829,21 +775,19 @@ int main(argc,argv)
       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);
+      while( fgets(bufz,sizeof(bufz),fp_in) != NULL ) recs1++;
+      rewind(fp_in);
+      printf("SARG: Records in file: " OFFSET_STRING ", 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);
+           printf("SARG: Records in file: " OFFSET_STRING ", reading: %3.2f%%\r",recs1,perc);
            fflush (stdout);
            OutputNonZero = REPORT_EVERY_X_LINES ;
         }
@@ -896,8 +840,13 @@ int main(argc,argv)
               if((str=(char *) strstr(str+1, ".")) != (char *) NULL ) {
                  strcpy(ip,data);
                         strcpy(elap,"0");
-                getword(none,bufz,' ');
-                getword(user,bufz,' ');
+                if(squid24) {
+                    getword(user,bufz,' ');
+                    getword(none,bufz,' ');
+                } else {
+                   getword(none,bufz,' ');
+                   getword(user,bufz,' ');
+                }
                 getword(data,bufz,']');
                 getword(fun,bufz,'"');
                 getword(fun,bufz,' ');
@@ -905,6 +854,8 @@ int main(argc,argv)
                  getword(code2,bufz,' ');
                  getword(code2,bufz,' ');
                  getword(tam,bufz,' ');
+
+
                  if((str=(char *) strstr(bufz, " ")) != (char *) NULL )
                     getword(code,bufz,' ');
                  else strcpy(code,bufz);
@@ -930,6 +881,10 @@ int main(argc,argv)
              getword(tam,bufz,' ');
              getword(fun,bufz,' ');
              getword(url,bufz,' ');
+//              while (strstr(bufz,"%20") != 0) {
+//                 getword(warea,bufz,' ');
+//                 strcat(url,warea);
+//              }
              getword(user,bufz,' ');
              squid_log=1;
           }
@@ -988,6 +943,11 @@ int main(argc,argv)
            sprintf(data," %s/%s/%s:%s",dia,mes,ano,hora);
         }
 
+        if(strlen(user) > 150) {
+           totregsx++;
+           continue;
+        }
+
        // include_users
        if(strlen(IncludeUsers) > 0) {
            sprintf(val1,":%s:",user);
@@ -1005,7 +965,12 @@ int main(argc,argv)
         if(testvaliduserchar(user))
           continue;
 
-        while(strstr(user,"%5c") != 0 || strstr(user,"%20") != 0) {
+        if(strstr(user,"%20") != 0) {
+           getword(w,user,'%');
+           strcpy(user,w);
+        }
+
+        while(strstr(user,"%5c") != 0) {
            getword(w,user,'%');
            strcpy(wuser,user+2);
            sprintf(user,"%s.%s",w,wuser);
@@ -1169,12 +1134,14 @@ int main(argc,argv)
              strcpy(user,"everybody");
         }
 
+        if(dotinuser) {
+           str2=(char *)subs(user,"_",".");
+           strcpy(user,str2);
+           dotinuser=0;
+        }
+
         if(puser) {
            sprintf(wuser,":%s:",user);
-           if(dotinuser && strstr(wuser,"_")) {
-               str2=(char *)subs(wuser,"_",".");
-               strcpy(wuser,str2);
-            }
            if(strstr(userfile, wuser) == 0)
               continue;
         }
@@ -1215,7 +1182,7 @@ int main(argc,argv)
 #else
               if((fp_ou=fopen(tmp3,"a"))==NULL) {
 #endif
-                fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[9],tmp3,strerror(errno));
+                fprintf(stderr, "%s: (zzzlog) %s: %s - %s\n",argv[0],text[9],tmp3,strerror(errno));
                 exit(1);
               }
               fputs(bufz,fp_ou);
@@ -1247,8 +1214,9 @@ int main(argc,argv)
 #endif
              totregsg++;
 
-              if(download_flag) {
-                 sprintf(bufz, "%s %s %s %s %s\n",dia,hora,user,ip,download_url);
+              if(download_flag && strstr(code,"DENIED") == 0) {
+                 ndownload = 1;
+                 sprintf(bufz, "%s %s %s %s %s %s\n",dia,hora,user,ip,download_url);
 
 #ifdef LEGACY_WRITE_DOWNLOAD
                  sprintf(tmp3,"%s/sarg/download.unsort",tmp);
@@ -1293,13 +1261,13 @@ int main(argc,argv)
        
               if(!totper && !sarglog){
                 totper++;
-                 sprintf(periodo,"%s-",tbuf);
+                 sprintf(period,"%s-",tbuf);
                  sprintf(per_hour,"%s-",tbuf2);
                  if(strlen(date)>0)
-                    fixper(tbuf, periodo, cduntil);
+                    fixper(tbuf, period, cduntil);
                  if(debugz){
                     debugaz("tbuf",tbuf);
-                    debugaz("periodo",periodo);
+                    debugaz("period",period);
                  }
              }
            }
@@ -1318,7 +1286,7 @@ int main(argc,argv)
         }
       }
       if( bool_ShowReadStatistics )
-        printf("SARG: Records in file: %d, reading: %3.2f%%\n",recs1, (float) 100 );
+        printf("SARG: Records in file: " OFFSET_STRING ", reading: %3.2f%%\n",recs1, (float) 100 );
    }
 
    if ( fp_Download_Unsort ) 
@@ -1377,18 +1345,18 @@ int main(argc,argv)
    }
 
    if(date[0] == '\0' && !sarglog) {
-      strcat(periodo,tbuf);
+      strcat(period,tbuf);
       strcat(per_hour,tbuf2);
    }
 
    if(debugz){
       debugaz("data",dia);
       debugaz("tbuf",tbuf);
-      debugaz("periodo",periodo);
+      debugaz("period",period);
    }
 
    if(debug){
-     sprintf(msg, "%s: %s",text[17],periodo);
+     sprintf(msg, "%s: %s",text[17],period);
      debuga(msg);
    }
 
@@ -1401,7 +1369,7 @@ int main(argc,argv)
 
    if(strcmp(ParsedOutputLog, "no") != 0 && !sarglog) {
       fclose(fp_log); 
-      strcpy(val1,periodo);
+      strcpy(val1,period);
       getword(val2,val1,'-');
       getword(val3,per_hour,'-');
       sprintf(val4,"%s/sarg-%s_%s-%s_%s.log",ParsedOutputLog,val2,val3,val1,per_hour);
@@ -1441,11 +1409,10 @@ int main(argc,argv)
       recomp(arq, zip); }
 //   else  unlink(arq);
 
-   if(debug)
-      debuga(text[21]);
-
-   sprintf(csort,"rm -rf %s",tmp);
-   system(csort);
+   if(strcmp(tmp,"/tmp") != 0) {
+      sprintf(tmp4,"rm -rf %s",tmp);
+      system(tmp4);
+   }
 
    if(excludecode)
       free(excludecode);
@@ -1456,6 +1423,9 @@ int main(argc,argv)
    if(excludeuser)
       free(excludeuser);
 
+   if(debug)
+      debuga(text[21]);
+
    exit(0);
 
 }
@@ -1492,7 +1462,7 @@ void getusers(char *pwdfile, int debug)
    bzero(userfile,nreg);
    sprintf(userfile,":");
 
-   while(fgets(buf,255,fp_usr)!=NULL){
+   while(fgets(buf,255,fp_usr)!=NULL) {
      getword(user,buf,':');
      strncat(userfile,user,strlen(user));
      strncat(userfile,":",1);
@@ -1540,7 +1510,7 @@ void gethexclude(char *hexfile, int debug)
      strcat(excludefile," ");
    }
 
-   strcat(excludefile,"*FIM* ");
+   strcat(excludefile,"*END* ");
 
    fclose(fp_ex);
 
@@ -1584,7 +1554,7 @@ void getuexclude(char *uexfile, int debug)
      strcat(excludeuser," ");
    }
 
-   strcat(excludeuser,"*FIM* ");
+   strcat(excludeuser,"*END* ");
 
    fclose(fp_ex);
 
index 407866928520db576449cef5a4bad610254d41ef..db4e86daca474e44429c06a0c23cae18632b5a8c 100755 (executable)
@@ -46,12 +46,49 @@ realtime(int argc, char *argv[])
 
 void getlog()
 {
-   FILE *tmp, *fp;
+   FILE *tmp, *fp, *fp_usr;
    char template1[255]="/var/tmp/sargtpl1.XXXXXX";
    char template2[255]="/var/tmp/sargtpl2.XXXXXX";
    char cmd[512];
    char buf[512];
-   int fd1,fd2;
+   int  fd1,fd2,nreg;
+
+   if(UserTabFile[0] != '\0') {
+      if(debug) {
+         sprintf(msg,"%s: %s",text[86],UserTabFile);
+         debuga(msg);
+      }
+      if((fp_usr=fopen(UserTabFile,"r"))==NULL) {
+        fprintf(stderr, "SARG: (realtime) %s: %s - %s\n",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, "SARG ERROR: %s",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);
+   }
 
    fd1 = mkstemp(template1);
    fd2 = mkstemp(template2);
@@ -68,7 +105,7 @@ void getlog()
    pclose(fp);
    fclose(tmp);
 
-   sprintf(cmd,"sort -k 4,4 -k 5,5 -o %s %s",template2,template1);
+   sprintf(cmd,"sort -r -k 1,1 -k 2,2 -o %s %s",template2,template1);
    system(cmd);
    unlink(template1);
    datashow(template2);
@@ -139,7 +176,29 @@ void datashow(char *tmp)
       if(strcmp(ouser,user) == 0 && strcmp(ourl,url) == 0)
          continue;
 
-      printf("<tr><td class=\"data\">%s %s</td><td class=\"data3\">%s</td><td class=\"data3\">%s</td><td class=\"data3\">%s</td><td class=\"data2\"><a href=\"http://%s\">%s</td></tr>\n",dat,tim,ip,user,typ,url,url);
+      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);
+
+      if(dotinuser && strstr(name,"_")) {
+         str2=(char *)subs(name,"_",".");
+         strcpy(name,str2);
+      }
+
+      printf("<tr><td class=\"data\">%s %s</td><td class=\"data3\">%s</td><td class=\"data3\">%s</td><td class=\"data3\">%s</td><td class=\"data2\"><a href=\"http://%s\">%s</td></tr>\n",dat,tim,ip,name,typ,url,url);
       strcpy(ouser,user);
       strcpy(ourl,url);
    }
index 02562e6e26847de4bb69e91dd522e8f43f54b855..91957808cb399e94bffd87a6693d0925d0d4d565 100644 (file)
--- a/repday.c
+++ b/repday.c
@@ -33,28 +33,22 @@ 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 hour[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;
+   int  ihour=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);
@@ -73,30 +67,12 @@ void report_day(char *user, int *iprel, int *ipuser)
      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);
+   fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
    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 class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(html,fp_ou);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou);
-      fputs("</table>\n",fp_ou);
-   }
+   if(strlen(FontFace) > 0) fprintf(fp_ou,"<font face=%s>\n",FontFace);
+   fprintf(fp_ou,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   if(strlen(LogoImage) > 0) fprintf(fp_ou, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
    if(strcmp(IndexTree,"date") == 0)
       show_sarg(fp_ou, "../../../..");
@@ -110,7 +86,7 @@ void report_day(char *user, int *iprel, int *ipuser)
    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);
+   sprintf(html,"<tr><td class=\"header3\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[89],period);
    fputs(html,fp_ou);
 
    strcpy(wuser,user);
@@ -142,7 +118,7 @@ void report_day(char *user, int *iprel, int *ipuser)
       strcpy(name,str2);
    }
      
-   sprintf(html,"<tr><td class=\"header3\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[90],name);
+   sprintf(html,"<tr><th class=\"header3\" colspan=\"2\">%s:&nbsp;%s</th></tr>\n",text[90],name);
    fputs(html,fp_ou);
 
    fputs("<tr><td></td></tr><tr><td></td></tr>\n",fp_ou);
@@ -153,7 +129,7 @@ void report_day(char *user, int *iprel, int *ipuser)
    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" );
 
@@ -170,7 +146,7 @@ void report_day(char *user, int *iprel, int *ipuser)
          count++;
       }
 
-      getword(hora,buf,' ');
+      getword(hour,buf,' ');
       getword(elap,buf,' ');
       elap[strlen(elap)-1]='\0';
 
@@ -198,11 +174,11 @@ void report_day(char *user, int *iprel, int *ipuser)
          strcpy(elap,oelap);
       }
 
-      ihora=atoi(hora);
+      ihour=atoi(hour);
 
-      v[ ihora ]+=my_atoll(elap);
+      v[ ihour ]+=my_atoll(elap);
       tt+=my_atoll(elap);
-      t[ ihora ]+=my_atoll(elap);
+      t[ ihour ]+=my_atoll(elap);
       ttt+=my_atoll(elap);
 
    }
@@ -238,6 +214,5 @@ void report_day(char *user, int *iprel, int *ipuser)
 
    fclose(fp_in);
    fclose(fp_ou);
-
    return;
 }
index 116b2fabe5c0acbf5af56dc2fc87ba9ba9736558..bf04bd41c8d5e6cc27120381b945c6c7881d8771 100644 (file)
--- a/report.c
+++ b/report.c
@@ -29,7 +29,7 @@
 void gerarel()
 {
 
-   FILE *fp_in, *fp_ou;
+   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];
@@ -39,7 +39,6 @@ void gerarel()
    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;
@@ -54,9 +53,9 @@ void gerarel()
    nameantes[0]='\0';
    smartfilter=0;
 
-   sprintf(dirname, "%s%s", outdir, periodo);
-   sprintf(wdir, "%s%s", outdir, periodo);
-   strcpy(per1,periodo);
+   sprintf(dirname, "%s%s", outdir, period);
+   sprintf(wdir, "%s%s", outdir, period);
+   strcpy(per1,period);
    vrfydir(wdir, per1, addr, site, us, email);
 
    if(debugz){
@@ -65,27 +64,23 @@ void gerarel()
    }
  
    strcpy(wdirname,dirname);
-   gperiodo();
+   gperiod();
 
-   if(strlen(UserAgentLog) > 0 && email[0] == '\0') 
-      useragent();
+   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)
+      if((strstr(direntp->d_name,".log") == 0) ||
+         (strncmp(direntp->d_name,"download.log",12) == 0) ||
+         (strncmp(direntp->d_name,"denied.log",10) == 0) ||
+        (strncmp(direntp->d_name,"authfail.log.unsort",19) == 0))
          continue;
-      if(strncmp(direntp->d_name,"download.log",12) == 0)
-         continue;
-      if(strncmp(direntp->d_name,"denied.log",10) == 0)
-         continue;
-      if(strncmp(direntp->d_name,"authfail.log.unsort",19) == 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);
+         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);
       }
     
@@ -114,8 +109,7 @@ void gerarel()
          getword(accurl,buf,' ');
          getword(accbytes,buf,' ');
          getword(acccode,buf,' ');
-         if(strncmp(acccode,"TCP_DENIED/407",14) == 0)
-            continue;
+         if(strncmp(acccode,"TCP_DENIED/407",14) == 0) continue;
          getword(accelap,buf,' ');
          getword(accsmart,buf,' ');
          getword(accsmart,buf,'"');
@@ -225,35 +219,19 @@ void gerarel()
                   *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);
+           fprintf(fp_tt, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
             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) {
-               fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_tt);
-               sprintf(html,"<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-               fputs(html,fp_tt);
-               fputs("<tr><td height=\"5\"></td></tr>\n",fp_tt);
-               fputs("</table>\n",fp_tt);
-            }
+            fprintf(fp_tt,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+           if(strlen(LogoImage) > 0) fprintf(fp_tt, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
             if(strcmp(IndexTree,"date") == 0)
                show_sarg(fp_tt, "../../../..");
             else
                show_sarg(fp_tt, "../..");
 
-            sprintf(html,"<tr><th class=\"title\" colspan=\"2\">%s</th></tr>\n",Title);
-            fputs(html,fp_tt);
+            fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_tt);
+            fprintf(fp_tt,"<tr><th class=\"title\" colspan=\"2\">%s</th></tr>\n",Title);
 
             strcpy(u2,user);
             if(strcmp(Ip2Name,"yes") == 0)
@@ -277,24 +255,17 @@ void gerarel()
                strcpy(name,str2);
             }
 
-            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);
+           fprintf(fp_tt,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[89],period);
+           fprintf(fp_tt,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s</td></tr>\n",text[90],name);
+           fprintf(fp_tt,"<tr><td class=\"header\" colspan=\"2\">%s:&nbsp;%s, %s</td></tr>\n",text[104],UserSortField,UserSortOrder);
+           fprintf(fp_tt,"<tr><th class=\"header3\" colspan=2>%s</th></tr>\n",text[32]);
 
             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);
+            fprintf(fp_tt,"<tr><th class=\"header\">%s</th><th class=\"header\">%s</th><th class=\"header\">%s</th></tr>\n",text[91],tmp4,text[110]+5);
         }
 
          sprintf(html,"<tr><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",accurl,accdia,acchora);
@@ -302,9 +273,7 @@ void gerarel()
         if(strcmp(html,html_old) != 0)
             fputs(html,fp_tt);
         strcpy(html_old, html);
-      } else {
-         bzero(ltext110, 50);
-      } 
+      } else bzero(ltext110, 50);
 
       strcpy(wcrc,acccode);
       getword(crc2,wcrc,'/');
@@ -317,7 +286,7 @@ void gerarel()
 
       if(strcmp(accuser,oldaccuser) != 0) {
          strcpy(wdirname,dirname);
-         totaliza_day(tmp,oldaccuser,indexonly);
+         day_totalize(tmp,oldaccuser,indexonly);
       }
 
       strcpy(oldaccuser,accuser);
@@ -337,11 +306,13 @@ void gerarel()
    if(strstr(oldacccode,"DENIED") != 0)
       sprintf(oldmsg,"%s",text[46]);
    strcpy(wdirname,dirname);
+   if(strlen(oldaccuser) == 0)
+      strcpy(oldaccuser,accuser);
    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);
+   day_totalize(tmp,oldaccuser,indexonly);
 
    tmpsort();
 
@@ -349,8 +320,7 @@ void gerarel()
    totalger(wdirname, debug, outdir);
 
    if(strlen(email) == 0) {
-      if(strstr(ReportType,"downloads") != 0)
-         download_report();
+      if(strstr(ReportType,"downloads") != 0) download_report();
 
       if(strlen(DansGuardianConf) > 0) {
          strcpy(wdirname,dirname);
@@ -363,39 +333,31 @@ void gerarel()
       strcpy(wdirname,dirname);
       topuser();
 
-      if(strstr(ReportType,"topsites") != 0)
-         topsites();
+      if(strstr(ReportType,"topsites") != 0) topsites();
 
-      if(strstr(ReportType,"sites_users") != 0)
-         siteuser();
+      if(strstr(ReportType,"sites_users") != 0) siteuser();
       gen_denied_report();
 
       strcpy(wdirname,dirname);
       authfail_report();
 
-      if(smartfilter)
-         smartfilter_report();
+      if(smartfilter) smartfilter_report();
 
-      if(strlen(DansGuardianConf) > 0)
-         dansguardian_report();
+      if(strlen(DansGuardianConf) > 0) dansguardian_report();
 
       squidguard_report();
 
-      if(strstr(ReportType,"users_sites") != 0)
-         htmlrel();
+      if(strstr(ReportType,"users_sites") != 0) htmlrel();
 
       make_index();
 
-      if(strncmp(SuccessfulMsg,"yes",3) == 0)
-         fprintf(stderr, "SARG: %s %s\n",text[47],dirname);
+      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)
+      if((strcmp(email,"stdout") != 0) && (strncmp(SuccessfulMsg,"yes",3) == 0))
             fprintf(stderr, "SARG: %s %s\n",text[48],email);
-      }
    }
 
    if(indexonly) {
@@ -403,7 +365,8 @@ void gerarel()
       index_only(wdirname, debug);
    }
 
-   removetmp(dirname);
+   if(strlen(email) < 0)
+      removetmp(dirname);
 
    return;
 }
@@ -469,7 +432,6 @@ void gravatmp(char *oldaccuser, char *dirname, char *oldurl, long long int nacc,
 
    FILE *fp_ou;
 
-   char reg[MAXLEN];
    char wdirname[MAXLEN];
 
    if(indexonly) return;
@@ -490,8 +452,7 @@ void gravatmp(char *oldaccuser, char *dirname, char *oldurl, long long int nacc,
    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);
+   fprintf(fp_ou,"%s %s %s %s %s %s %s\n",val1,val2,oldurl,oldmsg,val3,val4,val5);
 
    fclose(fp_ou);
    ttopen=0;
@@ -512,11 +473,9 @@ void gravatmp_hora(char *dirname, char *user, char *data, char *hora, char *elap
 
    FILE *fp_ou;
 
-   char reg[MAXLEN];
    char wdirname[MAXLEN];
 
-   if(indexonly) return;
-   if(strstr(ReportType,"users_sites") == 0) return;
+   if(indexonly || (strstr(ReportType,"users_sites") == 0)) return;
 
    strcpy(wdirname,tmp);
    strcat(wdirname,"/");
@@ -528,10 +487,8 @@ void gravatmp_hora(char *dirname, char *user, char *data, char *hora, char *elap
       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);
+   if(strcmp(datetimeby,"bytes") == 0) fprintf(fp_ou,"%s %s %s\n",data,hora,bytes);
+   else fprintf(fp_ou,"%s %s %s\n",data,hora,elap);
 
    fclose(fp_ou);
 
@@ -544,11 +501,9 @@ void gravaporuser(char *user, char *dirname, char *url, char *ip, char *data, ch
 
    FILE *fp_ou;
 
-   char reg[MAXLEN];
    char wdirname[MAXLEN];
 
-   if(indexonly) return;
-   if(strstr(ReportType,"users_sites") == 0) return;
+   if(indexonly || (strstr(ReportType,"users_sites") == 0)) return;
 
    strcpy(wdirname,tmp);
    strcat(wdirname,"/");
@@ -560,8 +515,7 @@ void gravaporuser(char *user, char *dirname, char *url, char *ip, char *data, ch
       exit(1);
    } 
 
-   sprintf(reg,"%s %s %s %s %s %s\n",ip,url,data,hora,tam,elap);
-   fputs(reg,fp_ou);
+   fprintf(fp_ou,"%s %s %s %s %s %s\n",ip,url,data,hora,tam,elap);
 
    fclose(fp_ou);
 
@@ -575,11 +529,9 @@ void gravatmpf(char *oldaccuser, char *dirname, char *oldurl, long long int nacc
 
    FILE *fp_ou;
 
-   char reg[MAXLEN];
    char wdirname[MAXLEN];
 
-   if(indexonly) return;
-   if(strstr(ReportType,"users_sites") == 0) return;
+   if(indexonly || (strstr(ReportType,"users_sites") == 0)) return;
 
    strcpy(wdirname,tmp);
    strcat(wdirname,"/");
@@ -596,8 +548,7 @@ void gravatmpf(char *oldaccuser, char *dirname, char *oldurl, long long int nacc
    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);
+   fprintf(fp_ou,"%s %s %s %s %s %s %s\n",val1,val2,oldurl,oldmsg,val3,val4,val5);
 
    fclose(fp_ou);
    ttopen=0;
@@ -618,10 +569,9 @@ void gravager(char *dirname, char *user, long long int nacc, char *url, long lon
 {
 
    FILE *fp_ou;
-   char reg[MAXLEN];
 
    strcat(dirname,"/");
-   strcat(dirname,"geral");
+   strcat(dirname,"sarg-general");
    
    if((fp_ou=fopen(dirname,"a"))==NULL){
       fprintf(stderr, "SARG: (report) %s: %s\n",text[45],dirname);
@@ -633,8 +583,7 @@ void gravager(char *dirname, char *user, long long int nacc, char *url, long lon
    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);
+   fprintf(fp_ou,"%s %s %s %s %s %s %s %s %s %s\n",user,val1,val2,url,ip,hora,dia,val3,val4,val5);
 
    fclose(fp_ou);
    return;
@@ -646,7 +595,6 @@ void grava_SmartFilter(char *dirname, char *user, char *ip, char *data, char *ho
 
    FILE *fp_ou;
 
-   char reg[MAXLEN];
    char wdirname[MAXLEN];
 
    sprintf(wdirname,"%s/smartfilter.unsort",dirname);
@@ -656,8 +604,7 @@ void grava_SmartFilter(char *dirname, char *user, char *ip, char *data, char *ho
       exit(1);
    }
 
-   sprintf(reg,"%s %s %s %s %s %s\n",user,data,hora,ip,url,smart);
-   fputs(reg,fp_ou);
+   fprintf(fp_ou,"%s %s %s %s %s %s\n",user,data,hora,ip,url,smart);
    fputs("</body>\n</html>\n",fp_tt);
 
    fclose(fp_ou);
index b71e69e27c1cec279377d24874b12e71259ac4d9..2602df1b4a2d7b7f985177eccc105f32f3837eac 100644 (file)
@@ -1,8 +1,8 @@
 This PHP modules is under i18n. 
 Available languages:
 
-       English                 Pedro Orso <orso@brturbo.com.br>
-       Brazilian_Portuguese    Pedro Orso <orso@brturbo.com.br>
+       English                 Pedro Orso <pedro.orso@gmail.com>
+       Brazilian_Portuguese    Pedro Orso <pedro.orso@gmail.com>
        French                  Jacques GRILLOT <Jacques.Grillot@grouperdi.com>
        Russian                 Michael Stepanenko <mistic@ecolines.ru>
 
@@ -12,5 +12,5 @@ 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
+3. send to pedro.orso@gmail.com to implement
    * plase send your name and email address.
index f5bc8b9c97b691109726c601555415eae8de1310..8ab44a9a7f66805cad429a8994f750435548a3a6 100755 (executable)
@@ -1,8 +1,8 @@
 <?php
 
 /*
- * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
- *                                                            1998, 2005
+ * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
+ *                                                            1998, 2006
  * SARG Squid Analysis Report Generator            http://sarg-squid.org
  *
  * SARG donations:
@@ -40,6 +40,10 @@ function sarg_config($line,$clave) {
          $language = "en-EN";
       else if ( 0 == strcmp("Portuguese", $lang))
          $language = "pt_BR";
+      else if ( 0 == strcmp("French", $lang))
+         $language = "fr";
+      else if ( 0 == strcmp("Russian", $lang))
+         $language = "ru";
       return;
    }
 }
diff --git a/sarg-php/locale/en_EN/LC_MESSAGES/messages.mo b/sarg-php/locale/en_EN/LC_MESSAGES/messages.mo
new file mode 100755 (executable)
index 0000000..e341c9d
Binary files /dev/null and b/sarg-php/locale/en_EN/LC_MESSAGES/messages.mo differ
diff --git a/sarg-php/locale/en_EN/LC_MESSAGES/messages.po b/sarg-php/locale/en_EN/LC_MESSAGES/messages.po
new file mode 100755 (executable)
index 0000000..1f23a04
--- /dev/null
@@ -0,0 +1,49 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+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: 2004-08-12 11:14-0400\n"
+"Last-Translator: Pedro Lineu Orso <orso@brturbo.com>\n"
+"Language-Team: English\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; 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-php/locale/fr/LC_MESSAGES/messages.mo b/sarg-php/locale/fr/LC_MESSAGES/messages.mo
new file mode 100755 (executable)
index 0000000..7dafa13
Binary files /dev/null and b/sarg-php/locale/fr/LC_MESSAGES/messages.mo differ
diff --git a/sarg-php/locale/fr/LC_MESSAGES/messages.po b/sarg-php/locale/fr/LC_MESSAGES/messages.po
new file mode 100755 (executable)
index 0000000..0cf5405
--- /dev/null
@@ -0,0 +1,43 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: sarg-squidGuard 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2005-02-10 09:30-0300\n"
+"PO-Revision-Date: 2005-02-10 09:30-0300\n"
+"Last-Translator: Jacques Grillot <Jacques.Grillot@grouperdi.com>\n"
+"Language-Team: French\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sarg-squidguard-block2.php:10
+msgid "Could not open the file"
+msgstr "Ne peut pas ouvrir le fichier"
+
+#: sarg-squidguard-block2.php:19
+msgid "Write error"
+msgstr "Erreur d'ecriture"
+
+#: sarg-squidguard-block2.php:23
+msgid "Done!"
+msgstr "Fait!"
+
+#: sarg-squidguard-block2.php:27
+msgid "Return"
+msgstr "revenir"
+
+#: sarg-squidguard-block2.php:30
+msgid " to Sarg."
+msgstr " a Sarg"
+
+#: sarg-squidguard-block.php:29
+msgid "Sarg-SquidGuard - URL Blocking"
+msgstr "Sarg-SquidGuard - Blocage d'URL"
+
+#: sarg-squidguard-block.php:33
+msgid "Choose the rule set where"
+msgstr "Choisissez la regle qui"
+
+#: sarg-squidguard-block.php:36
+msgid "will by added"
+msgstr "sera ajoutee"
diff --git a/sarg-php/locale/pt_BR/LC_MESSAGES/messages.mo b/sarg-php/locale/pt_BR/LC_MESSAGES/messages.mo
new file mode 100755 (executable)
index 0000000..468f709
Binary files /dev/null and b/sarg-php/locale/pt_BR/LC_MESSAGES/messages.mo differ
diff --git a/sarg-php/locale/pt_BR/LC_MESSAGES/messages.po b/sarg-php/locale/pt_BR/LC_MESSAGES/messages.po
new file mode 100755 (executable)
index 0000000..aa9bda0
--- /dev/null
@@ -0,0 +1,49 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+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: 2004-08-12 11:14-0300\n"
+"Last-Translator: Pedro Lineu Orso <pedro.orso@gmail.com>\n"
+"Language-Team: Brazilian_Portuguese\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sarg-squidguard-block2.php:10
+msgid "Could not open the file"
+msgstr "N&atilde;o pode abrir o arquivo"
+
+#: sarg-squidguard-block2.php:19
+msgid "Write error"
+msgstr "Erro na escrita do arquivo"
+
+#: sarg-squidguard-block2.php:23
+msgid "Done!"
+msgstr "Feito!"
+
+#: sarg-squidguard-block2.php:27
+msgid "Return"
+msgstr "Retorna"
+
+#: sarg-squidguard-block2.php:30
+msgid " to Sarg."
+msgstr "ao Sarg"
+
+#: sarg-squidguard-block.php:29
+msgid "Sarg-SquidGuard - URL Blocking"
+msgstr "Sarg-SquidGuard - Bloqueio de URL"
+
+#: sarg-squidguard-block.php:33
+msgid "Choose the rule set where"
+msgstr "Escolha uma regra onde a URL"
+
+#: sarg-squidguard-block.php:36
+msgid "will by added"
+msgstr "ser&aacute; incluida"
diff --git a/sarg-php/locale/ru/LC_MESSAGES/messages.mo b/sarg-php/locale/ru/LC_MESSAGES/messages.mo
new file mode 100755 (executable)
index 0000000..7e996b8
Binary files /dev/null and b/sarg-php/locale/ru/LC_MESSAGES/messages.mo differ
diff --git a/sarg-php/locale/ru/LC_MESSAGES/messages.po b/sarg-php/locale/ru/LC_MESSAGES/messages.po
new file mode 100755 (executable)
index 0000000..9580353
--- /dev/null
@@ -0,0 +1,49 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+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: 2004-11-18 17:31+0300\n"
+"Last-Translator: Michael Stepanenko <mistic@yandex.ru>\n"
+"Language-Team: Russian\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=koi8-r\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"
+
+#: sarg-squidguard-block.php:29
+msgid "Sarg-SquidGuard - URL Blocking"
+msgstr "Sarg-SquidGuard - ÂÌÏËÉÒÏ×ËÁ URL"
+
+#: sarg-squidguard-block.php:33
+msgid "Choose the rule set where"
+msgstr "÷ÙÂÅÒÅÔÅ ÎÁÂÏÒ ÐÒÁ×ÉÌ ËÕÄÁ URL"
+
+#: sarg-squidguard-block.php:36
+msgid "will by added"
+msgstr "ÂÕÄÅÔ ÄÏÂÁ×ÌÅÎ"
index 925b827caadd101e6aea9a0f4c18e8c655e97e11..20efb9adcaf9d8e1df7c8a1351e64bdb2a8a702f 100755 (executable)
@@ -1,8 +1,8 @@
 <?php
 
 /*
- * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
- *                                                            1998, 2005
+ * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
+ *                                                            1998, 2006
  * SARG Squid Analysis Report Generator            http://sarg-squid.org
  *
  * SARG donations:
index 2104bfca676de5e7848fb948c480cccbcb143bba..c403a0d324a931cb2528f68040929e3d88461bf2 100755 (executable)
@@ -1,8 +1,8 @@
 <?php
 
 /*
- * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
- *                                                            1998, 2005
+ * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
+ *                                                            1998, 2006
  * SARG Squid Analysis Report Generator            http://sarg-squid.org
  *
  * SARG donations:
@@ -25,7 +25,7 @@
  *
  */
 
-// Change to squidGuard and sarg config files path
+// Change to squidGuard and sarg config file paths
 $SargConf = "/usr/local/sarg/sarg.conf";
 $squidGuardConf = "/usr/local/squidGuard/squidGuard.conf";
 
index 46a568cdb99dea4f7b95e40abb0e2a308e8ed82f..dac7e1fe9fd720fecdc606b7b840ea902287773f 100755 (executable)
@@ -1,8 +1,8 @@
 <?php
 
 /*
- * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
- *                                                            1998, 2005
+ * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
+ *                                                            1998, 2006
  * SARG Squid Analysis Report Generator            http://sarg-squid.org
  *
  * SARG donations:
index cb63b26d9241c3977db9f98956617bef593b7094..0f7baebed36ce1e395b3bf6407fd71131cf430d3 100755 (executable)
@@ -1,8 +1,8 @@
 <?php
 
 /*
- * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
- *                                                            1998, 2005
+ * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
+ *                                                            1998, 2006
  * SARG Squid Analysis Report Generator            http://sarg-squid.org
  *
  * SARG donations:
index f8621d6b4682ecf5a3052dabda9b5101f95e7388..6010d1594f2ce74ce122da36034be9e2e74f5e03 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * AUTHOR: Pedro Lineu Orso                           rso@brturbo.com.br
- *                                                            1998, 2005
+ * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
+ *                                                            1998, 2006
  * SARG Squid Analysis Report Generator            http://sarg-squid.org
  *
  * SARG donations:
index 316a4ecdea3c090e0d047e13ca8d64c13bdd89b4..165a2fd8238b994066e18bdc928adc749c374a58 100644 (file)
--- a/sarg.conf
+++ b/sarg.conf
@@ -5,6 +5,7 @@
 #              Bulgarian_windows1251
 #              Catalan
 #              Czech
+#              Czech_UTF8
 #              Dutch
 #              English
 #              French
 #      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
+#max_elapsed 28800000
 # 8 Hours
-max_elapsed 28800000
 
 # TAG: report_type type
 #      What kind of reports to generate.
@@ -325,7 +325,7 @@ max_elapsed 28800000
 # TAG: date_time_by bytes|elap
 #      Date/Time reports will use bytes or elapsed time?
 #
-#date_time_by bytes
+#date_time_by elap
 
 # TAG: charset name
 #      ISO 8859 is a full series of 10 standardized multilingual single-byte coded (8bit)
@@ -342,7 +342,9 @@ max_elapsed 28800000
 #              Latin5          - Turkish 
 #              Latin6
 #              Windows-1251
+#              Japan
 #              Koi8-r
+#              UTF-8
 #
 #charset Latin1
 
@@ -392,6 +394,11 @@ max_elapsed 28800000
 #
 #user_report_fields CONNECT BYTES %BYTES IN-CACHE-OUT USED_TIME MILISEC %TIME TOTAL AVERAGE
 
+# TAG: bytes_in_sites_users_report yes|no
+#      Bytes field must be in Site & Users Report ?
+#
+#bytes_in_sites_users_report no
+
 # TAG: topuser_num n
 #      How many users in topsites report. 0 = no limit
 #
@@ -446,8 +453,8 @@ max_elapsed 28800000
 #dansguardian_conf none
 
 # TAG: dansguardian_ignore_date on|off
-#      Use 'on'  use the record even the date range is different from the used squid access.log file.
-#      Use 'off' use the record only if the date range is in the used squid access.log file.
+#      'on'  must use the record even the date range is different from the used in squid access.log file.
+#      'off' must use the record only if the date range is in the irange used in squid access.log file.
 #
 #dansguardian_ignore_date off
 
@@ -583,6 +590,7 @@ max_elapsed 28800000
 # TAG: 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.
+#    If you run sarg with a low privilege user, set to 'none' to disable ulimit
 #
 #ulimit 20000
 
@@ -610,7 +618,7 @@ max_elapsed 28800000
 # TAG: realtime_unauthenticated_records: ignore|show
 #      What to do with unauthenticated records in realtime report.
 #
-# realtime_unauthenticated_records: ignore
+# realtime_unauthenticated_records: show
 
 # TAG: byte_cost value no_cost_limit
 #      Cost per byte.
@@ -620,3 +628,8 @@ max_elapsed 28800000
 #      0 = disable
 #
 # byte_cost 0.01 50000000
+
+# TAG: squid24 on|off
+#      Compatilibity with squid version <= 2.4 when using emulate_http_log on
+#
+# squid24 off
index 52cb2bd59b256c4ba6aba5e210d3019fced86662..f656395a0c7f1149b141ee0ce9eec1a35451c9b4 100644 (file)
@@ -36,23 +36,28 @@ void siteuser()
    char ourl[MAXLEN];
    char nacc[20];
    char nbytes[20];
+   char obytes[20];
    char csort[255];
-   char geral[MAXLEN];
-   char geral2[MAXLEN];
+   char general[MAXLEN];
+   char general2[MAXLEN];
    char per[MAXLEN];
    char html[MAXLEN];
    char sites[MAXLEN];
    char report[MAXLEN];
-   char periodo[100];
-   char ftime[128];
+   char period[100];
    int regs=0;
    int ucount=0;
    char *users;
+   long long int llbytes=0;
 
-   sprintf(geral,"%s/geral",dirname);
-   sprintf(sites,"%s/sites",dirname);
-   sprintf(geral2,"%s/geral2",dirname);
-   sprintf(per,"%s/periodo",dirname);
+   if(strcmp(Privacy,"yes") == 0)
+      return;
+
+   nsitesusers = 0;
+   sprintf(general,"%s/sarg-general",dirname);
+   sprintf(sites,"%s/sarg-sites",dirname);
+   sprintf(general2,"%s/sarg-general2",dirname);
+   sprintf(per,"%s/sarg-period",dirname);
    sprintf(report,"%s/siteuser.html",dirname);
 
    if ((fp_in = fopen(per, "r")) == 0) {
@@ -60,14 +65,14 @@ void siteuser()
       exit(1);
    }
 
-   fgets(periodo,sizeof(periodo),fp_in);
+   fgets(period,sizeof(period),fp_in);
    fclose(fp_in);
 
-   sprintf(csort,"sort -k 4,4 -k 1,1 -o '%s' '%s'",geral2,geral);
+   sprintf(csort,"sort -k 4,4 -k 1,1 -o '%s' '%s'",general2,general);
    system(csort);
 
-   if((fp_in=fopen(geral2,"r"))==NULL) {
-     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],geral2);
+   if((fp_in=fopen(general2,"r"))==NULL) {
+     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],general2);
      exit(1);
    }
 
@@ -76,30 +81,12 @@ void siteuser()
      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);
+   fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
    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 class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(url,fp_ou);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou);
-      fputs("</table>\n",fp_ou);
-   }
+   if(strlen(FontFace) > 0) fprintf(fp_ou,"<font face=%s>\n",FontFace);
+   fprintf(fp_ou,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   if(strlen(LogoImage) > 0) fprintf(fp_ou, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
    if(strcmp(IndexTree,"date") == 0)
       show_sarg(fp_ou, "../../..");
@@ -110,21 +97,22 @@ void siteuser()
    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);
+   sprintf(url,"<tr><td class=\"header3\">%s: %s</td></tr>\n",text[89],period);
    fputs(url,fp_ou);
-   sprintf(url,"<tr><td class=\"header3\">%s</td></tr>\n",text[85]);
+   sprintf(url,"<tr><th class=\"header3\">%s</th></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]);
+   if(strncmp(strlow(BytesInSitesUsersReport),"yes",3) == 0)
+      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[100],text[91],text[93],text[103]);
+   else 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';
+   obytes[0]='\0';
 
    if((users=(char *) malloc(204800))==NULL){
       fprintf(stderr, "SARG: ERROR: %s",text[87]);
@@ -165,11 +153,13 @@ void siteuser()
          ip2name(user);
 
       getword(nacc,buf,' ');
+      if (atoi(nacc) > 0) nsitesusers = 1;
       getword(nbytes,buf,' ');
       getword(url,buf,' ');
 
       if(!regs) {
          strcpy(ourl,url);
+         strcpy(obytes,nbytes);
          regs++;
       }
       
@@ -193,21 +183,28 @@ void siteuser()
          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);
+      if(strcmp(url,ourl) != 0 && nsitesusers) {
+         if(strncmp(strlow(BytesInSitesUsersReport),"yes",3) == 0) {
+            llbytes=my_atoll(obytes);
+            sprintf(wwork2,"%s",fixnum(llbytes,1));
+            sprintf(html,"<tr><td class=\"data\">%d</td><td class=\"data2\">%s<a href=\"http://%s\">%s</td><td class=\"data\">%s</td><td class=\"data2\">%s</td></tr>\n",regs,BlockImage,ourl,ourl,wwork2,users);
+         } else 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);
+         strcpy(obytes,nbytes);
       }
    }
 
-   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);
+   if(nsitesusers) {
+      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);
+   unlink(general2);
 
    fputs("</table></center>\n",fp_ou);
 
index c38c9ac57f74dc453612f6ae518ab692d8921550..50f9e46cad910e8cbf9f981bf1f67850ee62681e 100644 (file)
@@ -39,7 +39,7 @@ void smartfilter_report()
    char per[MAXLEN];
    char sites[MAXLEN];
    char report[MAXLEN];
-   char periodo[100];
+   char period[100];
    char ip[MAXLEN];
    char user[MAXLEN];
    char ouser[MAXLEN];
@@ -58,9 +58,9 @@ void smartfilter_report()
    strup(smartheader);
 
    sprintf(smart_in,"%s/smartfilter.unsort",dirname);
-   sprintf(sites,"%s/sites",dirname);
+   sprintf(sites,"%s/sarg-sites",dirname);
    sprintf(smart_ou,"%s/smartfilter.log",dirname);
-   sprintf(per,"%s/periodo",dirname);
+   sprintf(per,"%s/sarg-period",dirname);
    sprintf(report,"%s/smartfilter.html",dirname);
 
    if ((fp_in = fopen(per, "r")) == 0) {
@@ -68,7 +68,7 @@ void smartfilter_report()
       exit(1);
    }
 
-   fgets(periodo,sizeof(periodo),fp_in);
+   fgets(period,sizeof(period),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);
@@ -85,47 +85,23 @@ void smartfilter_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);
+   fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
    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(FontFace) > 0) fprintf(fp_ou,"<font face=%s>\n",FontFace);
+   fprintf(fp_ou,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
    fputs("<center><table cellpadding=0 cellspacing=0>\n",fp_ou);
+   if(strlen(LogoImage) > 0) fprintf(fp_ou, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
-   if(strlen(LogoImage) > 0) {
-      fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou);
-      sprintf(url,"<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(url,fp_ou);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou);
-      fputs("</table>\n",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);
+   fprintf(fp_ou,"<tr><th align=center><b><font color=%s size=+1>%s</font></b></th></tr>\n",TiColor,Title);
+   fprintf(fp_ou,"<tr><td align=center bgcolor=%s><font size=%s>%s: %s</font></td></tr>\n",HeaderBgColor,FontSize,text[89],period);
+   fprintf(fp_ou,"<tr><th bgcolor=%s align=center><font size=%s>%s</font></th></tr>\n",HeaderBgColor,FontSize,text[116]);
    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);
+   fprintf(fp_ou,"<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);
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
       getword(user,buf,' ');
@@ -175,16 +151,10 @@ void smartfilter_report()
          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);
+         if(strlen(LogoImage) > 0) fprintf(fp_user,"<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);
+         fprintf(fp_user,"<tr><th align=center><b><font color=%s size=+1>%s</font></b></th></tr>\n",TiColor,Title);
+         fprintf(fp_user,"<tr><td align=center bgcolor=%s><font size=%s>%s: %s</font></td></tr>\n",HeaderBgColor,FontSize,text[89],period);
+         fprintf(fp_user,"<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("</table></center>\n",fp_user);
          fputs("<center><table cellpadding=0 cellspacing=2>\n",fp_user);
          fputs("<tr><td></td></tr>\n",fp_user);
diff --git a/sort.c b/sort.c
index 736968b4a509c2befd3eae99ad3be9ae5fbf2bef..4813a666ed4ff4f4f3af495f5cea759887204a92 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -118,6 +118,11 @@ void sort_users_log(char *tmp, int debug)
    char wname2[MAXLEN];
    char wdname[MAXLEN];
 
+   if(debug) {
+      sprintf(msg,"%s",text[138]);
+      debuga(msg);
+   }
+
    sprintf(wtmp,"%s/sarg",tmp);
 
    dirp = opendir(wtmp);
index bf5eb116046e8e5f645107a54c7579133cfb1520..59e378cc34439dc616800912f4aa54652da75f48 100644 (file)
 
 #include "include/conf.h"
 
+static char **files_done = NULL;
+static int nfiles_done = 0;
+
+
 void read_log(char *wentp, FILE *fp_ou)
 {
    FILE *fp_in = NULL;
@@ -34,6 +38,7 @@ void read_log(char *wentp, FILE *fp_ou)
    char list[MAXLEN];
    char wdata[127];
    int  idata=0;
+   int  i;
 
    if(debug) {
       strcpy(buf,text[7]);
@@ -42,6 +47,44 @@ void read_log(char *wentp, FILE *fp_ou)
       sprintf(msg,"%s squidGuard %s: %s",urly,buf,wentp);
       debuga(msg);
    }
+
+   /* With squidGuard, you can log groups in only one log file.
+      We must parse each log files only one time.  Example :
+      dest porn {
+          domainlist porn/domains
+          urllist    porn/urls
+          log file1.log
+      }
+      dest aggressive {
+          domainlist aggressive/domains
+          urllist    aggressive/urls
+          log file2.log
+      }
+      dest audio-video {
+          domainlist audio-video/domains
+          urllist    audio-video/urls
+          log file1.log
+      }
+   */
+   for (i=0; i<nfiles_done; i++)
+      if (!strcmp(wentp, files_done[i])) return;
+   
+   nfiles_done++;
+   files_done = realloc(files_done, nfiles_done*sizeof(char *));
+   if (!files_done) {
+       perror("parse squidGuard - realloc");
+       exit(EXIT_FAILURE);
+   }
+   files_done[nfiles_done-1] = strdup(wentp);
+   if (!files_done[nfiles_done-1]) {
+       perror("parse squidGuard - strdup");
+       exit(EXIT_FAILURE);
+   }
+
+   if ((fp_in=fopen(wentp,"r"))==NULL) {
+         fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],wentp);
+       exit(1);
+   }
    
    if ((fp_in=fopen(wentp,"r"))==NULL) {
       fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],wentp);
@@ -128,6 +171,8 @@ int squidguard_log()
    char ip[30];
    int  x, y;
 
+   str2 = user;
+
    if(strlen(SquidGuardConf) < 1 && strlen(SquidGuardLogAlternate) < 1)
      return;
 
@@ -147,28 +192,28 @@ int squidguard_log()
 
    if(strcmp(SquidguardIgnoreDate,"on") == 0) {
       if(strcmp(df,"e") == 0) {
-         strncpy(day,periodo,2);
-         strncpy(mon,periodo+2,3);
-         strncpy(year,periodo+5,4);
+         strncpy(day,period,2);
+         strncpy(mon,period+2,3);
+         strncpy(year,period+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);
+         strncpy(day,period+10,2);
+         strncpy(mon,period+12,3);
+         strncpy(year,period+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);
+         strncpy(day,period+7,2);
+         strncpy(mon,period+4,3);
+         strncpy(year,period,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);
+         strncpy(day,period+17,2);
+         strncpy(mon,period+14,3);
+         strncpy(year,period+10,4);
          conv_month(mon);
          sprintf(warea,"%s%s%s",year,mon,day);
          duntil=atoi(warea);
@@ -198,12 +243,25 @@ int squidguard_log()
             str=str+3;
             str2[0]='\0';
             y=0;
+            while(*str == ' ')
+              str++;
+           if (str == (char *) strstr(str, "anonymous"))
+               str+=9;
+
             for (x=0; x<=strlen(str); x++) {
                if (str[x] != ' ' && str[x] != '\t') {
                   str2[y] = str[x];
                   y++;
                }
             }
+            if(strchr(str2,' ') != 0) {
+               getword(warea,str2,' ');
+               strcpy(str2,warea);
+            }
+            if(strchr(str2,'#') != 0) {
+               getword(warea,str2,'#');
+               strcpy(str2,warea);
+            }
             sprintf(wentp,"%s/%s",logdir,str2);
             read_log(wentp,fp_ou);
          }
index 6bd0426c941ca6b1a748bed530f838aeea180aa6..41eb4688bba0ebe042c684707198f4d443743c64 100644 (file)
@@ -37,7 +37,7 @@ void squidguard_report()
    char squidguard_ou[MAXLEN];
    char per[MAXLEN];
    char report[MAXLEN];
-   char periodo[100];
+   char period[100];
    char ip[MAXLEN];
    char rule[255];
    char oip[MAXLEN];
@@ -59,7 +59,7 @@ void squidguard_report()
       return;
    }
 
-   sprintf(per,"%s/periodo",dirname);
+   sprintf(per,"%s/sarg-period",dirname);
    sprintf(report,"%s/squidguard.html",dirname);
 
    if ((fp_in = fopen(per, "r")) == 0) {
@@ -67,7 +67,7 @@ void squidguard_report()
       exit(1);
    }
 
-   fgets(periodo,sizeof(periodo),fp_in);
+   fgets(period,sizeof(period),fp_in);
    fclose(fp_in);
 
    if((fp_in=fopen(squidguard_in,"r"))==NULL) {
@@ -80,30 +80,12 @@ void squidguard_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);
+   fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
    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 class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(url,fp_ou);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou);
-      fputs("</table>\n",fp_ou);
-   }
+   if(strlen(FontFace) > 0) fprintf(fp_ou,"<font face=%s>\n",FontFace);
+   fprintf(fp_ou,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   if(strlen(LogoImage) > 0) fprintf(fp_ou, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
    if(strcmp(IndexTree,"date") == 0)
       show_sarg(fp_ou, "../../..");
@@ -113,9 +95,9 @@ void squidguard_report()
    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);
+   sprintf(url,"<tr><td class=\"header\">%s: %s</td></tr>\n",text[89],period);
    fputs(url,fp_ou);
-   sprintf(url,"<tr><th class=\"header3\">%s %s</th></tr>\n",text[120],text[55]);
+   sprintf(url,"<tr><th class=\"header3\">%s</th></tr>\n",text[120]);
    fputs(url,fp_ou);
    fputs("</table></center>\n",fp_ou);
 
index 0cf74a07ef5de4016fa4947ddeea4aa9732e53a0..3f2eed0554578439ba5c9c55d91e73e45e0ef1fa 100644 (file)
@@ -40,14 +40,13 @@ void topsites()
    char ttnbytes[20];
    char ttntime[20];
    char csort[255];
-   char geral[MAXLEN];
-   char geral2[MAXLEN];
-   char geral3[MAXLEN];
+   char general[MAXLEN];
+   char general2[MAXLEN];
+   char general3[MAXLEN];
    char per[MAXLEN];
    char sites[MAXLEN];
    char report[MAXLEN];
-   char periodo[100];
-   char ftime[128];
+   char period[100];
    char sortf[10];
    char sortt[10];
    long long int tnacc=0;
@@ -56,12 +55,14 @@ void topsites()
    long long int twork1=0, twork2=0, twork3=0;
    int regs=0;
 
+   if(strcmp(Privacy,"yes") == 0)
+      return;
 
-   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(general,"%s/sarg-general",dirname);
+   sprintf(sites,"%s/sarg-sites",dirname);
+   sprintf(general2,"%s/sarg-general2",dirname);
+   sprintf(general3,"%s/sarg-general3",dirname);
+   sprintf(per,"%s/sarg-period",dirname);
 
    if (strstr(ReportType,"topusers") == 0)
       sprintf(report,"%s/index.html",dirname);
@@ -73,19 +74,19 @@ void topsites()
       exit(1);
    }
 
-   fgets(periodo,sizeof(periodo),fp_in);
+   fgets(period,sizeof(period),fp_in);
    fclose(fp_in);
 
-   sprintf(csort,"sort -k 4,4 -o '%s' '%s'",geral2,geral);
+   sprintf(csort,"sort -k 4,4 -o '%s' '%s'",general2,general);
    system(csort);
 
-   if((fp_in=fopen(geral2,"r"))==NULL) {
-     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],geral2);
+   if((fp_in=fopen(general2,"r"))==NULL) {
+     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],general2);
      exit(1);
    }
 
-   if((fp_ou=fopen(geral3,"w"))==NULL) {
-     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],geral3);
+   if((fp_ou=fopen(general3,"w"))==NULL) {
+     fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],general3);
      exit(1);
    }
 
@@ -135,7 +136,7 @@ void topsites()
 
    fclose(fp_in);
    fclose(fp_ou);
-   unlink(geral2);
+   unlink(general2);
 
    strlow(TopsitesSortField);
    strlow(TopsitesSortType);
@@ -149,11 +150,11 @@ void topsites()
    if(strcmp(TopsitesSortType,"d") == 0)
       strcpy(sortt,"-r");
 
-   sprintf(csort,"sort %s -k %s -o '%s' '%s'",sortt,sortf,sites,geral3);
+   sprintf(csort,"sort %s -k %s -o '%s' '%s'",sortt,sortf,sites,general3);
    system(csort);
 
-   unlink(geral2);
-   unlink(geral3);
+   unlink(general2);
+   unlink(general3);
 
    if((fp_in=fopen(sites,"r"))==NULL) {
      fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],sites);
@@ -167,25 +168,11 @@ void topsites()
 
    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);
+   fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
    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 class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(url,fp_ou);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou);
-      fputs("</table>\n",fp_ou);
-   }
+   fprintf(fp_ou,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   if(strlen(LogoImage) > 0) fprintf(fp_ou, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
    if(strcmp(IndexTree,"date") == 0)
       show_sarg(fp_ou,"../../..");
@@ -196,26 +183,29 @@ void topsites()
    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);
+   sprintf(url,"<tr><td class=\"header3\">%s: %s</td></tr>\n",text[89],period);
    fputs(url,fp_ou);
-   sprintf(url,"<tr><td class=\"header3\">%s %s %s</td></tr>\n",text[83],TopSitesNum,text[84]);
+   sprintf(url,"<tr><th class=\"header3\">%s %s %s</th></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> \
+   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[100],text[91],text[92],text[93],text[99]);
    fputs(url,fp_ou);
 
    regs=1;
+   ntopsites = 0;
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
       if(regs>atoi(TopSitesNum))
          break;
       getword(nacc,buf,' ');
+      if (atoi(nacc) == 0) continue;
+
       getword(nbytes,buf,' ');
       getword(ntime,buf,' ');
       getword(url,buf,' ');
@@ -226,7 +216,7 @@ void topsites()
 
       sprintf(wwork1,"%s",fixnum(twork1,1));
       sprintf(wwork2,"%s",fixnum(twork2,1));
-      sprintf(wwork3,"%s",fixnum(twork3,1));
+      sprintf(wwork3,"%s",fixtime(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);
index 55a9795f547587f815359ac669ea282cc651a87d..829c9126d7033b71612e1e8e16730d13b701c610 100644 (file)
--- a/topuser.c
+++ b/topuser.c
@@ -36,15 +36,14 @@ int topuser()
    float perc2=0.00;
    float inperc=0.00, ouperc=0.00;
    int posicao=0;
-   char olduser[MAXLEN], csort[MAXLEN], periodo[MAXLEN], arqper[MAXLEN];
+   char olduser[MAXLEN], csort[MAXLEN], period[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 ip[MAXLEN], time[30], date[30], elap[30], incac[30], oucac[30];
    char ipantes[MAXLEN], nameantes[MAXLEN];
    char sfield[10]="2,2";
    char order[255]="-r";
    char wheader[512]="";
-   char ftime[128];
    int  totuser=0;
    int  topcount=0;
    char *s;
@@ -57,12 +56,13 @@ int topuser()
    strcpy(top2,dirname);
    strcpy(top3,dirname);
    strcpy(tusr,dirname);
-   strcat(wger,"/geral");
+   strcat(wger,"/sarg-general");
    strcat(top1,"/top");
    strcat(top2,"/top.tmp");
-   strcat(tusr,"/users");
+   strcat(tusr,"/sarg-users");
    strcat(top3,"/index.html");
 
+   ntopuser = 0;
    if((fp_in=fopen(wger,"r"))==NULL) {
     fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],wger);
     exit(1);
@@ -73,16 +73,7 @@ int topuser()
     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);
+   fscanf(fp_in,"%s%s%s%s%s%s%s%s%s%s",user,nacc,nbytes,url,ip,time,date,elap,incac,oucac);
 
    strcpy(olduser,user);
    totuser=1;
@@ -119,16 +110,7 @@ int topuser()
       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);
+      fscanf(fp_in,"%s%s%s%s%s%s%s%s%s%s",user,nacc,nbytes,url,ip,time,date,elap,incac,oucac);
 
       if(strcmp(user,"TOTAL") == 0)
          continue;
@@ -199,107 +181,55 @@ int topuser()
  */
 
    strcpy(arqper,dirname);
-   strcat(arqper,"/periodo");
+   strcat(arqper,"/sarg-period");
 
    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);
+   fgets(period,sizeof(period),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);
+   fprintf(fp_top3, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
    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 class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(preg,fp_top3);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_top3);
-      fputs("</table>\n",fp_top3);
-   }
+   fprintf(fp_top3,"<body class=\"body\">");
+   if(strlen(LogoImage) > 0) fprintf(fp_top3, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
    if(strcmp(IndexTree,"date") == 0)
       show_sarg(fp_top3, "../../..");
    else
       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);
+   fprintf(fp_top3,"<tr><th align=\"center\" class=\"title\">%s</th></tr>\n",Title);
 
-   sprintf(preg,"<tr><td class=\"header3\">%s: %s</td></tr>\n",text[89],periodo);
-   fputs(preg,fp_top3);
+   fprintf(fp_top3,"<tr><td class=\"header3\">%s: %s</td></tr>\n",text[89],period);
    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);
+   fprintf(fp_top3,"<tr><td class=\"header3\">%s</td></tr>\n",wheader);
+   fprintf(fp_top3,"<tr><th class=\"header3\">%s</th></tr>\n",text[137]);
 
    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 (strstr(ReportType,"downloads") != 0 && 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 (strstr(ReportType,"denied") != 0 && 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 (strstr(ReportType,"auth_failures") != 0 && 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);
+   if(strstr(ReportType,"topsites") != 0 && strcmp(Privacy,"yes") != 0) fprintf(fp_top3,"<tr><td class=\"link\" colspan=11><a href=\"topsites.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text[119]);
+   if(strstr(ReportType,"sites_users") != 0 && strcmp(Privacy,"yes") != 0) fprintf(fp_top3,"<tr><td class=\"link\" colspan=11><a href=\"siteuser.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text[85]);
+   if(dansguardian_count) fprintf(fp_top3,"<tr><td class=\"link\" colspan=11><a href=\"dansguardian.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text[128]);
+   if(squidguard_count) fprintf(fp_top3,"<tr><td class=\"link\" colspan=11><a href=\"squidguard.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text[122]);
+   if (strstr(ReportType,"downloads") != 0 && download_count && strcmp(Privacy,"yes") != 0 && ndownload) fprintf(fp_top3,"<tr><td class=\"link\" colspan=11><a href=\"download.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text[125]);
+   if (strstr(ReportType,"denied") != 0 && denied_count && strcmp(Privacy,"yes") != 0) fprintf(fp_top3,"<tr><td class=\"link\" colspan=11><a href=\"denied.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text[118]);
+   if (strstr(ReportType,"auth_failures") != 0 && authfail_count && strcmp(Privacy,"yes") != 0) fprintf(fp_top3,"<tr><td class=\"link\" colspan=11><a href=\"authfail.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text[117]);
+   if(smartfilter) fprintf(fp_top3,"<tr><td class=\"link\" colspan=11><a href=\"smartfilter.html\"><font class=\"link\">%s</font></a><font class=\"text\"></font></td></tr>\n",text[116]);
+   fputs("<tr><td></td></tr>\n",fp_top3);
 
    if (strstr(ReportType,"topuser") == 0) {
       fputs("</body>\n</html>\n",fp_top3);
-      if (fp_top3)
-         fclose (fp_top3);
+      if (fp_top3) fclose (fp_top3);
       return;
    }
    strcpy(val1,text[100]);
@@ -364,18 +294,16 @@ int topuser()
       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);
+   fprintf(fp_top3,"<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);
+   ntopuser = 0;
 
+   fscanf(fp_top1,"%s%s%s%s%s%s",user,nbytes,nacc,elap,incac,oucac);
    while(!feof(fp_top1)) {
+      if(atoi(nacc) < 1) {
+         fscanf(fp_top1,"%s%s%s%s%s%s",user,nbytes,nacc,elap,incac,oucac);
+         continue;
+      } else ntopuser = 1;
       if(atoi(TopUsersNum) > 0 && topcount >= atoi(TopUsersNum)) goto final;
       strcpy(user2,user);
       tnbytes=my_atoll(nbytes);
@@ -445,7 +373,8 @@ int topuser()
         unlink(val1);
       }
 
-      if(UserTabFile[0] != '\0' && strstr(user2,".") != 0) {
+//      if(UserTabFile[0] != '\0' && strstr(user2,".") != 0) {
+      if(UserTabFile[0] != '\0' && strcmp(user2,"TOTAL") != 0) {
          sprintf(warea,":%s:",user2);
          if((str=(char *) strstr(userfile,warea)) != (char *) NULL ) {
             z1=0;
@@ -459,24 +388,22 @@ int topuser()
          } 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)
+      if((strcmp(Ip2Name,"yes") == 0) && 
+        ((str=(char *) strstr(name, ".")) != (char *) NULL) && 
+       ((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(wwork3,"%s",fixnum2(tnelap,1));
 
       sprintf(val1,"%d",posicao);
 #ifdef HAVE_GD
-      sprintf(val2,"%s<img src=\"%s/graph.png\" border=\"0\" title=\"%s %s\"></a>&nbsp;%s<img src=\"%s/datetime.png\" border=\"0\" title=\"%s %s\">\n",href3,ImageFile,text[126],text[55],href2,ImageFile,ltext110,text[55]);
+      sprintf(val2,"%s<img src=\"%s/graph.png\" border=\"0\" title=\"%s\"></a>&nbsp;%s<img src=\"%s/datetime.png\" border=\"0\" title=\"%s %s\">\n",href3,ImageFile,text[126],href2,ImageFile,ltext110,text[55]);
 #else
-      sprintf(val2,"%s<img src=\"%s/datetime.png\" border=\"0\" title=\"%s %s\">\n",href2,ImageFile,ltext110,text[55]);
+      sprintf(val2,"%s<img src=\"%s/datetime.png\" border=\"0\" title=\"%s\">\n",href2,ImageFile,ltext110);
 #endif
 
       sprintf(val3,"%3.2f%%",perc);
@@ -516,6 +443,7 @@ int topuser()
          bzero(val3, 255);
          bzero(hbc5, 30);
       }
+
       if(strstr(TopUserFields,"IN-CACHE-OUT") == 0) {
          bzero(val4, 255);
          bzero(hbc6, 30);
@@ -562,7 +490,7 @@ int topuser()
 
         sprintf(wwork1,"%s",fixnum(ttnacc,1));
         sprintf(wwork2,"%s",fixnum(ttnbytes,1));
-        sprintf(wwork3,"%s",fixnum(ttnelap,1));
+        sprintf(wwork3,"%s",fixnum2(ttnelap,1));
 
          strcpy(hbc1,"class=\"header2\"");
          strcpy(hbc2,"class=\"header2\"");
@@ -614,23 +542,17 @@ int topuser()
 
       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);
+      fscanf(fp_top1,"%s%s%s%s%s%s",user,nbytes,nacc,elap,incac,oucac);
    }
 
-   if(ttnbytes) {
-      tnbytes=ttnbytes / totuser;
-   } else tnbytes=0;
+   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));
+   sprintf(wwork3,"%s",fixnum2(twork2,1));
 
    if(strstr(TopUserFields,"CONNECT") == 0) {
       bzero(wwork1, 255);
@@ -655,12 +577,9 @@ int topuser()
       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(ntopuser) {
+      if((strstr(ReportType,"date_time") != 0 && strstr(TopUserFields,"AVERAGE") != 0)) fprintf(fp_top3,"<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);
+      else if(strstr(TopUserFields,"AVERAGE") != 0) fprintf(fp_top3,"<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);
    }
 
    if(strlen(UserAgentLog) > 0) {
@@ -669,8 +588,7 @@ int topuser()
       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);
+   fputs("</table></center>",fp_top3);
 
    show_info(fp_top3);
 
@@ -683,8 +601,7 @@ final:
       exit(1);
    }
 
-   sprintf(preg,"%d\n",totuser);
-   fputs(preg,fp_ou);
+   fprintf(fp_ou,"%d\n",totuser);
 
    fputs("</body>\n</html>\n",fp_top3);
    fclose(fp_top3);
index 476593fd084550469a568e5425ebda2808cd295b..6895b6110686056f290214ae40ad6a30dd066628 100644 (file)
--- a/totday.c
+++ b/totday.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void totaliza_day(const char *tmp, char *user, int indexonly)
+void day_totalize(const char *tmp, char *user, int indexonly)
 {
 
    FILE *fp_in, *fp_ou;
@@ -88,7 +88,7 @@ void totaliza_day(const char *tmp, char *user, int indexonly)
          regs++;
       }
 
-      if(strcmp(hora,ohora) != 0) {
+      if(strcmp(hora,ohora) != 0 || strcmp(data,odata) != 0) {
          if(tused > telap)
             tused=telap;
 
index a6fed1b9c8b2aff3c2963a73b38e20297b489cd9..5334d48b946874e285d7823d80c508ab305c69fb 100644 (file)
--- a/totger.c
+++ b/totger.c
@@ -40,23 +40,14 @@ int totalger(const char *dirname, int debug, const char *outdir)
    char incac[15], oucac[15];
 
    strcpy(wger,dirname);
-   strcat(wger,"/geral");
+   strcat(wger,"/sarg-general");
 
    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);
+   fscanf(fp_in,"%s%s%s%s%s%s%s%s%s%s",user,nacc,nbytes,url,ip,hora,data,elap,incac,oucac);
 
    while(!feof(fp_in))
    {
@@ -66,22 +57,13 @@ int totalger(const char *dirname, int debug, const char *outdir)
       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);
+      fscanf(fp_in,"%s%s%s%s%s%s%s%s%s%s",user,nacc,nbytes,url,ip,hora,data,elap,incac,oucac);
    }
 
    fclose(fp_in);
 
    strcpy(wger,dirname);
-   strcat(wger,"/geral");
+   strcat(wger,"/sarg-general");
 
    if((fp_ou=fopen(wger,"a"))==NULL) {
     fprintf(stderr, "SARG: (totger) %s: %s\n",text[45],wger);
diff --git a/usage.c b/usage.c
index cadea24e887b6dae9a79c291b99ab2fd1ba4d25c..3a7620d26ff56734202f5c571d625b791e0702a6 100644 (file)
--- a/usage.c
+++ b/usage.c
@@ -49,7 +49,7 @@ void usage(char *prog)
   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@penguintech.com.br\n",PGM,VERSION,text[78]);
+  fprintf(stderr, "\n\t%s-%s %s Pedro Lineu Orso -    pedro.orso@gmail.com\n",PGM,VERSION,text[78]);
   fprintf(stderr, "\thttp://sarg.sourceforge.net\n");
   fprintf(stderr, "\n\tPease donate to the sarg project:");
   fprintf(stderr, "\n\t\thttp://sarg.sourceforge.net/donations.php\n\n");
index bbb7a53782fa56da5788414622b43ff415375e7e..fe6dfbd891767dc197d839acabf59671e1e33ca3 100644 (file)
@@ -29,20 +29,14 @@ 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 ip[MAXLEN], data[MAXLEN], agent[MAXLEN], user[MAXLEN];
+   char ipbefore[MAXLEN], namebefore[MAXLEN];
+   char tagent[MAXLEN];
+   char user_old[MAXLEN]="$#%0a3bc6";
+   char agent_old[MAXLEN]="$#%0a3bc6";
    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';
@@ -51,12 +45,12 @@ void useragent()
    user[0]='\0';
    user_old[0]='\0';
    agent_old[0]='\0';
-   ipantes[0]='\0';
-   nameantes[0]='\0';
+   ipbefore[0]='\0';
+   namebefore[0]='\0';
 
-   sprintf(hfile,"%s/%s/useragent.html", outdir,periodo);
+   sprintf(hfile,"%s/%s/useragent.html", outdir,period);
 
-   sprintf(tmp,"%s/squagent.unsort",TempDir);
+   sprintf(tmp3,"%s/squagent.unsort",TempDir);
    sprintf(tmp2,"%s/squagent.log",TempDir);
 
    if((fp_in=fopen(UserAgentLog,"r"))==NULL) {
@@ -64,8 +58,8 @@ void useragent()
       exit(1);
    }
 
-   if((fp_ou=fopen(tmp,"w"))==NULL) {
-      fprintf(stderr, "SARG: (email) %s: %s\n",text[45],tmp);
+   if((fp_ou=fopen(tmp3,"w"))==NULL) {
+      fprintf(stderr, "SARG: (email) %s: %s\n",text[45],tmp3);
       exit(1);
    }
 
@@ -84,6 +78,11 @@ void useragent()
       getword(agent,buf,'"');
       getword(agent,buf,'"');
 
+      strcpy(warea,agent);
+      strup(warea);
+      if(strstr(warea,"SCRIPT") != 0 || strstr(warea,"ONLOAD") != 0)
+         baddata();
+
       if(strlen(buf)) {
          getword(user,buf,' ');
          getword(user,buf,'\n');
@@ -118,10 +117,10 @@ void useragent()
       debuga(msg);
    }
 
-   sprintf(csort,"sort -n -t '\\' -k 4,4 -k 3,3 -k 2,2 -k 1,1 -o '%s' '%s'",tmp2,tmp);
+   sprintf(csort,"sort -n -t '\\' -k 4,4 -k 3,3 -k 2,2 -k 1,1 -o '%s' '%s'",tmp2,tmp3);
    system(csort);
 
-   unlink(tmp);
+   unlink(tmp3);
 
    if((fp_in=fopen(tmp2,"r"))==NULL) {
       fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp2);
@@ -136,29 +135,11 @@ void useragent()
    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);
+   fprintf(fp_ht, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
    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 class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(html,fp_ht);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ht);
-      fputs("</table>\n",fp_ht);
-   }
+   if(strlen(FontFace) > 0) fprintf(fp_ht,"<font face=%s>\n",FontFace);
+   fprintf(fp_ht,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
+   if(strlen(LogoImage) > 0) fprintf(fp_ht, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
    if(strcmp(IndexTree,"date") == 0)
       show_sarg(fp_ht, "../../..");
@@ -187,11 +168,11 @@ void useragent()
       getword(ip,buf,'\\');
 
       if(strcmp(Ip2Name,"yes") == 0) {
-         if(strcmp(ip,ipantes) != 0) {
-            strcpy(ipantes,ip);
+         if(strcmp(ip,ipbefore) != 0) {
+            strcpy(ipbefore,ip);
             ip2name(ip);
-            strcpy(nameantes,ip);
-         } else strcpy(ip,nameantes);
+            strcpy(namebefore,ip);
+         } else strcpy(ip,namebefore);
       }
 
       getword(data,buf,'\\');
@@ -216,13 +197,13 @@ void useragent()
    fclose(fp_in);
    fclose(fp_ou);
 
-   sprintf(csort,"sort -n -t '\\' -k 3,3 -o '%s' '%s'",tmp,tmp2);
+   sprintf(csort,"sort -n -t '\\' -k 3,3 -o '%s' '%s'",tmp3,tmp2);
    system(csort);
 
    unlink(tmp2);
 
-   if((fp_in=fopen(tmp,"r"))==NULL) {
-      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp);
+   if((fp_in=fopen(tmp3,"r"))==NULL) {
+      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp3);
       exit(1);
    }
 
@@ -262,15 +243,15 @@ void useragent()
    fclose(fp_in);
    fclose(fp_ou);
 
-   unlink(tmp);
+   unlink(tmp3);
 
-   sprintf(csort,"sort -n -r -k 1,1 -o '%s' '%s'",tmp,tmp2);
+   sprintf(csort,"sort -n -r -k 1,1 -o '%s' '%s'",tmp3,tmp2);
    system(csort);
 
    unlink(tmp2);
 
-   if((fp_in=fopen(tmp,"r"))==NULL) {
-      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp);
+   if((fp_in=fopen(tmp3,"r"))==NULL) {
+      fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp3);
       exit(1);
    }
 
@@ -306,7 +287,7 @@ void useragent()
    fclose(fp_in);
    fclose(fp_ht);
 
-   unlink(tmp); 
+   unlink(tmp3); 
 
    return;
       
diff --git a/util.c b/util.c
index 0eace43e0a0f65e9e34ea6610eb9a76d8259fe59..f4c1941844587e22255ef83260962e53aac12293 100644 (file)
--- a/util.c
+++ b/util.c
 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 fgetword(char *word, char *line, int stop)
+{
+    //VARIANT N1
+    int x;
+    
+    for (x=0; line[x] && (line[x] != stop); x++) word[x] = line[x];
+    word[x] = '\0';
+
+    //VARIANT N2
+    char *tchar;
+    int difflen;
+    
+    tchar = strchr(line, stop);
+    if (tchar == NULL) strcpy(word, line);
+    else
+    {
+       difflen = tchar - line;
+       strncpy(word, line, difflen);
+       word[difflen] = '\0';
+    }
+}*/
+
 void getword(char *word, char *line, int stop)
 {
-  int x = 0,y;
-  int loop=0;
+  int x = 0, y = 0;
   int limit=10000;
   char wline[MAXLEN];
 
-  strcpy(wline,line);
+  //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];
+  for(x=0; line[x] && (line[x] != stop ) && x<limit; x++) word[x] = line[x];
+  if(x == 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] = '\0';
-  if(line[x]) ++x;
-    y=0;
+  
+  if (line[x]) ++x;
 
   while((line[y++] = line[x++]));
 }
 
 char *  getword2(char *word, char *line, int stop)
 {
-  int x = 0 , y;
+  int x = 0;
   int limit=MAXLEN;
 
   if(strlen(line) < 3) {
@@ -76,9 +94,7 @@ char *  getword2(char *word, char *line, int stop)
   }
 
   // printf( "IN Buffer <%s>\n" , line ) ;
-  for(x=0;((line[x]) && (line[x] != stop && limit ));x++ , limit-- ) {
-     word[x] = line[x];
-  }
+  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);
@@ -95,14 +111,11 @@ char *  getword2(char *word, char *line, int stop)
 
 void getword3(char *word, char *line, int stop)
 {
-  int x = 0,y;
-  int loop=0;
+  int x = 0, y = 0;
 
-  for(x=0;((line[x]) && (line[x] != stop ));x++)
-     word[x] = line[x];
+  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++]));
 }
 
@@ -322,7 +335,7 @@ void name_month(char *month)
 }
 
 
-void fixper(char *tbuf, char *periodo, char *duntil)
+void fixper(char *tbuf, char *period, char *duntil)
 {
 
    char warea[50];
@@ -348,7 +361,7 @@ void fixper(char *tbuf, char *periodo, char *duntil)
    if(strcmp(df,"u") == 0)
       sprintf(warea,"%s%s%s",ano,mes,dia);
 
-   strcat(periodo,warea);
+   strcat(period,warea);
 }
 
 
@@ -396,14 +409,13 @@ void fixip(char *ip)
 
 
 char *fixnum(long long int value, int n)
-#define MAXIMO 1024
+#define MAXLEN 1024
 {
-   char num[MAXIMO];
-   char buf[MAXIMO * 2];
+   char num[MAXLEN];
+   char buf[MAXLEN * 2];
    char *pbuf;
-   char ret[MAXIMO * 2];
+   static char ret[MAXLEN * 2];
    char *pret;
-   float perc=0;
    register int i, j, k;
    static char abbrev[30];
       
@@ -458,7 +470,7 @@ char *fixnum(long long int value, int n)
       return(abbrev);
    }
 
-   bzero(buf, MAXIMO*2);
+   bzero(buf, MAXLEN*2);
 
    pbuf = buf;
    pret = ret;
@@ -489,6 +501,50 @@ char *fixnum(long long int value, int n)
 }
 
 
+char *fixnum2(long long int value, int n)
+#define MAXLEN 1024
+{
+   char num[MAXLEN];
+   char buf[MAXLEN * 2];
+   char *pbuf;
+   static char ret[MAXLEN * 2];
+   char *pret;
+   register int i, j, k;
+   static char abbrev[30];
+      
+   my_lltoa(value, num, 0);
+   bzero(buf, MAXLEN*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];
@@ -538,10 +594,13 @@ void obtdate(char *dirname, char *name, char *data)
    FILE *fp_in;
    char wdir[MAXLEN];
 
-   sprintf(wdir,"%s%s/date",dirname,name);
+   sprintf(wdir,"%s%s/sarg-date",dirname,name);
    if ((fp_in = fopen(wdir, "r")) == 0) {
-      data[0]='\0';
-      return;
+      sprintf(wdir,"%s%s/date",dirname,name);
+      if ((fp_in = fopen(wdir, "r")) == 0) {
+         data[0]='\0';
+         return;
+      }
    }
 
    fgets(data,80,fp_in);
@@ -559,10 +618,13 @@ void obtuser(char *dirname, char *name, char *tuser)
    FILE *fp_in;
    char wdir[MAXLEN];
 
-   sprintf(wdir,"%s%s/users",dirname,name);
-   if((fp_in=fopen(wdir,"r"))==NULL){    
-      tuser[0]='\0';
-      return;
+   sprintf(wdir,"%s%s/sarg-users",dirname,name);
+   if((fp_in=fopen(wdir,"r"))==NULL) {    
+      sprintf(wdir,"%s%s/users",dirname,name);
+      if((fp_in=fopen(wdir,"r"))==NULL) {    
+         tuser[0]='\0';
+         return;
+      }
    }
 
    fgets(tuser,20,fp_in);
@@ -582,11 +644,13 @@ void obttotal(char *dirname, char *name, char *tbytes, char *tuser, char *media)
    long long int med=0;
    long long int wtuser=0;
 
-   sprintf(wdir,"%s%s/geral",dirname,name);
-
+   sprintf(wdir,"%s%s/sarg-general",dirname,name);
    if ((fp_in = fopen(wdir, "r")) == 0) {
-      tbytes=0;
-      return;
+      sprintf(wdir,"%s%s/general",dirname,name);
+      if ((fp_in = fopen(wdir, "r")) == 0) {
+         tbytes=0;
+         return;
+      }
    }
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
@@ -615,8 +679,8 @@ void obttotal(char *dirname, char *name, char *tbytes, char *tuser, char *media)
 }
 
 
-//void gperiodo(char *dirname, const char *periodo)
-void gperiodo()
+//void gperiod(char *dirname, const char *period)
+void gperiod()
 {
  
    FILE *fp_ou;
@@ -625,14 +689,14 @@ void gperiodo()
 
    strcpy(wdirname,dirname);
    strcat(wdirname,"/");
-   strcat(wdirname,"periodo");
+   strcat(wdirname,"sarg-period");
 
    if((fp_ou=fopen(wdirname,"w"))==NULL){
       fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname);
       exit(1);
    }
  
-   fputs(periodo,fp_ou);
+   fputs(period,fp_ou);
    fclose(fp_ou);
 
    if(debug)
@@ -650,7 +714,6 @@ void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form
    char wdir[MAXLEN];
    char per2[MAXLEN];
    char dirname2[MAXLEN];
-   char buffer[1024];
    char images[512];
    DIR *dirp;
    struct dirent *direntp;
@@ -663,19 +726,19 @@ void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form
       bzero(m1,4);
       bzero(m2,4);
       if(strncmp(df,"u",1) == 0) {
-         strncpy(y1,periodo,4);
-         strncpy(y2,periodo+10,4);
-         strncpy(m1,periodo+4,3);
-         strncpy(m2,periodo+14,3);
-         strncpy(d1,periodo+7,2);
-         strncpy(d2,periodo+17,2);
+         strncpy(y1,period,4);
+         strncpy(y2,period+10,4);
+         strncpy(m1,period+4,3);
+         strncpy(m2,period+14,3);
+         strncpy(d1,period+7,2);
+         strncpy(d2,period+17,2);
       } else if(strncmp(df,"e",1) == 0) {
-         strncpy(d1,periodo+0,2);
-         strncpy(d2,periodo+10,2);
-         strncpy(m1,periodo+2,3);
-         strncpy(m2,periodo+12,3);
-         strncpy(y1,periodo+5,4);
-         strncpy(y2,periodo+15,4);
+         strncpy(d1,period+0,2);
+         strncpy(d2,period+10,2);
+         strncpy(m1,period+2,3);
+         strncpy(m2,period+12,3);
+         strncpy(y1,period+5,4);
+         strncpy(y2,period+15,4);
       }
       conv_month(m1);
       conv_month(m2);
@@ -781,7 +844,7 @@ void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form
    sprintf(images,"%simages",outdir);
    mkdir(images,0755);
 
-   sprintf(wdir,"date >%s/%s",dirname,"date");
+   sprintf(wdir,"date >%s/%s",dirname,"sarg-date");
    system(wdir);
 
    sprintf(per2,"%s/images",SYSCONFDIR);
@@ -966,7 +1029,13 @@ char *subs(char *str, char *from, char *to)
       return (char *) str;
 
     ss = strlen(str); st = strlen(to) + 10;
-    ret = (char *) malloc(ss + st);
+
+    if((ret=(char *) malloc(ss + st))==NULL)
+    {
+     fprintf(stderr, "SARG: %s (%d):\n",text[59],ss+st);
+     exit(1);
+    }
+
     bzero(ret,ss+st);
 
     tmp = strstr(str, from);
@@ -989,12 +1058,12 @@ void removetmp(char *outdir)
       return;
    } else {
       if(debug) {
-         sprintf(msg,"%s: geral, periodo",text[82]);
+         sprintf(msg,"%s: sarg-general, sarg-period",text[82]);
          debuga(msg);
       }
-      sprintf(warea,"%s/geral",outdir);
+      sprintf(warea,"%s/sarg-general",outdir);
       if((fp_in=fopen(warea,"r"))==NULL){
-         fprintf(stderr, "SARG: (removetmp) %s: %s\n",text[45],warea);
+         fprintf(stderr, "===SARG: (removetmp) %s: %s\n",text[45],warea);
          exit(1);
       }
       while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
@@ -1008,7 +1077,7 @@ void removetmp(char *outdir)
       }
       fputs(buf,fp_in);
       fclose(fp_in);
-      sprintf(warea,"%s/periodo",outdir);
+      sprintf(warea,"%s/sarg-period",outdir);
       unlink(warea);
    }
   
@@ -1155,24 +1224,14 @@ int getnumlist( char *buf, numlist *list, const int len, const int maxvalue )
 
 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);
-   }
+  if(strcmp(ShowSargInfo,"yes") != 0) return;
+  zdate(ftime, DateFormat);
+  fprintf(fp_ou,"<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);
 }
 
 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://sarg.sourceforge.net\"><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);
-   }
+   if(strcmp(ShowSargLogo,"yes") == 0) fprintf(fp_ou,"<center><table cellpadding=0 cellspacing=0>\n<tr><th class=\"logo\"><a href=\"http://sarg.sourceforge.net\"><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<tr><th class=\"title\">&nbsp</th></tr>\n<table>\n",ind);
 }
 
 get_size(char *path, char *file)
@@ -1192,41 +1251,29 @@ get_size(char *path, char *file)
 
 void write_html_header(FILE *fp_ou, char * ind)
 {
-   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);
+   fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n</head>\n",CharSet);
    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) {
-      fputs("<center><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ou);
-      sprintf(html,"<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n",LogoImage,Width,Height,LogoText);
-      fputs(html,fp_ou);
-      fputs("<tr><td height=\"5\"></td></tr>\n",fp_ou);
-      fputs("</table>\n",fp_ou);
-   }
+   fprintf(fp_ou,"<body style=\"font-family:%s;font-size:%s;background-color:%s;background-image:url(%s)\">\n",FontFace,TitleFontSize,BgColor,BgImage);
+   if(strlen(LogoImage) > 0) fprintf(fp_ou, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
    show_sarg(fp_ou, ind);
-   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);
-
+   fprintf(fp_ou,"<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"title\">%s</th></tr>\n</table></center>\n<center><table cellpadding=\"1\" cellspacing=\"2\">\n<tr><td></td><td></td></tr>\n",Title);
 }
 
-
-void write_html_trailer(FILE *fp_ou)
+void baddata()
 {
-   fputs("</table></center>\n",fp_ou);
-   zdate(ftime, DateFormat);
-   show_info(fp_ou);
-   fputs("</body>\n</html>\n",fp_ou);
+   printf("SARG: ------------------------------------------------------------------------------\n");
+   printf("SARG: MALICIUS CODE DETECTED.\n");
+   printf("SARG: I think someone is trying to execute arbitrary code in your system using sarg.\n");
+   printf("SARG: please review your access.log and/or your useragent.log file.\n");
+   printf("SARG: process stoped. No actions taken.\n");
+   printf("SARG: ------------------------------------------------------------------------------\n");
+
+   system("rm -rf /tmp/sarg");
+   sprintf(tmp4,"rm -rf %s",dirname);
+   system(tmp4);
+   system("rm -rf /tmp/sarg");
+
+   exit(1);
 }
 
 
@@ -1253,6 +1300,15 @@ char url_module(char *url, char *w2)
    return;
 }
 
+
+void write_html_trailer(FILE *fp_ou)
+{
+   fputs("</table></center>\n",fp_ou);
+   zdate(ftime, DateFormat);
+   show_info(fp_ou);
+   fputs("</body>\n</html>\n",fp_ou);
+}
+
 void version()
 {
    printf("SARG Version: %s\n",VERSION);