From: Frédéric Marchal Date: Thu, 25 Jun 2009 09:39:47 +0000 (+0000) Subject: Mass commit of all the changes made between version 2.1 and 2.2.5. See ChangeLog... X-Git-Tag: v2_2_6~89 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d6e703cc9d76c0317941597bcc103ca277b71d52;p=thirdparty%2Fsarg.git Mass commit of all the changes made between version 2.1 and 2.2.5. See ChangeLog for more details. --- diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 225739a..3fae467 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -49,3 +49,4 @@ Andreu Sanchez Joe Cooper Guilherme Veloso Neves Oliveira Filippo Grassilli +l4teral@gmail.com diff --git a/ChangeLog b/ChangeLog index 4107633..8b075df 100644 --- 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 "" 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 + - 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 + - Russian_UTF-8 language fixed by Igor Ageikin + - realtime_unauthenticated_records tag changed to show by default. + - chmod 755 in sarg-php due to errors in rpmbuild. + Thanks to Davide Madrisan + - when the keyword "anonymous" is used in squidGuard.conf, Sarg does + not find the log-files anymore. + Thanks to Daniel Vogel + - after reading the squidGuard configuration, the data read from the + usertab file was corrupted. + Thanks to Daniel Vogel + - milisec values showed as bytes. Thanks to Carlos + - with squidGuard, you can log groups in only one log file. + We must parse each log files only one time. + Thanks to Christophe BADINA + - error message(removetmp) Cannot open /tmp/sarg_tmp/../general + when sending report by email. Thanks to Peter Volkov + - 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 + - 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 + - exclude_hosts and some code errors fixed by + Alexander Kozlov . Many thanks. + - temporary file names changed to sarg-... to avoid conflicts + with usernames. Thanks to Ukrainian Elephant + - 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 + . 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 + - greport_day() doesn't add the volume for the first hour of each day to the total. + Thanks to Ian Dall + - Russian_koi8 and Russian_windows1251 languages updated by + Stas Degteff . Many thanks + - realtime reporting is sorted by URL, and not by Date/Time. + Thanks tp Puce-Xcit + +Aug/29/2006 Version 2.2.2 + - malloc test implemented to avoid high-memory consuming. + Thanks to Rodrigo Rubira Branco + - Czech UTF8 language added by Josef Karliak + - fixed: parsed mismatch in realtime_access_log_lines and + access_log_lines tags. + Thanks to Kuznetsov Andrey + - changed: realtime report sort changed by date/time + Thanks to Leonardo Buonsanti + - 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 . + - new word added to languages: Topuser + - missing fclose fp-in in css.c + Thanks to Renato Botelho . + - index.c fixed. Missing -r in reverse sort. + Thanks to Fernando Lemes da Silva + - wrong values in columns in-cache and out-cache. + Thanks to Hugo P S Costa + +May/17/2006 Version 2.2 + - sarg ported to 64 bits. + Thanks to Antonio F. Zago + 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 + - fixed "file too long" messages when using long_url + Thanks to Fabio Lo Votrico + - fixes and improvements from Oleg - 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 (); + . 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 - wronk link point in Generated by sarg-2.. Thanks to Markus Hoffmann - - Russian_UFT-8 language added by Alex Deiter + - Russian_UTF-8 language added by Alex Deiter Aug/04/2005 version 2.0.9 - dansguardian_report_limit missing in sarg.conf file. diff --git a/Makefile.in b/Makefile.in index 7ddebcb..711bcfd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 b1d9e0f..2688d30 100644 --- a/README +++ b/README @@ -32,13 +32,14 @@ Antonis Maglaras - Greek language Dusan Woletz - Slovak Language Jose Luis Hernandez - Spanish language fix Theo kastermans - Dutch language fix -Alex Deiter - Russian UFT-8 language added - +Alex Deiter - Russian UTF-8 language +Josef Karliak - Czech UTF-8 +Igor Ageikin - 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 diff --git a/authfail.c b/authfail.c index 0950520..469f7eb 100644 --- a/authfail.c +++ b/authfail.c @@ -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("\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); - sprintf(html," \n",CharSet); - fputs(html,fp_ou); + fprintf(fp_ou, "\n\n\n \n",CharSet); css(fp_ou); fputs("\n",fp_ou); - - if(strlen(FontFace) > 0) { - sprintf(url,"\n",FontFace); - fputs(url,fp_ou); - } - - sprintf(url,"\n",BgColor,TxColor,BgImage); - fputs(url,fp_ou); - - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_ou); - sprintf(url,"\n",LogoImage,Width,Height,LogoText); - fputs(url,fp_ou); - fputs("\n",fp_ou); - fputs("
 %s
\n",fp_ou); - } + if(strlen(FontFace) > 0) fprintf(fp_ou,"\n",FontFace); + fprintf(fp_ou,"\n",BgColor,TxColor,BgImage); + if(strlen(LogoImage) > 0) fprintf(fp_ou, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); if(strcmp(IndexTree,"date") == 0) show_sarg(fp_ou, "../../.."); @@ -119,9 +99,9 @@ void authfail_report() sprintf(url,"%s\n",Title); fputs(url,fp_ou); - sprintf(url,"%s: %s\n",text[89],periodo); + sprintf(url,"%s: %s\n",text[89],period); fputs(url,fp_ou); - sprintf(url,"%s %s\n",text[117],text[55]); + sprintf(url,"%s\n",text[117]); fputs(url,fp_ou); fputs("
\n",fp_ou); diff --git a/cfgaux/compile b/cfgaux/compile new file mode 100755 index 0000000..9bb997a --- /dev/null +++ b/cfgaux/compile @@ -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 . +# +# 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 diff --git a/cfgaux/config.guess b/cfgaux/config.guess index b0f5dca..f32079a 100755 --- a/cfgaux/config.guess +++ b/cfgaux/config.guess @@ -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 @@ -14,88 +18,327 @@ # # 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 . -# The master version of this file is at the FSF in /home/gd/gnu/lib. + +# Originally written by Per Bothner . +# Please send patches to . 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 ." + +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 0 ;; + 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 0 ;; - 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 0 ;; - i86pc:SunOS:5.*:*) + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + 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 0 ;; + 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 0 ;; + 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 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + 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 /* 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 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + 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 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + 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 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 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; - 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 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + 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 + #include + + 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 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 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + 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 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; - 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 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + 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 0 ;; + 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 0 ;; + echo powerpcle-unknown-cygwin + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + 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 <$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 + #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' /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 0 ;; + exit ;; paragon:*:*:*) echo i860-intel-osf1 - exit 0 ;; + 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 0 ;; + 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 0 ;; + 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 0 ;; - 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 0 ;; + 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 + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + 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 - 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 <$dummy.c < # include @@ -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 +# 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 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi -#echo '(Unable to guess system type)' 1>&2 +cat >&2 < 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 index 0000000..4db13e5 --- /dev/null +++ b/cfgaux/config.rpath @@ -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 , 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 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=/' <. 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. @@ -45,30 +54,75 @@ # 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 ." + +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 index 0000000..6589965 --- /dev/null +++ b/cfgaux/depcomp @@ -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 . + +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 diff --git a/cfgaux/install-sh b/cfgaux/install-sh index ebc6691..e9de238 100755 --- a/cfgaux/install-sh +++ b/cfgaux/install-sh @@ -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 index e69de29..0000000 diff --git a/cfgaux/missing b/cfgaux/missing new file mode 100755 index 0000000..0a7fb5a --- /dev/null +++ b/cfgaux/missing @@ -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 , 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 index 0000000..4a06bf3 --- /dev/null +++ b/cfgaux/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# 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 diff --git a/charset.c b/charset.c index 8d1f6cd..d5d94ee 100644 --- a/charset.c +++ b/charset.c @@ -27,40 +27,18 @@ 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; - } diff --git a/configure b/configure index 5b213d6..cb1d227 100755 --- a/configure +++ b/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include #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 &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 +#include +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 +#include +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 +#include +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. @@ -3105,13 +3901,320 @@ fi -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 +#include + +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 -#include - +$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 +#include +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 diff --git a/configure.in b/configure.in index 9a9afc5..f8737d1 100644 --- a/configure.in +++ b/configure.in @@ -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 4469190..bf4e0af 100644 --- a/css.c +++ b/css.c @@ -25,66 +25,41 @@ #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("\n",fp_ou); + fputs("\n",fp_css); return; } - fputs("\n",fp_ou); - - return; -;} + fprintf(fp_css,"\n", FontFace, FontSize); +} diff --git a/dansguardian_log.c b/dansguardian_log.c index ce690b8..bcabde9 100644 --- a/dansguardian_log.c +++ b/dansguardian_log.c @@ -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); diff --git a/dansguardian_report.c b/dansguardian_report.c index d87b8e9..a3c85d4 100644 --- a/dansguardian_report.c +++ b/dansguardian_report.c @@ -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("\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); - sprintf(html," \n",CharSet); - fputs(html,fp_ou); + fprintf(fp_ou, "\n\n\n \n",CharSet); css(fp_ou); fputs("\n",fp_ou); - - if(strlen(FontFace) > 0) { - sprintf(url,"\n",FontFace); - fputs(url,fp_ou); - } - - sprintf(url,"\n",BgColor,TxColor,BgImage); - fputs(url,fp_ou); - - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_ou); - sprintf(url,"\n",LogoImage,Width,Height,LogoText); - fputs(url,fp_ou); - fputs("\n",fp_ou); - fputs("
 %s
\n",fp_ou); - } - + if(strlen(FontFace) > 0) fprintf(fp_ou,"\n",FontFace); + fprintf(fp_ou,"\n",BgColor,TxColor,BgImage); + if(strlen(LogoImage) > 0) fprintf(fp_ou, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); + if(strcmp(IndexTree,"date") == 0) show_sarg(fp_ou, "../../.."); else @@ -113,9 +95,9 @@ void dansguardian_report() sprintf(url,"%s\n",Title); fputs(url,fp_ou); - sprintf(url,"%s: %s\n",text[89],periodo); + sprintf(url,"%s: %s\n",text[89],period); fputs(url,fp_ou); - sprintf(url,"%s %s\n",text[128],text[55]); + sprintf(url,"%s\n",text[128]); fputs(url,fp_ou); fputs("
\n",fp_ou); diff --git a/datafile.c b/datafile.c index e2b2ef3..f8533dd 100644 --- a/datafile.c +++ b/datafile.c @@ -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; - } diff --git a/denied.c b/denied.c index 651f634..7610f70 100644 --- 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("\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); - sprintf(html," \n",CharSet); - fputs(html,fp_ou); + fprintf(fp_ou, "\n\n\n \n",CharSet); css(fp_ou); fputs("\n",fp_ou); - - sprintf(url,"\n",BgColor,TxColor,BgImage); - fputs(url,fp_ou); - - fputs("
\n",fp_ou); - - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_ou); - sprintf(url,"\n",LogoImage,Width,Height,LogoText); - fputs(url,fp_ou); - fputs("\n",fp_ou); - fputs("
 %s
\n",fp_ou); - } + fprintf(fp_ou,"\n",BgColor,TxColor,BgImage); + if(strlen(LogoImage) > 0) fprintf(fp_ou, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); if(strcmp(IndexTree,"date") == 0) show_sarg(fp_ou, "../../.."); else show_sarg(fp_ou, ".."); + + fputs("
\n",fp_ou); sprintf(url,"\n",Title); fputs(url,fp_ou); - sprintf(url,"\n",text[89],periodo); + sprintf(url,"\n",text[89],period); fputs(url,fp_ou); - sprintf(url,"\n",text[46],text[55]); + sprintf(url,"\n",text[46]); fputs(url,fp_ou); fputs("
%s
%s: %s
%s: %s
%s %s
%s
\n",fp_ou); fputs("
\n",fp_ou); fputs("\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); sprintf(url,"\n",text[98],text[111],text[110],text[91]); fputs(url,fp_ou); diff --git a/download.c b/download.c index 72506a1..e8f9387 100644 --- a/download.c +++ b/download.c @@ -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,"\n",BgColor,TxColor,BgImage); fputs(url,fp_ou); - fputs("
%s%s%s%s
\n",fp_ou); - - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_ou); - sprintf(url,"\n",LogoImage,Width,Height,LogoText); - fputs(url,fp_ou); - fputs("\n",fp_ou); - fputs("
 %s
\n",fp_ou); - } + if(strlen(LogoImage) > 0) fprintf(fp_ou, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); if(strcmp(IndexTree,"date") == 0) show_sarg(fp_ou, "../../.."); else show_sarg(fp_ou, ".."); + + fputs("
\n",fp_ou); sprintf(url,"\n",Title); fputs(url,fp_ou); - sprintf(url,"\n",text[89],periodo); + sprintf(url,"\n",text[89],period); fputs(url,fp_ou); - sprintf(url,"\n",text[125],text[55]); + sprintf(url,"\n",text[125]); fputs(url,fp_ou); fputs("
%s
%s: %s
%s: %s
%s %s
%s
\n",fp_ou); fputs("
\n",fp_ou); fputs("\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); sprintf(url,"\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 1606799..7f5d718 100644 --- 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); diff --git a/exclude.c b/exclude.c index d1ff83d..9c9afc3 100644 --- a/exclude.c +++ b/exclude.c @@ -25,39 +25,53 @@ #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 index 0000000..62f2d9b Binary files /dev/null and b/fonts/DejaVuSans.ttf differ diff --git a/fonts/FreeSans.ttf b/fonts/FreeSans.ttf index 46f5532..4573145 100644 Binary files a/fonts/FreeSans.ttf and b/fonts/FreeSans.ttf differ diff --git a/fonts/README b/fonts/README index cd9ee10..ff23ad2 100644 --- a/fonts/README +++ b/fonts/README @@ -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 diff --git a/getconf.c b/getconf.c index 0718add..2d75530 100644 --- 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; } diff --git a/grepday.c b/grepday.c index 5e53679..3c5596b 100644 --- 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 #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 de74596..678fb68 100644 --- 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,"\n",text[89],periodo); + sprintf(html,"\n",text[89],period); fputs(html,fp_ou); sprintf(html,"\n",text[90],name2); fputs(html,fp_ou); @@ -243,7 +242,7 @@ void htmlrel() fputs("\n",fp_ou); fputs("
%s%s%s%s
%s: %s
%s: %s
%s: %s
\n",fp_ou); - fputs("
\n",fp_ou); + fputs("
\n",fp_ou); if(strlen(denied_report) > 0) { sprintf(html,"\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,"\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; diff --git a/include/conf.h b/include/conf.h index dfd534a..2cb9510 100755 --- a/include/conf.h +++ b/include/conf.h @@ -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; diff --git a/include/info.h b/include/info.h index e0b4b0a..2f266d5 100755 --- a/include/info.h +++ b/include/info.h @@ -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 32e39f3..7a4adf8 100644 --- 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,"\n",hbc1,text[130],hbc1,text[132]); - fputs(html,fp_ou); + fprintf(fp_ou,"\n",hbc1,text[130],hbc1,text[132]); while(fgets(wwork1,MAXLEN,fp_tmp)!=NULL) { getword(tmp4,wwork1,' '); - sprintf(html,"\n",tmp4,tmp4,wwork1); - fputs(html,fp_ou); + fprintf(fp_ou,"\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,"\n",hbc1,text[130],text[131]); - fputs(html,fp_ou2); + fprintf(fp_ou2,"\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,"\n",wwork1,tmp4,nmonth); - fputs(html,fp_ou2); + fprintf(fp_ou2,"\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,"\n",hbc1,text[130],text[131],text[127]); - fputs(html,fp_ou3); + fprintf(fp_ou3,"\n",hbc1,text[130],text[131],text[127]); while(fgets(warea,MAXLEN,fp_tmp3)!=NULL) { warea[strlen(warea)-1]='\0'; - sprintf(html,"\n",warea,tmp4,nmonth,warea); - fputs(html,fp_ou3); + fprintf(fp_ou3,"\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,"\n",hbc1,text[101],hbc1,text[102],hbc1,text[103],hbc1,text[93],hbc1,text[96]); - fputs(html,fp_ou); + fprintf(fp_ou,"\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,"\n",period,ReplaceIndex,period,data,tuser,tbytes,media); - fputs(html,fp_ou); + fprintf(fp_ou,"\n",period,ReplaceIndex,period,data,tuser,tbytes,media); } if(fp_tmp2) fclose(fp_tmp2); unlink(wdir_tmp2); } - strcpy(html,"
%s %s
%s%s%s%s%s%s
%s%s
%s%s
%s%s
%s%s
%s/%s
%s/%s
%s %s
%s %s
%s/%s/%s
%s/%s/%s
%s %s %s
%s %s %s
%s%s%s%s%s
%s%s%s%s%s
%s%s%s%s%s
%s%s%s%s%s
"); - fputs(html,fp_ou); + fputs("
",fp_ou); zdate(ftime, DateFormat); show_info(fp_ou); - strcpy(html,"\n\n"); - fputs(html,fp_ou); - - return; + fputs("\n\n",fp_ou); } diff --git a/languages/Bulgarian_windows1251 b/languages/Bulgarian_windows1251 index dbd61da..c5cc69f 100644 --- a/languages/Bulgarian_windows1251 +++ b/languages/Bulgarian_windows1251 @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Catalan b/languages/Catalan index 1e32cc3..3e3365d 100644 --- a/languages/Catalan +++ b/languages/Catalan @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Czech b/languages/Czech index 3f7a6c8..591bcaf 100644 --- a/languages/Czech +++ b/languages/Czech @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Czech_UTF8 b/languages/Czech_UTF8 new file mode 100644 index 0000000..79c0608 --- /dev/null +++ b/languages/Czech_UTF8 @@ -0,0 +1,131 @@ +# by Josef Karliak +"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" diff --git a/languages/Dutch b/languages/Dutch index 7ac2075..b68d9d5 100644 --- a/languages/Dutch +++ b/languages/Dutch @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/English b/languages/English index 7241a66..68d88ea 100644 --- a/languages/English +++ b/languages/English @@ -1,4 +1,4 @@ -# by Pedro Lineu Orso +# by Pedro Lineu Orso "Yes" "No" "English" @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/French b/languages/French index ffe7de3..88a68a9 100644 --- a/languages/French +++ b/languages/French @@ -1,4 +1,4 @@ -# by Fred Pacquier +# by Nicod "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" @@ -115,23 +115,25 @@ "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" diff --git a/languages/German b/languages/German index c24a0e7..0ea6cc1 100644 --- a/languages/German +++ b/languages/German @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Greek b/languages/Greek index 9d4e9cd..6785f44 100644 --- a/languages/Greek +++ b/languages/Greek @@ -133,3 +133,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Hungarian b/languages/Hungarian index 3e72cc3..5053deb 100644 --- a/languages/Hungarian +++ b/languages/Hungarian @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Indonesian b/languages/Indonesian index 3ce1cf8..687be1b 100644 --- a/languages/Indonesian +++ b/languages/Indonesian @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Italian b/languages/Italian index 5533f3b..d71a93a 100644 --- a/languages/Italian +++ b/languages/Italian @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Japanese b/languages/Japanese index c64e5bf..788a493 100644 --- a/languages/Japanese +++ b/languages/Japanese @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Latvian b/languages/Latvian index efc41dd..7100482 100644 --- a/languages/Latvian +++ b/languages/Latvian @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Polish b/languages/Polish index 3dc4ff1..a4075bc 100644 --- a/languages/Polish +++ b/languages/Polish @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Portuguese b/languages/Portuguese index a8cb008..8b8a58d 100644 --- a/languages/Portuguese +++ b/languages/Portuguese @@ -1,4 +1,4 @@ -# by Pedro Lineu Orso +# by Pedro Lineu Orso "Sim" "Nao" "Portuguese" @@ -135,3 +135,5 @@ "Realtime" "TIPO" "Auto refresh" +"Topuser" +"pre-classificando arquivos" diff --git a/languages/Romanian b/languages/Romanian index 15cd411..740c7e0 100644 --- a/languages/Romanian +++ b/languages/Romanian @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Russian_UTF-8 b/languages/Russian_UTF-8 index 1596305..9add4ea 100755 --- a/languages/Russian_UTF-8 +++ b/languages/Russian_UTF-8 @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Russian_koi8 b/languages/Russian_koi8 index e2b6493..a8a19b9 100644 --- a/languages/Russian_koi8 +++ b/languages/Russian_koi8 @@ -1,4 +1,4 @@ -# by Andrew Okhmat +# Russian language file (codepage koi8-r) for the SARG by Palamarchuk Eugen and Dima I. Allaverdov Updated for SARG 2.9.0 by Stas Degteff "äÁ" "îÅÔ" "Russian" @@ -21,13 +21,13 @@ "óÏÒÔÉÒÏ×ËÁ ÆÁÊÌÏ×" "úÁ×ÅÒÛÅÎÏ" "ðÁÒÁÍÅÔÒÙ" -"éÍÑ ÉÌÉ 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 @@ "ðÅÒÉÏÄ" "ðÏÌØÚÏ×ÁÔÅÌØ" "áÄÒÅÓÁ" -"ðÏÄËÌÀÞÅÎÉÊ" +"úÁÐÒÏÓÏ×" "âÁÊÔ" "ïÂÝÅÅ ×ÒÅÍÑ" "íÉÌÌÉÓÅË." @@ -103,29 +103,29 @@ "äÁÔÁ ÓÏÚÄÁÎÉÑ" "ðÏÌØÚÏ×ÁÔÅÌÅÊ" "ïÔÓÏÒÔÉÒÏ×ÁÎÏ" -"ïÔÞÅÔ 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" @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Russian_windows1251 b/languages/Russian_windows1251 index ceecb74..4c30c4b 100644 --- a/languages/Russian_windows1251 +++ b/languages/Russian_windows1251 @@ -1,4 +1,4 @@ -# by Palamarchuk Eugen and Dima I. Allaverdov +# Russian language file (codepage 1251) for the SARG by Palamarchuk Eugen and Dima I. Allaverdov Updated for SARG 2.9.0 by Stas Degteff "Äà" "Íåò" "Russian" @@ -21,13 +21,13 @@ "Ñîðòèðîâêà ôàéëîâ" "Çàâåðøåíî" "Ïàðàìåòðû" -"Èìÿ èëè 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 @@ "Ïåðèîä" "Ïîëüçîâàòåëü" "Àäðåñà" -"Ïîäêëþ÷åíèé" +"Çàïðîñîâ" "Áàéò" "Îáùåå âðåìÿ" "Ìèëëèñåê." @@ -103,29 +103,29 @@ "Äàòà ñîçäàíèÿ" "Ïîëüçîâàòåëåé" "Îòñîðòèðîâàíî" -"Îò÷åò 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" @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Serbian b/languages/Serbian index b2e2bed..a163549 100644 --- a/languages/Serbian +++ b/languages/Serbian @@ -136,3 +136,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Slovak b/languages/Slovak index 8e11ced..c199e32 100644 --- a/languages/Slovak +++ b/languages/Slovak @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Spanish b/languages/Spanish index ba75182..c56ca91 100644 --- a/languages/Spanish +++ b/languages/Spanish @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Turkish b/languages/Turkish index e9c16c5..4690627 100644 --- a/languages/Turkish +++ b/languages/Turkish @@ -135,3 +135,5 @@ "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/languages/Ukrainian_windows1251 b/languages/Ukrainian_windows1251 index 5e40284..5359a36 100644 --- a/languages/Ukrainian_windows1251 +++ b/languages/Ukrainian_windows1251 @@ -135,3 +135,5 @@ DansGuardian" "Realtime" "TYPE" "Auto refresh" +"Topuser" +"pre-sorting files" diff --git a/log.c b/log.c index e6d84d5..335b102 100644 --- 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); diff --git a/realtime.c b/realtime.c index 4078669..db4e86d 100755 --- a/realtime.c +++ b/realtime.c @@ -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("%s %s%s%s%s%s\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("%s %s%s%s%s%s\n",dat,tim,ip,name,typ,url,url); strcpy(ouser,user); strcpy(ourl,url); } diff --git a/repday.c b/repday.c index 02562e6..9195780 100644 --- 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("\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); - sprintf(html," \n",CharSet); - fputs(html,fp_ou); + fprintf(fp_ou, "\n\n\n \n",CharSet); css(fp_ou); fputs("\n",fp_ou); - - if(strlen(FontFace) > 0) { - sprintf(html,"\n",FontFace); - fputs(html,fp_ou); - } - - sprintf(html,"\n",BgColor,TxColor,BgImage); - fputs(html,fp_ou); - - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_ou); - sprintf(html,"\n",LogoImage,Width,Height,LogoText); - fputs(html,fp_ou); - fputs("\n",fp_ou); - fputs("
 %s
\n",fp_ou); - } + if(strlen(FontFace) > 0) fprintf(fp_ou,"\n",FontFace); + fprintf(fp_ou,"\n",BgColor,TxColor,BgImage); + if(strlen(LogoImage) > 0) fprintf(fp_ou, "
\n\n\n
 %s
\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("
\n",fp_ou); fputs("
\n",fp_ou); - sprintf(html,"\n",text[89],periodo); + sprintf(html,"\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,"\n",text[90],name); + sprintf(html,"\n",text[90],name); fputs(html,fp_ou); fputs("\n",fp_ou); @@ -153,7 +129,7 @@ void report_day(char *user, int *iprel, int *ipuser) fputs( "\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; } diff --git a/report.c b/report.c index 116b2fa..bf04bd4 100644 --- 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("\n",fp_tt); - fputs("\n",fp_tt); - fputs("\n",fp_tt); - sprintf(html," \n",CharSet); - fputs(html,fp_tt); + fprintf(fp_tt, "\n\n\n \n",CharSet); css(fp_tt); fputs("\n",fp_tt); - - sprintf(html,"\n",BgColor,TxColor,BgImage); - fputs(html,fp_tt); - - fputs("
%s: %s
%s: %s
%s: %s
%s: %s
\n",fp_tt); - - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_tt); - sprintf(html,"\n",LogoImage,Width,Height,LogoText); - fputs(html,fp_tt); - fputs("\n",fp_tt); - fputs("
 %s
\n",fp_tt); - } + fprintf(fp_tt,"\n",BgColor,TxColor,BgImage); + if(strlen(LogoImage) > 0) fprintf(fp_tt, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); if(strcmp(IndexTree,"date") == 0) show_sarg(fp_tt, "../../../.."); else show_sarg(fp_tt, "../.."); - sprintf(html,"%s\n",Title); - fputs(html,fp_tt); + fputs("
\n",fp_tt); + fprintf(fp_tt,"\n",Title); strcpy(u2,user); if(strcmp(Ip2Name,"yes") == 0) @@ -277,24 +255,17 @@ void gerarel() strcpy(name,str2); } - sprintf(html,"\n",text[89],periodo); - fputs(html,fp_tt); - sprintf(html,"\n",text[90],name); - fputs(html,fp_tt); - sprintf(html,"\n",text[104],UserSortField,UserSortOrder); - fputs(html,fp_tt); - sprintf(html,"\n",text[32],text[55]); - fputs(html,fp_tt); + fprintf(fp_tt,"\n",text[89],period); + fprintf(fp_tt,"\n",text[90],name); + fprintf(fp_tt,"\n",text[104],UserSortField,UserSortOrder); + fprintf(fp_tt,"\n",text[32]); fputs("
%s
%s: %s
%s: %s
%s: %s, %s
%s %s
%s: %s
%s: %s
%s: %s, %s
%s
\n",fp_tt); fputs("
\n",fp_tt); fputs("",fp_tt); bzero(tmp4, MAXLEN); - bzero(tmp5, MAXLEN); strncpy(tmp4,text[110],4); - strncpy(tmp5,text[110]+5,4); - sprintf(html,"\n",text[91],tmp4,tmp5); - fputs(html,fp_tt); + fprintf(fp_tt,"\n",text[91],tmp4,text[110]+5); } sprintf(html,"\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("\n\n",fp_tt); fclose(fp_ou); diff --git a/sarg-php/LANGUAGES b/sarg-php/LANGUAGES index b71e69e..2602df1 100644 --- a/sarg-php/LANGUAGES +++ b/sarg-php/LANGUAGES @@ -1,8 +1,8 @@ This PHP modules is under i18n. Available languages: - English Pedro Orso - Brazilian_Portuguese Pedro Orso + English Pedro Orso + Brazilian_Portuguese Pedro Orso French Jacques GRILLOT Russian Michael Stepanenko @@ -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. diff --git a/sarg-php/language.php b/sarg-php/language.php index f5bc8b9..8ab44a9 100755 --- a/sarg-php/language.php +++ b/sarg-php/language.php @@ -1,8 +1,8 @@ , 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 \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 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 index 0000000..0cf5405 --- /dev/null +++ b/sarg-php/locale/fr/LC_MESSAGES/messages.po @@ -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 \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 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 index 0000000..aa9bda0 --- /dev/null +++ b/sarg-php/locale/pt_BR/LC_MESSAGES/messages.po @@ -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 , 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 \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ã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á 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 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 index 0000000..9580353 --- /dev/null +++ b/sarg-php/locale/ru/LC_MESSAGES/messages.po @@ -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 , 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 \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 "ÂÕÄÅÔ ÄÏÂÁ×ÌÅÎ" diff --git a/sarg-php/sarg-block-it.php b/sarg-php/sarg-block-it.php index 925b827..20efb9a 100755 --- a/sarg-php/sarg-block-it.php +++ b/sarg-php/sarg-block-it.php @@ -1,8 +1,8 @@ \n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); - sprintf(html," \n",CharSet); - fputs(html,fp_ou); + fprintf(fp_ou, "\n\n\n \n",CharSet); css(fp_ou); fputs("\n",fp_ou); - - if(strlen(FontFace) > 0) { - sprintf(url,"\n",FontFace); - fputs(url,fp_ou); - } - - sprintf(url,"\n",BgColor,TxColor,BgImage); - fputs(url,fp_ou); - - if(strlen(LogoImage) > 0) { - fputs("
%s%s%s
%s%s%s
%s%s%s
\n",fp_ou); - sprintf(url,"\n",LogoImage,Width,Height,LogoText); - fputs(url,fp_ou); - fputs("\n",fp_ou); - fputs("
 %s
\n",fp_ou); - } + if(strlen(FontFace) > 0) fprintf(fp_ou,"\n",FontFace); + fprintf(fp_ou,"\n",BgColor,TxColor,BgImage); + if(strlen(LogoImage) > 0) fprintf(fp_ou, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); if(strcmp(IndexTree,"date") == 0) show_sarg(fp_ou, "../../.."); @@ -110,21 +97,22 @@ void siteuser() sprintf(url,"%s\n",Title); fputs(url,fp_ou); - sprintf(url,"%s: %s\n",text[89],periodo); + sprintf(url,"%s: %s\n",text[89],period); fputs(url,fp_ou); - sprintf(url,"%s\n",text[85]); + sprintf(url,"%s\n",text[85]); fputs(url,fp_ou); fputs("
\n",fp_ou); fputs("
\n",fp_ou); fputs("\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); - sprintf(url,"\n",text[100],text[91],text[103]); + if(strncmp(strlow(BytesInSitesUsersReport),"yes",3) == 0) + sprintf(url,"\n",text[100],text[91],text[93],text[103]); + else sprintf(url,"\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," ",wwwDocumentRoot,BlockIt,ourl); else BlockImage[0]='\0'; - if(strcmp(url,ourl) != 0) { - sprintf(html,"\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,"\n",regs,BlockImage,ourl,ourl,wwork2,users); + } else sprintf(html,"\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,"\n",regs,ourl,ourl,users); - fputs(html,fp_ou); + if(nsitesusers) { + sprintf(html,"\n",regs,ourl,ourl,users); + fputs(html,fp_ou); + } - unlink(geral2); + unlink(general2); fputs("
%s%s%s
%s%s%s%s
%s%s%s
%d%s%s%s
%d%s%s%s%s
%d%s%s%s
%d%s%s
%d%s%s
\n",fp_ou); diff --git a/smartfilter.c b/smartfilter.c index c38c9ac..50f9e46 100644 --- a/smartfilter.c +++ b/smartfilter.c @@ -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("\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); - sprintf(html," \n",CharSet); - fputs(html,fp_ou); + fprintf(fp_ou, "\n\n\n \n",CharSet); fputs("\n",fp_ou); - - if(strlen(FontFace) > 0) { - sprintf(url,"\n",FontFace); - fputs(url,fp_ou); - } - - sprintf(url,"\n",BgColor,TxColor,BgImage); - fputs(url,fp_ou); - + if(strlen(FontFace) > 0) fprintf(fp_ou,"\n",FontFace); + fprintf(fp_ou,"\n",BgColor,TxColor,BgImage); fputs("
\n",fp_ou); + if(strlen(LogoImage) > 0) fprintf(fp_ou, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_ou); - sprintf(url,"\n",LogoImage,Width,Height,LogoText); - fputs(url,fp_ou); - fputs("\n",fp_ou); - fputs("
 %s
\n",fp_ou); - } - - sprintf(url,"%s\n",TiColor,Title); - fputs(url,fp_ou); - - sprintf(url,"%s: %s\n",HeaderBgColor,FontSize,text[89],periodo); - fputs(url,fp_ou); - sprintf(url,"%s %s\n",HeaderBgColor,FontSize,text[116],text[55]); - fputs(url,fp_ou); + fprintf(fp_ou,"%s\n",TiColor,Title); + fprintf(fp_ou,"%s: %s\n",HeaderBgColor,FontSize,text[89],period); + fprintf(fp_ou,"%s\n",HeaderBgColor,FontSize,text[116]); fputs("
\n",fp_ou); fputs("
\n",fp_ou); fputs("\n",fp_ou); fputs("\n",fp_ou); fputs("\n",fp_ou); - sprintf(url,"\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,"\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,"\n",BgColor,TxColor,BgImage); fputs(html2,fp_user); fputs("
%s%s%s%s%s
%s%s%s%s%s
\n",fp_user); - if(strlen(LogoImage) > 0) { - sprintf(html2,"\n",TiColor,Title); - fputs(html2,fp_user); - sprintf(html2,"\n",HeaderBgColor,FontSize,text[89],periodo); - fputs(html2,fp_user); - sprintf(html2,"\n",HeaderBgColor,FontSize,text[90],FontSize,user); - fputs(html2,fp_user); + if(strlen(LogoImage) > 0) fprintf(fp_user,"\n",TiColor,Title); + fprintf(fp_user,"\n",HeaderBgColor,FontSize,text[89],period); + fprintf(fp_user,"\n",HeaderBgColor,FontSize,text[90],FontSize,user); fputs("
%s\n",LogoImage,Width,Height,LogoTextColor,LogoText); - fputs(html2,fp_user); - } - sprintf(html2,"
%s
%s: %s
%s: %s
%s\n",LogoImage,Width,Height,LogoTextColor,LogoText); + fprintf(fp_user,"
%s
%s: %s
%s: %s
\n",fp_user); fputs("
\n",fp_user); fputs("\n",fp_user); diff --git a/sort.c b/sort.c index 736968b..4813a66 100644 --- 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); diff --git a/squidguard_log.c b/squidguard_log.c index bf5eb11..59e378c 100644 --- a/squidguard_log.c +++ b/squidguard_log.c @@ -25,6 +25,10 @@ #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\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); - sprintf(html," \n",CharSet); - fputs(html,fp_ou); + fprintf(fp_ou, "\n\n\n \n",CharSet); css(fp_ou); fputs("\n",fp_ou); - - if(strlen(FontFace) > 0) { - sprintf(url,"\n",FontFace); - fputs(url,fp_ou); - } - - sprintf(url,"\n",BgColor,TxColor,BgImage); - fputs(url,fp_ou); - - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_ou); - sprintf(url,"\n",LogoImage,Width,Height,LogoText); - fputs(url,fp_ou); - fputs("\n",fp_ou); - fputs("
 %s
\n",fp_ou); - } + if(strlen(FontFace) > 0) fprintf(fp_ou,"\n",FontFace); + fprintf(fp_ou,"\n",BgColor,TxColor,BgImage); + if(strlen(LogoImage) > 0) fprintf(fp_ou, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); if(strcmp(IndexTree,"date") == 0) show_sarg(fp_ou, "../../.."); @@ -113,9 +95,9 @@ void squidguard_report() sprintf(url,"%s\n",Title); fputs(url,fp_ou); - sprintf(url,"%s: %s\n",text[89],periodo); + sprintf(url,"%s: %s\n",text[89],period); fputs(url,fp_ou); - sprintf(url,"%s %s\n",text[120],text[55]); + sprintf(url,"%s\n",text[120]); fputs(url,fp_ou); fputs("
\n",fp_ou); diff --git a/topsites.c b/topsites.c index 0cf74a0..3f2eed0 100644 --- a/topsites.c +++ b/topsites.c @@ -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("\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); - sprintf(html," \n",CharSet); - fputs(html,fp_ou); + fprintf(fp_ou, "\n\n\n \n",CharSet); css(fp_ou); fputs("\n",fp_ou); - - sprintf(url,"\n",BgColor,TxColor,BgImage); - fputs(url,fp_ou); - - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_ou); - sprintf(url,"\n",LogoImage,Width,Height,LogoText); - fputs(url,fp_ou); - fputs("\n",fp_ou); - fputs("
 %s
\n",fp_ou); - } + fprintf(fp_ou,"\n",BgColor,TxColor,BgImage); + if(strlen(LogoImage) > 0) fprintf(fp_ou, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); if(strcmp(IndexTree,"date") == 0) show_sarg(fp_ou,"../../.."); @@ -196,26 +183,29 @@ void topsites() sprintf(url,"%s\n",Title); fputs(url,fp_ou); - sprintf(url,"%s: %s\n",text[89],periodo); + sprintf(url,"%s: %s\n",text[89],period); fputs(url,fp_ou); - sprintf(url,"%s %s %s\n",text[83],TopSitesNum,text[84]); + sprintf(url,"%s %s %s\n",text[83],TopSitesNum,text[84]); fputs(url,fp_ou); fputs("
\n",fp_ou); fputs("
\n",fp_ou); fputs("\n",fp_ou); - sprintf(url," \ + sprintf(url," \ \ \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," ",wwwDocumentRoot,BlockIt,url); diff --git a/topuser.c b/topuser.c index 55a9795..829c912 100644 --- 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("\n",fp_top3); - fputs("\n",fp_top3); - fputs("\n",fp_top3); - sprintf(html," \n",CharSet); - fputs(html,fp_top3); + fprintf(fp_top3, "\n\n\n \n",CharSet); fputs("\n",fp_top3); - css(fp_top3); - - sprintf(preg,""); - fputs(preg,fp_top3); - - if(strlen(LogoImage) > 0) { - fputs("
%s%s
%s%s%s%s%s
\n",fp_top3); - sprintf(preg,"\n",LogoImage,Width,Height,LogoText); - fputs(preg,fp_top3); - fputs("\n",fp_top3); - fputs("
 %s
\n",fp_top3); - } + fprintf(fp_top3,""); + if(strlen(LogoImage) > 0) fprintf(fp_top3, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); if(strcmp(IndexTree,"date") == 0) show_sarg(fp_top3, "../../.."); else show_sarg(fp_top3, ".."); fputs("
\n",fp_top3); - sprintf(preg,"\n",Title); - fputs(preg,fp_top3); + fprintf(fp_top3,"\n",Title); - sprintf(preg,"\n",text[89],periodo); - fputs(preg,fp_top3); + fprintf(fp_top3,"\n",text[89],period); strcat(wheader,(char *)text[104]); strcat(wheader,": "); strcat(wheader,TopuserSortField); strcat(wheader,", "); strcat(wheader,TopuserSortOrder); - sprintf(preg,"\n",wheader); - fputs(preg,fp_top3); - sprintf(preg,"\n",text[55]); - fputs(preg,fp_top3); + fprintf(fp_top3,"\n",wheader); + fprintf(fp_top3,"\n",text[137]); fputs("
%s
%s
%s: %s
%s: %s
%s
Topuser %s
%s
%s
\n",fp_top3); fputs("
\n",fp_top3); fputs("\n",fp_top3); - if(strstr(ReportType,"topsites") != 0) { - sprintf(preg,"\n",text[119],text[55]); - fputs(preg,fp_top3); - } - - if(strstr(ReportType,"sites_users") != 0) { - sprintf(preg,"\n",text[85],text[55]); - fputs(preg,fp_top3); - } - - if(dansguardian_count) { - sprintf(preg,"\n",text[128],text[55]); - fputs(preg,fp_top3); - } - - if(squidguard_count) { - sprintf(preg,"\n",text[122],text[55]); - fputs(preg,fp_top3); - } - - if (strstr(ReportType,"downloads") != 0 && download_count) { - sprintf(preg,"\n",text[125],text[55]); - fputs(preg,fp_top3); - } - - if (strstr(ReportType,"denied") != 0 && denied_count) { - sprintf(preg,"\n",text[118],text[55]); - fputs(preg,fp_top3); - } - - if (strstr(ReportType,"auth_failures") != 0 && authfail_count) { - sprintf(preg,"\n",text[117],text[55]); - fputs(preg,fp_top3); - } - - if(smartfilter) { - sprintf(preg,"\n",text[116],text[55]); - fputs(preg,fp_top3); - } - strcpy(preg,"\n"); - fputs(preg,fp_top3); + if(strstr(ReportType,"topsites") != 0 && strcmp(Privacy,"yes") != 0) fprintf(fp_top3,"\n",text[119]); + if(strstr(ReportType,"sites_users") != 0 && strcmp(Privacy,"yes") != 0) fprintf(fp_top3,"\n",text[85]); + if(dansguardian_count) fprintf(fp_top3,"\n",text[128]); + if(squidguard_count) fprintf(fp_top3,"\n",text[122]); + if (strstr(ReportType,"downloads") != 0 && download_count && strcmp(Privacy,"yes") != 0 && ndownload) fprintf(fp_top3,"\n",text[125]); + if (strstr(ReportType,"denied") != 0 && denied_count && strcmp(Privacy,"yes") != 0) fprintf(fp_top3,"\n",text[118]); + if (strstr(ReportType,"auth_failures") != 0 && authfail_count && strcmp(Privacy,"yes") != 0) fprintf(fp_top3,"\n",text[117]); + if(smartfilter) fprintf(fp_top3,"\n",text[116]); + fputs("\n",fp_top3); if (strstr(ReportType,"topuser") == 0) { fputs("\n\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,"\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,"\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 %s\n",href3,ImageFile,text[126],text[55],href2,ImageFile,ltext110,text[55]); + sprintf(val2,"%s %s\n",href3,ImageFile,text[126],href2,ImageFile,ltext110,text[55]); #else - sprintf(val2,"%s\n",href2,ImageFile,ltext110,text[55]); + sprintf(val2,"%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,"\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,"\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,"\n",hbc10,text[96],hbc1,wwork1,hbc2,wwork2,hbc3,buildtime(ttnelap/totuser),hbc4,wwork3); + else if(strstr(TopUserFields,"AVERAGE") != 0) fprintf(fp_top3,"\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("\n",fp_top3); } - strcpy(preg,"

%s %s
%s %s
%s %s
%s %s
%s %s
%s %s
%s %s
%s %s
%s
%s
%s
%s
%s
%s
%s
%s
%s%s%s%s%s%s%s%s%s%s
%s%s%s%s%s%s%s%s%s%s
%s%s%15s%s%s
%s%s%15s%s%s
%s%s%15s%s%s
%s%s%15s%s%s
Useragent Report
"); - fputs(preg,fp_top3); + fputs("
",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("\n\n",fp_top3); fclose(fp_top3); diff --git a/totday.c b/totday.c index 476593f..6895b61 100644 --- 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; diff --git a/totger.c b/totger.c index a6fed1b..5334d48 100644 --- 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 cadea24..3a7620d 100644 --- 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"); diff --git a/useragent.c b/useragent.c index bbb7a53..fe6dfbd 100644 --- a/useragent.c +++ b/useragent.c @@ -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("\n",fp_ht); - fputs("\n",fp_ht); - fputs("\n",fp_ht); - sprintf(html," \n",CharSet); - fputs(html,fp_ht); + fprintf(fp_ht, "\n\n\n \n",CharSet); fputs("\n",fp_ht); - - if(strlen(FontFace) > 0) { - sprintf(html,"\n",FontFace); - fputs(html,fp_ht); - } - - sprintf(html,"\n",BgColor,TxColor,BgImage); - fputs(html,fp_ht); - - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_ht); - sprintf(html,"\n",LogoImage,Width,Height,LogoText); - fputs(html,fp_ht); - fputs("\n",fp_ht); - fputs("
 %s
\n",fp_ht); - } + if(strlen(FontFace) > 0) fprintf(fp_ht,"\n",FontFace); + fprintf(fp_ht,"\n",BgColor,TxColor,BgImage); + if(strlen(LogoImage) > 0) fprintf(fp_ht, "
\n\n\n
 %s
\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 0eace43..f4c1941 100644 --- a/util.c +++ b/util.c @@ -31,43 +31,61 @@ 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\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,"


%s %s-%s %s %s
\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,"


%s %s-%s %s %s
\n",text[108],URL,PGM,VERSION,text[109],ftime); } void show_sarg(FILE *fp_ou, char *ind) { - if(strcmp(ShowSargLogo,"yes") == 0) { - fputs("
\n",fp_ou); - sprintf(html,"\n",ind,Title); - fputs(html,fp_ou); - sprintf(html,"\n",Title); - fputs(html,fp_ou); - fputs("
 Squid Analysis Report Generator
 
\n",fp_ou); - } + if(strcmp(ShowSargLogo,"yes") == 0) fprintf(fp_ou,"
\n\n\n
 Squid Analysis Report Generator
 
\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("\n",fp_ou); - fputs("\n",fp_ou); - fputs("\n",fp_ou); - sprintf(html," \n",CharSet); - fputs(html,fp_ou); - fputs("\n",fp_ou); + fprintf(fp_ou, "\n\n\n \n\n",CharSet); css(fp_ou); - sprintf(buf,"\n",FontFace,TitleFontSize,BgColor,BgImage); - fputs(buf,fp_ou); - sprintf(buf,"
\n"); - fputs(buf,fp_ou); - if(strlen(LogoImage) > 0) { - fputs("
\n",fp_ou); - sprintf(html,"\n",LogoImage,Width,Height,LogoText); - fputs(html,fp_ou); - fputs("\n",fp_ou); - fputs("
 %s
\n",fp_ou); - } + fprintf(fp_ou,"\n",FontFace,TitleFontSize,BgColor,BgImage); + if(strlen(LogoImage) > 0) fprintf(fp_ou, "
\n\n\n
 %s
\n",LogoImage,Width,Height,LogoText); show_sarg(fp_ou, ind); - sprintf(html,"%s\n",Title); - fputs(html,fp_ou); - fputs("
\n",fp_ou); - fputs("
\n",fp_ou); - fputs("\n",fp_ou); - + fprintf(fp_ou,"
\n\n
%s
\n
\n\n",Title); } - -void write_html_trailer(FILE *fp_ou) +void baddata() { - fputs("
\n",fp_ou); - zdate(ftime, DateFormat); - show_info(fp_ou); - fputs("\n\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("
\n",fp_ou); + zdate(ftime, DateFormat); + show_info(fp_ou); + fputs("\n\n",fp_ou); +} + void version() { printf("SARG Version: %s\n",VERSION);