inetlib-1.1.2/0000775000076400007640000000000011347426737010172 500000000000000inetlib-1.1.2/config/0000775000076400007640000000000011347426737011437 500000000000000inetlib-1.1.2/config/config.guess0000775000076400007640000012365211345235565013703 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2004-01-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 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. # 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 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 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 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # 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 -q "$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 ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (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_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # 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 ;; *) 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 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pegasos:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # 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 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 ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha*:OpenVMS:*:*) echo alpha-hp-vms exit 0 ;; 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 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; *:OS400:*:*) echo powerpc-ibm-os400 exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; 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) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; 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 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # 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 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) 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); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; 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 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) 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 fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[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/[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 if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; 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 "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; 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 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) # Determine whether the default compiler uses glibc. eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #if __GLIBC__ >= 2 LIBC=gnu #else LIBC= #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` # GNU/KFreeBSD systems have a "k" prefix to indicate we are using # FreeBSD's kernel, but not the complete OS. case ${LIBC} in gnu) kernel_only='k' ;; esac echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit 0 ;; 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 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *: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 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; 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 | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; 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 0 ;; 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 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; 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 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # 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 0 ;; 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 #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; 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: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 0 ;; 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 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; 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_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) 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 0 ;; 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|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 ;; 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 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 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) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; 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 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) case `uname -p` in *86) UNAME_PROCESSOR=i686 ;; powerpc) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *: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 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *: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 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; *:DRAGONFLY:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE} exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # 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) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi 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: inetlib-1.1.2/config/missing0000755000076400007640000002623311347426735012760 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 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, see . # 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=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # 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 msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -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' autom4te touch the output file, or create a stub one 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] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. 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 $msg. 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 $msg. 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 $msg. 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 ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. 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 test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. 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 test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. 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 "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. 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." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # 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 "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && 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 is $msg. 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 prerequisites 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 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: inetlib-1.1.2/config/install-sh0000755000076400007640000003253711347426735013371 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: inetlib-1.1.2/config/depcomp0000775000076400007640000003034111345235565012730 00000000000000#! /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., 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. # 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'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi 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 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. base=`echo "$object" | sed -e 's/\.o$//' -e 's/\.lo$//'` tmpdepfile1="$base.o.d" tmpdepfile2="$base.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" sed '1,2d' "$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 for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -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 inetlib-1.1.2/config/mkinstalldirs0000755000076400007640000000672211347426735014170 00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2009-04-28.21; # UTC # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' IFS=" "" $nl" errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue 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 else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp=$pathcomp/ done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: inetlib-1.1.2/config/config.sub0000775000076400007640000007432111345235565013344 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2004-01-05' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . 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. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` 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 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 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # 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 0;; * ) 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 nto-qnx* | linux-gnu* | linux-dietlibc | 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/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) 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 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -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/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -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. 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 \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | 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) ;; # 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*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 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-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | msp430-* \ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # 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 ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) 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-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) 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 ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; 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 ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) 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 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) 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 ;; 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]) basic_machine=hppa1.0-hp ;; 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 ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; 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 -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; 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 ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; 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 ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nv1) basic_machine=nv1-cray os=-unicosmp ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; 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 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; 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-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; 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 ;; 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 ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; 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 ;; 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 ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; 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 ;; # 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. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; 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 ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; 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 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -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*) # 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* \ | -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|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # 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 ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; 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 ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -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 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: inetlib-1.1.2/config/ltmain.sh0000775000076400007640000054701411345235565013210 00000000000000# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 # Free Software Foundation, Inc. # 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., 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. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.4 TIMESTAMP=" (1.1220.2.90 2004/04/03 14:10:19) Debian$Rev: 203 $" # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2003 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $EXIT_SUCCESS ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $EXIT_SUCCESS ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 exit $EXIT_FAILURE fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) if test "$deplibs_check_method" != pass_all; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" status=$? if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "$mkdir $xdir" $run $mkdir "$xdir" status=$? if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi # We will extract separately just the conflicting names and we will no # longer touch any unique names. It is faster to leave these extract # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 $AR t "$xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$save_output-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$save_output-${k}.$objext k=`expr $k + 1` output=$output_objdir/$save_output-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" status=$? if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "$mkdir $xdir" $run $mkdir "$xdir" status=$? if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi # We will extract separately just the conflicting names and we will no # longer touch any unique names. It is faster to leave these extract # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 $AR t "$xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR #define DIR_SEPARATOR '/' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) #define HAVE_DOS_BASED_FILE_SYSTEM #ifndef DIR_SEPARATOR_2 #define DIR_SEPARATOR_2 '\\' #endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * fnqualify(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = fnqualify(argv[0]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } char * fnqualify(const char *path) { size_t size; char *p; char tmp[LT_PATHMAX + 1]; assert(path != NULL); /* Is it qualified already? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (path[0]) && path[1] == ':') return xstrdup (path); #endif if (IS_DIR_SEPARATOR (path[0])) return xstrdup (path); /* prepend the current directory */ /* doesn't handle '~' */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ p = XMALLOC(char, size); sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); return p; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" status=$? if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "$mkdir $xdir" $run $mkdir "$xdir" status=$? if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi # We will extract separately just the conflicting names and we will no # longer touch any unique names. It is faster to leave these extract # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 $AR t "$xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: inetlib-1.1.2/config/compile0000775000076400007640000000533211345235565012733 00000000000000#! /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., 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. # 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 inetlib-1.1.2/source/0000775000076400007640000000000011345235602011455 500000000000000inetlib-1.1.2/source/gnu/0000775000076400007640000000000011345235603012247 500000000000000inetlib-1.1.2/source/gnu/inet/0000775000076400007640000000000011345235603013206 500000000000000inetlib-1.1.2/source/gnu/inet/finger/0000775000076400007640000000000011347412570014462 500000000000000inetlib-1.1.2/source/gnu/inet/finger/FingerConnection.java0000664000076400007640000001161611345235566020512 00000000000000/* * FingerConnection.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.finger; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.Socket; /** * A client for the finger protocol described in RFC 1288. * * @author Chris Burdess */ public class FingerConnection { /** * The default finger port. */ public static final int DEFAULT_PORT = 79; /* * The US-ASCII encoding. */ private static final String US_ASCII = "US-ASCII"; /** * The underlying socket used for communications. */ protected Socket socket; /** * If we want a verbose response. */ protected boolean verbose; /** * Creates a new finger connection. * @param host the name of the internet host to connect to */ public FingerConnection(String host) throws IOException { this(host, DEFAULT_PORT); } /** * Creates a new finger connection. * @param host the name of the internet host to connect to * @param port the port to connect to */ public FingerConnection(String host, int port) throws IOException { socket = new Socket(host, port); } /** * Retrieves the verbose flag. * If true, the server should provide more output. */ public boolean isVerbose() { return verbose; } /** * Sets the verbose flag. * If true, the server should provide more output. * @param verbose true for more verbose, false otherwise */ public void setVerbose(boolean verbose) { this.verbose = verbose; } /** * Lists the available users. */ public String list() throws IOException { return finger(null, null); } /** * Fingers the specified user. * @param username the user to finger * @return information about all matching users */ public String finger(String username) throws IOException { return finger(username, null); } /** * Fingers the specified user at the specified host. * @param username the user to finger (null for any user) * @param hostname the domain of the user (null for any domain) * @return information about all matching users */ public String finger(String username, String hostname) throws IOException { // Send the command OutputStream out = socket.getOutputStream(); out = new BufferedOutputStream(out); if (verbose) { out.write('/'); out.write('W'); if (username != null || hostname != null) { out.write(' '); } } if (username != null) { out.write(username.getBytes(US_ASCII)); } if (hostname != null) { out.write('@'); out.write(hostname.getBytes(US_ASCII)); } out.write('\r'); out.write('\n'); out.flush(); // Read the response InputStream in = socket.getInputStream(); ByteArrayOutputStream acc = new ByteArrayOutputStream(); byte[] buf = new byte[4096]; for (int len = in.read(buf); len != -1; len = in.read(buf)) { acc.write(buf, 0, len); } return acc.toString(US_ASCII); } } inetlib-1.1.2/source/gnu/inet/finger/Handler.java0000664000076400007640000000445511345235566016640 00000000000000/* * Handler.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.finger; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; /** * A URL stream handler implementing the finger protocol. * * @author Chris Burdess */ public class Handler extends URLStreamHandler { protected int getDefaultPort() { return FingerConnection.DEFAULT_PORT; } protected URLConnection openConnection(URL url) throws IOException { return new FingerURLConnection(url); } } inetlib-1.1.2/source/gnu/inet/finger/FingerURLConnection.java0000664000076400007640000000532111345235566021071 00000000000000/* * FingerURLConnection.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.finger; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.IOException; import java.net.URL; import java.net.URLConnection; /** * A URL connection that uses the finger protocol. * * @author Chris Burdess */ class FingerURLConnection extends URLConnection { FingerConnection connection; String response; FingerURLConnection(URL url) throws IOException { super(url); } public void connect() throws IOException { if (connection != null) { return; } connection = new FingerConnection(url.getHost(), url.getPort()); response = connection.finger(url.getUserInfo()); } public InputStream getInputStream() throws IOException { if (!connected) { connect(); } byte[] bytes = response.getBytes("US-ASCII"); return new ByteArrayInputStream(bytes); } } inetlib-1.1.2/source/gnu/inet/finger/package.html0000664000076400007640000000035011345235566016667 00000000000000

This is a simple client for the finger protocol described in RFC 1288. The response returned by a finger command is unstructured. As soon as a response is returned, the underlying TCP connection is closed.

inetlib-1.1.2/source/gnu/inet/gopher/0000775000076400007640000000000011347412570014474 500000000000000inetlib-1.1.2/source/gnu/inet/gopher/GopherConnection.java0000664000076400007640000000765211345235566020543 00000000000000/* * GopherConnection.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.gopher; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.Socket; import gnu.inet.util.CRLFInputStream; import gnu.inet.util.MessageInputStream; /** * A gopher client. * * @author Chris Burdess */ public class GopherConnection { /** * The default gopher port. */ public static final int DEFAULT_PORT = 80; protected Socket socket; protected InputStream in; protected OutputStream out; /** * Creates a new connection to the gopher server at the specified * hostname. * @param hostname the hostname */ public GopherConnection(String host) throws IOException { this(host, DEFAULT_PORT); } /** * Creates a new connection to the gopher server at the specified * hostname with the specified non-standard port. * @param hostname the hostname * @param port the non-standard port to use */ public GopherConnection(String host, int port) throws IOException { if (port <= 0) { port = DEFAULT_PORT; } socket = new Socket(host, port); in = socket.getInputStream(); out = socket.getOutputStream(); } /** * Returns the directory listing for this gopher server. * When all entries have been read from the listing, the connection will * be closed. */ public DirectoryListing list() throws IOException { byte[] CRLF = { 0x0d, 0x0a }; out.write(CRLF); out.flush(); InputStream listStream = new CRLFInputStream(in); listStream = new MessageInputStream(listStream); return new DirectoryListing(listStream); } /** * Returns the resource identified by the specified selector. * If the resource is text-based, it will need to be wrapped in a * CRLFInputStream. */ public InputStream get(String selector) throws IOException { byte[] chars = selector.getBytes("US-ASCII"); byte[] line = new byte[chars.length + 2]; System.arraycopy(chars, 0, line, 0, chars.length); line[chars.length] = 0x0d; line[chars.length + 1] = 0x0a; out.write(line); out.flush(); return in; } } inetlib-1.1.2/source/gnu/inet/gopher/Handler.java0000664000076400007640000000443011345235566016643 00000000000000/* * Handler.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.gopher; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; /** * A Gopher URL stream handler. * * @author Chris Burdess */ public class Handler extends URLStreamHandler { protected int getDefaultPort () { return GopherConnection.DEFAULT_PORT; } protected URLConnection openConnection (URL url) throws IOException { return new GopherURLConnection(url); } } inetlib-1.1.2/source/gnu/inet/gopher/GopherContentHandler.java0000664000076400007640000000545711345235566021355 00000000000000/* * GopherContentHandler.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.gopher; import java.io.IOException; import java.net.ContentHandler; import java.net.UnknownServiceException; import java.net.URL; import java.net.URLConnection; /** * A Gopher content handler. * This will return either directory listings or input streams. * * @author Chris Burdess */ public class GopherContentHandler extends ContentHandler { public Object getContent(URLConnection urlc) throws IOException { if (urlc instanceof GopherURLConnection) { GopherURLConnection gurlc = (GopherURLConnection) urlc; GopherConnection connection = gurlc.connection; URL url = gurlc.getURL(); String dir = url.getPath(); String file = url.getFile(); if (dir == null && file == null) { return connection.list(); } else { return gurlc.getInputStream(); } } else { throw new UnknownServiceException(); } } } inetlib-1.1.2/source/gnu/inet/gopher/DirectoryListing.java0000664000076400007640000001312211345235566020562 00000000000000/* * DirectoryListing.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.gopher; import java.io.InputStream; import java.io.IOException; import java.net.ProtocolException; import java.util.Iterator; import java.util.NoSuchElementException; import gnu.inet.util.LineInputStream; /** * A gopher directory listing. * * @author Chris Burdess */ public final class DirectoryListing implements Iterator { private static final String DOT = "."; private LineInputStream in; private boolean doneRead = false; private DirectoryEntry current; DirectoryListing(InputStream in) { this.in = new LineInputStream(in); } /** * Indicates whether this listing contains more entries. */ public boolean hasNext() { try { fetch(); } catch (IOException e) { return false; } return (current != null); } /** * @see #nextEntry */ public Object next() { try { return nextEntry(); } catch (IOException e) { throw new NoSuchElementException("I/O error: " + e.getMessage()); } } /** * This iterator is read-only. */ public void remove() { throw new UnsupportedOperationException(); } /** * Returns the next entry in the directory listing. */ public DirectoryEntry nextEntry() throws IOException { fetch(); if (current == null) { throw new NoSuchElementException(); } doneRead = false; return current; } void fetch() throws IOException { if (doneRead) { return; } String line = in.readLine(); if (DOT.equals(line)) { current = null; } else { // Parse line int type = DirectoryEntry.ERROR; switch(line.charAt(0)) { case '0': type = DirectoryEntry.FILE; break; case '1': type = DirectoryEntry.DIRECTORY; break; case '2': type = DirectoryEntry.CSO_PHONE_BOOK; break; case '3': type = DirectoryEntry.ERROR; break; case '4': type = DirectoryEntry.BINHEX; break; case '5': type = DirectoryEntry.DOS_ARCHIVE; break; case '6': type = DirectoryEntry.UUENCODED; break; case '7': type = DirectoryEntry.INDEX_SEARCH; break; case '8': type = DirectoryEntry.TELNET; break; case '9': type = DirectoryEntry.BINARY; break; case '+': type = DirectoryEntry.REDUNDANT; break; case 'T': type = DirectoryEntry.TN3270; break; case 'g': type = DirectoryEntry.GIF; break; case 'I': type = DirectoryEntry.IMAGE; break; } int start = 1; int end = line.indexOf('\t', start); if (end == -1) { throw new ProtocolException("Invalid directory entry: " + line); } String title = line.substring(start, end); start = end + 1; end = line.indexOf('\t', start); if (end == -1) { throw new ProtocolException("Invalid directory entry: " + line); } String selector = line.substring(start, end); start = end + 1; end = line.indexOf('\t', start); if (end == -1) { throw new ProtocolException("Invalid directory entry: " + line); } String hostname = line.substring(start, end); start = end + 1; int port = Integer.parseInt(line.substring(start)); current = new DirectoryEntry(type, title, selector, hostname, port); } } } inetlib-1.1.2/source/gnu/inet/gopher/DirectoryEntry.java0000664000076400007640000001044111345235566020253 00000000000000/* * DirectoryEntry.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.gopher; import java.io.InputStream; import java.io.IOException; import java.util.Iterator; import java.util.NoSuchElementException; /** * A gopher directory entry. * * @author Chris Burdess */ public final class DirectoryEntry { /** * Item is a file. */ public static final int FILE = 0x30; /** * Item is a directory. */ public static final int DIRECTORY = 0x31; /** * Item is a CSO phone-book server. */ public static final int CSO_PHONE_BOOK = 0x32; /** * Error. */ public static final int ERROR = 0x33; /** * Item is a BinHex Macintosh file. */ public static final int BINHEX = 0x34; /** * Item is a DOS binary archive of some sort. */ public static final int DOS_ARCHIVE = 0x35; /** * Item is a UNIX uuencoded file. */ public static final int UUENCODED = 0x36; /** * Item is an Index-Search server. */ public static final int INDEX_SEARCH = 0x37; /** * Item points to a text-based Telnet session. */ public static final int TELNET = 0x38; /** * Item is a binary file. */ public static final int BINARY = 0x39; /** * Item is a redundant server. */ public static final int REDUNDANT = 0x2b; /** * Item points to a text-based tn3270 session. */ public static final int TN3270 = 0x54; /** * Item is a GIF format graphics file. */ public static final int GIF = 0x67; /** * Item is some kind of image file. */ public static final int IMAGE = 0x49; final int type; final String title; final String selector; final String hostname; final int port; DirectoryEntry(int type, String title, String selector, String hostname, int port) { this.type = type; this.title = title; this.selector = selector; this.hostname = hostname; this.port = port; } /** * Returns the type of this entry. */ public int getType() { return type; } /** * Returns the title for this entry. */ public String getTitle() { return title; } /** * Returns the selector for this entry. * This is used to retrieve the content for the entry. */ public String getSelector() { return selector; } /** * Returns the hostname for the content of this entry. */ public String getHostname() { return hostname; } /** * Returns the port on which the content for this entry can be retrieved. */ public int getPort() { return port; } } inetlib-1.1.2/source/gnu/inet/gopher/GopherURLConnection.java0000664000076400007640000000721511345235566021121 00000000000000/* * GopherURLConnection.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.gopher; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.UnknownServiceException; import java.net.URL; import java.net.URLConnection; /** * A Gopher URL connection. * * @author Chris Burdess */ public class GopherURLConnection extends URLConnection { /** * The connection managing the protocol exchange. */ protected GopherConnection connection; /** * Constructs a Gopher connection to the specified URL. * @param url the URL */ public GopherURLConnection(URL url) { super(url); } /** * Establishes the connection. */ public void connect() throws IOException { if (connected) { return; } String host = url.getHost(); int port = url.getPort(); connection = new GopherConnection(host, port); } /** * Returns an input stream that reads from this open connection. */ public InputStream getInputStream() throws IOException { if (!connected) { connect(); } String dir = url.getPath(); String filename = url.getFile(); if (dir == null && filename == null) { throw new UnsupportedOperationException("not implemented"); } else { String selector = (dir == null) ? filename : dir + '/' + filename; return connection.get(selector); } } /** * Returns an output stream that writes to this connection. */ public OutputStream getOutputStream() throws IOException { throw new UnknownServiceException(); } public Object getContent() throws IOException { return new GopherContentHandler().getContent(this); } public Object getContent(Class[] classes) throws IOException { return new GopherContentHandler().getContent(this, classes); } } inetlib-1.1.2/source/gnu/inet/gopher/package.html0000664000076400007640000000050011345235566016676 00000000000000

This package contains a Gopher client. It can provide two types of response: an input stream to retrieve content for the given selector (Gopher identifier), or a directory listing of the various selectors available. As soon as the response is returned, the underlying TCP connection is closed.

inetlib-1.1.2/source/gnu/inet/comsat/0000775000076400007640000000000011347412570014476 500000000000000inetlib-1.1.2/source/gnu/inet/comsat/ComsatClient.java0000664000076400007640000001036011345235566017654 00000000000000/* * ComsatClient.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.comsat; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.util.StringTokenizer; /** * Simple comsat client. * * @author Chris Burdess */ public class ComsatClient { /** * The default comsat port. */ public static final int DEFAULT_PORT = 512; protected DatagramSocket socket; public ComsatClient() throws IOException { this(DEFAULT_PORT, 0); } public ComsatClient(int port, int timeout) throws IOException { if (port < 0) { port = DEFAULT_PORT; } socket = new DatagramSocket(port); if (timeout > 0) { socket.setSoTimeout(timeout); } socket.setReceiveBufferSize(1024); } public void close() throws IOException { socket.close(); } public ComsatInfo read() throws IOException { byte[] buf = new byte[socket.getReceiveBufferSize()]; int len = buf.length; DatagramPacket packet = new DatagramPacket(buf, len); socket.receive(packet); buf = packet.getData(); len = packet.getLength(); String data = new String(buf, 0, len, "ISO-8859-1"); ComsatInfo info = new ComsatInfo(); StringTokenizer st = new StringTokenizer(data, "\n"); String mailbox = st.nextToken(); info.setMailbox(mailbox); boolean inBody = false; String lastHeader = null; while (st.hasMoreTokens()) { String line = st.nextToken(); if (inBody) { String body = info.getBody(); if (body == null) { body = line; } else { body += "\n" + line; } info.setBody(body); } else { if (line.length() == 0) { inBody = true; } else { int ci = line.indexOf(':'); if (ci != -1) { lastHeader = line.substring(0, ci); info.setHeader(lastHeader, line.substring(ci + 1).trim()); } else { String val = info.getHeader(lastHeader); val += "\n" + line; info.setHeader(lastHeader, val); } } } } return info; } } inetlib-1.1.2/source/gnu/inet/comsat/ComsatInfo.java0000664000076400007640000000544211345235566017336 00000000000000/* * ComsatInfo.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.comsat; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; /** * A comsat notification message. * * @author Chris Burdess */ public class ComsatInfo { /** * The mailbox in which the new message appeared. */ protected String mailbox; /** * The message headers. */ protected Map headers = new LinkedHashMap(); /** * The first few lines of the message body. */ protected String body; public String getMailbox() { return mailbox; } protected void setMailbox(String mailbox) { this.mailbox = mailbox; } public String getHeader(String key) { return (String) headers.get(key); } public Iterator getHeaderNames() { return headers.keySet().iterator(); } protected void setHeader(String key, String value) { headers.put(key, value); } public String getBody() { return body; } protected void setBody(String body) { this.body = body; } } inetlib-1.1.2/source/gnu/inet/ftp/0000775000076400007640000000000011347412570014001 500000000000000inetlib-1.1.2/source/gnu/inet/ftp/ActiveModeDTP.java0000664000076400007640000001457011345235566017171 00000000000000/* * ActiveModeDTP.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; /** * An active mode FTP data transfer process. * This starts a server on the specified port listening for a data * connection. It converts the socket input into a file stream for reading. * * @author Chris Burdess */ final class ActiveModeDTP implements DTP, Runnable { ServerSocket server; Socket socket; DTPInputStream in; DTPOutputStream out; boolean completed; boolean inProgress; int transferMode; IOException exception; Thread acceptThread; int connectionTimeout; ActiveModeDTP(InetAddress localhost, int port, int connectionTimeout, int timeout) throws IOException { completed = false; inProgress = false; server = new ServerSocket(port, 1, localhost); if (timeout > 0) { server.setSoTimeout(timeout); } if (connectionTimeout <= 0) { connectionTimeout = 20000; } this.connectionTimeout = connectionTimeout; acceptThread = new Thread(this, "ActiveModeDTP"); acceptThread.setDaemon(true); acceptThread.start(); } /** * Start listening. */ public void run() { try { socket = server.accept(); //System.err.println("Accepted connection from "+socket.getInetAddress()+":"+socket.getPort()); } catch (IOException e) { exception = e; } } /** * Waits until a client has connected. */ public void waitFor() throws IOException { try { acceptThread.join(connectionTimeout); } catch (InterruptedException e) { } if (exception != null) { throw exception; } if (socket == null) { server.close(); throw new IOException("client did not connect before timeout"); } acceptThread = null; } /** * Returns an input stream from which a remote file can be read. */ public InputStream getInputStream() throws IOException { if (inProgress) { throw new IOException("Transfer in progress"); } if (acceptThread != null) { waitFor(); } switch (transferMode) { case FTPConnection.MODE_STREAM: in = new StreamInputStream(this, socket.getInputStream()); break; case FTPConnection.MODE_BLOCK: in = new BlockInputStream(this, socket.getInputStream()); break; case FTPConnection.MODE_COMPRESSED: in = new CompressedInputStream(this, socket.getInputStream()); break; default: throw new IllegalStateException("invalid transfer mode"); } in.setTransferComplete(false); return in; } /** * Returns an output stream to which a local file can be written for * upload. */ public OutputStream getOutputStream() throws IOException { if (inProgress) { throw new IOException("Transfer in progress"); } if (acceptThread != null) { waitFor(); } switch (transferMode) { case FTPConnection.MODE_STREAM: out = new StreamOutputStream(this, socket.getOutputStream()); break; case FTPConnection.MODE_BLOCK: out = new BlockOutputStream(this, socket.getOutputStream()); break; case FTPConnection.MODE_COMPRESSED: out = new CompressedOutputStream(this, socket.getOutputStream()); break; default: throw new IllegalStateException("invalid transfer mode"); } out.setTransferComplete(false); return out; } public void setTransferMode(int mode) { transferMode = mode; } public void complete() { completed = true; if (!inProgress) { transferComplete(); } } public boolean abort() { completed = true; transferComplete(); return inProgress; } public void transferComplete() { if (socket == null) { return; } if (in != null) { in.setTransferComplete(true); } if (out != null) { out.setTransferComplete(true); } completed = completed || (transferMode == FTPConnection.MODE_STREAM); if (completed && socket != null) { try { socket.close(); } catch (IOException e) { } try { server.close(); } catch (IOException e) { } } } } inetlib-1.1.2/source/gnu/inet/ftp/BlockInputStream.java0000664000076400007640000000706711345235566020032 00000000000000/* * BlockInputStream.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.FilterInputStream; import java.io.InputStream; import java.io.IOException; /** * A DTP input stream that implements the FTP block transfer mode. * * @author Chris Burdess */ class BlockInputStream extends DTPInputStream { static final int EOF = 64; int descriptor; int max = -1; int count = -1; BlockInputStream(DTP dtp, InputStream in) { super(dtp, in); } public int read() throws IOException { if (transferComplete) { return -1; } if (count == -1) { readHeader(); } if (max < 1) { close(); return -1; } int c = in.read(); if (c == -1) { dtp.transferComplete(); } count++; if (count >= max) { count = -1; if (descriptor == EOF) { close(); } } return c; } public int read(byte[] buf) throws IOException { return read(buf, 0, buf.length); } public int read(byte[] buf, int off, int len) throws IOException { if (transferComplete) { return -1; } if (count == -1) { readHeader(); } if (max < 1) { close(); return -1; } int l = in.read(buf, off, len); if (l == -1) { dtp.transferComplete(); } count += l; if (count >= max) { count = -1; if (descriptor == EOF) { close(); } } return l; } /** * Reads the block header. */ void readHeader() throws IOException { descriptor = in.read(); int max_hi = in.read(); int max_lo = in.read(); max = (max_hi << 8) | max_lo; count = 0; } } inetlib-1.1.2/source/gnu/inet/ftp/Handler.java0000664000076400007640000000450211345235566016150 00000000000000/* * Handler.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; /** * An FTP URL stream handler. * * @author Chris Burdess */ public class Handler extends URLStreamHandler { protected int getDefaultPort() { return FTPConnection.FTP_PORT; } /** * Returns an FTPURLConnection for the given URL. */ public URLConnection openConnection(URL url) throws IOException { return new FTPURLConnection(url); } } inetlib-1.1.2/source/gnu/inet/ftp/StreamInputStream.java0000664000076400007640000000530611345235566020225 00000000000000/* * StreamInputStream.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.FilterInputStream; import java.io.InputStream; import java.io.IOException; /** * A DTP input stream that implements the FTP stream data transfer mode. * * @author Chris Burdess */ class StreamInputStream extends DTPInputStream { StreamInputStream(DTP dtp, InputStream in) { super(dtp, in); } public int read() throws IOException { if (transferComplete) { return -1; } int c = in.read(); if (c == -1) { close(); } return c; } public int read(byte[] buf) throws IOException { return read(buf, 0, buf.length); } public int read(byte[] buf, int off, int len) throws IOException { if (transferComplete) { return -1; } int l = in.read(buf, off, len); if (l == -1) { close(); } return l; } } inetlib-1.1.2/source/gnu/inet/ftp/FTPURLConnection.java0000664000076400007640000002352411345235566017634 00000000000000/* * FTPURLConnection.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.FileNotFoundException; import java.io.FilterInputStream; import java.io.FilterOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.InetAddress; import java.net.URL; import java.net.URLConnection; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.HashMap; import java.util.Map; import gnu.inet.util.GetLocalHostAction; import gnu.inet.util.GetSystemPropertyAction; /** * An FTP URL connection. * * @author Chris Burdess */ public class FTPURLConnection extends URLConnection { /** * The connection managing the protocol exchange. */ protected FTPConnection connection; protected boolean passive; protected int representationType; protected int fileStructure; protected int transferMode; /** * Constructs an FTP connection to the specified URL. * @param url the URL */ public FTPURLConnection(URL url) { super(url); passive = true; representationType = FTPConnection.TYPE_BINARY; fileStructure = -1; transferMode = -1; } /** * Establishes the connection. */ public void connect() throws IOException { if (connected) { return; } String host = url.getHost(); int port = url.getPort(); String username = url.getUserInfo(); String password = null; if (username != null) { int ci = username.indexOf(':'); if (ci != -1) { password = username.substring(ci + 1); username = username.substring(0, ci); } } else { username = "anonymous"; PrivilegedAction a = new GetSystemPropertyAction("user.name"); String systemUsername =(String) AccessController.doPrivileged(a); a = new GetLocalHostAction(); InetAddress localhost =(InetAddress) AccessController.doPrivileged(a); password = systemUsername + "@" + ((localhost == null) ? "localhost" : localhost.getHostName()); } connection = new FTPConnection(host, port); if (!connection.authenticate(username, password)) { throw new SecurityException("Authentication failed"); } connection.setPassive(passive); if (representationType != -1) { connection.setRepresentationType(representationType); } if (fileStructure != -1) { connection.setFileStructure(fileStructure); } if (transferMode != -1) { connection.setTransferMode(transferMode); } } /** * This connection supports doInput. */ public void setDoInput(boolean doinput) { doInput = doinput; } /** * This connection supports doOutput. */ public void setDoOutput(boolean dooutput) { doOutput = dooutput; } /** * Returns an input stream that reads from this open connection. */ public InputStream getInputStream() throws IOException { if (!connected) { connect(); } String path = url.getPath(); if (path.startsWith("/")) { path = path.substring(1); } if (connection.changeWorkingDirectory(path)) { return this.new ClosingInputStream(connection.list(null)); } else { return this.new ClosingInputStream(connection.retrieve(path)); } } /** * Returns an output stream that writes to this connection. */ public OutputStream getOutputStream() throws IOException { if (!connected) { connect(); } String path = url.getPath(); return this.new ClosingOutputStream(connection.store(path)); } public String getRequestProperty(String key) { if ("passive".equals(key)) { return Boolean.toString(passive); } else if ("representationType".equals(key)) { switch (representationType) { case FTPConnection.TYPE_ASCII: return "ASCII"; case FTPConnection.TYPE_EBCDIC: return "EBCDIC"; case FTPConnection.TYPE_BINARY: return "BINARY"; } } else if ("fileStructure".equals(key)) { switch (fileStructure) { case FTPConnection.STRUCTURE_FILE: return "FILE"; case FTPConnection.STRUCTURE_RECORD: return "RECORD"; case FTPConnection.STRUCTURE_PAGE: return "PAGE"; } } else if ("transferMode".equals(key)) { switch (transferMode) { case FTPConnection.MODE_STREAM: return "STREAM"; case FTPConnection.MODE_BLOCK: return "BLOCK"; case FTPConnection.MODE_COMPRESSED: return "COMPRESSED"; } } return null; } public Map getRequestProperties() { Map map = new HashMap(); addRequestPropertyValue(map, "passive"); addRequestPropertyValue(map, "representationType"); addRequestPropertyValue(map, "fileStructure"); addRequestPropertyValue(map, "transferMode"); return map; } private void addRequestPropertyValue(Map map, String key) { String value = getRequestProperty(key); map.put(key, value); } public void setRequestProperty(String key, String value) { if (connected) { throw new IllegalStateException(); } if ("passive".equals(key)) { passive = Boolean.valueOf(value).booleanValue(); } else if ("representationType".equals(key)) { if ("A".equalsIgnoreCase(value) || "ASCII".equalsIgnoreCase(value)) { representationType = FTPConnection.TYPE_ASCII; } else if ("E".equalsIgnoreCase(value) || "EBCDIC".equalsIgnoreCase(value)) { representationType = FTPConnection.TYPE_EBCDIC; } else if ("I".equalsIgnoreCase(value) || "BINARY".equalsIgnoreCase(value)) { representationType = FTPConnection.TYPE_BINARY; } else { throw new IllegalArgumentException(value); } } else if ("fileStructure".equals(key)) { if ("F".equalsIgnoreCase(value) || "FILE".equalsIgnoreCase(value)) { fileStructure = FTPConnection.STRUCTURE_FILE; } else if ("R".equalsIgnoreCase(value) || "RECORD".equalsIgnoreCase(value)) { fileStructure = FTPConnection.STRUCTURE_RECORD; } else if ("P".equalsIgnoreCase(value) || "PAGE".equalsIgnoreCase(value)) { fileStructure = FTPConnection.STRUCTURE_PAGE; } else { throw new IllegalArgumentException(value); } } else if ("transferMode".equals(key)) { if ("S".equalsIgnoreCase(value) || "STREAM".equalsIgnoreCase(value)) { transferMode = FTPConnection.MODE_STREAM; } else if ("B".equalsIgnoreCase(value) || "BLOCK".equalsIgnoreCase(value)) { transferMode = FTPConnection.MODE_BLOCK; } else if ("C".equalsIgnoreCase(value) || "COMPRESSED".equalsIgnoreCase(value)) { transferMode = FTPConnection.MODE_COMPRESSED; } else { throw new IllegalArgumentException(value); } } } public void addRequestProperty(String key, String value) { setRequestProperty(key, value); } class ClosingInputStream extends FilterInputStream { ClosingInputStream(InputStream in) { super(in); } public void close() throws IOException { super.close(); connection.logout(); } } class ClosingOutputStream extends FilterOutputStream { ClosingOutputStream(OutputStream out) { super(out); } public void close() throws IOException { super.close(); connection.logout(); } } } inetlib-1.1.2/source/gnu/inet/ftp/FTPResponse.java0000664000076400007640000000575011345235566016751 00000000000000/* * FTPResponse.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; /** * An FTP control response. * * @author Chris Burdess */ public final class FTPResponse { /** * The 3-digit status code. */ protected final int code; /** * The human-readable message. */ protected final String message; /** * Multiline data, if present. */ protected final String data; /** * Constructs a new FTP response. * @param code the status code * @param message the message */ public FTPResponse(int code, String message) { this(code, message, null); } /** * Constructs a new multiline FTP response. * @param code the status code * @param message the message * @param data multiline data */ public FTPResponse(int code, String message, String data) { this.code = code; this.message = message; this.data = data; } /** * Returns the 3-digit status code. */ public int getCode() { return code; } /** * Returns the human-readable message. */ public String getMessage() { return message; } /** * Returns the multiline data, or null if there was no such data. */ public String getData() { return data; } } inetlib-1.1.2/source/gnu/inet/ftp/FTPException.java0000664000076400007640000000467711345235566017120 00000000000000/* * FTPException.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.IOException; /** * An FTP control exception. * * @author Chris Burdess */ public class FTPException extends IOException { /** * The response that provoked this exception. */ protected final FTPResponse response; /** * Constructs a new FTP exception. * @param response the response that provoked this exception */ public FTPException(FTPResponse response) { super(response.getMessage()); this.response = response; } /** * Returns the response that provoked this exception. */ public FTPResponse getResponse() { return response; } } inetlib-1.1.2/source/gnu/inet/ftp/CompressedOutputStream.java0000664000076400007640000001535011345235566021277 00000000000000/* * CompressedOutputStream.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; /** * A DTP output stream that implements the FTP compressed transfer mode. * * @author Chris Burdess */ class CompressedOutputStream extends DTPOutputStream { static final byte RECORD = -128; // 0x80 static final byte EOF = 64; // 0x40 CompressedOutputStream(DTP dtp, OutputStream out) { super(dtp, out); } /** * Just one byte cannot be compressed. * It takes 5 bytes to transmit - hardly very compressed! */ public void write(int c) throws IOException { if (transferComplete) { return; } byte[] buf = new byte[] { RECORD, /* record descriptor */ 0x00, 0x01, /* one byte */ 0x01, /* one uncompressed byte */ (byte) c /* the byte */ }; out.write(buf, 0, 5); } public void write(byte[] b) throws IOException { write(b, 0, b.length); } /** * The larger len is, the better. */ public void write(byte[] b, int off, int len) throws IOException { if (transferComplete) { return; } byte[] buf = compress(b, off, len); len = buf.length; buf[0] = RECORD; /* record descriptor */ buf[1] = (byte) ((len & 0x00ff) >> 8); /* high byte of bytecount */ buf[2] = (byte) (len & 0xff00); /* low byte of bytecount */ out.write(buf, 0, len); } /** * Returns the compressed form of the given byte array. * The first 3 bytes are left free for header information. */ byte[] compress(byte[] b, int off, int len) { byte[] buf = new byte[len]; byte last = 0; int pos = 0, raw_count = 0, rep_count = 1; for (int i = off; i < len; i++) { byte c = b[i]; if (i > off && c == last) // compress { if (raw_count > 0) // flush raw bytes to buf { // need to add raw_count+1 bytes if (pos + (raw_count + 1) > buf.length) { buf = realloc(buf, len); } pos = flush_raw(buf, pos, b, (i - raw_count) - 1, raw_count); raw_count = 0; } rep_count++; // keep looking for same byte } else { if (rep_count > 1) // flush compressed bytes to buf { // need to add 2 bytes if (pos + 2 > buf.length) { buf = realloc(buf, len); } pos = flush_compressed(buf, pos, rep_count, last); rep_count = 1; } raw_count++; // keep looking for raw bytes } if (rep_count == 127) // flush compressed bytes { // need to add 2 bytes if (pos + 2 > buf.length) { buf = realloc(buf, len); } pos = flush_compressed(buf, pos, rep_count, last); rep_count = 1; } if (raw_count == 127) // flush raw bytes { // need to add raw_count+1 bytes if (pos + (raw_count + 1) > buf.length) { buf = realloc(buf, len); } pos = flush_raw(buf, pos, b, (i - raw_count), raw_count); raw_count = 0; } last = c; } if (rep_count > 1) // flush compressed bytes { // need to add 2 bytes if (pos + 2 > buf.length) { buf = realloc(buf, len); } pos = flush_compressed(buf, pos, rep_count, last); rep_count = 1; } if (raw_count > 0) // flush raw bytes { // need to add raw_count+1 bytes if (pos + (raw_count + 1) > buf.length) { buf = realloc(buf, len); } pos = flush_raw(buf, pos, b, (len - raw_count), raw_count); raw_count = 0; } byte[] ret = new byte[pos + 3]; System.arraycopy(buf, 0, ret, 3, pos); return ret; } int flush_compressed(byte[] buf, int pos, int count, byte c) { buf[pos++] = (byte) (0x80 | count); buf[pos++] = c; return pos; } int flush_raw(byte[] buf, int pos, byte[] src, int off, int len) { buf[pos++] = (byte) len; System.arraycopy(src, off, buf, pos, len); return pos + len; } byte[] realloc(byte[] buf, int len) { byte[] ret = new byte[buf.length + len]; System.arraycopy(buf, 0, ret, 0, buf.length); return ret; } public void close() throws IOException { byte[] buf = new byte[] { EOF, /* eof descriptor */ 0x00, 0x00 /* no bytes */ }; out.write(buf, 0, 3); out.close(); } } inetlib-1.1.2/source/gnu/inet/ftp/DTPInputStream.java0000664000076400007640000000527311345235566017424 00000000000000/* * DTPInputStream.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.FilterInputStream; import java.io.InputStream; import java.io.IOException; /** * An input stream that notifies a DTP on completion. * * @author Chris Burdess */ abstract class DTPInputStream extends FilterInputStream { DTP dtp; boolean transferComplete; /** * Constructor. * @param dtp the controlling data transfer process * @param in the underlying socket stream */ DTPInputStream (DTP dtp, InputStream in) { super(in); this.dtp = dtp; transferComplete = false; } /** * Marks this input stream complete. * This is called by the DTP. */ void setTransferComplete(boolean flag) { transferComplete = flag; } /** * Notifies the controlling DTP that this stream has completed transfer. */ public void close() throws IOException { dtp.transferComplete(); } } inetlib-1.1.2/source/gnu/inet/ftp/DTP.java0000664000076400007640000000561311345235566015226 00000000000000/* * DTP.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; /** * An FTP data transfer process. * * @author Chris Burdess */ interface DTP { /** * Returns an input stream from which a remote file can be read. */ InputStream getInputStream() throws IOException; /** * Returns an output stream to which a local file can be written for * upload. */ OutputStream getOutputStream() throws IOException; /** * Sets the transfer mode to be used with this DTP. */ void setTransferMode(int mode); /** * Marks this DTP completed. * When the current transfer has finished, any resources will be released. */ void complete(); /** * Aborts any current transfer and releases all resources held by this * DTP. * @return true if a transfer was interrupted, false otherwise */ boolean abort(); /** * Used to notify the DTP that its current transfer is complete. * This occurs either when end-of-stream is reached or a 226 response is * received. */ void transferComplete(); } inetlib-1.1.2/source/gnu/inet/ftp/DTPOutputStream.java0000664000076400007640000000537611345235566017631 00000000000000/* * DTPOutputStream.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; /** * An output stream that notifies a DTP on end of stream. * * @author Chris Burdess */ abstract class DTPOutputStream extends FilterOutputStream { DTP dtp; boolean transferComplete; /** * Constructor. * @param dtp the controlling data transfer process * @param out the socket output stream */ DTPOutputStream(DTP dtp, OutputStream out) { super(out); this.dtp = dtp; transferComplete = false; } /** * Tells this stream whether transfer has completed or not. * @param flag true if the process has completed, false otherwise */ void setTransferComplete(boolean flag) { transferComplete = flag; } /** * Notifies the controlling DTP that this stream has been terminated. */ public void close() throws IOException { dtp.transferComplete(); } } inetlib-1.1.2/source/gnu/inet/ftp/FTPConnection.java0000664000076400007640000011026111345235566017244 00000000000000/* * FTPConnection.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.BindException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ProtocolException; import java.net.Socket; import java.net.UnknownHostException; import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.List; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import gnu.inet.util.CRLFInputStream; import gnu.inet.util.CRLFOutputStream; import gnu.inet.util.EmptyX509TrustManager; import gnu.inet.util.LineInputStream; /** * An FTP client connection, or PI. * This implements RFC 959, with the following exceptions: *
    *
  • STAT, HELP, SITE, SMNT, and ACCT commands are not supported.
  • *
  • the TYPE command does not allow alternatives to the default bytesize * (Non-print), and local bytesize is not supported.
  • *
* * @author Chris Burdess */ public class FTPConnection { /** * The default FTP transmission control port. */ public static final int FTP_PORT = 21; /** * The FTP data port. */ public static final int FTP_DATA_PORT = 20; // -- FTP vocabulary -- protected static final String USER = "USER"; protected static final String PASS = "PASS"; protected static final String ACCT = "ACCT"; protected static final String CWD = "CWD"; protected static final String CDUP = "CDUP"; protected static final String SMNT = "SMNT"; protected static final String REIN = "REIN"; protected static final String QUIT = "QUIT"; protected static final String PORT = "PORT"; protected static final String PASV = "PASV"; protected static final String TYPE = "TYPE"; protected static final String STRU = "STRU"; protected static final String MODE = "MODE"; protected static final String RETR = "RETR"; protected static final String STOR = "STOR"; protected static final String STOU = "STOU"; protected static final String APPE = "APPE"; protected static final String ALLO = "ALLO"; protected static final String REST = "REST"; protected static final String RNFR = "RNFR"; protected static final String RNTO = "RNTO"; protected static final String ABOR = "ABOR"; protected static final String DELE = "DELE"; protected static final String RMD = "RMD"; protected static final String MKD = "MKD"; protected static final String PWD = "PWD"; protected static final String LIST = "LIST"; protected static final String NLST = "NLST"; protected static final String SITE = "SITE"; protected static final String SYST = "SYST"; protected static final String STAT = "STAT"; protected static final String HELP = "HELP"; protected static final String NOOP = "NOOP"; protected static final String AUTH = "AUTH"; protected static final String PBSZ = "PBSZ"; protected static final String PROT = "PROT"; protected static final String CCC = "CCC"; protected static final String TLS = "TLS"; public static final int TYPE_ASCII = 1; public static final int TYPE_EBCDIC = 2; public static final int TYPE_BINARY = 3; public static final int STRUCTURE_FILE = 1; public static final int STRUCTURE_RECORD = 2; public static final int STRUCTURE_PAGE = 3; public static final int MODE_STREAM = 1; public static final int MODE_BLOCK = 2; public static final int MODE_COMPRESSED = 3; // -- Telnet constants -- private static final String US_ASCII = "US-ASCII"; /** * The socket used to communicate with the server. */ protected Socket socket; /** * The socket input stream. */ protected LineInputStream in; /** * The socket output stream. */ protected CRLFOutputStream out; /** * The timeout when attempting to connect a socket. */ protected int connectionTimeout; /** * The read timeout on sockets. */ protected int timeout; /** * If true, print debugging information. */ protected boolean debug; /** * The current data transfer process in use by this connection. */ protected DTP dtp; /** * The current representation type. */ protected int representationType = TYPE_ASCII; /** * The current file structure type. */ protected int fileStructure = STRUCTURE_FILE; /** * The current transfer mode. */ protected int transferMode = MODE_STREAM; /** * If true, use passive mode. */ protected boolean passive = false; /** * Creates a new connection to the server using the default port. * @param hostname the hostname of the server to connect to */ public FTPConnection(String hostname) throws UnknownHostException, IOException { this(hostname, -1, 0, 0, false); } /** * Creates a new connection to the server. * @param hostname the hostname of the server to connect to * @param port the port to connect to(if <=0, use default port) */ public FTPConnection(String hostname, int port) throws UnknownHostException, IOException { this(hostname, port, 0, 0, false); } /** * Creates a new connection to the server. * @param hostname the hostname of the server to connect to * @param port the port to connect to(if <=0, use default port) * @param connectionTimeout the connection timeout, in milliseconds * @param timeout the I/O timeout, in milliseconds * @param debug print debugging information */ public FTPConnection(String hostname, int port, int connectionTimeout, int timeout, boolean debug) throws UnknownHostException, IOException { this.connectionTimeout = connectionTimeout; this.timeout = timeout; this.debug = debug; if (port <= 0) { port = FTP_PORT; } // Set up socket socket = new Socket(); InetSocketAddress address = new InetSocketAddress(hostname, port); if (connectionTimeout > 0) { socket.connect(address, connectionTimeout); } else { socket.connect(address); } if (timeout > 0) { socket.setSoTimeout(timeout); } InputStream is = socket.getInputStream(); is = new BufferedInputStream(is); is = new CRLFInputStream(is); in = new LineInputStream(is); OutputStream os = socket.getOutputStream(); os = new BufferedOutputStream(os); out = new CRLFOutputStream(os); // Read greeting FTPResponse response = getResponse(); switch (response.getCode()) { case 220: // hello break; default: throw new FTPException(response); } } /** * Authenticate using the specified username and password. * If the username suffices for the server, the password will not be used * and may be null. * @param username the username * @param password the optional password * @return true on success, false otherwise */ public boolean authenticate(String username, String password) throws IOException { String cmd = USER + ' ' + username; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 230: // User logged in return true; case 331: // User name okay, need password break; case 332: // Need account for login case 530: // No such user return false; default: throw new FTPException(response); } cmd = PASS + ' ' + password; send(cmd); response = getResponse(); switch (response.getCode()) { case 230: // User logged in case 202: // Superfluous return true; case 332: // Need account for login case 530: // Bad password return false; default: throw new FTPException(response); } } /** * Negotiates TLS over the current connection. * See IETF draft-murray-auth-ftp-ssl-15.txt for details. * @param confidential whether to provide confidentiality for the * connection */ public boolean starttls(boolean confidential) throws IOException { return starttls(confidential, new EmptyX509TrustManager()); } /** * Negotiates TLS over the current connection. * See IETF draft-murray-auth-ftp-ssl-15.txt for details. * @param confidential whether to provide confidentiality for the * connection * @param tm the trust manager used to validate the server certificate. */ public boolean starttls(boolean confidential, TrustManager tm) throws IOException { try { // Use SSLSocketFactory to negotiate a TLS session and wrap the // current socket. SSLContext context = SSLContext.getInstance("TLS"); // We don't require strong validation of the server certificate TrustManager[] trust = new TrustManager[] { tm }; context.init(null, trust, null); SSLSocketFactory factory = context.getSocketFactory(); send(AUTH + ' ' + TLS); FTPResponse response = getResponse(); switch (response.getCode()) { case 500: case 502: case 504: case 534: case 431: return false; case 234: break; default: throw new FTPException(response); } String hostname = socket.getInetAddress().getHostName(); int port = socket.getPort(); SSLSocket ss = (SSLSocket) factory.createSocket(socket, hostname, port, true); String[] protocols = { "TLSv1", "SSLv3" }; ss.setEnabledProtocols(protocols); ss.setUseClientMode(true); ss.startHandshake(); // PBSZ:PROT sequence send(PBSZ + ' ' + Integer.MAX_VALUE); response = getResponse(); switch (response.getCode()) { case 501: // syntax error case 503: // not authenticated return false; case 200: break; default: throw new FTPException(response); } send(PROT + ' ' +(confidential ? 'P' : 'C')); response = getResponse(); switch (response.getCode()) { case 503: // not authenticated case 504: // invalid level case 536: // level not supported return false; case 200: break; default: throw new FTPException(response); } if (confidential) { // Set up streams InputStream is = ss.getInputStream(); is = new BufferedInputStream(is); is = new CRLFInputStream(is); in = new LineInputStream(is); OutputStream os = ss.getOutputStream(); os = new BufferedOutputStream(os); out = new CRLFOutputStream(os); } return true; } catch (GeneralSecurityException e) { return false; } } /** * Changes directory to the specified path. * @param path an absolute or relative pathname * @return true on success, false if the specified path does not exist */ public boolean changeWorkingDirectory(String path) throws IOException { String cmd = CWD + ' ' + path; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 250: return true; case 550: return false; default: throw new FTPException(response); } } /** * Changes directory to the parent of the current working directory. * @return true on success, false otherwise */ public boolean changeToParentDirectory() throws IOException { send(CDUP); FTPResponse response = getResponse(); switch (response.getCode()) { case 250: return true; case 550: return false; default: throw new FTPException(response); } } /** * Terminates an authenticated login. * If file transfer is in progress, it remains active for result response * only. */ public void reinitialize() throws IOException { send(REIN); FTPResponse response = getResponse(); switch (response.getCode()) { case 220: if (dtp != null) { dtp.complete(); dtp = null; } break; default: throw new FTPException(response); } } /** * Terminates the control connection. * The file transfer connection remains open for result response only. * This connection is invalid and no further commands may be issued. */ public void logout() throws IOException { send(QUIT); try { getResponse(); // not required } catch (IOException e) { } if (dtp != null) { dtp.complete(); dtp = null; } try { socket.close(); } catch (IOException e) { } } /** * Initialise the data transfer process. */ protected void initialiseDTP() throws IOException { if (dtp != null) { dtp.complete(); dtp = null; } InetAddress localhost = socket.getLocalAddress(); if (passive) { send(PASV); FTPResponse response = getResponse(); switch (response.getCode()) { case 227: String message = response.getMessage(); try { int start = message.indexOf(','); char c = message.charAt(start - 1); while (c >= 0x30 && c <= 0x39) { c = message.charAt((--start) - 1); } int mid1 = start; for (int i = 0; i < 4; i++) { mid1 = message.indexOf(',', mid1 + 1); } int mid2 = message.indexOf(',', mid1 + 1); if (mid1 == -1 || mid2 < mid1) { throw new ProtocolException("Malformed 227: " + message); } int end = mid2; c = message.charAt(end + 1); while (c >= 0x30 && c <= 0x39) { c = message.charAt((++end) + 1); } String address = message.substring(start, mid1).replace(',', '.'); int port_hi = Integer.parseInt(message.substring(mid1 + 1, mid2)); int port_lo = Integer.parseInt(message.substring(mid2 + 1, end + 1)); int port = (port_hi << 8) | port_lo; /*System.out.println("Entering passive mode: " + address + ":" + port);*/ dtp = new PassiveModeDTP(address, port, localhost, connectionTimeout, timeout); break; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e.getMessage() + ": " + message); } catch (NumberFormatException e) { throw new ProtocolException(e.getMessage() + ": " + message); } default: throw new FTPException(response); } } else { // Get the local port int port = socket.getLocalPort() + 1; int tries = 0; // Bind the active mode DTP while (dtp == null) { try { dtp = new ActiveModeDTP(localhost, port, connectionTimeout, timeout); /*System.out.println("Listening on: " + port);*/ } catch (BindException e) { port++; tries++; if (tries > 9) { throw e; } } } // Send PORT command StringBuffer buf = new StringBuffer(PORT); buf.append(' '); // Construct the address/port string form byte[] address = localhost.getAddress(); for (int i = 0; i < address.length; i++) { int a =(int) address[i]; if (a < 0) { a += 0x100; } buf.append(a); buf.append(','); } int port_hi =(port & 0xff00) >> 8; int port_lo =(port & 0x00ff); buf.append(port_hi); buf.append(','); buf.append(port_lo); send(buf.toString()); // Get response FTPResponse response = getResponse(); switch (response.getCode()) { case 200: // OK break; default: dtp.abort(); dtp = null; throw new FTPException(response); } } dtp.setTransferMode(transferMode); } /** * Set passive mode. * @param flag true if we should use passive mode, false otherwise */ public void setPassive(boolean flag) throws IOException { if (passive != flag) { passive = flag; initialiseDTP(); } } /** * Returns the current representation type of the transfer data. * @return TYPE_ASCII, TYPE_EBCDIC, or TYPE_BINARY */ public int getRepresentationType() { return representationType; } /** * Sets the desired representation type of the transfer data. * @param type TYPE_ASCII, TYPE_EBCDIC, or TYPE_BINARY */ public void setRepresentationType(int type) throws IOException { StringBuffer buf = new StringBuffer(TYPE); buf.append(' '); switch (type) { case TYPE_ASCII: buf.append('A'); break; case TYPE_EBCDIC: buf.append('E'); break; case TYPE_BINARY: buf.append('I'); break; default: throw new IllegalArgumentException(Integer.toString(type)); } //buf.append(' '); //buf.append('N'); send(buf.toString()); FTPResponse response = getResponse(); switch (response.getCode()) { case 200: representationType = type; break; default: throw new FTPException(response); } } /** * Returns the current file structure type. * @return STRUCTURE_FILE, STRUCTURE_RECORD, or STRUCTURE_PAGE */ public int getFileStructure() { return fileStructure; } /** * Sets the desired file structure type. * @param structure STRUCTURE_FILE, STRUCTURE_RECORD, or STRUCTURE_PAGE */ public void setFileStructure(int structure) throws IOException { StringBuffer buf = new StringBuffer(STRU); buf.append(' '); switch (structure) { case STRUCTURE_FILE: buf.append('F'); break; case STRUCTURE_RECORD: buf.append('R'); break; case STRUCTURE_PAGE: buf.append('P'); break; default: throw new IllegalArgumentException(Integer.toString(structure)); } send(buf.toString()); FTPResponse response = getResponse(); switch (response.getCode()) { case 200: fileStructure = structure; break; default: throw new FTPException(response); } } /** * Returns the current transfer mode. * @return MODE_STREAM, MODE_BLOCK, or MODE_COMPRESSED */ public int getTransferMode() { return transferMode; } /** * Sets the desired transfer mode. * @param mode MODE_STREAM, MODE_BLOCK, or MODE_COMPRESSED */ public void setTransferMode(int mode) throws IOException { StringBuffer buf = new StringBuffer(MODE); buf.append(' '); switch (mode) { case MODE_STREAM: buf.append('S'); break; case MODE_BLOCK: buf.append('B'); break; case MODE_COMPRESSED: buf.append('C'); break; default: throw new IllegalArgumentException(Integer.toString(mode)); } send(buf.toString()); FTPResponse response = getResponse(); switch (response.getCode()) { case 200: transferMode = mode; if (dtp != null) { dtp.setTransferMode(mode); } break; default: throw new FTPException(response); } } /** * Retrieves the specified file. * @param filename the filename of the file to retrieve * @return an InputStream containing the file content */ public InputStream retrieve(String filename) throws IOException { if (dtp == null || transferMode == MODE_STREAM) { initialiseDTP(); } /* int size = -1; String cmd = SIZE + ' ' + filename; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 213: size = Integer.parseInt(response.getMessage()); break; case 550: // File not found default: throw new FTPException(response); } */ String cmd = RETR + ' ' + filename; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 125: // Data connection already open; transfer starting case 150: // File status okay; about to open data connection return dtp.getInputStream(); default: throw new FTPException(response); } } /** * Returns a stream for uploading a file. * If a file with the same filename already exists on the server, it will * be overwritten. * @param filename the name of the file to save the content as * @return an OutputStream to write the file data to */ public OutputStream store(String filename) throws IOException { if (dtp == null || transferMode == MODE_STREAM) { initialiseDTP(); } String cmd = STOR + ' ' + filename; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 125: // Data connection already open; transfer starting case 150: // File status okay; about to open data connection return dtp.getOutputStream(); default: throw new FTPException(response); } } /** * Returns a stream for uploading a file. * If a file with the same filename already exists on the server, the * content specified will be appended to the existing file. * @param filename the name of the file to save the content as * @return an OutputStream to write the file data to */ public OutputStream append(String filename) throws IOException { if (dtp == null || transferMode == MODE_STREAM) { initialiseDTP(); } String cmd = APPE + ' ' + filename; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 125: // Data connection already open; transfer starting case 150: // File status okay; about to open data connection return dtp.getOutputStream(); default: throw new FTPException(response); } } /** * This command may be required by some servers to reserve sufficient * storage to accommodate the new file to be transferred. * It should be immediately followed by a store or * append. * @param size the number of bytes of storage to allocate */ public void allocate(long size) throws IOException { String cmd = ALLO + ' ' + size; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 200: // OK case 202: // Superfluous break; default: throw new FTPException(response); } } /** * Renames a file. * @param oldName the current name of the file * @param newName the new name * @return true if successful, false otherwise */ public boolean rename(String oldName, String newName) throws IOException { String cmd = RNFR + ' ' + oldName; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 450: // File unavailable case 550: // File not found return false; case 350: // Pending break; default: throw new FTPException(response); } cmd = RNTO + ' ' + newName; send(cmd); response = getResponse(); switch (response.getCode()) { case 250: // OK return true; case 450: case 550: return false; default: throw new FTPException(response); } } /** * Aborts the transfer in progress. * @return true if a transfer was in progress, false otherwise */ public boolean abort() throws IOException { send(ABOR); FTPResponse response = getResponse(); // Abort client DTP if (dtp != null) { dtp.abort(); } switch (response.getCode()) { case 226: // successful abort return false; case 426: // interrupted response = getResponse(); if (response.getCode() == 226) { return true; } // Otherwise fall through to throw exception default: throw new FTPException(response); } } /** * Causes the file specified to be deleted at the server site. * @param filename the file to delete */ public boolean delete(String filename) throws IOException { String cmd = DELE + ' ' + filename; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 250: // OK return true; case 450: // File unavailable case 550: // File not found return false; default: throw new FTPException(response); } } /** * Causes the directory specified to be deleted. * This may be an absolute or relative pathname. * @param pathname the directory to delete */ public boolean removeDirectory(String pathname) throws IOException { String cmd = RMD + ' ' + pathname; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 250: // OK return true; case 550: // File not found return false; default: throw new FTPException(response); } } /** * Causes the directory specified to be created at the server site. * This may be an absolute or relative pathname. * @param pathname the directory to create */ public boolean makeDirectory(String pathname) throws IOException { String cmd = MKD + ' ' + pathname; send(cmd); FTPResponse response = getResponse(); switch (response.getCode()) { case 257: // Directory created return true; case 550: // File not found return false; default: throw new FTPException(response); } } /** * Returns the current working directory. */ public String getWorkingDirectory() throws IOException { send(PWD); FTPResponse response = getResponse(); switch (response.getCode()) { case 257: String message = response.getMessage(); if (message.charAt(0) == '"') { int end = message.indexOf('"', 1); if (end == -1) { throw new ProtocolException(message); } return message.substring(1, end); } else { int end = message.indexOf(' '); if (end == -1) { return message; } else { return message.substring(0, end); } } default: throw new FTPException(response); } } /** * Returns a listing of information about the specified pathname. * If the pathname specifies a directory or other group of files, the * server should transfer a list of files in the specified directory. * If the pathname specifies a file then the server should send current * information on the file. A null argument implies the user's * current working or default directory. * @param pathname the context pathname, or null */ public InputStream list(String pathname) throws IOException { if (dtp == null || transferMode == MODE_STREAM) { initialiseDTP(); } if (pathname == null) { send(LIST); } else { String cmd = LIST + ' ' + pathname; send(cmd); } FTPResponse response = getResponse(); switch (response.getCode()) { case 125: // Data connection already open; transfer starting case 150: // File status okay; about to open data connection return dtp.getInputStream(); default: throw new FTPException(response); } } /** * Returns a directory listing. The pathname should specify a * directory or other system-specific file group descriptor; a null * argument implies the user's current working or default directory. * @param pathname the directory pathname, or null * @return a list of filenames(strings) */ public List nameList(String pathname) throws IOException { if (dtp == null || transferMode == MODE_STREAM) { initialiseDTP(); } if (pathname == null) { send(NLST); } else { String cmd = NLST + ' ' + pathname; send(cmd); } FTPResponse response = getResponse(); switch (response.getCode()) { case 125: // Data connection already open; transfer starting case 150: // File status okay; about to open data connection InputStream is = dtp.getInputStream(); is = new BufferedInputStream(is); is = new CRLFInputStream(is); // TODO ensure that TYPE is correct LineInputStream li = new LineInputStream(is); List ret = new ArrayList(); for (String line = li.readLine(); line != null; line = li.readLine()) { ret.add(line); } li.close(); return ret; default: throw new FTPException(response); } } /** * Returns the type of operating system at the server. */ public String system() throws IOException { send(SYST); FTPResponse response = getResponse(); switch (response.getCode()) { case 215: String message = response.getMessage(); int end = message.indexOf(' '); if (end == -1) { return message; } else { return message.substring(0, end); } default: throw new FTPException(response); } } /** * Does nothing. * This method can be used to ensure that the connection does not time * out. */ public void noop() throws IOException { send(NOOP); FTPResponse response = getResponse(); switch (response.getCode()) { case 200: break; default: throw new FTPException(response); } } // -- I/O -- /** * Sends the specified command line to the server. * The CRLF sequence is automatically appended. * @param cmd the command line to send */ protected void send(String cmd) throws IOException { byte[] data = cmd.getBytes(US_ASCII); out.write(data); out.writeln(); out.flush(); } /** * Reads the next response from the server. * If the server sends the "transfer complete" code, this is handled here, * and the next response is passed to the caller. */ protected FTPResponse getResponse() throws IOException { FTPResponse response = readResponse(); if (response.getCode() == 226) { if (dtp != null) { dtp.transferComplete(); } response = readResponse(); } return response; } /** * Reads and parses the next response from the server. */ protected FTPResponse readResponse() throws IOException { String line = in.readLine(); if (line == null) { throw new ProtocolException( "EOF"); } if (line.length() < 4) { throw new ProtocolException(line); } int code = parseCode(line); if (code == -1) { throw new ProtocolException(line); } char c = line.charAt(3); if (c == ' ') { return new FTPResponse(code, line.substring(4)); } else if (c == '-') { StringBuffer buf = new StringBuffer(line.substring(4)); buf.append('\n'); while(true) { line = in.readLine(); if (line == null) { throw new ProtocolException("EOF"); } if (line.length() >= 4 && line.charAt(3) == ' ' && parseCode(line) == code) { return new FTPResponse(code, line.substring(4), buf.toString()); } else { buf.append(line); buf.append('\n'); } } } else { throw new ProtocolException(line); } } /* * Parses the 3-digit numeric code at the beginning of the given line. * Returns -1 on failure. */ static final int parseCode(String line) { char[] c = { line.charAt(0), line.charAt(1), line.charAt(2) }; int ret = 0; for (int i = 0; i < 3; i++) { int digit =((int) c[i]) - 0x30; if (digit < 0 || digit > 9) { return -1; } // Computing integer powers is way too expensive in Java! switch (i) { case 0: ret +=(100 * digit); break; case 1: ret +=(10 * digit); break; case 2: ret += digit; break; } } return ret; } } inetlib-1.1.2/source/gnu/inet/ftp/StreamOutputStream.java0000664000076400007640000000507111345235566020425 00000000000000/* * StreamOutputStream.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; /** * A DTP output stream that implements the FTP stream transfer mode. * * @author Chris Burdess */ class StreamOutputStream extends DTPOutputStream { StreamOutputStream(DTP dtp, OutputStream out) { super(dtp, out); } public void write(int c) throws IOException { if (transferComplete) { return; } out.write(c); } public void write(byte[] b) throws IOException { write(b, 0, b.length); } public void write(byte[] b, int off, int len) throws IOException { if (transferComplete) { return; } out.write(b, off, len); } } inetlib-1.1.2/source/gnu/inet/ftp/PassiveModeDTP.java0000664000076400007640000001271311345235566017365 00000000000000/* * PassiveModeDTP.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; /** * A passive mode FTP data transfer process. * This connects to the host specified and proxies the resulting socket's * input and output streams. * * @author Chris Burdess */ final class PassiveModeDTP implements DTP { final String address; final int port; Socket socket; DTPInputStream in; DTPOutputStream out; boolean completed; boolean inProgress; int transferMode; PassiveModeDTP(String address, int port, InetAddress localhost, int connectionTimeout, int timeout) throws IOException { this.address = address; this.port = port; completed = false; inProgress = false; socket = new Socket(); InetSocketAddress remote = new InetSocketAddress(address, port); InetSocketAddress local = new InetSocketAddress(localhost, port + 1); socket.bind(local); if (connectionTimeout > 0) { socket.connect(remote, connectionTimeout); } else { socket.connect(remote); } if (timeout > 0) { socket.setSoTimeout(timeout); } } /** * Returns an input stream from which a remote file can be read. */ public InputStream getInputStream() throws IOException { if (inProgress) { throw new IOException("Transfer in progress"); } switch (transferMode) { case FTPConnection.MODE_STREAM: in = new StreamInputStream(this, socket.getInputStream()); break; case FTPConnection.MODE_BLOCK: in = new BlockInputStream(this, socket.getInputStream()); break; case FTPConnection.MODE_COMPRESSED: in = new CompressedInputStream(this, socket.getInputStream()); break; default: throw new IllegalStateException("Invalid transfer mode"); } in.setTransferComplete(false); return in; } /** * Returns an output stream to which a local file can be written for * upload. */ public OutputStream getOutputStream() throws IOException { if (inProgress) { throw new IOException("Transfer in progress"); } switch (transferMode) { case FTPConnection.MODE_STREAM: out = new StreamOutputStream(this, socket.getOutputStream()); break; case FTPConnection.MODE_BLOCK: out = new BlockOutputStream(this, socket.getOutputStream()); break; case FTPConnection.MODE_COMPRESSED: out = new CompressedOutputStream(this, socket.getOutputStream()); break; default: throw new IllegalStateException("Invalid transfer mode"); } out.setTransferComplete(false); return out; } public void setTransferMode(int mode) { transferMode = mode; } public void complete() { completed = true; if (!inProgress) { transferComplete(); } } public boolean abort() { completed = true; transferComplete(); return inProgress; } /* * Called by DTPInputStream or DTPOutputStream when end of * stream is reached. */ public void transferComplete() { if (in != null) { in.setTransferComplete(true); } if (out != null) { out.setTransferComplete(true); } inProgress = false; completed = completed ||(transferMode == FTPConnection.MODE_STREAM); if (completed && socket != null) { try { socket.close(); } catch (IOException e) { } } } } inetlib-1.1.2/source/gnu/inet/ftp/CompressedInputStream.java0000664000076400007640000001152711345235566021100 00000000000000/* * CompressedInputStream.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.InputStream; import java.io.IOException; import java.net.ProtocolException; /** * A DTP input stream that implements the FTP compressed transfer mode. * * @author Chris Burdess */ class CompressedInputStream extends DTPInputStream { static final int EOF = 64; static final int RAW = 0x00; static final int COMPRESSED = 0x80; static final int FILLER = 0xc0; int descriptor; int max = -1; int count = -1; int state = RAW; // RAW | STATE | FILLER int rep; // the compressed byte int n = 0; // the number of compressed or raw bytes CompressedInputStream(DTP dtp, InputStream in) { super(dtp, in); } public int read() throws IOException { if (transferComplete) { return -1; } if (count == -1) { readHeader(); } if (max < 1) { close(); return -1; } if (n > 0 && (state == COMPRESSED || state == FILLER)) { n--; return rep; } int c = in.read(); if (c == -1) { close(); } count++; if (count >= max) { count = -1; if (descriptor == EOF) { close(); } } if (c == -1) { return c; } while (n == 0) // read code header { state = (c & 0xc0); n = (c & 0x3f); c = in.read(); if (c == -1) { return -1; } } switch (state) { case RAW: break; case COMPRESSED: case FILLER: rep = c; break; default: throw new ProtocolException("Illegal state: " + state); } n--; return c; } public int read(byte[] buf) throws IOException { return read(buf, 0, buf.length); } public int read(byte[] buf, int off, int len) throws IOException { if (transferComplete) { return -1; } if (count == -1) { readHeader(); } if (max < 1) { close(); return -1; } // TODO improve performance for (int i = off; i < len; i++) { int c = read(); if (c == -1) { close(); return i; } buf[i] = (byte) c; } return len; /* int l = in.read (buf, off, len); if (l==-1) { close (); } count += l; if (count>=max) { count = -1; if (descriptor==EOF) { close (); } } return l; */ } /** * Reads the block header. */ void readHeader() throws IOException { descriptor = in.read(); int max_hi = in.read(); int max_lo = in.read(); max = (max_hi << 8) | max_lo; count = 0; } /** * Reads the code header. */ void readCodeHeader() throws IOException { int code = in.read(); state = (code & 0xc0); n = (code & 0x3f); } } inetlib-1.1.2/source/gnu/inet/ftp/BlockOutputStream.java0000664000076400007640000000653711345235566020234 00000000000000/* * BlockOutputStream.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ftp; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; /** * A DTP output stream that implements the FTP block transfer mode. * * @author Chris Burdess */ class BlockOutputStream extends DTPOutputStream { static final byte RECORD = -128; // 0x80 static final byte EOF = 64; // 0x40 BlockOutputStream(DTP dtp, OutputStream out) { super(dtp, out); } public void write(int c) throws IOException { if (transferComplete) { return; } byte[] buf = new byte[] { RECORD, /* record descriptor */ 0x00, 0x01, /* one byte */ (byte) c /* the byte */ }; out.write(buf, 0, 4); } public void write(byte[] b) throws IOException { write(b, 0, b.length); } public void write(byte[] b, int off, int len) throws IOException { if (transferComplete) { return; } byte[] buf = new byte[len + 3]; buf[0] = RECORD; /* record descriptor */ buf[1] = (byte) ((len & 0x00ff) >> 8); /* high byte of bytecount */ buf[2] = (byte) (len & 0xff00); /* low byte of bytecount */ System.arraycopy(b, off, buf, 3, len); out.write(buf, 0, len); } public void close() throws IOException { byte[] buf = new byte[] { EOF, /* eof descriptor */ 0x00, 0x00 /* no bytes */ }; out.write(buf, 0, 3); super.close(); } } inetlib-1.1.2/source/gnu/inet/ftp/package.html0000664000076400007640000000062311345235566016211 00000000000000

This package contains an FTP client. It can handle both active and passive mode connections and the various transfer modes and representation types.

Interaction with the server is via a simple stream interface. Only one concurrent stream (input or output) is supported.

The control connection to the server can be protected using TLS (the starttls method).

inetlib-1.1.2/source/gnu/inet/imap/0000775000076400007640000000000011347426714014143 500000000000000inetlib-1.1.2/source/gnu/inet/imap/ListEntry.java0000664000076400007640000001130111345235566016660 00000000000000/* * ListEntry.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.util.List; /** * An item in an IMAP LIST or LSUB response. * * @author Chris Burdess */ public class ListEntry implements IMAPConstants { private String mailbox; private char delimiter; private boolean noinferiors; private boolean noselect; private boolean marked; private boolean unmarked; /* * Constructor. * The list entry is otherwise immutable. */ ListEntry(String mailbox, char delimiter, boolean noinferiors, boolean noselect, boolean marked, boolean unmarked) { this.mailbox = mailbox; this.delimiter = delimiter; this.noinferiors = noinferiors; this.noselect = noselect; this.marked = marked; this.unmarked = unmarked; } /** * Returns the mailbox this list entry refers to. */ public String getMailbox() { return mailbox; } /** * Returns the mailbox hierarchy delimiter. */ public char getDelimiter() { return delimiter; } /** * If true: it is not possible for any child levels of hierarchy to * exist under this name; no child levels exist now and none can be * created in the future. */ public boolean isNoinferiors() { return noinferiors; } /** * If true: it is not possible to use this name as a selectable * mailbox. */ public boolean isNoselect() { return noselect; } /** * If true: the mailbox has been marked "interesting" by the server; * the mailbox probably contains messages that have been added since * the last time the mailbox was selected. */ public boolean isMarked() { return marked; } /** * If true: the mailbox does not contain any additional messages since * the last time the mailbox was selected. */ public boolean isUnmarked() { return unmarked; } /** * Debugging */ public String toString() { StringBuffer buffer = new StringBuffer(); if (noinferiors || noselect || marked || unmarked) { buffer.append("(\u001b[00;35m"); boolean seq = false; seq = conditionalAppend(buffer, seq, noinferiors, LIST_NOINFERIORS); seq = conditionalAppend(buffer, seq, noselect, LIST_NOSELECT); seq = conditionalAppend(buffer, seq, marked, LIST_MARKED); seq = conditionalAppend(buffer, seq, unmarked, LIST_UNMARKED); buffer.append("\u001b[00m) "); } buffer.append("\"\u001b[00;31m"); buffer.append(delimiter); buffer.append("\u001b[00m\" "); buffer.append(mailbox); return buffer.toString(); } private static boolean conditionalAppend(StringBuffer buffer, boolean seq, boolean test, String value) { if (test) { if (seq) { buffer.append(' '); } buffer.append(value); seq = true; } return seq; } } inetlib-1.1.2/source/gnu/inet/imap/Pair.java0000664000076400007640000000464011345235566015626 00000000000000/* * Pair.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.util.List; /** * Implementation of a key-value pair. * The key is always a String, and the value must be a List. * * @author Chris Burdess */ public final class Pair { private String key; private List value; Pair(String key, List value) { this.key = key; this.value = value; } /** * Returns the key part of this pair. */ public String getKey() { return key; } /** * Returns the value part of this pair. */ public List getValue() { return value; } public String toString() { return key + value; } } inetlib-1.1.2/source/gnu/inet/imap/UTF7imap.java0000664000076400007640000002414711345235566016333 00000000000000/* * UTF7imap.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.io.ByteArrayOutputStream; import java.io.IOException; /** * Encodes and decodes text according to the IMAP4rev1 mailbox name * encoding scheme. * * @author Chris Burdess */ public final class UTF7imap { private static final String US_ASCII = "US-ASCII"; private static final byte[] src = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2b, 0x2c }; private static final byte[] dst; static { dst = new byte[0x100]; for (int i = 0; i < 0xff; i++) { dst[i] = -1; } for (int i = 0; i < src.length; i++) { dst[src[i]] = (byte) i; } } private UTF7imap() { } /** * Encode the specified byte array using the modified BASE64 algorithm * specified by UTF-7, with further IMAP4rev1 modifications. * * @param bs the source byte array */ static byte[] encode(byte[] bs) { int si = 0, ti = 0; // source/target array indices byte[] bt = new byte[(((bs.length + 2) / 3) * 4) -1];// target byte array for (; si < bs.length; si += 3) { int buflen = bs.length - si; if (buflen == 1) { byte b = bs[si]; int i = 0; boolean flag = false; bt[ti++] = src[b >>> 2 & 0x3f]; bt[ti++] = src[(b << 4 & 0x30) + (i >>> 4 & 0xf)]; } else if (buflen == 2) { byte b1 = bs[si], b2 = bs[si + 1]; int i = 0; bt[ti++] = src[b1 >>> 2 & 0x3f]; bt[ti++] = src[(b1 << 4 & 0x30) + (b2 >>> 4 & 0xf)]; bt[ti++] = src[(b2 << 2 & 0x3c) + (i >>> 6 & 0x3)]; } else if (buflen == 3) { byte b1 = bs[si], b2 = bs[si + 1], b3 = bs[si + 2]; bt[ti++] = src[b1 >>> 2 & 0x3f]; bt[ti++] = src[(b1 << 4 & 0x30) + (b2 >>> 4 & 0xf)]; bt[ti++] = src[(b2 << 2 & 0x3c) + (b3 >>> 6 & 0x3)]; bt[ti++] = src[b3 & 0x3f]; } } return bt; } /** * Decode the specified byte array using the modified BASE64 algorithm * specified by UTF-7, with further IMAP4rev1 modifications. * * @param bs the source byte array */ static int[] decode(byte[] bs) { int[] buffer = new int[bs.length]; int buflen = 0; int si = 0; int len = bs.length - si; while (len > 0) { byte b0 = dst[bs[si++] & 0xff]; byte b2 = dst[bs[si++] & 0xff]; buffer[buflen++] = (b0 << 2 & 0xfc | b2 >>> 4 & 0x3); if (len > 2) { b0 = b2; b2 = dst[bs[si++] & 0xff]; buffer[buflen++] = (b0 << 4 & 0xf0 | b2 >>> 2 & 0xf); if (len > 3) { b0 = b2; b2 = dst[bs[si++] & 0xff]; buffer[buflen++] = (b0 << 6 & 0xc0 | b2 & 0x3f); } } len = bs.length - si; } int[] bt = new int[buflen]; System.arraycopy(buffer, 0, bt, 0, buflen); return bt; } /** * Encodes the specified name using the UTF-7.imap encoding. * See IMAP4rev1 spec, section 5.1.3 */ public static String encode(String name) { try { StringBuffer buffer = null; ByteArrayOutputStream encoderSink = null; char[] chars = name.toCharArray(); boolean encoding = false; for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (c == '&') { if (buffer == null) { buffer = new StringBuffer(); for (int j = 0; j < i; j++) { buffer.append(chars[j]); } } buffer.append('&'); buffer.append('-'); } else if (c < 0x1f || c > 0x7f) { // needs encoding if (buffer == null) { buffer = new StringBuffer(); for (int j = 0; j < i; j++) { buffer.append(chars[j]); } encoderSink = new ByteArrayOutputStream(); } if (!encoding) { encoderSink.reset(); buffer.append('&'); encoding = true; } encoderSink.write(((int) c) / 0x100); encoderSink.write(((int) c) % 0x100); } else if (encoding) { encoderSink.flush(); byte[] encoded = encode(encoderSink.toByteArray()); buffer.append(new String(encoded, US_ASCII)); buffer.append('-'); encoding = false; if (c != '-') { buffer.append(c); } } else if (buffer != null) { buffer.append(c); } } if (encoding) { encoderSink.flush(); byte[] encoded = encode(encoderSink.toByteArray()); buffer.append(new String(encoded, US_ASCII)); buffer.append('-'); } if (buffer != null) { return buffer.toString(); } } catch (IOException e) { // This should never happen throw new RuntimeException(e.getMessage()); } return name; } /** * Decodes the specified name using the UTF-7.imap decoding. * See IMAP4rev1 spec, section 5.1.3 */ public static String decode(String name) { StringBuffer buffer = null; ByteArrayOutputStream decoderSink = null; char[] chars = name.toCharArray(); boolean encoded = false; for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (c == '&') { if (buffer == null) { buffer = new StringBuffer(); decoderSink = new ByteArrayOutputStream(); for (int j = 0; j < i; j++) { buffer.append(chars[j]); } } decoderSink.reset(); encoded = true; } else if (c == '-' && encoded) { if (decoderSink.size() == 0) { buffer.append('&'); } else { int[] decoded = decode(decoderSink.toByteArray()); for (int j = 0; j < decoded.length - 1; j += 2) { int hibyte = decoded[j]; int lobyte = decoded[j + 1]; int d = (hibyte * 0x100) | lobyte; buffer.append((char) d); } } encoded = false; } else if (encoded) { decoderSink.write((byte) c); } else if (buffer != null) { buffer.append(c); } } if (buffer != null) { return buffer.toString(); } return name; } public static void main(String[] args) { boolean decode = false; for (int i = 0; i < args.length; i++) { if (args[i].equals("-d")) { decode = true; } else { String ret = decode ? decode(args[i]) : encode(args[i]); StringBuffer buf = new StringBuffer(args[i]); buf.append(" = \""); buf.append(ret); buf.append("\"("); for (int j = 0; j < ret.length(); j++) { if (j > 0) { buf.append(' '); } int c = (int) ret.charAt(j); buf.append(Integer.toString(c, 16)); } buf.append(")"); System.out.println(buf.toString()); } } } } inetlib-1.1.2/source/gnu/inet/imap/MailboxStatus.java0000664000076400007640000000436311345235566017534 00000000000000/* * MailboxStatus.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.util.List; /** * Represents the state of a mailbox. * * @author Chris Burdess */ public class MailboxStatus { public int messageCount = -1; public int newMessageCount = -1; public int firstUnreadMessage = -1; public int uidNext = -1; public int uidValidity = -1; public List flags; public List permanentFlags; public boolean select; public boolean readWrite; } inetlib-1.1.2/source/gnu/inet/imap/UIDPlusHandler.java0000664000076400007640000000553611345235566017523 00000000000000/* * UIDPlusHandler.java * Copyright (C) 2005 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; /** * Callback interface for receiving APPENDUID and COPYUID responses. * See RFC 2359 for details. * * @author Chris Burdess */ public interface UIDPlusHandler { /** * Notification of an APPENDUID response. * Called on a successful APPEND to a server that supports the UIDPLUS * extension. * @param uidvalidity the UIDVALIDITY of the destination mailbox * @param uid the UID assigned to the appended message. */ void appenduid(long uidvalidity, long uid); /** * Notification of a COPYUID response. * Called on a successful COPY to a server that supports the UIDPLUS * extension. * If more than one message is copied, this method will be called multiple * times, once for each message copied. * @param uidvalidity the UIDVALIDITY of the destination mailbox * @param oldUID the UID of the message in the source mailbox * @param newUID the UID of the corresponding message in the target * mailbox */ void copyuid(long uidvalidity, long oldUID, long newUID); } inetlib-1.1.2/source/gnu/inet/imap/IMAPResponse.java0000664000076400007640000001113411345235566017174 00000000000000/* * IMAPResponse.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.util.List; /** * An IMAP4rev1 server response. * * @author Chris Burdess */ public class IMAPResponse { /** * The untagged response tag. */ public static final String UNTAGGED = "*"; /** * The continuation response tag. */ public static final String CONTINUATION = "+"; /** * The tag for this response. */ protected String tag = null; /** * The response ID. */ protected String id = null; /** * The message count (for responses returning counts). */ protected int count = -1; /** * The mailbox (for STATUS responses). */ protected String mailbox = null; /** * The response code. */ protected List code = null; /** * The human-readable text. */ protected String text; public String getTag() { return tag; } public boolean isTagged() { return (tag != UNTAGGED && tag != CONTINUATION); } public boolean isUntagged() { return (tag == UNTAGGED); } public boolean isContinuation() { return (tag == CONTINUATION); } public String getID() { return id; } public int getCount() { return count; } public List getResponseCode() { return code; } public String getText() { return text; } /** * ANSI-coloured toString for debugging. */ public String toANSIString() { StringBuffer buffer = new StringBuffer(); buffer.append(tag); if (count != -1) { buffer.append(" \u001b[00;31m"); buffer.append(count); buffer.append("\u001b[00m"); } if (!isContinuation()) { buffer.append(" \u001b[01m"); buffer.append(id); buffer.append("\u001b[00m"); } if (mailbox != null) { buffer.append(" \u001b[00;35m"); buffer.append(mailbox); buffer.append("\u001b[00m"); } if (code != null) { buffer.append(" \u001b[00;36m"); buffer.append(code); buffer.append("\u001b[00m"); } if (text != null) { buffer.append(" \u001b[00;33m"); buffer.append(text); buffer.append("\u001b[00m"); } return buffer.toString(); } public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(tag); if (count != -1) { buffer.append(' '); buffer.append(count); } if (!isContinuation()) { buffer.append(' '); buffer.append(id); } if (mailbox != null) { buffer.append(' '); buffer.append(mailbox); } if (code != null) { buffer.append(' '); buffer.append(code); } if (text != null) { buffer.append(' '); buffer.append(text); } return buffer.toString(); } } inetlib-1.1.2/source/gnu/inet/imap/IMAPConnection.java0000664000076400007640000022002111345235566017472 00000000000000/* * IMAPConnection.java * Copyright (C) 2003,2004,2005 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.EOFException; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.ProtocolException; import java.net.Socket; import java.net.UnknownHostException; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.security.auth.callback.CallbackHandler; import javax.security.sasl.Sasl; import javax.security.sasl.SaslClient; import javax.security.sasl.SaslException; import gnu.inet.util.BASE64; import gnu.inet.util.CRLFOutputStream; import gnu.inet.util.EmptyX509TrustManager; import gnu.inet.util.SaslCallbackHandler; import gnu.inet.util.SaslCramMD5; import gnu.inet.util.SaslInputStream; import gnu.inet.util.SaslLogin; import gnu.inet.util.SaslOutputStream; import gnu.inet.util.SaslPlain; import gnu.inet.util.TraceLevel; /** * The protocol class implementing IMAP4rev1. * * @author Chris Burdess */ public class IMAPConnection implements IMAPConstants { /** * The network trace level. */ public static final Level IMAP_TRACE = new TraceLevel("imap"); /** * Prefix for tags. */ protected static final String TAG_PREFIX = "A"; /** * The encoding used to create strings for IMAP commands. */ protected static final String US_ASCII = "US-ASCII"; /** * The default IMAP port. */ protected static final int DEFAULT_PORT = 143; /** * The default IMAP-SSL port. */ protected static final int DEFAULT_SSL_PORT = 993; /** * The logger used for IMAP protocol traces. */ public final Logger logger = Logger.getLogger("gnu.inet.imap"); /** * The socket used for communication with the server. */ protected Socket socket; /** * The tokenizer used to read IMAP responses from. */ protected IMAPResponseTokenizer in; /** * The output stream. */ protected CRLFOutputStream out; /** * List of responses received asynchronously. */ protected List asyncResponses; /** * List of alert strings. */ private List alerts; /* * Used to generate new tags for tagged commands. */ private int tagIndex = 0; /* * Print debugging output using ANSI colour escape sequences. */ private boolean ansiDebug = false; /** * Creates a new connection to the default IMAP port. * @param host the name of the host to connect to */ public IMAPConnection(String host) throws UnknownHostException, IOException { this(host, -1, 0, 0, false, null); } /** * Creates a new connection. * @param host the name of the host to connect to * @param port the port to connect to, or -1 for the default */ public IMAPConnection(String host, int port) throws UnknownHostException, IOException { this(host, port, 0, 0, false, null); } /** * Creates a new connection. * @param host the name of the host to connect to * @param port the port to connect to, or -1 for the default * @param connectionTimeout the socket connection timeout * @param timeout the socket timeout */ public IMAPConnection(String host, int port, int connectionTimeout, int timeout) throws UnknownHostException, IOException { this(host, port, connectionTimeout, timeout, false, null); } /** * Creates a new secure connection using the specified trust manager. * @param host the name of the host to connect to * @param port the port to connect to, or -1 for the default * @param tm a trust manager used to check SSL certificates, or null to * use the default */ public IMAPConnection(String host, int port, TrustManager tm) throws UnknownHostException, IOException { this(host, port, 0, 0, true, tm); } /** * Creates a new connection. * @param host the name of the host to connect to * @param port the port to connect to, or -1 for the default * @param connectionTimeout the socket connection timeout * @param timeout the socket timeout * @param secure if an IMAP-SSL connection should be made * @param tm a trust manager used to check SSL certificates, or null to * use the default */ public IMAPConnection(String host, int port, int connectionTimeout, int timeout, boolean secure, TrustManager tm) throws UnknownHostException, IOException { if (port < 0) { port = secure ? DEFAULT_SSL_PORT : DEFAULT_PORT; } // Set up socket try { socket = new Socket(); InetSocketAddress address = new InetSocketAddress(host, port); if (connectionTimeout > 0) { socket.connect(address, connectionTimeout); } else { socket.connect(address); } if (timeout > 0) { socket.setSoTimeout(timeout); } if (secure) { SSLSocketFactory factory = getSSLSocketFactory(tm); SSLSocket ss = (SSLSocket) factory.createSocket(socket, host, port, true); String[] protocols = { "TLSv1", "SSLv3" }; ss.setEnabledProtocols(protocols); ss.setUseClientMode(true); ss.startHandshake(); socket = ss; } } catch (GeneralSecurityException e) { IOException e2 = new IOException(); e2.initCause(e); throw e2; } InputStream is = socket.getInputStream(); is = new BufferedInputStream(is); in = new IMAPResponseTokenizer(is); OutputStream os = socket.getOutputStream(); os = new BufferedOutputStream(os); out = new CRLFOutputStream(os); asyncResponses = new ArrayList(); alerts = new ArrayList(); } /** * Sets whether debugging output should use ANSI colour escape sequences. */ public void setAnsiDebug(boolean flag) { ansiDebug = flag; } /** * Returns a new tag for a command. */ protected String newTag() { return TAG_PREFIX + (++tagIndex); } /** * Sends the specified IMAP tagged command to the server. */ protected void sendCommand(String tag, String command) throws IOException { logger.log(IMAP_TRACE, "> " + tag + " " + command); out.write(tag + ' ' + command); out.writeln(); out.flush(); } /** * Sends the specified IMAP command. * @param command the command * @return true if OK was received, or false if NO was received * @exception IOException if BAD was received or an I/O error occurred */ public boolean invokeSimpleCommand(String command) throws IOException { String tag = newTag(); sendCommand(tag, command); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { return true; } else if (id == NO) { return false; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { asyncResponses.add(response); } else { throw new IMAPException(id, response.getText()); } } } /** * Reads an IMAP response from the server. * The response will consist of either: *
    *
  • A tagged response corresponding to a pending command
  • *
  • An untagged error response
  • *
  • A continuation response
  • */ protected IMAPResponse readResponse() throws IOException { IMAPResponse response = in.next(); if (response == null) { logger.log(IMAP_TRACE, " 0); } /** * Returns the pending alerts for the user-agent as an array. */ public String[] getAlerts() { String[] a = new String[alerts.size()]; alerts.toArray(a); alerts.clear(); // flush return a; } // -- IMAP commands -- /** * Returns a list of the capabilities of the IMAP server. */ public List capability() throws IOException { String tag = newTag(); sendCommand(tag, CAPABILITY); List capabilities = new ArrayList(); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { if (capabilities.size() == 0) { // The capability list may be contained in the // response text. addTokens(capabilities, response.getText()); } return capabilities; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { if (id == CAPABILITY) { // The capability list may be contained in the // response text. addTokens(capabilities, response.getText()); } else if (id == OK) { // The capability list may be contained in the // response code. List code = response.getResponseCode(); int len = (code == null) ? 0 : code.size(); if (len > 0 && CAPABILITY.equals(code.get(0))) { for (int i = 1; i < len; i++) { String token = (String) code.get(i); if (!capabilities.contains(token)) { capabilities.add(token); } } } else { asyncResponses.add(response); } } else { asyncResponses.add(response); } } else { throw new IMAPException(id, response.getText()); } } } private void addTokens(List list, String text) { int start = 0; int end = text.indexOf(' '); String token; while (end != -1) { token = text.substring(start, end); if (!list.contains(token)) { list.add(token); } start = end + 1; end = text.indexOf(' ', start); } token = text.substring(start); if (token.length() > 0 && !list.contains(token)) { list.add(token); } } /** * Ping the server. * If a change in mailbox state is detected, a new mailbox status is * returned, otherwise this method returns null. */ public MailboxStatus noop() throws IOException { String tag = newTag(); sendCommand(tag, NOOP); boolean changed = false; MailboxStatus ms = new MailboxStatus(); Iterator asyncIterator = asyncResponses.iterator(); while (true) { IMAPResponse response; // Process any asynchronous responses first if (asyncIterator.hasNext()) { response = (IMAPResponse) asyncIterator.next(); asyncIterator.remove(); } else { response = readResponse(); } String id = response.getID(); if (response.isUntagged()) { changed = changed || updateMailboxStatus(ms, id, response); } else if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { return changed ? ms : null; } else { throw new IMAPException(id, response.getText()); } } else { throw new IMAPException(id, response.getText()); } } } /** * Returns a configured SSLSocketFactory to use in creating new SSL * sockets. * @param tm an optional trust manager to use */ protected SSLSocketFactory getSSLSocketFactory(TrustManager tm) throws GeneralSecurityException { if (tm == null) { tm = new EmptyX509TrustManager(); } SSLContext context = SSLContext.getInstance("TLS"); TrustManager[] trust = new TrustManager[] { tm }; context.init(null, trust, null); return context.getSocketFactory(); } /** * Attempts to start TLS on the specified connection. * See RFC 2595 for details. * @return true if successful, false otherwise */ public boolean starttls() throws IOException { return starttls(new EmptyX509TrustManager()); } /** * Attempts to start TLS on the specified connection. * See RFC 2595 for details. * @param tm the custom trust manager to use * @return true if successful, false otherwise */ public boolean starttls(TrustManager tm) throws IOException { try { SSLSocketFactory factory = getSSLSocketFactory(tm); String hostname = socket.getInetAddress().getHostName(); int port = socket.getPort(); String tag = newTag(); sendCommand(tag, STARTTLS); while (true) { IMAPResponse response = readResponse(); if (response.isTagged() && tag.equals(response.getTag())) { processAlerts(response); String id = response.getID(); if (id == OK) { break; // negotiate TLS } else if (id == BAD) { return false; } } else { asyncResponses.add(response); } } SSLSocket ss = (SSLSocket) factory.createSocket(socket, hostname, port, true); String[] protocols = { "TLSv1", "SSLv3" }; ss.setEnabledProtocols(protocols); ss.setUseClientMode(true); ss.startHandshake(); InputStream is = ss.getInputStream(); is = new BufferedInputStream(is); in = new IMAPResponseTokenizer(is); OutputStream os = ss.getOutputStream(); os = new BufferedOutputStream(os); out = new CRLFOutputStream(os); return true; } catch (GeneralSecurityException e) { e.printStackTrace(); return false; } } /** * Login to the connection using the username and password method. * @param username the authentication principal * @param password the authentication credentials * @return true if authentication was successful, false otherwise */ public boolean login(String username, String password) throws IOException { return invokeSimpleCommand(LOGIN + ' ' + quote(username) + ' ' + quote(password)); } /** * Authenticates the connection using the specified SASL mechanism, * username, and password. * @param mechanism a SASL authentication mechanism, e.g. LOGIN, PLAIN, * CRAM-MD5, GSSAPI * @param username the authentication principal * @param password the authentication credentials * @return true if authentication was successful, false otherwise */ public boolean authenticate(String mechanism, String username, String password) throws IOException { try { String[] m = new String[] { mechanism }; CallbackHandler ch = new SaslCallbackHandler(username, password); // Avoid lengthy callback procedure for GNU Crypto HashMap p = new HashMap(); p.put("gnu.crypto.sasl.username", username); p.put("gnu.crypto.sasl.password", password); SaslClient sasl = Sasl.createSaslClient(m, null, "imap", socket.getInetAddress(). getHostName(), p, ch); if (sasl == null) { // Fall back to home-grown SASL clients if ("LOGIN".equalsIgnoreCase(mechanism)) { sasl = new SaslLogin(username, password); } else if ("PLAIN".equalsIgnoreCase(mechanism)) { sasl = new SaslPlain(username, password); } else if ("CRAM-MD5".equalsIgnoreCase(mechanism)) { sasl = new SaslCramMD5(username, password); } else { logger.log(IMAP_TRACE, mechanism + " not available"); return false; } } StringBuffer cmd = new StringBuffer(AUTHENTICATE); cmd.append(' '); cmd.append(mechanism); String tag = newTag(); sendCommand(tag, cmd.toString()); while (true) { IMAPResponse response = readResponse(); if (tag.equals(response.getTag())) { processAlerts(response); String id = response.getID(); if (id == OK) { String qop = (String) sasl.getNegotiatedProperty(Sasl.QOP); if ("auth-int".equalsIgnoreCase(qop) || "auth-conf".equalsIgnoreCase(qop)) { InputStream is = socket.getInputStream(); is = new BufferedInputStream(is); is = new SaslInputStream(sasl, is); in = new IMAPResponseTokenizer(is); OutputStream os = socket.getOutputStream(); os = new BufferedOutputStream(os); os = new SaslOutputStream(sasl, os); out = new CRLFOutputStream(os); } return true; } else if (id == NO) { return false; } else if (id == BAD) { throw new IMAPException(id, response.getText()); } } else if (response.isContinuation()) { try { byte[] c0 = response.getText().getBytes(US_ASCII); byte[] c1 = BASE64.decode(c0); // challenge byte[] r0 = sasl.evaluateChallenge(c1); byte[] r1 = BASE64.encode(r0); // response out.write(r1); out.writeln(); out.flush(); logger.log(IMAP_TRACE, "> " + new String(r1, US_ASCII)); } catch (SaslException e) { // Error in SASL challenge evaluation - cancel exchange out.write(0x2a); out.writeln(); out.flush(); logger.log(IMAP_TRACE, "> *"); } } else { asyncResponses.add(response); } } } catch (SaslException e) { logger.log(IMAP_TRACE, e.getMessage(), e); return false; // No provider for mechanism } catch (RuntimeException e) { logger.log(IMAP_TRACE, e.getMessage(), e); return false; // No javax.security.sasl classes } } /** * Logout this connection. * Underlying network resources will be freed. */ public void logout() throws IOException { String tag = newTag(); sendCommand(tag, LOGOUT); while (true) { IMAPResponse response = readResponse(); if (response.isTagged() && tag.equals(response.getTag())) { processAlerts(response); String id = response.getID(); if (id == OK) { socket.close(); return; } else { throw new IMAPException(id, response.getText()); } } else { asyncResponses.add(response); } } } /** * Selects the specified mailbox. * The mailbox is identified as read-write if writes are permitted. * @param mailbox the mailbox name * @return a MailboxStatus containing the state of the selected mailbox */ public MailboxStatus select(String mailbox) throws IOException { return selectImpl(mailbox, SELECT); } /** * Selects the specified mailbox. * The mailbox is identified as read-only. * @param mailbox the mailbox name * @return a MailboxStatus containing the state of the selected mailbox */ public MailboxStatus examine(String mailbox) throws IOException { return selectImpl(mailbox, EXAMINE); } protected MailboxStatus selectImpl(String mailbox, String command) throws IOException { String tag = newTag(); sendCommand(tag, command + ' ' + quote(UTF7imap.encode(mailbox))); MailboxStatus ms = new MailboxStatus(); ms.select = true; while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (response.isUntagged()) { if (!updateMailboxStatus(ms, id, response)) { asyncResponses.add(response); } } else if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { List rc = response.getResponseCode(); if (rc != null && rc.size() > 0 && rc.get(0) == READ_WRITE) { ms.readWrite = true; } return ms; } else { throw new IMAPException(id, response.getText()); } } else { throw new IMAPException(id, response.getText()); } } } protected boolean updateMailboxStatus(MailboxStatus ms, String id, IMAPResponse response) throws IOException { if (id == OK) { boolean changed = false; List rc = response.getResponseCode(); int len = (rc == null) ? 0 : rc.size(); for (int i = 0; i < len; i++) { Object ocmd = rc.get(i); if (ocmd instanceof String) { String cmd = (String) ocmd; if (i + 1 < len) { Object oparam = rc.get(i + 1); if (oparam instanceof String) { String param = (String) oparam; try { if (cmd == UNSEEN) { ms.firstUnreadMessage = Integer.parseInt(param); i++; changed = true; } else if (cmd == UIDVALIDITY) { ms.uidValidity = Integer.parseInt(param); i++; changed = true; } } catch (NumberFormatException e) { throw new ProtocolException("Illegal " + cmd + " value: " + param); } } else if (oparam instanceof List) { if (cmd == PERMANENTFLAGS) { ms.permanentFlags = (List) oparam; i++; changed = true; } } } } } return changed; } else if (id == EXISTS) { ms.messageCount = response.getCount(); return true; } else if (id == RECENT) { ms.newMessageCount = response.getCount(); return true; } else if (id == FLAGS) { ms.flags = response.getResponseCode(); return true; } else { return false; } } /** * Creates a mailbox with the specified name. * @param mailbox the mailbox name * @return true if the mailbox was successfully created, false otherwise */ public boolean create(String mailbox) throws IOException { return invokeSimpleCommand(CREATE + ' ' + quote(UTF7imap.encode(mailbox))); } /** * Deletes the mailbox with the specified name. * @param mailbox the mailbox name * @return true if the mailbox was successfully deleted, false otherwise */ public boolean delete(String mailbox) throws IOException { return invokeSimpleCommand(DELETE + ' ' + quote(UTF7imap.encode(mailbox))); } /** * Renames the source mailbox to the specified name. * @param source the source mailbox name * @param target the target mailbox name * @return true if the mailbox was successfully renamed, false otherwise */ public boolean rename(String source, String target) throws IOException { return invokeSimpleCommand(RENAME + ' ' + quote(UTF7imap.encode(source)) + ' ' + quote(UTF7imap.encode(target))); } /** * Adds the specified mailbox to the set of subscribed mailboxes as * returned by the LSUB command. * @param mailbox the mailbox name * @return true if the mailbox was successfully subscribed, false otherwise */ public boolean subscribe(String mailbox) throws IOException { return invokeSimpleCommand(SUBSCRIBE + ' ' + quote(UTF7imap.encode(mailbox))); } /** * Removes the specified mailbox from the set of subscribed mailboxes as * returned by the LSUB command. * @param mailbox the mailbox name * @return true if the mailbox was successfully unsubscribed, false otherwise */ public boolean unsubscribe(String mailbox) throws IOException { return invokeSimpleCommand(UNSUBSCRIBE + ' ' + quote(UTF7imap.encode(mailbox))); } /** * Returns a subset of names from the compete set of names available to * the client. * @param reference the context relative to which mailbox names are * defined * @param mailbox a mailbox name, possibly including IMAP wildcards */ public ListEntry[] list(String reference, String mailbox) throws IOException { return listImpl(LIST, reference, mailbox); } /** * Returns a subset of subscribed names. * @see #list */ public ListEntry[] lsub(String reference, String mailbox) throws IOException { return listImpl(LSUB, reference, mailbox); } protected ListEntry[] listImpl(String command, String reference, String mailbox) throws IOException { if (reference == null) { reference = ""; } if (mailbox == null) { mailbox = ""; } String tag = newTag(); sendCommand(tag, command + ' ' + quote(UTF7imap.encode(reference)) + ' ' + quote(UTF7imap.encode(mailbox))); List acc = new ArrayList(); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (response.isUntagged()) { if (id.equals(command)) { List code = response.getResponseCode(); String text = response.getText(); // Populate entry attributes with the interned versions // of the response code. // NB IMAP servers do not necessarily pay attention to case. int alen = (code == null) ? 0 : code.size(); boolean noinferiors = false; boolean noselect = false; boolean marked = false; boolean unmarked = false; for (int i = 0; i < alen; i++) { String attribute = (String) code.get(i); if (attribute.equalsIgnoreCase(LIST_NOINFERIORS)) { noinferiors = true; } else if (attribute.equalsIgnoreCase(LIST_NOSELECT)) { noselect = true; } else if (attribute.equalsIgnoreCase(LIST_MARKED)) { marked = true; } else if (attribute.equalsIgnoreCase(LIST_UNMARKED)) { unmarked = true; } } int si = text.indexOf(' '); char delimiter = '\u0000'; String d = text.substring(0, si); if (!d.equalsIgnoreCase(NIL)) { delimiter = stripQuotes(d).charAt(0); } String mbox = stripQuotes(text.substring(si + 1)); mbox = UTF7imap.decode(mbox); ListEntry entry = new ListEntry(mbox, delimiter, noinferiors, noselect, marked, unmarked); acc.add(entry); } else { asyncResponses.add(response); } } else if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { ListEntry[] entries = new ListEntry[acc.size()]; acc.toArray(entries); return entries; } else { throw new IMAPException(id, response.getText()); } } else { throw new IMAPException(id, response.getText()); } } } /** * Requests the status of the specified mailbox. */ public MailboxStatus status(String mailbox, String[] statusNames) throws IOException { String tag = newTag(); StringBuffer buffer = new StringBuffer(STATUS) .append(' ') .append(quote(UTF7imap.encode(mailbox))) .append(' ') .append('('); for (int i = 0; i < statusNames.length; i++) { if (i > 0) { buffer.append(' '); } buffer.append(statusNames[i]); } buffer.append(')'); sendCommand(tag, buffer.toString()); MailboxStatus ms = new MailboxStatus(); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (response.isUntagged()) { if (id == STATUS) { List code = response.getResponseCode(); int last = (code == null) ? 0 : code.size() - 1; for (int i = 0; i < last; i += 2) { try { String statusName = ((String) code.get(i)).intern(); int value = Integer.parseInt((String) code.get(i + 1)); if (statusName == MESSAGES) { ms.messageCount = value; } else if (statusName == RECENT) { ms.newMessageCount = value; } else if (statusName == UIDNEXT) { ms.uidNext = value; } else if (statusName == UIDVALIDITY) { ms.uidValidity = value; } else if (statusName == UNSEEN) { ms.firstUnreadMessage = value; } } catch (NumberFormatException e) { throw new IMAPException(id, "Invalid code: " + code); } } } else { asyncResponses.add(response); } } else if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { return ms; } else { throw new IMAPException(id, response.getText()); } } else { throw new IMAPException(id, response.getText()); } } } /** * Append a message to the specified mailbox. * This method returns an OutputStream to which the message should be * written and then closed. * @param mailbox the mailbox name * @param flags optional list of flags to specify for the message * @param content the message body(including headers) * @return true if successful, false if error in flags/text */ public boolean append(String mailbox, String[] flags, byte[] content) throws IOException { return append(mailbox, flags, content, null); } /** * Append a message to the specified mailbox. * This method returns an OutputStream to which the message should be * written and then closed. * @param mailbox the mailbox name * @param flags optional list of flags to specify for the message * @param content the message body(including headers) * @param uidplus handler for any APPENDUID information in the response * @return true if successful, false if error in flags/text */ public boolean append(String mailbox, String[] flags, byte[] content, UIDPlusHandler uidplus) throws IOException { String tag = newTag(); StringBuffer buffer = new StringBuffer(APPEND) .append(' ') .append(quote(UTF7imap.encode(mailbox))) .append(' '); if (flags != null) { buffer.append('('); for (int i = 0; i < flags.length; i++) { if (i > 0) { buffer.append(' '); } buffer.append(flags[i]); } buffer.append(')'); buffer.append(' '); } buffer.append('{'); buffer.append(content.length); buffer.append('}'); sendCommand(tag, buffer.toString()); IMAPResponse response = readResponse(); if (!response.isContinuation()) { throw new IMAPException(response.getID(), response.getText()); } out.write(content); // write the message body out.writeln(); out.flush(); while (true) { response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { if (uidplus != null) { processUIDPlus(response.getResponseCode(), uidplus); } return true; } else if (id == NO) { return false; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { asyncResponses.add(response); } else { throw new IMAPException(id, response.getText()); } } } void processUIDPlus(List code, UIDPlusHandler uidplus) { int len = code.size(); for (int i = 0; i < len; i++) { Object item = code.get(i); if (item instanceof String) { if ("APPENDUID".equals(item) && i < len - 2) { long uidvalidity = Long.parseLong((String) code.get(i + 1)); long uid = Long.parseLong((String) code.get(i + 2)); uidplus.appenduid(uidvalidity, uid); } else if ("COPYUID".equals(item) && i < len - 3) { long uidvalidity = Long.parseLong((String) code.get(i + 1)); MessageSetTokenizer oldUIDs = new MessageSetTokenizer((String) code.get(i + 2)); MessageSetTokenizer newUIDs = new MessageSetTokenizer((String) code.get(i + 3)); while (oldUIDs.hasNext()) { long oldUID = ((Long) oldUIDs.next()).longValue(); long newUID = ((Long) newUIDs.next()).longValue(); uidplus.copyuid(uidvalidity, oldUID, newUID); } } } else { processUIDPlus((List) item, uidplus); } } } /** * Request a checkpoint of the currently selected mailbox. */ public void check() throws IOException { invokeSimpleCommand(CHECK); } /** * Permanently remove all messages that have the \Deleted flags set, * and close the mailbox. * @return true if successful, false if no mailbox was selected */ public boolean close() throws IOException { return invokeSimpleCommand(CLOSE); } /** * Permanently removes all messages that have the \Delete flag set. * @return the numbers of the messages expunged */ public int[] expunge() throws IOException { String tag = newTag(); sendCommand(tag, EXPUNGE); List numbers = new ArrayList(); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (response.isUntagged()) { if (id == EXPUNGE) { numbers.add(new Integer(response.getCount())); } else { asyncResponses.add(response); } } else if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { int len = numbers.size(); int[] mn = new int[len]; for (int i = 0; i < len; i++) { mn[i] = ((Integer) numbers.get(i)).intValue(); } return mn; } else { throw new IMAPException(id, response.getText()); } } else { throw new IMAPException(id, response.getText()); } } } /** * Searches the currently selected mailbox for messages matching the * specified criteria. */ public int[] search(String charset, String[] criteria) throws IOException { String tag = newTag(); StringBuffer buffer = new StringBuffer(SEARCH); buffer.append(' '); if (charset != null) { buffer.append(charset); buffer.append(' '); } for (int i = 0; i < criteria.length; i++) { if (i > 0) { buffer.append(' '); } buffer.append(criteria[i]); } sendCommand(tag, buffer.toString()); List list = new ArrayList(); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (response.isUntagged()) { if (id == SEARCH) { String text = response.getText(); if (text == null) { continue; } try { int si = text.indexOf(' '); while (si != -1) { list.add(new Integer(text.substring(0, si))); text = text.substring(si + 1); si = text.indexOf(' '); } list.add(new Integer(text)); } catch (NumberFormatException e) { throw new IMAPException(id, "Expecting number: " + text); } } else { asyncResponses.add(response); } } else if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { int len = list.size(); int[] mn = new int[len]; for (int i = 0; i < len; i++) { mn[i] = ((Integer) list.get(i)).intValue(); } return mn; } else { throw new IMAPException(id, response.getText()); } } else { throw new IMAPException(id, response.getText()); } } } /** * Retrieves data associated with the specified message in the mailbox. * @param message the message number * @param fetchCommands the fetch commands, e.g. FLAGS */ public MessageStatus fetch(int message, String[] fetchCommands) throws IOException { String ids = (message == -1) ? "*" : Integer.toString(message); return fetchImpl(FETCH, ids, fetchCommands)[0]; } /** * Retrieves data associated with the specified range of messages in * the mailbox. * @param start the message number of the first message * @param end the message number of the last message * @param fetchCommands the fetch commands, e.g. FLAGS */ public MessageStatus[] fetch(int start, int end, String[] fetchCommands) throws IOException { StringBuffer ids = new StringBuffer(); ids.append((start == -1) ? '*' : start); ids.append(':'); ids.append((end == -1) ? '*' : end); return fetchImpl(FETCH, ids.toString(), fetchCommands); } /** * Retrieves data associated with messages in the mailbox. * @param messages the message numbers * @param fetchCommands the fetch commands, e.g. FLAGS */ public MessageStatus[] fetch(int[] messages, String[] fetchCommands) throws IOException { StringBuffer ids = new StringBuffer(); for (int i = 0; i < messages.length; i++) { if (i > 0) { ids.append(','); } ids.append(messages[i]); } return fetchImpl(FETCH, ids.toString(), fetchCommands); } /** * Retrieves data associated with the specified message in the mailbox. * @param uid the message UID * @param fetchCommands the fetch commands, e.g. FLAGS */ public MessageStatus uidFetch(long uid, String[] fetchCommands) throws IOException { String ids = (uid == -1L) ? "*" : Long.toString(uid); return fetchImpl(UID + ' ' + FETCH, ids, fetchCommands)[0]; } /** * Retrieves data associated with the specified range of messages in * the mailbox. * @param start the message number of the first message * @param end the message number of the last message * @param fetchCommands the fetch commands, e.g. FLAGS */ public MessageStatus[] uidFetch(long start, long end, String[] fetchCommands) throws IOException { StringBuffer ids = new StringBuffer(); ids.append((start == -1L) ? '*' : start); ids.append(':'); ids.append((end == -1L) ? '*' : end); return fetchImpl(UID + ' ' + FETCH, ids.toString(), fetchCommands); } /** * Retrieves data associated with messages in the mailbox. * @param uids the message UIDs * @param fetchCommands the fetch commands, e.g. FLAGS */ public MessageStatus[] uidFetch(long[] uids, String[] fetchCommands) throws IOException { StringBuffer ids = new StringBuffer(); for (int i = 0; i < uids.length; i++) { if (i > 0) { ids.append(','); } ids.append(uids[i]); } return fetchImpl(UID + ' ' + FETCH, ids.toString(), fetchCommands); } private MessageStatus[] fetchImpl(String cmd, String ids, String[] fetchCommands) throws IOException { String tag = newTag(); StringBuffer buffer = new StringBuffer(cmd); buffer.append(' '); buffer.append(ids); buffer.append(' '); buffer.append('('); for (int i = 0; i < fetchCommands.length; i++) { if (i > 0) { buffer.append(' '); } buffer.append(fetchCommands[i]); } buffer.append(')'); sendCommand(tag, buffer.toString()); List list = new ArrayList(); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (response.isUntagged()) { if (id == FETCH) { int msgnum = response.getCount(); List code = response.getResponseCode(); MessageStatus status = new MessageStatus(msgnum, code); list.add(status); } else { asyncResponses.add(response); } } else if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { MessageStatus[] statuses = new MessageStatus[list.size()]; list.toArray(statuses); return statuses; } else { throw new IMAPException(id, response.getText()); } } else { throw new IMAPException(id, response.getText()); } } } /** * Alters data associated with the specified message in the mailbox. * @param message the message number * @param flagCommand FLAGS, +FLAGS, -FLAGS(or .SILENT versions) * @param flags message flags to set * @return the message status */ public MessageStatus store(int message, String flagCommand, String[] flags) throws IOException { String ids = (message == -1) ? "*" : Integer.toString(message); return storeImpl(STORE, ids, flagCommand, flags)[0]; } /** * Alters data associated with the specified range of messages in the * mailbox. * @param start the message number of the first message * @param end the message number of the last message * @param flagCommand FLAGS, +FLAGS, -FLAGS(or .SILENT versions) * @param flags message flags to set * @return a list of message-number to current flags */ public MessageStatus[] store(int start, int end, String flagCommand, String[] flags) throws IOException { StringBuffer ids = new StringBuffer(); ids.append((start == -1) ? '*' : start); ids.append(':'); ids.append((end == -1) ? '*' : end); return storeImpl(STORE, ids.toString(), flagCommand, flags); } /** * Alters data associated with messages in the mailbox. * @param messages the message numbers * @param flagCommand FLAGS, +FLAGS, -FLAGS(or .SILENT versions) * @param flags message flags to set * @return a list of message-number to current flags */ public MessageStatus[] store(int[] messages, String flagCommand, String[] flags) throws IOException { StringBuffer ids = new StringBuffer(); for (int i = 0; i < messages.length; i++) { if (i > 0) { ids.append(','); } ids.append(messages[i]); } return storeImpl(STORE, ids.toString(), flagCommand, flags); } /** * Alters data associated with the specified message in the mailbox. * @param uid the message UID * @param flagCommand FLAGS, +FLAGS, -FLAGS(or .SILENT versions) * @param flags message flags to set * @return the message status */ public MessageStatus uidStore(long uid, String flagCommand, String[] flags) throws IOException { String ids = (uid == -1L) ? "*" : Long.toString(uid); return storeImpl(UID + ' ' + STORE, ids, flagCommand, flags)[0]; } /** * Alters data associated with the specified range of messages in the * mailbox. * @param start the UID of the first message * @param end the UID of the last message * @param flagCommand FLAGS, +FLAGS, -FLAGS(or .SILENT versions) * @param flags message flags to set * @return a list of message-number to current flags */ public MessageStatus[] uidStore(long start, long end, String flagCommand, String[] flags) throws IOException { StringBuffer ids = new StringBuffer(); ids.append((start == -1L) ? '*' : start); ids.append(':'); ids.append((end == -1L) ? '*' : end); return storeImpl(UID + ' ' + STORE, ids.toString(), flagCommand, flags); } /** * Alters data associated with messages in the mailbox. * @param uids the message UIDs * @param flagCommand FLAGS, +FLAGS, -FLAGS(or .SILENT versions) * @param flags message flags to set * @return a list of message-number to current flags */ public MessageStatus[] uidStore(long[] uids, String flagCommand, String[] flags) throws IOException { StringBuffer ids = new StringBuffer(); for (int i = 0; i < uids.length; i++) { if (i > 0) { ids.append(','); } ids.append(uids[i]); } return storeImpl(UID + ' ' + STORE, ids.toString(), flagCommand, flags); } private MessageStatus[] storeImpl(String cmd, String ids, String flagCommand, String[] flags) throws IOException { String tag = newTag(); StringBuffer buffer = new StringBuffer(cmd); buffer.append(' '); buffer.append(ids); buffer.append(' '); buffer.append(flagCommand); buffer.append(' '); buffer.append('('); for (int i = 0; i < flags.length; i++) { if (i > 0) { buffer.append(' '); } buffer.append(flags[i]); } buffer.append(')'); sendCommand(tag, buffer.toString()); List list = new ArrayList(); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (response.isUntagged()) { int msgnum = response.getCount(); List code = response.getResponseCode(); // 2 different styles returned by server: FETCH or FETCH FLAGS if (id == FETCH) { MessageStatus mf = new MessageStatus(msgnum, code); list.add(mf); } else if (id == FETCH_FLAGS) { List base = new ArrayList(); base.add(FLAGS); base.add(code); MessageStatus mf = new MessageStatus(msgnum, base); list.add(mf); } else { asyncResponses.add(response); } } else if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { MessageStatus[] mf = new MessageStatus[list.size()]; list.toArray(mf); return mf; } else { throw new IMAPException(id, response.getText()); } } else { throw new IMAPException(id, response.getText()); } } } /** * Copies the specified messages to the end of the destination mailbox. * @param messages the message numbers * @param mailbox the destination mailbox */ public boolean copy(int[] messages, String mailbox) throws IOException { return copy(messages, mailbox, null); } /** * Copies the specified messages to the end of the destination mailbox. * @param messages the message numbers * @param mailbox the destination mailbox * @param uidplus UIDPLUS callback for COPYUID information */ public boolean copy(int[] messages, String mailbox, UIDPlusHandler uidplus) throws IOException { if (messages == null || messages.length < 1) { return true; } StringBuffer buffer = new StringBuffer(COPY) .append(' '); for (int i = 0; i < messages.length; i++) { if (i > 0) { buffer.append(','); } buffer.append(messages[i]); } buffer.append(' ').append(quote(UTF7imap.encode(mailbox))); String tag = newTag(); sendCommand(tag, buffer.toString()); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { if (uidplus != null) { processUIDPlus(response.getResponseCode(), uidplus); } return true; } else if (id == NO) { return false; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { asyncResponses.add(response); } else { throw new IMAPException(id, response.getText()); } } } /** * Returns the namespaces available on the server. * See RFC 2342 for details. */ public Namespaces namespace() throws IOException { String tag = newTag(); sendCommand(tag, NAMESPACE); Namespaces namespaces = null; while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { return namespaces; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { if (NAMESPACE.equals(response.getID())) { namespaces = new Namespaces(response.getText()); } else { asyncResponses.add(response); } } else { throw new IMAPException(id, response.getText()); } } } /** * Changes the access rights on the specified mailbox such that the * authentication principal is granted the specified permissions. * @param mailbox the mailbox name * @param principal the authentication identifier * @param rights the rights to assign */ public boolean setacl(String mailbox, String principal, int rights) throws IOException { String command = SETACL + ' ' + quote(UTF7imap.encode(mailbox)) + ' ' + UTF7imap.encode(principal) + ' ' + rightsToString(rights); return invokeSimpleCommand(command); } /** * Removes any access rights for the given authentication principal on the * specified mailbox. * @param mailbox the mailbox name * @param principal the authentication identifier */ public boolean deleteacl(String mailbox, String principal) throws IOException { String command = DELETEACL + ' ' + quote(UTF7imap.encode(mailbox)) + ' ' + UTF7imap.encode(principal); return invokeSimpleCommand(command); } /** * Returns the access control list for the specified mailbox. * The returned rights are a logical OR of RIGHTS_* bits. * @param mailbox the mailbox name * @return a map of principal names to Integer rights */ public Map getacl(String mailbox) throws IOException { String tag = newTag(); sendCommand(tag, GETACL + ' ' + quote(UTF7imap.encode(mailbox))); Map ret = new TreeMap(); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { return ret; } else if (id == NO) { return null; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { if (ACL.equals(response.getID())) { String text = response.getText(); List args = parseACL(text, 1); String rights = (String) args.get(2); ret.put(args.get(1), new Integer(stringToRights(rights))); } else { asyncResponses.add(response); } } else { throw new IMAPException(id, response.getText()); } } } /** * Returns the rights for the given principal for the specified mailbox. * The returned rights are a logical OR of RIGHTS_* bits. * @param mailbox the mailbox name * @param principal the authentication identity */ public int listrights(String mailbox, String principal) throws IOException { String tag = newTag(); String command = LISTRIGHTS + ' ' + quote(UTF7imap.encode(mailbox)) + ' ' + UTF7imap.encode(principal); sendCommand(tag, command); int ret = -1; while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { return ret; } else if (id == NO) { return -1; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { if (LISTRIGHTS.equals(response.getID())) { String text = response.getText(); List args = parseACL(text, 1); ret = stringToRights((String) args.get(2)); } else { asyncResponses.add(response); } } else { throw new IMAPException(id, response.getText()); } } } /** * Returns the rights for the current principal for the specified mailbox. * The returned rights are a logical OR of RIGHTS_* bits. * @param mailbox the mailbox name */ public int myrights(String mailbox) throws IOException { String tag = newTag(); String command = MYRIGHTS + ' ' + quote(UTF7imap.encode(mailbox)); sendCommand(tag, command); int ret = -1; while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { return ret; } else if (id == NO) { return -1; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { if (MYRIGHTS.equals(response.getID())) { String text = response.getText(); List args = parseACL(text, 0); ret = stringToRights((String) args.get(2)); } else { asyncResponses.add(response); } } else { throw new IMAPException(id, response.getText()); } } } private String rightsToString(int rights) { StringBuffer buf = new StringBuffer(); if ((rights & RIGHTS_LOOKUP) != 0) { buf.append('l'); } if ((rights & RIGHTS_READ) != 0) { buf.append('r'); } if ((rights & RIGHTS_SEEN) != 0) { buf.append('s'); } if ((rights & RIGHTS_WRITE) != 0) { buf.append('w'); } if ((rights & RIGHTS_INSERT) != 0) { buf.append('i'); } if ((rights & RIGHTS_POST) != 0) { buf.append('p'); } if ((rights & RIGHTS_CREATE) != 0) { buf.append('c'); } if ((rights & RIGHTS_DELETE) != 0) { buf.append('d'); } if ((rights & RIGHTS_ADMIN) != 0) { buf.append('a'); } return buf.toString(); } private int stringToRights(String text) { int ret = 0; int len = text.length(); for (int i = 0; i < len; i++) { switch (text.charAt(i)) { case 'l': ret |= RIGHTS_LOOKUP; break; case 'r': ret |= RIGHTS_READ; break; case 's': ret |= RIGHTS_SEEN; break; case 'w': ret |= RIGHTS_WRITE; break; case 'i': ret |= RIGHTS_INSERT; break; case 'p': ret |= RIGHTS_POST; break; case 'c': ret |= RIGHTS_CREATE; break; case 'd': ret |= RIGHTS_DELETE; break; case 'a': ret |= RIGHTS_ADMIN; break; } } return ret; } /* * Parse an ACL entry into a list of 2 or 3 components: mailbox name, * optional principal, and rights. */ private List parseACL(String text, int prolog) { int len = text.length(); boolean inQuotes = false; List ret = new ArrayList(); StringBuffer buf = new StringBuffer(); for (int i = 0; i < len; i++) { char c = text.charAt(i); switch (c) { case '"': inQuotes = !inQuotes; break; case ' ': if (inQuotes || ret.size() > prolog) { buf.append(c); } else { ret.add(UTF7imap.decode(buf.toString())); buf.setLength(0); } break; default: buf.append(c); } } ret.add(buf.toString()); return ret; } /** * Sets the quota for the specified quota root. * @param quotaRoot the quota root * @param resources the list of resources and associated limits to set * @return the new quota, or null if the operation failed */ public Quota setquota(String quotaRoot, Quota.Resource[] resources) throws IOException { // Create resource limits list StringBuffer resourceLimits = new StringBuffer(); if (resources != null) { for (int i = 0; i < resources.length; i++) { if (i > 0) { resourceLimits.append(' '); } resourceLimits.append(resources[i].toString()); } } String tag = newTag(); String command = SETQUOTA + ' ' + quote(UTF7imap.encode(quotaRoot)) + ' ' + resourceLimits.toString(); sendCommand(tag, command); Quota ret = null; while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { return ret; } else if (id == NO) { return null; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { if (QUOTA.equals(response.getID())) { ret = new Quota(response.getText()); } else { asyncResponses.add(response); } } else { throw new IMAPException(id, response.getText()); } } } /** * Returns the specified quota root's resource usage and limits. * @param quotaRoot the quota root */ public Quota getquota(String quotaRoot) throws IOException { String tag = newTag(); String command = GETQUOTA + ' ' + quote(UTF7imap.encode(quotaRoot)); sendCommand(tag, command); Quota ret = null; while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { return ret; } else if (id == NO) { return null; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { if (QUOTA.equals(response.getID())) { ret = new Quota(response.getText()); } else { asyncResponses.add(response); } } else { throw new IMAPException(id, response.getText()); } } } /** * Returns the quotas for the given mailbox. * @param mailbox the mailbox name */ public Quota[] getquotaroot(String mailbox) throws IOException { String tag = newTag(); String command = GETQUOTAROOT + ' ' + quote(UTF7imap.encode(mailbox)); sendCommand(tag, command); List acc = new ArrayList(); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { Quota[] ret = new Quota[acc.size()]; acc.toArray(ret); return ret; } else if (id == NO) { return null; } else { throw new IMAPException(id, response.getText()); } } else if (response.isUntagged()) { if (QUOTA.equals(response.getID())) { acc.add(new Quota(response.getText())); } else { asyncResponses.add(response); } } else { throw new IMAPException(id, response.getText()); } } } /** * Expunges the specified range of messages. * See RFC 2359 for details. * @param start the UID of the first message to expunge * @param end the UID of the last message to expunge */ public int[] uidExpunge(long start, long end) throws IOException { String tag = newTag(); StringBuffer cmd = new StringBuffer(UID_EXPUNGE); cmd.append(' '); cmd.append(start); cmd.append(':'); cmd.append(end); sendCommand(tag, cmd.toString()); List numbers = new ArrayList(); while (true) { IMAPResponse response = readResponse(); String id = response.getID(); if (response.isUntagged()) { if (id == EXPUNGE) { numbers.add(new Integer(response.getCount())); } else { asyncResponses.add(response); } } else if (tag.equals(response.getTag())) { processAlerts(response); if (id == OK) { int len = numbers.size(); int[] mn = new int[len]; for (int i = 0; i < len; i++) { mn[i] = ((Integer) numbers.get(i)).intValue(); } return mn; } else { throw new IMAPException(id, response.getText()); } } else { throw new IMAPException(id, response.getText()); } } } // -- Utility methods -- /** * Remove the quotes from each end of a string literal. */ static String stripQuotes(String text) { if (text.charAt(0) == '"') { int len = text.length(); if (text.charAt(len - 1) == '"') { return text.substring(1, len - 1); } } return text; } /** * Quote the specified text if necessary. */ static String quote(String text) { if (text.length() == 0 || text.indexOf(' ') != -1 || text.indexOf('%') != -1) { StringBuffer buffer = new StringBuffer(); buffer.append('"'); buffer.append(text); buffer.append('"'); return buffer.toString(); } return text; } } inetlib-1.1.2/source/gnu/inet/imap/IMAPConstants.java0000664000076400007640000002174111345235566017357 00000000000000/* * IMAPConstants.java * Copyright (C) 2003,2004,2005 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; /** * IMAP4rev1 string constants. * * @author Chris Burdess */ public interface IMAPConstants { // Client commands public static final String CAPABILITY = "CAPABILITY"; public static final String NOOP = "NOOP"; public static final String AUTHENTICATE = "AUTHENTICATE"; public static final String LOGIN = "LOGIN"; public static final String LOGOUT = "LOGOUT"; public static final String SELECT = "SELECT"; public static final String EXAMINE = "EXAMINE"; public static final String CREATE = "CREATE"; public static final String DELETE = "DELETE"; public static final String RENAME = "RENAME"; public static final String SUBSCRIBE = "SUBSCRIBE"; public static final String UNSUBSCRIBE = "UNSUBSCRIBE"; public static final String LIST = "LIST"; public static final String LSUB = "LSUB"; public static final String STATUS = "STATUS"; public static final String APPEND = "APPEND"; public static final String CHECK = "CHECK"; public static final String CLOSE = "CLOSE"; public static final String EXPUNGE = "EXPUNGE"; public static final String SEARCH = "SEARCH"; public static final String FETCH = "FETCH"; public static final String STORE = "STORE"; public static final String COPY = "COPY"; public static final String UID = "UID"; public static final String STARTTLS = "STARTTLS"; public static final String NAMESPACE = "NAMESPACE"; public static final String SETACL = "SETACL"; public static final String DELETEACL = "DELETEACL"; public static final String GETACL = "GETACL"; public static final String LISTRIGHTS = "LISTRIGHTS"; public static final String MYRIGHTS = "MYRIGHTS"; public static final String SETQUOTA = "SETQUOTA"; public static final String GETQUOTA = "GETQUOTA"; public static final String GETQUOTAROOT = "GETQUOTAROOT"; public static final String UID_EXPUNGE = "UID EXPUNGE"; // Server responses public static final String OK = "OK"; public static final String NO = "NO"; public static final String BAD = "BAD"; public static final String PREAUTH = "PREAUTH"; public static final String BYE = "BYE"; // Response codes public static final String ALERT = "ALERT"; public static final String NEWNAME = "NEWNAME"; public static final String PARSE = "PARSE"; public static final String PERMANENTFLAGS = "PERMANENTFLAGS"; public static final String READ_ONLY = "READ-ONLY"; public static final String READ_WRITE = "READ-WRITE"; public static final String TRYCREATE = "TRYCREATE"; public static final String UIDVALIDITY = "UIDVALIDITY"; public static final String UNSEEN = "UNSEEN"; public static final String ACL = "ACL"; public static final String QUOTA = "QUOTA"; public static final String QUOTAROOT = "QUOTAROOT"; public static final String APPENDUID = "APPENDUID"; public static final String COPYUID = "COPYUID"; // Select responses public static final String FLAGS = "FLAGS"; public static final String EXISTS = "EXISTS"; public static final String RECENT = "RECENT"; public static final String FETCH_FLAGS = "FETCH FLAGS"; // Status items public static final String MESSAGES = "MESSAGES"; public static final String UIDNEXT = "UIDNEXT"; // List responses public static final String LIST_NOINFERIORS = "\\Noinferiors"; public static final String LIST_NOSELECT = "\\Noselect"; public static final String LIST_MARKED = "\\Marked"; public static final String LIST_UNMARKED = "\\Unmarked"; // Flags public static final String FLAG_SEEN = "\\Seen"; public static final String FLAG_ANSWERED = "\\Answered"; public static final String FLAG_FLAGGED = "\\Flagged"; public static final String FLAG_DELETED = "\\Deleted"; public static final String FLAG_DRAFT = "\\Draft"; public static final String FLAG_RECENT = "\\Recent"; // Fetch data items public static final String BODY = "BODY"; public static final String BODY_PEEK = "BODY.PEEK"; public static final String HEADER = "HEADER"; public static final String HEADER_FIELDS = "HEADER.FIELDS"; public static final String HEADER_FIELDS_NOT = "HEADER.FIELDS.NOT"; public static final String BODYSTRUCTURE = "BODYSTRUCTURE"; public static final String ENVELOPE = "ENVELOPE"; public static final String INTERNALDATE = "INTERNALDATE"; public static final String RFC822 = "RFC822"; public static final String RFC822_HEADER = "RFC822.HEADER"; public static final String RFC822_SIZE = "RFC822.SIZE"; public static final String RFC822_TEXT = "RFC822.TEXT"; // Search criteria public static final String SEARCH_ALL = "ALL"; public static final String SEARCH_ANSWERED = "ANSWERED"; public static final String SEARCH_BCC = "BCC"; public static final String SEARCH_BEFORE = "BEFORE"; public static final String SEARCH_BODY = "BODY"; public static final String SEARCH_CC = "CC"; public static final String SEARCH_DELETED = "DELETED"; public static final String SEARCH_DRAFT = "DRAFT"; public static final String SEARCH_FLAGGED = "FLAGGED"; public static final String SEARCH_FROM = "FROM"; public static final String SEARCH_HEADER = "HEADER"; public static final String SEARCH_KEYWORD = "KEYWORD"; public static final String SEARCH_LARGER = "LARGER"; public static final String SEARCH_NEW = "NEW"; public static final String SEARCH_NOT = "NOT"; public static final String SEARCH_OLD = "OLD"; public static final String SEARCH_ON = "ON"; public static final String SEARCH_OR = "OR"; public static final String SEARCH_RECENT = "RECENT"; public static final String SEARCH_SEEN = "SEEN"; public static final String SEARCH_SENTBEFORE = "SENTBEFORE"; public static final String SEARCH_SENTON = "SENTON"; public static final String SEARCH_SENTSINCE = "SENTSINCE"; public static final String SEARCH_SINCE = "SINCE"; public static final String SEARCH_SMALLER = "SMALLER"; public static final String SEARCH_SUBJECT = "SUBJECT"; public static final String SEARCH_TEXT = "TEXT"; public static final String SEARCH_TO = "TO"; public static final String SEARCH_UID = "UID"; public static final String SEARCH_UNANSWERED = "UNANSWERED"; public static final String SEARCH_UNDELETED = "UNDELETED"; public static final String SEARCH_UNDRAFT = "UNDRAFT"; public static final String SEARCH_UNFLAGGED = "UNFLAGGED"; public static final String SEARCH_UNKEYWORD = "UNKEYWORD"; public static final String SEARCH_UNSEEN = "UNSEEN"; // NIL public static final String NIL = "NIL"; // ACL rights public static final int RIGHTS_LOOKUP = 0x0001; public static final int RIGHTS_READ = 0x0002; public static final int RIGHTS_SEEN = 0x0004; public static final int RIGHTS_WRITE = 0x0008; public static final int RIGHTS_INSERT = 0x0010; public static final int RIGHTS_POST = 0x0020; public static final int RIGHTS_CREATE = 0x0040; public static final int RIGHTS_DELETE = 0x0080; public static final int RIGHTS_ADMIN = 0x0100; // Quota limits public static final String STORAGE = "STORAGE"; // Authentication mechanisms public static final String KERBEROS_V4 = "KERBEROS_V4"; public static final String GSSAPI = "GSSAPI"; public static final String SKEY = "SKEY"; public static final String CRAM_MD5 = "CRAM-MD5"; public static final String LOGINDISABLED = "LOGINDISABLED"; } inetlib-1.1.2/source/gnu/inet/imap/MessageSetTokenizer.java0000664000076400007640000000576411345235566020676 00000000000000/* * MessageSetTokenizer.java * Copyright (C) 2005 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.util.Iterator; import java.util.LinkedList; /** * Tokenizer for an IMAP UID message-set. * This iterates over the UIDs specified in the set. * * @author Chris Burdess */ class MessageSetTokenizer implements Iterator { private Iterator iterator; MessageSetTokenizer(String spec) { LinkedList acc = new LinkedList(); for (int ci = spec.indexOf(','); ci != -1; ci = spec.indexOf(',')) { addToken(acc, spec.substring(0, ci)); spec = spec.substring(ci + 1); } addToken(acc, spec); iterator = acc.iterator(); } private void addToken(LinkedList acc, String token) { int ci = token.indexOf(':'); if (ci == -1) { acc.add(new Long(token)); } else { long start = Long.parseLong(token.substring(0, ci)); long end = Long.parseLong(token.substring(ci + 1)); while (start <= end) { acc.add(new Long(start++)); } } } public boolean hasNext() { return iterator.hasNext(); } public Object next() { return iterator.next(); } public void remove() { iterator.remove(); } } inetlib-1.1.2/source/gnu/inet/imap/Namespaces.java0000664000076400007640000002025511345235566017012 00000000000000/* * Namespaces.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeMap; /** * A tuple of IMAP namespaces, as defined in RFC 2342. * * @author Chris Burdess */ public class Namespaces { /** * An individual namespace specification. */ public static class Namespace { String prefix; char delimiter; Map extensions; /** * Returns the namespace prefix. */ public String getPrefix() { return prefix; } /** * Returns the delimiter character for the namespace. */ public char getDelimiter() { return delimiter; } /** * Returns the dictionary of extension values for the namespace, * or null if there are no extensions. */ public Map getExtensions() { return extensions; } /** * Debugging. */ public String toString() { StringBuffer buf = new StringBuffer(); buf.append('('); buf.append(quote(prefix)); buf.append(' '); buf.append(quote(delimiter)); if (extensions != null) { buf.append(' '); for (Iterator i = extensions.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String key = (String) entry.getKey(); buf.append(quote(key)); buf.append(' '); buf.append(format(entry.getValue())); } } buf.append(')'); return buf.toString(); } static String quote(String text) { return '"' + text + '"'; } static String quote(char c) { char[] chars = new char[] { '"', c, '"' }; return new String(chars); } private String format(Object value) { if (value == null) { return IMAPConstants.NIL; } else if (value instanceof String) { return quote((String) value); } else { List list = (List) value; int len = list.size(); StringBuffer buf = new StringBuffer(); buf.append('('); for (int i = 0; i < len; i++) { if (i > 0) { buf.append(' '); } buf.append(format(list.get(i))); } buf.append(')'); return buf.toString(); } } } List personal; List other; List shared; Namespaces(String text) { List acc = new ArrayList(); int len = text.length(); parse(text, 0, len, acc); len = acc.size(); if (len > 0) { personal = parseNamespaceList(acc.get(0)); if (len > 1) { other = parseNamespaceList(acc.get(1)); if (len > 2) { shared = parseNamespaceList(acc.get(2)); } } } } /** * Returns the list of personal namespaces. */ public Namespace[] getPersonal() { return toArray(personal); } /** * Returns the list of other users' namespaces. */ public Namespace[] getOther() { return toArray(other); } /** * Returns the list of shared namespaces. */ public Namespace[] getShared() { return toArray(shared); } private Namespace[] toArray(List namespaceList) { if (namespaceList == null) { return null; } Namespace[] ret = new Namespace[namespaceList.size()]; namespaceList.toArray(ret); return ret; } /** * Parse the specified text into an S-expression. */ static int parse(String text, int start, int len, List acc) { StringBuffer buf = new StringBuffer(); boolean inLiteral = false; for (int i = start; i < len; i++) { char c = text.charAt(i); if (inLiteral) { if (c == '"') { String literal = buf.toString(); buf.setLength(0); inLiteral = false; acc.add(literal); } else { buf.append(c); } } else { switch (c) { case ' ': String token = buf.toString(); if (IMAPConstants.NIL.equals(token)) { acc.add(null); } buf.setLength(0); break; case '"': inLiteral = true; buf.setLength(0); break; case '(': List sub = new ArrayList(); i = parse(text, i + 1, len, sub); acc.add(sub); break; case ')': return i; } } } return len; } private List parseNamespaceList(Object ns) { if (ns == null) { return null; } List list = (List) ns; int len = list.size(); List ret = new ArrayList(len); for (int i = 0; i < len; i++) { ret.add(parseNamespace((List) list.get(i))); } return ret; } private Namespace parseNamespace(List comps) { int len = comps.size(); Namespace ns = new Namespace(); ns.prefix = (String) comps.get(0); ns.delimiter = ((String) comps.get(1)).charAt(0); if (len > 2) { ns.extensions = new TreeMap(); for (int i = 2; i < len; i += 2) { String key = (String) comps.get(i); Object val = (i == len - 1) ? null : comps.get(i + 1); ns.extensions.put(key, val); } } return ns; } /** * Debugging. */ public String toString() { StringBuffer buf = new StringBuffer(); appendNamespaceList(buf, personal); buf.append(' '); appendNamespaceList(buf, other); buf.append(' '); appendNamespaceList(buf, shared); return buf.toString(); } private void appendNamespaceList(StringBuffer buf, List list) { if (list == null) { buf.append(IMAPConstants.NIL); } else { int len = list.size(); buf.append('('); for (int i = 0; i < len; i++) { if (i > 0) { buf.append(' '); } buf.append(list.get(i)); } buf.append(')'); } } } inetlib-1.1.2/source/gnu/inet/imap/IMAPException.java0000664000076400007640000000436111345235566017340 00000000000000/* * IMAPException.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.io.IOException; /** * Exception corresponding to an IMAP4 BAD or NO server response. * * @author Chris Burdess */ public class IMAPException extends IOException { /** * ID of the exception (BAD or NO). */ protected String id; public IMAPException(String id, String message) { super(message); this.id = id; } public String getId() { return id; } } inetlib-1.1.2/source/gnu/inet/imap/IMAPResponseTokenizer.java0000664000076400007640000003435611345235566021102 00000000000000/* * IMAPResponseTokenizer.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.IOException; import java.net.ProtocolException; import java.util.ArrayList; import java.util.List; import java.util.Stack; /** * An object that can parse an underlying socket stream containing IMAP * protocol server responses into IMAPResponse tokens. * * @author Chris Burdess */ public class IMAPResponseTokenizer implements IMAPConstants { /** * The server stream. */ protected InputStream in; private byte[] buffer = null; private static final int BUFFER_SIZE = 4096; // Seems to be a good value private static final String DEFAULT_ENCODING = "US-ASCII"; private static final int STATE_TAG = 0; private static final int STATE_COUNT = 1; private static final int STATE_ID = 2; private static final int STATE_MAYBE_CODE = 3; private static final int STATE_CODE = 4; private static final int STATE_LITERAL_LENGTH = 5; private static final int STATE_LITERAL = 6; private static final int STATE_TEXT = 7; private static final int STATE_STATUS = 8; /** * Constructor. * @param in the server socket input stream */ public IMAPResponseTokenizer(InputStream in) { this.in = in; } /* * Reads bytes, from the underlying stream if necessary, or from the * cache. If moreNeeded is specified, always performs a read to append * more to the cache. */ byte[] read(boolean moreNeeded) throws IOException { if (buffer != null && !moreNeeded && buffer.length > 0) { return buffer; } int max = in.available(); if (max < 1) { max = BUFFER_SIZE; } byte[] tmp = new byte[max]; int len = 0; while (len == 0) { len = in.read(tmp, 0, max); } if (len == -1) { return null; // EOF } int blen =(buffer == null) ? 0 : buffer.length; byte[] uni = new byte[blen + len]; if (blen != 0) { System.arraycopy(buffer, 0, uni, 0, blen); } System.arraycopy(tmp, 0, uni, blen, len); buffer = uni; return buffer; } /* * Invalidates the byte cache up to the specified index. */ void mark(int index) { int len = buffer.length; int start = index + 1; if (start < len) { int n =(len - start); byte[] tmp = new byte[n]; System.arraycopy(buffer, start, tmp, 0, n); buffer = tmp; } else { buffer = null; } } /** * Returns the next IMAPResponse. */ public IMAPResponse next() throws IOException { // Perform read byte[] buf = read(false); if (buf == null) { return null; // pass EOF back up the chain } int len = buf.length; IMAPResponse response = new IMAPResponse(); ByteArrayOutputStream genericSink = new ByteArrayOutputStream(); ByteArrayOutputStream literalSink = null; int literalCount = 0, literalLength = -1; Stack context = new Stack(); int state = STATE_TAG; boolean inQuote = false; boolean inContent = false; for (int i = 0; i < len; i++) { byte b = buf[i]; switch (state) { case STATE_TAG: // expect tag if (i == 0 && b == 0x2a) // untagged { response.tag = IMAPResponse.UNTAGGED; } else if (i == 0 && b == 0x2b) // continuation { response.tag = IMAPResponse.CONTINUATION; } else if (b == 0x20) // delimiter { if (response.tag == null) { byte[] tb = genericSink.toByteArray(); response.tag = new String(tb, DEFAULT_ENCODING); } genericSink.reset(); if (response.isContinuation()) { state = STATE_TEXT; } else { state = STATE_COUNT; } } else // tag literal { genericSink.write(b); } break; case STATE_COUNT: // expect count or id if (b < 0x30 || b > 0x39) { state = STATE_ID; } if (b == 0x20) // delimiter { byte[] cb = genericSink.toByteArray(); genericSink.reset(); String cs = new String(cb, DEFAULT_ENCODING); try { response.count = Integer.parseInt(cs); } catch (NumberFormatException e) { throw new ProtocolException("Expecting number: " + cs); } state = STATE_ID; } else { genericSink.write(b); } break; case STATE_ID: // expect id if (b == 0x20) // delimiter { byte[] ib = genericSink.toByteArray(); genericSink.reset(); response.id = new String(ib, DEFAULT_ENCODING).intern(); state = STATE_MAYBE_CODE; } else if (b == 0x0a) // EOL { byte[] ib = genericSink.toByteArray(); genericSink.reset(); response.id = new String(ib, DEFAULT_ENCODING).intern(); state = STATE_TAG; // mark bytes read mark(i); return response; } else if (b != 0x0d) // id literal { genericSink.write(b); } break; case STATE_MAYBE_CODE: // expect code or text if (b == 0x28 || b == 0x5b) { List top = new ArrayList(); response.code = top; context.push(top); state = STATE_CODE; } else { if (response.id == FETCH) { // We can't have text here so it must be the beginning of // FETCH FLAGS. Go back to ID state. genericSink.reset(); byte[] fetchBytes = new byte[] { 0x46, 0x45, 0x54, 0x43, 0x48, 0x20}; genericSink.write(fetchBytes); genericSink.write(b); state = STATE_ID; } else if (response.id == STATUS) { // We are in the mailbox name part of the STATUS response genericSink.write(b); state = STATE_STATUS; } else { genericSink.write(b); state = STATE_TEXT; } } break; case STATE_STATUS: if (b == 0x20) // delimiter { response.mailbox = genericSink.toString(); genericSink.reset(); state = STATE_MAYBE_CODE; } else { genericSink.write(b); } break; case STATE_CODE: // response code inside parentheses if (b == 0x22) // quote delimiter { inQuote = !inQuote; } else if (inQuote) { genericSink.write(b); } else { if (b == 0x28 || b == 0x5b) // start parenthesis/bracket { List parent =(List) context.peek(); List top = new ArrayList(); if (genericSink.size() > 0) { byte[] tb = genericSink.toByteArray(); String token = new String(tb, DEFAULT_ENCODING).intern(); Pair pair = new Pair(token, top); parent.add(pair); genericSink.reset(); } else { parent.add(top); } context.push(top); } else if (b == 0x29 || b == 0x5d) // end parenthesis/bracket { List top =(List) context.pop(); // flush genericSink if (genericSink.size() > 0) { byte[] tb = genericSink.toByteArray(); String token = new String(tb, DEFAULT_ENCODING).intern(); top.add(token); genericSink.reset(); } } else if (b == 0x7b) // literal length { genericSink.reset(); state = STATE_LITERAL_LENGTH; } else if (b == 0x20) // token delimiter { if (context.size() == 0) // end state { state = STATE_TEXT; } else // add token { List top =(List) context.peek(); // flush genericSink if (genericSink.size() > 0) { byte[] tb = genericSink.toByteArray(); String token = new String(tb, DEFAULT_ENCODING).intern(); top.add(token); genericSink.reset(); } } } else if (b == 0x0a) // EOL { state = STATE_TAG; // mark bytes read mark(i); return response; } else if (b != 0x0d) // ignore CR { genericSink.write(b); } } break; case STATE_LITERAL_LENGTH: if (b == 0x7d) // end literal length { byte[] cb = genericSink.toByteArray(); genericSink.reset(); String cs = new String(cb, DEFAULT_ENCODING); try { literalLength = Integer.parseInt(cs); } catch (NumberFormatException e) { throw new ProtocolException("Expecting number: " + cs); } } else if (b == 0x0a) // start literal { state = STATE_LITERAL; literalSink = new ByteArrayOutputStream(); literalCount = 0; } else if (b != 0x0d) // ignore CR { genericSink.write(b); } break; case STATE_LITERAL: if (literalCount >= literalLength) { List top =(List) context.peek(); byte[] literal = literalSink.toByteArray(); top.add(literal); literalSink = null; inContent = false; state = STATE_CODE; } else { literalSink.write(b); literalCount++; } break; case STATE_TEXT: // human-readable text if (b == 0x0a) // delimiter { byte[] tb = genericSink.toByteArray(); genericSink.reset(); response.text = new String(tb, DEFAULT_ENCODING); state = STATE_TAG; // mark bytes read mark(i); return response; } else if (b != 0x0d) // ignore CR { genericSink.write(b); } break; } } // get more bytes buf = read(true); return next(); } } inetlib-1.1.2/source/gnu/inet/imap/Quota.java0000664000076400007640000001125211345235566016021 00000000000000/* * Quota.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; /** * An IMAP quota entry. * * @author Chris Burdess */ public class Quota { /** * A quota resource entry. */ public static class Resource { String name; int current; int limit; /** * Specifies a new resource with the given name and limit. * @param name the resource name * @param limit the resource limit */ public Resource(String name, int limit) { this(name, -1, limit); } Resource(String name, int current, int limit) { this.name = name; this.current = current; this.limit = limit; } /** * Returns the resource name. */ public String getName() { return name; } /** * Returns the current usage of the resource, or -1 if not * known. */ public int getCurrentUsage() { return current; } /** * Returns the resource limit. */ public int getLimit() { return limit; } /** * Debugging. */ public String toString() { StringBuffer buf = new StringBuffer(); buf.append('('); buf.append(name); if (current >= 0) { buf.append(' '); buf.append(current); } buf.append(' '); buf.append(limit); buf.append(')'); return buf.toString(); } } String quotaRoot; List resources; Quota(String text) { int len = text.length(); List acc = new ArrayList(); Namespaces.parse(text, 0, len, acc); quotaRoot = (String) acc.get(0); resources = new ArrayList(); len = acc.size(); for (int i = 1; i < len; i++) { resources.add(parseResource((List) acc.get(i))); } } private Resource parseResource(List triple) { String name = (String) triple.get(0); String current = (String) triple.get(1); String limit = (String) triple.get(2); return new Resource(name, Integer.parseInt(current), Integer.parseInt(limit)); } /** * Returns the quota root. All mailboxes that share the same named * quota root share the resource limits of the quota root. */ public String getQuotaRoot() { return quotaRoot; } /** * Returns the list of quota resources. */ public Resource[] getResources() { Resource[] ret = new Resource[resources.size()]; resources.toArray(ret); return ret; } /** * Debugging. */ public String toString() { StringBuffer buf = new StringBuffer(); buf.append(IMAPConnection.quote(UTF7imap.encode(quotaRoot))); int len = resources.size(); for (int i = 0; i < len; i++) { buf.append(' '); buf.append(resources.get(i)); } return buf.toString(); } } inetlib-1.1.2/source/gnu/inet/imap/MessageStatus.java0000664000076400007640000000441111345235566017517 00000000000000/* * MessageStatus.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.imap; import java.util.List; /** * Represents the state of a message. * * @author Chris Burdess */ public final class MessageStatus { private int messageNumber; private List code; MessageStatus(int messageNumber, List code) { this.messageNumber = messageNumber; this.code = code; } public int getMessageNumber() { return messageNumber; } public List getCode() { return code; } } inetlib-1.1.2/source/gnu/inet/imap/package.html0000664000076400007640000000067511345235566016355 00000000000000

    This package contains an IMAP4rev1 client. It supports the following features:

    • Extensible authentication using any available SASL mechanism
    • TLS negotiation (RFC 2595)
    • Automatic UTF-7imap folder name decoding/encoding
    • IMAP over SSL
    • IMAP namespaces (RFC 2342)
    • IMAP ACLs (RFC 2086)
    • IMAP quotas (RFC 2087)
    • IMAP UIDPLUS extension (RFC 2359)

    inetlib-1.1.2/source/gnu/inet/nntp/0000775000076400007640000000000011347412570014167 500000000000000inetlib-1.1.2/source/gnu/inet/nntp/NNTPException.java0000664000076400007640000000472211345235566017423 00000000000000/* * $Id: NNTPException.java,v 1.6 2005/08/25 12:32:03 dog Exp $ * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.IOException; /** * An NNTP exception. * * @author Chris Burdess * @version $Revision: 1.6 $ $Date: 2005/08/25 12:32:03 $ */ public class NNTPException extends IOException { /* * The response that caused this exception. */ protected final StatusResponse response; /** * Constructor. */ protected NNTPException (StatusResponse response) { super (response.getMessage ()); this.response = response; } /** * Returns the response that caused this exception. */ public StatusResponse getResponse () { return response; } } inetlib-1.1.2/source/gnu/inet/nntp/ArticleResponse.java0000664000076400007640000000541611345235566020070 00000000000000/* * ArticleResponse.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.InputStream; /** * An NNTP article status response. * This represents the status response associated with NNTP status codes * 220-223, including an article number and a message-id. * * @author Chris Burdess */ public class ArticleResponse extends StatusResponse { /* * The article number. */ public int articleNumber; /* * The message-id. */ public String messageId; /** * If the status code for this response is one of: *
      *
    • ARTICLE_FOLLOWS *
    • HEAD_FOLLOWS *
    • BODY_FOLLOWS *
    * then this stream can be used to retrieve the byte content of the article * retrieved. Otherwise, it will be null. If it is non-null, the stream * must be read in its entirety before further methods can be invoked on * the NNTPConnection. */ public InputStream in; protected ArticleResponse(short status, String message) { super(status, message); } } inetlib-1.1.2/source/gnu/inet/nntp/Pair.java0000664000076400007640000000433111345235566015654 00000000000000/* * Pair.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; /** * A pair of strings associated with one another. * * @author Chris Burdess */ public final class Pair { String key; String value; Pair(String key, String value) { this.key = key; this.value = value; } /** * The key. */ public String getKey() { return key; } /** * The value. */ public String getValue() { return value; } } inetlib-1.1.2/source/gnu/inet/nntp/GroupResponse.java0000664000076400007640000000465311345235566017603 00000000000000/* * GroupResponse.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; /** * An NNTP group status response. * This represents the status response with NNTP code 211, for newsgroup * selection. * * @author Chris Burdess */ public class GroupResponse extends StatusResponse { /* * The estimated number of articles in the group. */ public int count; /* * The first article number in the group. */ public int first; /* * The last article number in the group. */ public int last; /* * The newsgroup name. */ public String group; GroupResponse(short status, String message) { super(status, message); } } inetlib-1.1.2/source/gnu/inet/nntp/OverviewIterator.java0000664000076400007640000000705711345235566020311 00000000000000/* * OverviewIterator.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.IOException; import java.net.ProtocolException; import java.util.NoSuchElementException; /** * An iterator over an overview listing. * * @author Chris Burdess */ public class OverviewIterator extends LineIterator { OverviewIterator(NNTPConnection connection) { super(connection); } /** * Returns the next overview entry. */ public Object next() { try { return nextOverview(); } catch (IOException e) { throw new NoSuchElementException("I/O error: " + e.getMessage()); } } /** * Returns the next overview entry. */ public Overview nextOverview() throws IOException { String line = nextLine(); try { // Parse line int start = 0, end; end = line.indexOf('\t', start); int articleNumber = Integer.parseInt(line.substring(start, end)); start = end + 1; Overview overview = new Overview(articleNumber); end = line.indexOf('\t', start); while(end > -1) { String entry = line.substring(start, end); overview.add(entry); start = end + 1; end = line.indexOf('\t', start); } String entry = line.substring(start); overview.add(entry); return overview; } catch (StringIndexOutOfBoundsException e) { ProtocolException e2 = new ProtocolException("Invalid overview line: " + line); e2.initCause(e); throw e2; } catch (NumberFormatException e) { ProtocolException e2 = new ProtocolException("Invalid overview line: " + line); e2.initCause(e); throw e2; } } } inetlib-1.1.2/source/gnu/inet/nntp/ActiveTimesIterator.java0000664000076400007640000000665511345235566020723 00000000000000/* * ActiveTimesIterator.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.IOException; import java.net.ProtocolException; import java.text.ParseException; import java.util.Date; import java.util.NoSuchElementException; /** * An iterator over an NNTP LIST ACTIVE.TIMES listing. * * @author Chris Burdess */ public class ActiveTimesIterator extends LineIterator { ActiveTimesIterator(NNTPConnection connection) { super(connection); } /** * Returns the next group active time. */ public Object next() { try { return nextGroup(); } catch (IOException e) { throw new NoSuchElementException("I/O error: " + e.getMessage()); } } /** * Returns the next group active time. */ public ActiveTime nextGroup() throws IOException { String line = nextLine(); // Parse line try { int start = 0, end; end = line.indexOf(' ', start); String group = line.substring(start, end); start = end + 1; end = line.indexOf(' ', start); Date time = connection.parseDate(line.substring(start, end)); start = end + 1; String email = line.substring(start); return new ActiveTime(group, time, email); } catch (ParseException e) { ProtocolException e2 = new ProtocolException("Invalid active time line: " + line); e2.initCause(e); throw e2; } catch (StringIndexOutOfBoundsException e) { ProtocolException e2 = new ProtocolException("Invalid active time line: " + line); e2.initCause(e); throw e2; } } } inetlib-1.1.2/source/gnu/inet/nntp/ArticleNumberIterator.java0000664000076400007640000000553611345235566021237 00000000000000/* * ArticleNumberIterator.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.IOException; import java.net.ProtocolException; import java.util.NoSuchElementException; /** * An iterator over a listing of article numbers. * * @author Chris Burdess */ public class ArticleNumberIterator extends LineIterator { ArticleNumberIterator(NNTPConnection connection) { super(connection); } /** * Returns the next article number. */ public Object next() { try { return new Integer(nextArticleNumber()); } catch (IOException e) { throw new NoSuchElementException("I/O error: " + e.getMessage()); } } /** * Returns the next article number. */ public int nextArticleNumber() throws IOException { String line = nextLine(); try { return Integer.parseInt(line.trim()); } catch (NumberFormatException e) { ProtocolException e2 = new ProtocolException("Invalid article number: " + line); e2.initCause(e); throw e2; } } } inetlib-1.1.2/source/gnu/inet/nntp/StatusResponse.java0000664000076400007640000000506111345235566017764 00000000000000/* * StatusResponse.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; /** * An NNTP status response. * This represents the status code/message pair sent by the server in * response to client commands. * * @author Chris Burdess */ public class StatusResponse { /* * The status code. */ protected short status; /* * The message. */ protected String message; /** * Constructor. */ protected StatusResponse(short status, String message) { this.status = status; this.message = message; } /** * Returns the status code associated with this response. */ public short getStatus() { return status; } /** * Returns the message associated with this response. */ public String getMessage() { return message; } } inetlib-1.1.2/source/gnu/inet/nntp/NNTPConnection.java0000664000076400007640000012373411345235566017571 00000000000000/* * NNTPConnection.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import gnu.inet.util.CRLFInputStream; import gnu.inet.util.CRLFOutputStream; import gnu.inet.util.EmptyX509TrustManager; import gnu.inet.util.LineInputStream; import gnu.inet.util.SaslCallbackHandler; import gnu.inet.util.SaslInputStream; import gnu.inet.util.SaslOutputStream; import gnu.inet.util.TraceLevel; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.ProtocolException; import java.net.Socket; import java.security.GeneralSecurityException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.TimeZone; import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.security.auth.callback.CallbackHandler; import javax.security.sasl.Sasl; import javax.security.sasl.SaslClient; /** * An NNTP client. * This object is used to establish and manage a connection to an NNTP * server. * * @author Chris Burdess * @author Jan Michalica */ public class NNTPConnection implements NNTPConstants { /** * The network trace level. */ public static final Level NNTP_TRACE = new TraceLevel("nntp"); /** * The default NNTP port. */ public static final int DEFAULT_PORT = 119; /** * The default NNTPS port */ public static final int DEFAULT_SSL_PORT = 563; /** * The logger used for NNTP protocol traces. */ public final Logger logger = Logger.getLogger("gnu.inet.nntp"); /** * The hostname of the host we are connected to. */ protected String hostname; /** * The port on the host we are connected to. */ protected int port; /** * The socket used for network communication. */ protected Socket socket; /** * The socket input stream. */ protected LineInputStream in; /** * The socket output stream. */ protected CRLFOutputStream out; /** * Whether the host permits posting of articles. */ protected boolean canPost; /** * The greeting issued by the host when we connected. */ protected String welcome; /** * Pending data, if any. */ protected PendingData pendingData; private static final String DOT = "."; private static final String US_ASCII = "US-ASCII"; /** * Creates a new connection object. * @param hostname the hostname or IP address of the news server */ public NNTPConnection(String hostname) throws IOException { this(hostname, -1, 0, 0, false, null, true); } /** * Creates a new connection object. * @param hostname the hostname or IP address of the news server * @param port the port to connect to */ public NNTPConnection(String hostname, int port) throws IOException { this(hostname, port, 0, 0, false, null, true); } /** * Creates a new secure connection using the specified trust manager. * @param host the name of the host to connect to * @param port the port to connect to, or -1 for the default * @param tm a trust manager used to check SSL certificates, or null to * use the default */ public NNTPConnection(String host, int port, TrustManager tm) throws IOException { this(host, port, 0, 0, true, tm, true); } /** * Creates a new connection object. * @param hostname the hostname or IP address of the news server * @param port the port to connect to * @param connectionTimeout the socket connection timeout * @param timeout the read timeout on the socket */ public NNTPConnection(String hostname, int port, int connectionTimeout, int timeout) throws IOException { this(hostname, port, connectionTimeout, timeout, false, null, true); } /** * Creates a new connection object. * @param hostname the hostname or IP address of the news server * @param port the port to connect to * @param connectionTimeout the socket connection timeout * @param timeout the read timeout on the socket * @param init initialise the connection */ public NNTPConnection(String hostname, int port, int connectionTimeout, int timeout, boolean secure, TrustManager tm, boolean init) throws IOException { if (port < 0) { port = secure ? DEFAULT_SSL_PORT : DEFAULT_PORT; } this.hostname = hostname; this.port = port; // Set up the socket and streams try { socket = new Socket(); InetSocketAddress address = new InetSocketAddress(hostname, port); if (connectionTimeout > 0) { socket.connect(address, connectionTimeout); } else { socket.connect(address); } if (timeout > 0) { socket.setSoTimeout(timeout); } if (secure) { SSLSocketFactory factory = getSSLSocketFactory(tm); SSLSocket ss = (SSLSocket) factory.createSocket(socket, hostname, port, true); String[] protocols = { "TLSv1", "SSLv3" }; ss.setEnabledProtocols(protocols); ss.setUseClientMode(true); ss.startHandshake(); socket = ss; } } catch (GeneralSecurityException e) { throw (IOException) new IOException().initCause(e); } InputStream is = socket.getInputStream(); is = new CRLFInputStream(is); in = new LineInputStream(is); OutputStream os = socket.getOutputStream(); os = new BufferedOutputStream(os); out = new CRLFOutputStream(os); if (init) init(); } /** * Returns a configured SSLSocketFactory to use in creating new SSL * sockets. * @param tm an optional trust manager to use */ protected SSLSocketFactory getSSLSocketFactory(TrustManager tm) throws GeneralSecurityException { if (tm == null) { tm = new EmptyX509TrustManager(); } SSLContext context = SSLContext.getInstance("TLS"); TrustManager[] trust = new TrustManager[] { tm }; context.init(null, trust, null); return context.getSocketFactory(); } /** * Initialises the connection. * Unless the init parameter was provided with the value false, * do not call this method. Otherwise call it only once after e.g. * configuring logging. */ public void init() throws IOException { // Read the welcome message(RFC977:2.4.3) StatusResponse response = parseResponse(read()); switch (response.status) { case POSTING_ALLOWED: canPost = true; case NO_POSTING_ALLOWED: welcome = response.getMessage(); break; default: throw new NNTPException(response); } } /** * Negotiate TLS over the current connection. * This depends on many features, such as the JSSE classes being in the * classpath. Returns true if successful, false otherwise. */ public boolean starttls() throws IOException { return starttls(new EmptyX509TrustManager()); } /** * This command performs a TLS negotiation. * See RFC 4642 for details. * @param tm the custom trust manager to use * @return true if successful, false otherwise */ public boolean starttls(TrustManager tm) throws IOException { try { SSLSocketFactory factory = getSSLSocketFactory(tm); send(STARTTLS); StatusResponse response = parseResponse(read()); switch (response.status) { case TLS_INIT_ERROR: case PERMISSION_DENIED: // e.g. TLS is already active case COMMAND_NOT_RECOGNIZED: // i.e. server does not implement/allow STARTTLS /* * Although RFC 4642 forbids it, * INN returns this when STARTTLS has already succeeded. */ case ENCRYPTION_OR_AUTH_REQUIRED: return false; case CONTINUE_TLS_NEGOTIATION: break; default: throw new NNTPException(response); } SSLSocket ss = (SSLSocket) factory.createSocket(socket, hostname, port, true); String[] protocols = { "TLSv1", "SSLv3" }; ss.setEnabledProtocols(protocols); ss.setUseClientMode(true); ss.startHandshake(); // Set up streams InputStream in = socket.getInputStream(); in = new CRLFInputStream(in); this.in = new LineInputStream(in); OutputStream out = socket.getOutputStream(); out = new BufferedOutputStream(out); this.out = new CRLFOutputStream(out); return true; } catch (GeneralSecurityException e) { e.printStackTrace(); return false; } } /** * Return the welcome message sent by the server in reply to the initial * connection. * This message sometimes contains disclaimers or help information that * may be relevant to the user. */ public String getWelcome() { return welcome; } /* * Returns an NNTP-format date string. * This is only required when clients use the NEWGROUPS or NEWNEWS * methods, therefore rarely: we don't cache any of the variables here. */ String formatDate(Date date) { DateFormat df = new SimpleDateFormat("yyMMdd HHmmss 'GMT'"); Calendar cal = new GregorianCalendar(); TimeZone gmt = TimeZone.getTimeZone("GMT"); cal.setTimeZone(gmt); df.setCalendar(cal); cal.setTime(date); return df.format(date); } /* * Parse the specfied NNTP date text. */ Date parseDate(String text) throws ParseException { DateFormat df = new SimpleDateFormat("yyMMdd HHmmss 'GMT'"); return df.parse(text); } // RFC977:3.1 The ARTICLE, BODY, HEAD, and STAT commands /** * Send an article retrieval request to the server. * @param articleNumber the article number of the article to retrieve * @return an article response consisting of the article number and * message-id, and an iterator over the lines of the article header and * body, separated by an empty line */ public ArticleResponse article(int articleNumber) throws IOException { return articleImpl(ARTICLE, Integer.toString(articleNumber)); } /** * Send an article retrieval request to the server. * @param messageId the message-id of the article to retrieve * @return an article response consisting of the article number and * message-id, and an iterator over the lines of the article header and * body, separated by an empty line */ public ArticleResponse article(String messageId) throws IOException { return articleImpl(ARTICLE, messageId); } /** * Send an article head retrieval request to the server. * @param articleNumber the article number of the article to head * @return an article response consisting of the article number and * message-id, and an iterator over the lines of the article header */ public ArticleResponse head(int articleNumber) throws IOException { return articleImpl(HEAD, Integer.toString(articleNumber)); } /** * Send an article head retrieval request to the server. * @param messageId the message-id of the article to head * @return an article response consisting of the article number and * message-id, and an iterator over the lines of the article header */ public ArticleResponse head(String messageId) throws IOException { return articleImpl(HEAD, messageId); } /** * Send an article body retrieval request to the server. * @param articleNumber the article number of the article to body * @return an article response consisting of the article number and * message-id, and an iterator over the lines of the article body */ public ArticleResponse body(int articleNumber) throws IOException { return articleImpl(BODY, Integer.toString(articleNumber)); } /** * Send an article body retrieval request to the server. * @param messageId the message-id of the article to body * @return an article response consisting of the article number and * message-id, and an iterator over the lines of the article body */ public ArticleResponse body(String messageId) throws IOException { return articleImpl(BODY, messageId); } /** * Send an article status request to the server. * @param articleNumber the article number of the article to stat * @return an article response consisting of the article number and * message-id */ public ArticleResponse stat(int articleNumber) throws IOException { return articleImpl(STAT, Integer.toString(articleNumber)); } /** * Send an article status request to the server. * @param messageId the message-id of the article to stat * @return an article response consisting of the article number and * message-id */ public ArticleResponse stat(String messageId) throws IOException { return articleImpl(STAT, messageId); } /** * Performs an ARTICLE, BODY, HEAD, or STAT command. * @param command one of the above commands * @param messageId the article-number or message-id in string form */ protected ArticleResponse articleImpl(String command, String messageId) throws IOException { if (messageId != null) { StringBuffer line = new StringBuffer(command); line.append(' '); line.append(messageId); send(line.toString()); } else { send(command); } StatusResponse response = parseResponse(read()); switch (response.status) { case ARTICLE_FOLLOWS: case HEAD_FOLLOWS: case BODY_FOLLOWS: ArticleResponse aresponse = (ArticleResponse) response; ArticleStream astream = new ArticleStream(in); pendingData = astream; aresponse.in = astream; return aresponse; case ARTICLE_RETRIEVED: return (ArticleResponse) response; default: // NO_GROUP_SELECTED // NO_ARTICLE_SELECTED // NO_SUCH_ARTICLE_NUMBER // NO_SUCH_ARTICLE // NO_PREVIOUS_ARTICLE // NO_NEXT_ARTICLE throw new NNTPException(response); } } // RFC977:3.2 The GROUP command /** * Send a group selection command to the server. * Returns a group status response. * @param name the name of the group to select */ public GroupResponse group(String name) throws IOException { send(GROUP + ' ' + name); StatusResponse response = parseResponse(read()); switch (response.status) { case GROUP_SELECTED: return (GroupResponse) response; default: // NO_SUCH_GROUP throw new NNTPException(response); } } // RFC977:3.3 The HELP command /** * Requests a help listing. * @return an iterator over a collection of help lines. */ public LineIterator help() throws IOException { send(HELP); StatusResponse response = parseResponse(read()); switch (response.status) { case HELP_TEXT: LineIterator li = new LineIterator(this); pendingData = li; return li; default: throw new NNTPException(response); } } // RFC977:3.4 The IHAVE command /** * Sends an ihave command indicating that the client has an article with * the specified message-id. * @param messageId the article message-id * @return a PostStream if the server wants the specified article, null * otherwise */ public PostStream ihave(String messageId) throws IOException { send(IHAVE + ' ' + messageId); StatusResponse response = parseResponse(read()); switch (response.status) { case SEND_TRANSFER_ARTICLE: return new PostStream(this, false); case ARTICLE_NOT_WANTED: return null; default: throw new NNTPException(response); } } // RFC(77:3.5 The LAST command /** * Sends a previous article positioning command to the server. * @return the article number/message-id pair associated with the new * article */ public ArticleResponse last() throws IOException { return articleImpl(LAST, null); } // RFC977:3.6 The LIST command /** * Send a group listing command to the server. * Returns a GroupIterator. This must be read fully before other commands * are issued. */ public GroupIterator list() throws IOException { return listImpl(LIST); } GroupIterator listImpl(String command) throws IOException { send(command); StatusResponse response = parseResponse(read()); switch (response.status) { case LIST_FOLLOWS: GroupIterator gi = new GroupIterator(this); pendingData = gi; return gi; default: throw new NNTPException(response); } } // RFC977:3.7 The NEWGROUPS command /** * Returns an iterator over the list of new groups on the server since the * specified date. * NB this method suffers from a minor millenium bug. * * @param since the date from which to list new groups * @param distributions if non-null, an array of distributions to match */ public LineIterator newGroups(Date since, String[]distributions) throws IOException { StringBuffer buffer = new StringBuffer(NEWGROUPS); buffer.append(' '); buffer.append(formatDate(since)); if (distributions != null) { buffer.append(' '); for (int i = 0; i < distributions.length; i++) { if (i > 0) { buffer.append(','); } buffer.append(distributions[i]); } } send(buffer.toString()); StatusResponse response = parseResponse(read()); switch (response.status) { case NEWGROUPS_LIST_FOLLOWS: LineIterator li = new LineIterator(this); pendingData = li; return li; default: throw new NNTPException(response); } } // RFC977:3.8 The NEWNEWS command /** * Returns an iterator over the list of message-ids posted or received to * the specified newsgroup(s) since the specified date. * NB this method suffers from a minor millenium bug. * * @param newsgroup the newsgroup wildmat * @param since the date from which to list new articles * @param distributions if non-null, a list of distributions to match */ public LineIterator newNews(String newsgroup, Date since, String[] distributions) throws IOException { StringBuffer buffer = new StringBuffer(NEWNEWS); buffer.append(' '); buffer.append(newsgroup); buffer.append(' '); buffer.append(formatDate(since)); if (distributions != null) { buffer.append(' '); for (int i = 0; i < distributions.length; i++) { if (i > 0) { buffer.append(','); } buffer.append(distributions[i]); } } send(buffer.toString()); StatusResponse response = parseResponse(read()); switch (response.status) { case NEWNEWS_LIST_FOLLOWS: LineIterator li = new LineIterator(this); pendingData = li; return li; default: throw new NNTPException(response); } } // RFC977:3.9 The NEXT command /** * Sends a next article positioning command to the server. * @return the article number/message-id pair associated with the new * article */ public ArticleResponse next() throws IOException { return articleImpl(NEXT, null); } // RFC977:3.10 The POST command /** * Post an article. This is a two-stage process. * If successful, returns an output stream to write the article to. * Clients should call write() on the stream for all the * bytes of the article, and finally call close() * on the stream. * No other method should be called in between. * @see #postComplete */ public OutputStream post() throws IOException { send(POST); StatusResponse response = parseResponse(read()); switch (response.status) { case SEND_ARTICLE: return new PostStream(this, false); default: // POSTING_NOT_ALLOWED throw new NNTPException(response); } } /** * Indicates that the client has finished writing all the bytes of the * article. * Called by the PostStream during close(). * @see #post */ void postComplete() throws IOException { send(DOT); StatusResponse response = parseResponse(read()); switch (response.status) { case ARTICLE_POSTED: case ARTICLE_TRANSFERRED: return; default: // POSTING_FAILED // TRANSFER_FAILED // ARTICLE_REJECTED throw new NNTPException(response); } } // RFC977:3.11 The QUIT command /** * Close the connection. * After calling this method, no further calls on this object are valid. */ public void quit() throws IOException { send(QUIT); StatusResponse response = parseResponse(read()); switch (response.status) { case CLOSING_CONNECTION: socket.close(); return; default: throw new NNTPException(response); } } // RFC977:3.12 The SLAVE command /** * Indicates to the server that this is a slave connection. */ public void slave() throws IOException { send(SLAVE); StatusResponse response = parseResponse(read()); switch (response.status) { case SLAVE_ACKNOWLEDGED: break; default: throw new NNTPException(response); } } // RFC2980:1.1 The CHECK command public boolean check(String messageId) throws IOException { StringBuffer buffer = new StringBuffer(CHECK); buffer.append(' '); buffer.append(messageId); send(buffer.toString()); StatusResponse response = parseResponse(read()); switch (response.status) { case SEND_ARTICLE_VIA_TAKETHIS: return true; case ARTICLE_NOT_WANTED_VIA_TAKETHIS: return false; default: // SERVICE_DISCONTINUED // TRY_AGAIN_LATER // TRANSFER_PERMISSION_DENIED // COMMAND_NOT_RECOGNIZED throw new NNTPException(response); } } // RFC2980:1.2 The MODE STREAM command /** * Attempt to initialise the connection in streaming mode. * This is generally used to bypass the lock step nature of NNTP in order * to perform a series of CHECK and TAKETHIS commands. * * @return true if the server supports streaming mode */ public boolean modeStream() throws IOException { send(MODE_STREAM); StatusResponse response = parseResponse(read()); switch (response.status) { case STREAMING_OK: return true; default: // COMMAND_NOT_RECOGNIZED return false; } } // RFC2980:1.3 The TAKETHIS command /** * Implements the out-of-order takethis command. * The client uses the returned output stream to write all the bytes of the * article. When complete, it calls close() on the * stream. * @see #takethisComplete */ public OutputStream takethis(String messageId) throws IOException { send(TAKETHIS + ' ' + messageId); return new PostStream(this, true); } /** * Completes a takethis transaction. * Called by PostStream.close(). * @see #takethis */ void takethisComplete() throws IOException { send(DOT); StatusResponse response = parseResponse(read()); switch (response.status) { case ARTICLE_TRANSFERRED_OK: return; default: // SERVICE_DISCONTINUED // ARTICLE_TRANSFER_FAILED // TRANSFER_PERMISSION_DENIED // COMMAND_NOT_RECOGNIZED throw new NNTPException(response); } } // RFC2980:1.4 The XREPLIC command // TODO // RFC2980:2.1.2 The LIST ACTIVE command /** * Returns an iterator over the groups specified according to the wildmat * pattern. The iterator must be read fully before other commands are * issued. * @param wildmat the wildmat pattern. If null, returns all groups. If no * groups are matched, returns an empty iterator. */ public GroupIterator listActive(String wildmat) throws IOException { StringBuffer buffer = new StringBuffer(LIST_ACTIVE); if (wildmat != null) { buffer.append(' '); buffer.append(wildmat); } return listImpl(buffer.toString()); } // RFC2980:2.1.3 The LIST ACTIVE.TIMES command /** * Returns an iterator over the active.times file. * Each ActiveTime object returned provides details of who created the * newsgroup and when. */ public ActiveTimesIterator listActiveTimes() throws IOException { send(LIST_ACTIVE_TIMES); StatusResponse response = parseResponse(read()); switch (response.status) { case LIST_FOLLOWS: return new ActiveTimesIterator(this); default: throw new NNTPException(response); } } // RFC2980:2.1.4 The LIST DISTRIBUTIONS command // TODO // RFC2980:2.1.5 The LIST DISTRIB.PATS command // TODO // RFC2980:2.1.6 The LIST NEWSGROUPS command /** * Returns an iterator over the group descriptions for the given groups. * @param wildmat if non-null, limits the groups in the iterator to the * specified pattern * @return an iterator over group name/description pairs * @see #xgtitle */ public PairIterator listNewsgroups(String wildmat) throws IOException { StringBuffer buffer = new StringBuffer(LIST_NEWSGROUPS); if (wildmat != null) { buffer.append(' '); buffer.append(wildmat); } send(buffer.toString()); StatusResponse response = parseResponse(read()); switch (response.status) { case LIST_FOLLOWS: PairIterator pi = new PairIterator(this); pendingData = pi; return pi; default: throw new NNTPException(response); } } // RFC2980:2.1.7 The LIST OVERVIEW.FMT command /** * Returns an iterator over the order in which headers are stored in the * overview database. * Each line returned by the iterator contains one header field. * @see #xover */ public LineIterator listOverviewFmt() throws IOException { send(LIST_OVERVIEW_FMT); StatusResponse response = parseResponse(read()); switch (response.status) { case LIST_FOLLOWS: LineIterator li = new LineIterator(this); pendingData = li; return li; default: throw new NNTPException(response); } } // RFC2980:2.1.8 The LIST SUBSCRIPTIONS command /** * Returns a list of newsgroups suitable for new users of the server. */ public GroupIterator listSubscriptions() throws IOException { return listImpl(LIST_SUBSCRIPTIONS); } // RFC2980:2.2 The LISTGROUP command /** * Returns a listing of all the article numbers in the specified * newsgroup. If the group parameter is null, the currently * selected group is assumed. * @param group the name of the group to list articles for */ public ArticleNumberIterator listGroup(String group) throws IOException { StringBuffer buffer = new StringBuffer(LISTGROUP); if (group != null) { buffer.append(' '); buffer.append(group); } send(buffer.toString()); StatusResponse response = parseResponse(read(), true); switch (response.status) { case GROUP_SELECTED: ArticleNumberIterator ani = new ArticleNumberIterator(this); pendingData = ani; return ani; default: throw new NNTPException(response); } } // RFC2980:2.3 The MODE READER command /** * Indicates to the server that this is a user-agent. * @return true if posting is allowed, false otherwise. */ public boolean modeReader() throws IOException { send(MODE_READER); StatusResponse response = parseResponse(read()); switch (response.status) { case POSTING_ALLOWED: canPost = true; return canPost; case POSTING_NOT_ALLOWED: canPost = false; return canPost; default: throw new NNTPException(response); } } // RFC2980:2.4 The XGTITLE command /** * Returns an iterator over the list of newsgroup descriptions. * @param wildmat if non-null, the newsgroups to match */ public PairIterator xgtitle(String wildmat) throws IOException { StringBuffer buffer = new StringBuffer(XGTITLE); if (wildmat != null) { buffer.append(' '); buffer.append(wildmat); } send(buffer.toString()); StatusResponse response = parseResponse(read()); switch (response.status) { case XGTITLE_LIST_FOLLOWS: PairIterator pi = new PairIterator(this); pendingData = pi; return pi; default: throw new NNTPException(response); } } // RFC2980:2.6 The XHDR command public HeaderIterator xhdr(String header, String range) throws IOException { StringBuffer buffer = new StringBuffer(XHDR); buffer.append(' '); buffer.append(header); if (range != null) { buffer.append(' '); buffer.append(range); } send(buffer.toString()); StatusResponse response = parseResponse(read()); switch (response.status) { case HEAD_FOLLOWS: HeaderIterator hi = new HeaderIterator(this); pendingData = hi; return hi; default: // NO_GROUP_SELECTED // NO_SUCH_ARTICLE throw new NNTPException(response); } } // RFC2980:2.7 The XINDEX command // TODO // RFC2980:2.8 The XOVER command public OverviewIterator xover(Range range) throws IOException { StringBuffer buffer = new StringBuffer(XOVER); if (range != null) { buffer.append(' '); buffer.append(range.toString()); } send(buffer.toString()); StatusResponse response = parseResponse(read()); switch (response.status) { case OVERVIEW_FOLLOWS: OverviewIterator oi = new OverviewIterator(this); pendingData = oi; return oi; default: // NO_GROUP_SELECTED // PERMISSION_DENIED throw new NNTPException(response); } } // RFC2980:2.9 The XPAT command // TODO // RFC2980:2.10 The XPATH command // TODO // RFC2980:2.11 The XROVER command // TODO // RFC2980:2.12 The XTHREAD command // TODO // RFC2980:3.1.1 Original AUTHINFO /** * Basic authentication strategy. * @param username the user to authenticate * @param password the(cleartext) password * @return true on success, false on failure */ public boolean authinfo(String username, String password) throws IOException { StringBuffer buffer = new StringBuffer(AUTHINFO_USER); buffer.append(' '); buffer.append(username); send(buffer.toString()); StatusResponse response = parseResponse(read()); switch (response.status) { case AUTHINFO_OK: return true; case SEND_AUTHINFOPASS: buffer.setLength(0); buffer.append(AUTHINFO_PASS); buffer.append(' '); buffer.append(password); send(buffer.toString()); response = parseResponse(read()); switch (response.status) { case AUTHINFO_OK: return true; case PERMISSION_DENIED: return false; default: throw new NNTPException(response); } default: // AUTHINFO_REJECTED throw new NNTPException(response); } } // RFC2980:3.1.2 AUTHINFO SIMPLE /** * Implementation of NNTP simple authentication. * Note that use of this authentication strategy is highly deprecated, * only use on servers that won't accept any other form of authentication. */ public boolean authinfoSimple(String username, String password) throws IOException { send(AUTHINFO_SIMPLE); StatusResponse response = parseResponse(read()); switch (response.status) { case SEND_AUTHINFO_SIMPLE: StringBuffer buffer = new StringBuffer(username); buffer.append(' '); buffer.append(password); send(buffer.toString()); response = parseResponse(read()); switch (response.status) { case AUTHINFO_SIMPLE_OK: return true; case AUTHINFO_SIMPLE_DENIED: return false; default:throw new NNTPException(response); } default: throw new NNTPException(response); } } // RFC2980:3.1.3 AUTHINFO GENERIC /** * Authenticates the connection using the specified SASL mechanism, * username and password. * @param mechanism a SASL authentication mechanism, e.g. LOGIN, PLAIN, * CRAM-MD5, GSSAPI * @param username the authentication principal * @param password the authentication credentials */ public boolean authinfoGeneric(String mechanism, String username, String password) throws IOException { String[] m = new String[] { mechanism }; CallbackHandler ch = new SaslCallbackHandler(username, password); // Avoid lengthy callback procedure for GNU Crypto HashMap p = new HashMap(); p.put("gnu.crypto.sasl.username", username); p.put("gnu.crypto.sasl.password", password); SaslClient sasl = Sasl.createSaslClient(m, null, "nntp", socket.getInetAddress().getHostName(), p, ch); if (sasl == null) { return false; } StringBuffer cmd = new StringBuffer(AUTHINFO_GENERIC); cmd.append(' '); cmd.append(mechanism); if (sasl.hasInitialResponse()) { cmd.append(' '); byte[] init = sasl.evaluateChallenge(new byte[0]); cmd.append(new String(init, "US-ASCII")); } send(cmd.toString()); StatusResponse response = parseResponse(read()); switch (response.status) { case AUTHINFO_OK: String qop = (String) sasl.getNegotiatedProperty(Sasl.QOP); if ("auth-int".equalsIgnoreCase(qop) || "auth-conf".equalsIgnoreCase(qop)) { InputStream is = socket.getInputStream(); is = new BufferedInputStream(is); is = new SaslInputStream(sasl, is); is = new CRLFInputStream(is); in = new LineInputStream(is); OutputStream os = socket.getOutputStream(); os = new BufferedOutputStream(os); os = new SaslOutputStream(sasl, os); out = new CRLFOutputStream(os); } return true; case PERMISSION_DENIED: return false; case COMMAND_NOT_RECOGNIZED: case SYNTAX_ERROR: case INTERNAL_ERROR: default: throw new NNTPException(response); // FIXME how does the server send continuations? } } // RFC2980:3.2 The DATE command /** * Returns the date on the server. */ public Date date() throws IOException { send(DATE); StatusResponse response = parseResponse(read()); switch (response.status) { case DATE_OK: String message = response.getMessage(); try { DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); return df.parse(message); } catch (ParseException e) { throw new IOException("Invalid date: " + message); } default: throw new NNTPException(response); } } // -- Utility functions -- /** * Parse a response object from a response line sent by the server. */ protected StatusResponse parseResponse(String line) throws ProtocolException { return parseResponse(line, false); } /** * Parse a response object from a response line sent by the server. * @param isListGroup whether we are invoking the LISTGROUP command */ protected StatusResponse parseResponse(String line, boolean isListGroup) throws ProtocolException { if (line == null) { throw new ProtocolException(hostname + " closed connection"); } int start = 0, end; short status = -1; String statusText = line; String message = null; end = line.indexOf(' ', start); if (end > start) { statusText = line.substring(start, end); message = line.substring(end + 1); } try { status = Short.parseShort(statusText); } catch (NumberFormatException e) { throw new ProtocolException(line); } StatusResponse response; switch (status) { case ARTICLE_FOLLOWS: case HEAD_FOLLOWS: case BODY_FOLLOWS: case ARTICLE_RETRIEVED: case GROUP_SELECTED: /* The LISTGROUP command returns a list of articles with a 211, * instead of the newsgroup totals returned with the GROUP command. * Check for this case. */ if (status != GROUP_SELECTED || isListGroup) { try { ArticleResponse aresponse = new ArticleResponse(status, message); // article number start = end + 1; end = line.indexOf(' ', start); if (end > start) { aresponse.articleNumber = Integer.parseInt(line.substring(start, end)); } // message-id start = end + 1; end = line.indexOf(' ', start); if (end > start) { aresponse.messageId = line.substring(start, end); } else { aresponse.messageId = line.substring(start); } response = aresponse; } catch (NumberFormatException e) { // This will happen for XHDR response = new StatusResponse(status, message); } break; } // This is the normal case for GROUP_SELECTED GroupResponse gresponse = new GroupResponse(status, message); try { // count start = end + 1; end = line.indexOf(' ', start); if (end > start) { gresponse.count = Integer.parseInt(line.substring(start, end)); } // first start = end + 1; end = line.indexOf(' ', start); if (end > start) { gresponse.first = Integer.parseInt(line.substring(start, end)); } // last start = end + 1; end = line.indexOf(' ', start); if (end > start) { gresponse.last = Integer.parseInt(line.substring(start, end)); } // group start = end + 1; end = line.indexOf(' ', start); if (end > start) { gresponse.group = line.substring(start, end); } else { gresponse.group = line.substring(start); } } catch (NumberFormatException e) { throw new ProtocolException(line); } response = gresponse; break; default: response = new StatusResponse(status, message); } return response; } /** * Send a single line to the server. * @param line the line to send */ protected void send(String line) throws IOException { if (pendingData != null) { // Clear pending data pendingData.readToEOF(); pendingData = null; } logger.log(NNTP_TRACE, ">" + line); byte[] data = line.getBytes(US_ASCII); out.write(data); out.writeln(); out.flush(); } /** * Read a single line from the server. * @return a line of text */ protected String read() throws IOException { String line = in.readLine(); if (line == null) { logger.log(NNTP_TRACE, "Chris Burdess * @author Jan Michalica */ public interface NNTPConstants { /** * Indicates a line of help text. */ public static final short HELP_TEXT = 100; /** * Indicates a DATE response. */ public static final short DATE_OK = 111; /** * Indicates that the server is ready and posting is allowed. */ public static final short POSTING_ALLOWED = 200; /** * Indicates that the server is ready but posting is not allowed. */ public static final short NO_POSTING_ALLOWED = 201; /** * Indicates that the server has noted the slave status of the connection. */ public static final short SLAVE_ACKNOWLEDGED = 202; /** * Indicates that the server has accepted streaming mode. */ public static final short STREAMING_OK = 203; /** * Indicates that the server is closing the connection. */ public static final short CLOSING_CONNECTION = 205; /** * Indicates that the newsgroup was successfully selected. * Format of the message is "n f l s xxx" * (n = estimated number of articles in group, * f = first article number in the group, * l = last article number in the group, * s = name of the group.) */ public static final short GROUP_SELECTED = 211; /** * Indicates that a list of valid newsgroups follows. * The format of each following line is "g l f p" * (g = newsgroup name, * l = last article number in group, * f = first article number in group, * p = 'y' if posting to the group is allowed, * 'n' otherwise) */ public static final short LIST_FOLLOWS = 215; /** * Indicates that the article has been retrieved. * The head and body of the article follow. */ public static final short ARTICLE_FOLLOWS = 220; /** * Indicates that the article has been retrieved. * The head of the article follows. */ public static final short HEAD_FOLLOWS = 221; /** * Indicates that the article has been retrieved. * The body of the article follows. */ public static final short BODY_FOLLOWS = 222; /** * Indicates that the article has been retrieved. * The text of the article must be requested separately. */ public static final short ARTICLE_RETRIEVED = 223; /** * Indicates that a listing of overview information follows. */ public static final short OVERVIEW_FOLLOWS = 224; /** * Indicates that a list of new articles by message-id follows. */ public static final short NEWNEWS_LIST_FOLLOWS = 230; /** * Indicates that a list of new newsgroups follows. * This code is issued following a successful NEWGROUPS command. The * format of the listing is the same as for code 215 (list follows). */ public static final short NEWGROUPS_LIST_FOLLOWS = 231; /** * Indicates that the article was correctly transferred. */ public static final short ARTICLE_TRANSFERRED = 235; /** * Indicates that the server does not have the specified article and would * like it to be transferred via TAKETHIS. */ public static final short SEND_ARTICLE_VIA_TAKETHIS = 238; /** * Indicates that the server accepted the article transferred by a * TAKETHIS command. */ public static final short ARTICLE_TRANSFERRED_OK = 239; /** * Indicates that the article was successfully posted. */ public static final short ARTICLE_POSTED = 240; /** * Indicates success of an AUTHINFO SIMPLE transaction. */ public static final short AUTHINFO_SIMPLE_OK = 350; /** * Indicates that AUTHINFO authentication was successful. */ public static final short AUTHINFO_OK = 281; /** * Indicates that the article to be transferred should be sent by the * client. It should end with a CRLF-dot-CRLF sequence, i.e. a dot on a * line by itself. */ public static final short SEND_TRANSFER_ARTICLE = 335; /** * Indicates that the article to be posted should be sent by the * client. It should end with a CRLF-dot-CRLF sequence, i.e. a dot on a * line by itself. */ public static final short SEND_ARTICLE = 340; /** * Instructs the client to send a username/password pair according to the * AUTHINFO SIMPLE specification. */ public static final short SEND_AUTHINFO_SIMPLE = 350; /** * Indicates that the server is ready to accept the AUTHINFO password. */ public static final short SEND_AUTHINFOPASS = 381; /** * Indicates that the server is ready to proceed with TLS negotiation. */ public static final short CONTINUE_TLS_NEGOTIATION = 382; /** * Indicates that the service has been discontinued. */ public static final short SERVICE_DISCONTINUED = 400; /** * Indicates that no such newsgroup exists. */ public static final short NO_SUCH_GROUP = 411; /** * Indicates that no newsgroup has been selected. */ public static final short NO_GROUP_SELECTED = 412; /** * Indicates that no article has been selected. */ public static final short NO_ARTICLE_SELECTED = 420; /** * Indicates that there is no next article in this newsgroup. */ public static final short NO_NEXT_ARTICLE = 421; /** * Indicates that there is no previous article in this newsgroup. */ public static final short NO_PREVIOUS_ARTICLE = 422; /** * Indicates that no article with the specified number exists in this * newsgroup. */ public static final short NO_SUCH_ARTICLE_NUMBER = 423; /** * Indicates that the specified article could not be found. */ public static final short NO_SUCH_ARTICLE = 430; /** * Indicates that the server is not currently in a state to accept an * article, but may become so at a later stage. */ public static final short TRY_AGAIN_LATER = 431; /** * Indicates that the server does not want the specified article. * The client should not send the article. */ public static final short ARTICLE_NOT_WANTED = 435; /** * Indicates that transfer of the specified article failed. * The client should try to send the article again later. */ public static final short TRANSFER_FAILED = 436; /** * Indicates that the specified article was rejected. * The client should not attempt to send the article again. */ public static final short ARTICLE_REJECTED = 437; /** * Indicates that the server already has the specified article, and * therefore doesn't want it sent using TAKETHIS. */ public static final short ARTICLE_NOT_WANTED_VIA_TAKETHIS = 438; /** * Indicates that an article transferred by a TAKETHIS command failed. */ public static final short ARTICLE_TRANSFER_FAILED = 439; /** * Indicates that posting is not allowed. */ public static final short POSTING_NOT_ALLOWED = 440; /** * Indicates that posting of the article failed. * The client may attempt to post the article again. */ public static final short POSTING_FAILED = 441; /** * Indicates that authentication via the AUTHINFO SIMPLE strategy is * required. */ public static final short AUTHINFO_SIMPLE_REQUIRED = 450; /** * Indicates an authentication failure using AUTHINFO SIMPLE. */ public static final short AUTHINFO_SIMPLE_DENIED = 452; /** * Indicates that the client does not have the appropriate authorization * to transfer an article. */ public static final short TRANSFER_PERMISSION_DENIED = 480; /** * Indicates that an XGTITLE listing follows. */ public static final short XGTITLE_LIST_FOLLOWS = 481; /** * Indicates the the authentication information supplied was not accepted * by the server. */ public static final short AUTHINFO_REJECTED = 482; /** * Indicates that the server requires encrypted connection or stronger * authentication in order to perform request. */ public static final short ENCRYPTION_OR_AUTH_REQUIRED = 483; /** * Indicates that the command sent by the client was not understood by the * server. */ public static final short COMMAND_NOT_RECOGNIZED = 500; /** * Indicates that the command sent by the client was not a valid NNTP * command. */ public static final short SYNTAX_ERROR = 501; /** * Indicates that access restrictions deny permission to execute the * command sent by the client. */ public static final short PERMISSION_DENIED = 502; /** * Indicates that the server was unable to perform the command due to an * internal error. */ public static final short INTERNAL_ERROR = 503; /** * Indicates that the server is unable to proceed with TLS negotiation. */ public static final short TLS_INIT_ERROR = 580; // -- Client commands -- public static final String ARTICLE = "ARTICLE"; public static final String AUTHINFO_USER = "AUTHINFO USER"; public static final String AUTHINFO_PASS = "AUTHINFO PASS"; public static final String AUTHINFO_SIMPLE = "AUTHINFO SIMPLE"; public static final String AUTHINFO_GENERIC = "AUTHINFO GENERIC"; public static final String BODY = "BODY"; public static final String CHECK = "CHECK"; public static final String DATE = "DATE"; public static final String HEAD = "HEAD"; public static final String STAT = "STAT"; public static final String GROUP = "GROUP"; public static final String HELP = "HELP"; public static final String IHAVE = "IHAVE"; public static final String LAST = "LAST"; public static final String LIST = "LIST"; public static final String LIST_ACTIVE = "LIST ACTIVE"; public static final String LIST_ACTIVE_TIMES = "LIST ACTIVE.TIMES"; public static final String LIST_DISTRIBUTIONS = "LIST DISTRIBUTIONS"; public static final String LIST_DISTRIB_PATS = "LIST DISTRIB.PATS"; public static final String LIST_NEWSGROUPS = "LIST NEWSGROUPS"; public static final String LIST_OVERVIEW_FMT = "LIST OVERVIEW.FMT"; public static final String LIST_SUBSCRIPTIONS = "LIST SUBSCRIPTIONS"; public static final String LISTGROUP = "LISTGROUP"; public static final String MODE_READER = "MODE READER"; public static final String MODE_STREAM = "MODE STREAM"; public static final String NEWGROUPS = "NEWGROUPS"; public static final String NEWNEWS = "NEWNEWS"; public static final String NEXT = "NEXT"; public static final String POST = "POST"; public static final String QUIT = "QUIT"; public static final String SLAVE = "SLAVE"; public static final String STARTTLS = "STARTTLS"; public static final String TAKETHIS = "TAKETHIS"; public static final String XGTITLE = "XGTITLE"; public static final String XHDR = "XHDR"; public static final String XINDEX = "XINDEX"; public static final String XOVER = "XOVER"; public static final String XPAT = "XPAT"; public static final String XPATH = "XPATH"; public static final String XREPLIC = "XREPLIC"; public static final String XROVER = "XROVER"; } inetlib-1.1.2/source/gnu/inet/nntp/Newsrc.java0000664000076400007640000000540711345235566016227 00000000000000/* * Newsrc.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.util.Iterator; /** * Interface for a .newsrc configuration. * * @author Chris Burdess */ public interface Newsrc { /** * Returns an iterator over the names of the subscribed newsgroups. * Each item returned is a String. */ public Iterator list(); /** * Indicates whether a newsgroup is subscribed in this newsrc. */ public boolean isSubscribed(String newsgroup); /** * Sets whether a newsgroup is subscribed in this newsrc. */ public void setSubscribed(String newsgroup, boolean subs); /** * Indicates whether an article is marked as seen in the specified newsgroup. */ public boolean isSeen(String newsgroup, int article); /** * Sets whether an article is marked as seen in the specified newsgroup. */ public void setSeen(String newsgroup, int article, boolean seen); /** * Closes the configuration, potentially saving any changes. */ public void close(); } inetlib-1.1.2/source/gnu/inet/nntp/FileNewsrc.java0000664000076400007640000003502711345235566017030 00000000000000/* * FileNewsrc.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.BufferedReader; import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; /** * A .newsrc configuration on a filesystem. * * @author Chris Burdess */ public class FileNewsrc implements Newsrc { private static final String NEWSRC_ENCODING = "US-ASCII"; protected File file; protected List subs = null; protected List groups = null; protected Map lines = null; protected boolean dirty; protected boolean debug; /** * Constructor. * @param file the disk file * @param debug for debugging information on stderr */ public FileNewsrc(File file, boolean debug) { this.file = file; this.debug = debug; } public void close() { if (!dirty) { return; } save(); } /** * Load the file. */ void load() { long fs = file.length(); long max = (long) Integer.MAX_VALUE; int bs = (int) (fs > max ? max : fs); groups = new LinkedList(); lines = new HashMap(bs / 20); subs = new LinkedList(); // Load try { long t1 = System.currentTimeMillis(); if (debug) { System.err.println("DEBUG: nntp: newsrc loading " + file.getPath()); } FileInputStream fr = new FileInputStream(file); InputStreamReader ir = new InputStreamReader(fr, NEWSRC_ENCODING); BufferedReader reader = new BufferedReader(ir, bs); String line = reader.readLine(); while (line != null) { int cp = line.indexOf(':'); if (cp > -1) { // Subscribed newsgroup String name = line.substring(0, cp); groups.add(name); subs.add(name); cp++; if (cp < line.length()) { String tail = line.substring(cp).trim(); if (tail.length() > 0) { lines.put(name, tail); } } } else { int pp = line.indexOf('!'); if (pp > -1) { // Unsubscribed newsgroup String name = line.substring(0, pp); groups.add(name); pp++; if (pp < line.length()) { String tail = line.substring(pp).trim(); if (tail.length() > 0) { lines.put(name, tail); } } } // else ignore - comments etc will not be saved! } line = reader.readLine(); } reader.close(); long t2 = System.currentTimeMillis(); if (debug) { System.err.println("DEBUG: nntp: newsrc load: " + groups.size() + " groups in " + (t2 - t1) + "ms"); } } catch (FileNotFoundException e) { } catch (IOException e) { System.err.println("WARNING: nntp: unable to read newsrc file"); if (debug) { e.printStackTrace(System.err); } } catch (SecurityException e) { System.err.println("WARNING: nntp: " + "no read permission on newsrc file"); } dirty = false; } /** * Save the file. */ void save() { try { long t1 = System.currentTimeMillis(); if (debug) { System.err.println("DEBUG: nntp: newsrc saving " + file.getPath()); } int bs = (groups.size() * 20); // guess an average line length FileOutputStream fw = new FileOutputStream(file); BufferedOutputStream writer = new BufferedOutputStream(fw, bs); for (Iterator i = groups.iterator(); i.hasNext();) { String group = (String) i.next(); StringBuffer buffer = new StringBuffer(group); if (subs.contains(group)) { buffer.append(':'); } else { buffer.append('!'); } Object r = lines.get(group); if (r instanceof String) { buffer.append((String) r); } else { RangeList ranges = (RangeList) r; if (ranges != null) { buffer.append(ranges.toString()); } } buffer.append('\n'); byte[] bytes = buffer.toString().getBytes(NEWSRC_ENCODING); writer.write(bytes); } writer.flush(); writer.close(); long t2 = System.currentTimeMillis(); if (debug) { System.err.println("DEBUG: nntp: newsrc save: " + groups.size() + " groups in " + (t2 - t1) + "ms"); } } catch (IOException e) { System.err.println("WARNING: nntp: unable to save newsrc file"); if (debug) { e.printStackTrace(System.err); } } dirty = false; } /** * Returns an iterator over the names of the currently subscribed * newsgroups. */ public Iterator list() { if (subs == null) { load(); } return subs.iterator(); } public boolean isSubscribed(String newsgroup) { if (subs == null) { load(); } return (subs.contains(newsgroup)); } public void setSubscribed(String newsgroup, boolean flag) { if (subs == null) { load(); } if (flag && !groups.contains(newsgroup)) { groups.add(newsgroup); } boolean subscribed = subs.contains(newsgroup); if (flag && !subscribed) { subs.add(newsgroup); dirty = true; } else if (!flag && subscribed) { subs.remove(newsgroup); dirty = true; } } public boolean isSeen(String newsgroup, int article) { if (subs == null) { load(); } Object value = lines.get(newsgroup); if (value instanceof String) { value = new RangeList((String) value); } RangeList ranges = (RangeList) value; if (ranges != null) { return ranges.isSeen(article); } return false; } public void setSeen(String newsgroup, int article, boolean flag) { if (subs == null) { load(); } Object value = lines.get(newsgroup); if (value instanceof String) { value = new RangeList((String) value); } RangeList ranges = (RangeList) value; if (ranges == null) { ranges = new RangeList(); lines.put(newsgroup, ranges); dirty = true; } if (ranges.isSeen(article) != flag) { ranges.setSeen(article, flag); dirty = true; } } /** * A RangeList holds a series of ranges that are ordered and * non-overlapping. */ static class RangeList { List seen; RangeList() { seen = new ArrayList(); } RangeList(String line) { this(); try { // Parse the line at comma delimiters. int start = 0; int end = line.indexOf(','); while (end > start) { String token = line.substring(start, end); addToken(token); start = end + 1; end = line.indexOf(',', start); } addToken(line.substring(start)); } catch (NumberFormatException e) { System.err.println("ERROR: nntp: bad newsrc format: " + line); } } /* * Used during initial parse. */ private void addToken(String token) throws NumberFormatException { int hp = token.indexOf('-'); if (hp > -1) { // Range String fs = token.substring(0, hp); String ts = token.substring(hp + 1); int from = Integer.parseInt(fs); int to = Integer.parseInt(ts); if (from > -1 && to > -1) { insert(from, to); } } else { // Single number int number = Integer.parseInt(token); if (number > -1) { insert(number); } } } /** * Indicates whether the specified article is seen. */ public boolean isSeen(int num) { int len = seen.size(); Range[] r = new Range[len]; seen.toArray(r); for (int i = 0; i < len; i++) { if (r[i].contains(num)) { return true; } } return false; } /** * Sets whether the specified article is seen. */ public void setSeen(int num, boolean flag) { if (flag) { insert(num); } else { remove(num); } } /* * Find the index within seen to insert the specified article. * The range object at the returned index may already contain num. */ int indexOf(int num) { int len = seen.size(); Range[] r = new Range[len]; seen.toArray(r); for (int i = 0; i < len; i++) { if (r[i].contains(num)) { return i; } if (r[i].from > num) { return i; } if (r[i].to == num - 1) { return i; } } return len; } void insert(int start, int end) { Range range = new Range(start, end); int i1 = indexOf(range.from); // range is at end if (i1 == seen.size()) { seen.add(range); return; } Range r1 = (Range) seen.get(i1); // range is before r1 if (range.to < r1.from) { seen.add(i1, range); return; } // range is a subset of r1 if (r1.from <= range.from && r1.to >= range.to) { return; } // range is a superset of r1 int i2 = indexOf(range.to); Range r2 = (Range) seen.get(i2); System.err.println("r2 " + r2 + " i2 " + i2); // remove all ranges between for (int i = i2; i >= i1; i--) { seen.remove(i); } // merge int f = (range.from < r1.from) ? range.from : r1.from; int t = (range.to > r2.to) ? range.to : r2.to; range = new Range(f, t); seen.add(i1, range); } void insert(int num) { insert(num, num); } void remove(int num) { int i = indexOf(num); Range r = (Range) seen.get(i); seen.remove(i); // num == r if ((r.from == r.to) &&(r.to == num)) { return; } // split r if (r.to > num) { Range r2 = new Range(num + 1, r.to); seen.add(i, r2); } if (r.from < num) { Range r2 = new Range(r.from, num - 1); seen.add(i, r2); } } public String toString() { StringBuffer buf = new StringBuffer(); int len = seen.size(); for (int i = 0; i < len; i++) { Range range = (Range) seen.get(i); if (i > 0) { buf.append(','); } buf.append(range.toString()); } return buf.toString(); } } /** * A range is either a single integer or a range between two integers. */ static class Range { int from; int to; public Range(int i) { from = to = i; } public Range(int f, int t) { if (f > t) { from = t; to = f; } else { from = f; to = t; } } public boolean contains(int num) { return (num >= from && num <= to); } public String toString() { if (from != to) { return new StringBuffer() .append(from) .append('-') .append(to) .toString(); } else { return Integer.toString(from); } } } } inetlib-1.1.2/source/gnu/inet/nntp/ArticleStream.java0000664000076400007640000001027711345235566017526 00000000000000/* * ArticleStream.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.BufferedInputStream; import java.io.FilterInputStream; import java.io.InputStream; import java.io.IOException; /** * A stream that can be told to read to the end of its data. * * @author Chris Burdess */ public final class ArticleStream extends FilterInputStream implements PendingData { private static final int LF = 0x0a; private static final int DOT = 0x2e; boolean eol; boolean eof; ArticleStream(InputStream in) { super(in.markSupported() ? in : new BufferedInputStream(in)); eol = true; eof = false; } public int read() throws IOException { if (eof) { return -1; } int c = in.read(); // Check for LF if (c == LF) { eol = true; } else if (eol) { if (c == DOT) { in.mark(1); int d = in.read(); if (d == DOT) { // Not resetting here means that 2 dots are collapsed into 1 } else if (d == LF) { // Check for LF eof = true; return -1; } else { in.reset(); } } eol = false; } return c; } public int read(byte[] b) throws IOException { return read(b, 0, b.length); } public int read(byte[] b, int off, int len) throws IOException { if (eof) { return -1; } int l = in.read(b, off, len); if (l > 0) { if (eol) { if (b[off] == DOT && l > 1) { if (b[off + 1] == DOT) { // Truncate b System.arraycopy(b, off + 1, b, off, l - off); l--; } else if (b[off + 1] == LF) { // EOF eof = true; return -1; } } } eol = (b[(off + l) - 1] == LF); } return l; } /** * Read to the end of the article data. */ public void readToEOF() throws IOException { if (available() == 0) { return; } byte[] buf = new byte[4096]; int ret = 0; while (ret != -1) { ret = read(buf); } } } inetlib-1.1.2/source/gnu/inet/nntp/HeaderEntry.java0000664000076400007640000000464211345235566017200 00000000000000/* * HeaderEntry.java * Copyright (C) 2002 The free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; /** * An item in an NNTP newsgroup single-header listing. * * @author Chris Burdess */ public final class HeaderEntry { String articleId; String header; HeaderEntry(String articleId, String header) { this.articleId = articleId; this.header = header; } /** * The article ID. This is either an article number, if a number or range * was used in the XHDR command, or a Message-ID. */ public String getArticleId() { return articleId; } /** * The requested header value. */ public String getHeader() { return header; } } inetlib-1.1.2/source/gnu/inet/nntp/ActiveTime.java0000664000076400007640000000476211345235566017023 00000000000000/* * ActiveTime.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.util.Date; /** * An item in an NNTP newsgroup active time listing. * * @author Chris Burdess */ public final class ActiveTime { String group; Date time; String email; ActiveTime(String group, Date time, String email) { this.group = group; this.time = time; this.email = email; } /** * The name of the newsgroup. */ public String getGroup() { return group; } /** * The date the newsgroup was added to the hierarchy. */ public Date getTime() { return time; } /** * The email address of the creator of the newsgroup. */ public String getEmail() { return email; } } inetlib-1.1.2/source/gnu/inet/nntp/Overview.java0000664000076400007640000000475011345235566016574 00000000000000/* * Overview.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.util.List; import java.util.ArrayList; /** * An overview entry. * * @author Chris Burdess */ public final class Overview { int articleNumber; private List headers; Overview(int articleNumber) { this.articleNumber = articleNumber; headers = new ArrayList(8); } void add(String header) { headers.add(header); } /** * Returns the article number this overview entry is associated with. */ public int getArticleNumber() { return articleNumber; } /** * Returns the header at the specified index. */ public String getHeader(int index) { return (String) headers.get(index); } } inetlib-1.1.2/source/gnu/inet/nntp/PendingData.java0000664000076400007640000000441211345235566017137 00000000000000/* * PendingData.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.IOException; /** * An object representing data outside the simple request/response model of * NNTP. The client needs to read until the end of such data before it * can process further responses. * * @author Chris Burdess */ public interface PendingData { /** * Reads to the end of this data. * @exception IOException if an I/O error occurred */ public void readToEOF() throws IOException; } inetlib-1.1.2/source/gnu/inet/nntp/LineIterator.java0000664000076400007640000000704211345235566017364 00000000000000/* * LineIterator.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.IOException; import java.util.Iterator; import java.util.NoSuchElementException; /** * An iterator over an NNTP multi-line response. * * @author Chris Burdess */ public class LineIterator implements Iterator, PendingData { static final String DOT = "."; boolean doneRead = false; NNTPConnection connection; String current; LineIterator(NNTPConnection connection) { this.connection = connection; } void doRead() throws IOException { if (doneRead) { return; } String line = connection.read(); if (DOT.equals(line)) { current = null; } else { current = line; } doneRead = true; } /** * Indicates whether there are more lines to be read. */ public boolean hasNext() { try { doRead(); } catch (IOException e) { return false; } return(current != null); } /** * Returns the next line. */ public Object next() { try { return nextLine(); } catch (IOException e) { throw new NoSuchElementException("I/O error: " + e.getMessage()); } } /** * Returns the next line. */ public String nextLine() throws IOException { doRead(); if (current == null) { throw new NoSuchElementException(); } doneRead = false; return current; } /** * This iterator is read-only. */ public void remove() { throw new UnsupportedOperationException(); } /** * Read to the end of this iterator. */ public void readToEOF() throws IOException { do { doRead(); } while (current != null); } } inetlib-1.1.2/source/gnu/inet/nntp/GroupIterator.java0000664000076400007640000000657511345235566017603 00000000000000/* * GroupIterator.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.IOException; import java.net.ProtocolException; import java.util.NoSuchElementException; /** * An iterator over an NNTP newsgroup listing. * * @author Chris Burdess */ public class GroupIterator extends LineIterator { static final String CAN_POST = "y"; GroupIterator(NNTPConnection connection) { super(connection); } /** * Returns the next group. */ public Object next() { try { return nextGroup(); } catch (IOException e) { throw new NoSuchElementException("I/O error: " + e.getMessage()); } } /** * Returns the next group. */ public Group nextGroup() throws IOException { String line = nextLine(); // Parse line try { int start = 0, end; end = line.indexOf(' ', start); if (end == -1) return new Group(line, -1, -1, false); String name = line.substring(start, end); start = end + 1; end = line.indexOf(' ', start); int last = Integer.parseInt(line.substring(start, end)); start = end + 1; end = line.indexOf(' ', start); int first = Integer.parseInt(line.substring(start, end)); start = end + 1; boolean canPost = CAN_POST.equals(line.substring(start)); return new Group(name, last, first, canPost); } catch (StringIndexOutOfBoundsException e) { ProtocolException e2 = new ProtocolException("Invalid group line: " + line); e2.initCause(e); throw e2; } } } inetlib-1.1.2/source/gnu/inet/nntp/PairIterator.java0000664000076400007640000000573411345235566017376 00000000000000/* * PairIterator.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.IOException; import java.net.ProtocolException; import java.util.NoSuchElementException; /** * An iterator over a pair listing. * * @author Chris Burdess */ public class PairIterator extends LineIterator { PairIterator(NNTPConnection connection) { super(connection); } /** * Returns the next pair. */ public Object next() { try { return nextPair(); } catch (IOException e) { throw new NoSuchElementException("I/O error: " + e.getMessage()); } } /** * Returns the next pair. */ public Pair nextPair() throws IOException { String line = nextLine(); try { // Parse line int start = 0, end; end = line.indexOf(' ', start); String key = line.substring(start, end); start = end + 1; String value = line.substring(start); return new Pair(key, value); } catch (StringIndexOutOfBoundsException e) { ProtocolException e2 = new ProtocolException("Invalid pair line: " + line); e2.initCause(e); throw e2; } } } inetlib-1.1.2/source/gnu/inet/nntp/PostStream.java0000664000076400007640000000730611345235566017067 00000000000000/* * PostStream.java * Copyright (C) 2002, 2003 The free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.FilterOutputStream; import java.io.OutputStream; import java.io.IOException; /** * A stream to which article contents should be written. * * @author Chris Burdess */ public final class PostStream extends FilterOutputStream { private static final int LF = 0x0a; private static final int DOT = 0x2e; NNTPConnection connection; boolean isTakethis; byte last; PostStream(NNTPConnection connection, boolean isTakethis) { super(connection.out); this.connection = connection; this.isTakethis = isTakethis; } public void write(int c) throws IOException { super.write(c); if (c == DOT && last == LF) { super.write(c); // double up initial dot } last = (byte) c; } public void write(byte[] bytes) throws IOException { write(bytes, 0, bytes.length); } public void write(byte[] bytes, int pos, int len) throws IOException { int end = pos + len; for (int i = pos; i < end; i++) { byte c = bytes[i]; if (c == DOT && last == LF) { // Double dot if (i > pos) { // Write everything up to i int l = i - pos; super.write(bytes, pos, l); pos += l; len -= l; } else { super.write(DOT); } } last = c; } if (len > 0) { super.write(bytes, pos, len); } } /** * Close the stream. * This calls NNTPConnection.postComplete(). */ public void close() throws IOException { if (last != 0x0d) { // Need to add LF write(0x0d); } if (isTakethis) { connection.takethisComplete(); } else { connection.postComplete(); } } } inetlib-1.1.2/source/gnu/inet/nntp/HeaderIterator.java0000664000076400007640000000604611345235566017670 00000000000000/* * HeaderIterator.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; import java.io.IOException; import java.net.ProtocolException; import java.util.NoSuchElementException; /** * An iterator over an NNTP XHDR listing. * * @author Chris Burdess */ public class HeaderIterator extends LineIterator { HeaderIterator(NNTPConnection connection) { super(connection); } /** * Returns the next header entry. */ public Object next() { try { return nextHeaderEntry(); } catch (IOException e) { throw new NoSuchElementException("I/O error: " + e.getMessage()); } } /** * Returns the next header entry. */ public HeaderEntry nextHeaderEntry() throws IOException { String line = nextLine(); try { // Parse line int start = 0, end; end = line.indexOf(' ', start); String articleId = line.substring(start, end); start = end + 1; String header = line.substring(start); return new HeaderEntry(articleId, header); } catch (StringIndexOutOfBoundsException e) { ProtocolException e2 = new ProtocolException("Invalid header line: " + line); e2.initCause(e); throw e2; } } } inetlib-1.1.2/source/gnu/inet/nntp/Range.java0000664000076400007640000000410411345235566016013 00000000000000/* * Range.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; /** * A range of article numbers. * * @author Chris Burdess */ public abstract class Range { /** * Indicates whether this range contains the specfied article number. */ public abstract boolean contains(int articleNumber); } inetlib-1.1.2/source/gnu/inet/nntp/Group.java0000664000076400007640000000517511345235566016064 00000000000000/* * Group.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.nntp; /** * An item in an NNTP newsgroup listing. * * @author Chris Burdess */ public final class Group { String name; int last; int first; boolean canPost; Group(String name, int last, int first, boolean canPost) { this.name = name; this.last = last; this.first = first; this.canPost = canPost; } /** * The name of the newsgroup. */ public String getName() { return name; } /** * The number of the last known article currently in the newsgroup. */ public int getLast() { return last; } /** * The number of the first article currently in the newsgroup. */ public int getFirst() { return first; } /** * True if posting to this newsgroup is allowed. */ public boolean isCanPost() { return canPost; } } inetlib-1.1.2/source/gnu/inet/nntp/package.html0000664000076400007640000000046311345235566016401 00000000000000

    This is an NNTP client, implementing all of RFC 977, and many of the RFC 2980 NNTP extensions. Especially, there is support for the XOVER and XHDR commands and simple authentication.

    There is also a newsrc mechanism for storing newsgroup subscriptions and read articles.

    inetlib-1.1.2/source/gnu/inet/util/0000775000076400007640000000000011345235606014166 500000000000000inetlib-1.1.2/source/gnu/inet/util/LineInputStream.java0000664000076400007640000001354011345235566020044 00000000000000/* * LineInputStream.java * Copyright (C) 2002,2006 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.IOException; /** * An input stream that can read lines of input. * * @author Chris Burdess */ public class LineInputStream extends InputStream { /** * The underlying input stream. */ protected InputStream in; /* * Line buffer. */ private ByteArrayOutputStream buf; /* * Encoding to use when translating bytes to characters. */ private String encoding; /* * End-of-stream flag. */ private boolean eof; /** * Whether we can use block reads. */ private final boolean blockReads; /** * Constructor using the US-ASCII character encoding. * @param in the underlying input stream */ public LineInputStream(InputStream in) { this(in, "US-ASCII"); } /** * Constructor. * @param in the underlying input stream * @param encoding the character encoding to use */ public LineInputStream(InputStream in, String encoding) { this.in = in; buf = new ByteArrayOutputStream(); this.encoding = encoding; eof = false; blockReads = in.markSupported(); } public int read() throws IOException { return in.read(); } public int read(byte[] buf) throws IOException { return in.read(buf); } public int read(byte[] buf, int off, int len) throws IOException { return in.read(buf, off, len); } /** * Read a line of input. */ public String readLine() throws IOException { if (eof) { return null; } do { if (blockReads) { // Use mark and reset to read chunks of bytes final int MIN_LENGTH = 1024; int len, pos; len = in.available(); len = (len < MIN_LENGTH) ? MIN_LENGTH : len; byte[] b = new byte[len]; in.mark(len); // Read into buffer b len = in.read(b, 0, len); // Handle EOF if (len == -1) { eof = true; if (buf.size() == 0) { return null; } else { // We don't care about resetting buf return buf.toString(encoding); } } // Get index of LF in b pos = indexOf(b, len, (byte) 0x0a); if (pos != -1) { // Write pos bytes to buf buf.write(b, 0, pos); // Reset stream, and read pos + 1 bytes in.reset(); pos += 1; while (pos > 0) { len = in.read(b, 0, pos); pos = (len == -1) ? -1 : pos - len; } // Return line String ret = buf.toString(encoding); buf.reset(); return ret; } else { // Append everything to buf and fall through to re-read. buf.write(b, 0, len); } } else { // We must use character reads in order not to read too much // from the underlying stream. int c = in.read(); switch (c) { case -1: eof = true; if (buf.size() == 0) { return null; } // Fall through and return contents of buffer. case 0x0a: // LF String ret = buf.toString(encoding); buf.reset(); return ret; default: buf.write(c); } } } while (true); } private int indexOf(byte[] b, int len, byte c) { for (int pos = 0; pos < len; pos++) { if (b[pos] == c) { return pos; } } return -1; } } inetlib-1.1.2/source/gnu/inet/util/TraceLevel.java0000664000076400007640000000441111345235566017004 00000000000000/* * TraceLevel.java * Copyright (C) 2005 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.util.logging.Level; /** * A logging level used for network trace information. * * @author Chris Burdess */ public class TraceLevel extends Level { /** * The integer value for trace logging. */ public static final int TRACE = 450; /** * Constructor. * @param name the name of this level, normally the network protocol */ public TraceLevel(String name) { super(name, TRACE); } } inetlib-1.1.2/source/gnu/inet/util/SaslCramMD5.java0000664000076400007640000001226411345235566016776 00000000000000/* * SaslCramMD5.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import javax.security.sasl.SaslClient; import javax.security.sasl.SaslException; /** * SASL mechanism for CRAM-MD5. * * @author Chris Burdess */ public class SaslCramMD5 implements SaslClient { private String username; private String password; private boolean complete; public SaslCramMD5(String username, String password) { this.username = username; this.password = password; } public String getMechanismName() { return "CRAM-MD5"; } public boolean hasInitialResponse() { return false; } public byte[] evaluateChallenge(byte[] challenge) throws SaslException { try { byte[] s = password.getBytes("US-ASCII"); byte[] digest = hmac_md5(s, challenge); byte[] r0 = username.getBytes("US-ASCII"); byte[] r1 = new byte[r0.length + digest.length + 1]; System.arraycopy(r0, 0, r1, 0, r0.length); // add username r1[r0.length] = 0x20; // SPACE System.arraycopy(digest, 0, r1, r0.length+1, digest.length); complete = true; return r1; } catch (UnsupportedEncodingException e) { String msg = "Username or password contains non-ASCII characters"; throw new SaslException(msg, e); } catch (NoSuchAlgorithmException e) { String msg = "MD5 algorithm not available"; throw new SaslException(msg, e); } } public boolean isComplete() { return complete; } public byte[] unwrap(byte[] incoming, int off, int len) throws SaslException { byte[] ret = new byte[len - off]; System.arraycopy(incoming, off, ret, 0, len); return ret; } public byte[] wrap(byte[] outgoing, int off, int len) throws SaslException { byte[] ret = new byte[len - off]; System.arraycopy(outgoing, off, ret, 0, len); return ret; } public Object getNegotiatedProperty(String name) { return null; } public void dispose() { } /** * Computes a CRAM digest using the HMAC algorithm: *
       * MD5(key XOR opad, MD5(key XOR ipad, text))
       * 
    . * secret is null-padded to a length of 64 bytes. * If the shared secret is longer than 64 bytes, the MD5 digest of the * shared secret is used as a 16 byte input to the keyed MD5 calculation. * See RFC 2104 for details. */ private static byte[] hmac_md5(byte[] key, byte[] text) throws NoSuchAlgorithmException { byte[] k_ipad = new byte[64]; byte[] k_opad = new byte[64]; byte[] digest; MessageDigest md5 = MessageDigest.getInstance("MD5"); // if key is longer than 64 bytes reset it to key=MD5(key) if (key.length>64) { md5.update(key); key = md5.digest(); } // start out by storing key in pads System.arraycopy(key, 0, k_ipad, 0, key.length); System.arraycopy(key, 0, k_opad, 0, key.length); // XOR key with ipad and opad values for (int i=0; i<64; i++) { k_ipad[i] ^= 0x36; k_opad[i] ^= 0x5c; } // perform inner MD5 md5.reset(); md5.update(k_ipad); md5.update(text); digest = md5.digest(); // perform outer MD5 md5.reset(); md5.update(k_opad); md5.update(digest); digest = md5.digest(); return digest; } } inetlib-1.1.2/source/gnu/inet/util/MessageOutputStream.java0000664000076400007640000000712511345235566020744 00000000000000/* * MessageOutputStream.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; /** * An output stream that escapes any dots on a line by themself with * another dot, for the purposes of sending messages to SMTP and NNTP * servers. * * @author Chris Burdess */ public class MessageOutputStream extends FilterOutputStream { /** * The stream termination octet. */ public static final int END = 46; /** * The line termination octet. */ public static final int LF = 10; int[] last = { LF, LF }; // the last character written to the stream /** * Constructs a message output stream connected to the specified output * stream. * @param out the target output stream */ public MessageOutputStream(OutputStream out) { super(out); } /** * Character write. */ public void write(int c) throws IOException { if (last[0] == LF && last[1] == END && c == LF) { out.write (END); } out.write(c); last[0] = last[1]; last[1] = c; } public void write(byte[] bytes) throws IOException { write(bytes, 0, bytes.length); } /** * Block write. */ public void write(byte[] bytes, int off, int len) throws IOException { for (int i = 0; i < len; i++) { int c = (int) bytes[off + i]; if (last[0] == LF && last[1] == END && c == LF) { byte[] b2 = new byte[bytes.length + 1]; System.arraycopy(bytes, off, b2, off, i); b2[off + i] = END; System.arraycopy(bytes, off + i, b2, off + i + 1, len - i); bytes = b2; i++; len++; } last[0] = last[1]; last[1] = c; } out.write(bytes, off, len); } } inetlib-1.1.2/source/gnu/inet/util/SaslPlain.java0000664000076400007640000000712211345235566016646 00000000000000/* * SaslPlain.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.UnsupportedEncodingException; import javax.security.sasl.SaslClient; import javax.security.sasl.SaslException; /** * SASL mechanism for PLAIN. * * @author Chris Burdess */ public class SaslPlain implements SaslClient { private String username; private String password; private boolean complete; public SaslPlain(String username, String password) { this.username = username; this.password = password; } public String getMechanismName() { return "PLAIN"; } public boolean hasInitialResponse() { return true; } public byte[] evaluateChallenge(byte[] challenge) throws SaslException { try { byte[] a = username.getBytes("UTF-8"); byte[] b = password.getBytes("UTF-8"); byte[] c = new byte[(a.length * 2) + b.length + 2]; System.arraycopy(a, 0, c, 0, a.length); System.arraycopy(a, 0, c, a.length + 1, a.length); System.arraycopy(b, 0, c, (a.length * 2) + 2, b.length); complete = true; return c; } catch (UnsupportedEncodingException e) { String msg = "Username or password contains illegal UTF-8"; throw new SaslException(msg, e); } } public boolean isComplete() { return complete; } public byte[] unwrap(byte[] incoming, int off, int len) throws SaslException { byte[] ret = new byte[len - off]; System.arraycopy(incoming, off, ret, 0, len); return ret; } public byte[] wrap(byte[] outgoing, int off, int len) throws SaslException { byte[] ret = new byte[len - off]; System.arraycopy(outgoing, off, ret, 0, len); return ret; } public Object getNegotiatedProperty(String name) { return null; } public void dispose() { } } inetlib-1.1.2/source/gnu/inet/util/SaslCallbackHandler.java0000664000076400007640000000661711345235566020605 00000000000000/* * SaslCallbackHandler.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; /** * A callback handler that can manage username and password callbacks. * * @author Chris Burdess */ public final class SaslCallbackHandler implements CallbackHandler { /* * The username. */ private final String username; /* * The password. */ private final String password; /** * Constructor. * @param username the value to respond to Name callbacks with * @param password the value to respond to Password callbacks with */ public SaslCallbackHandler(String username, String password) { this.username = username; this.password = password; } /** * Handle callbacks. */ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof NameCallback) { NameCallback nc = (NameCallback) callbacks[i]; nc.setName(username); } else if (callbacks[i] instanceof PasswordCallback) { PasswordCallback pc = (PasswordCallback) callbacks[i]; pc.setPassword(password.toCharArray ()); } else { throw new UnsupportedCallbackException(callbacks[i]); } } } } inetlib-1.1.2/source/gnu/inet/util/.#CRLFInputStream.java.1.90000664000076400007640000001126211345235566020331 00000000000000/* * CRLFInputStream.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.BufferedInputStream; import java.io.InputStream; import java.io.IOException; /** * An input stream that filters out CR/LF pairs into LFs. * * @author Chris Burdess */ public class CRLFInputStream extends InputStream { /** * The CR octet. */ public static final int CR = 13; /** * The LF octet. */ public static final int LF = 10; /** * The underlying input stream. */ protected InputStream in; private boolean doReset; /** * Constructs a CR/LF input stream connected to the specified input * stream. */ public CRLFInputStream(InputStream in) { this.in = in.markSupported() ? in : new BufferedInputStream(in); } /** * Reads the next byte of data from this input stream. * Returns -1 if the end of the stream has been reached. * @exception IOException if an I/O error occurs */ public int read() throws IOException { int c = in.read(); if (c == CR) { in.mark(1); int d = in.read(); if (d == LF) { c = d; } else { in.reset(); } } return c; } /** * Reads up to b.length bytes of data from this input stream into * an array of bytes. * Returns -1 if the end of the stream has been reached. * @exception IOException if an I/O error occurs */ public int read(byte[] b) throws IOException { return read(b, 0, b.length); } /** * Reads up to len bytes of data from this input stream into an * array of bytes, starting at the specified offset. * Returns -1 if the end of the stream has been reached. * @exception IOException if an I/O error occurs */ public int read(byte[] b, int off, int len) throws IOException { in.mark(len + 1); int l = in.read(b, off, len); if (l > 0) { int i = indexOfCRLF(b, off, l); if (doReset) { in.reset(); if (i != -1) { l = in.read(b, off, (i + 1) - off); // read to CR in.read(); // skip LF b[i] = LF; // fix CR as LF } else { l = in.read(b, off, len); // CR(s) but no LF } } } return l; } private int indexOfCRLF(byte[] b, int off, int len) throws IOException { doReset = false; int lm1 = len - 1; for (int i = off; i < len; i++) { if (b[i] == CR) { int d; if (i == lm1) { d = in.read(); doReset = true; } else { d = b[i + 1]; } if (d == LF) { doReset = true; return i; } } } return -1; } } inetlib-1.1.2/source/gnu/inet/util/LaconicFormatter.java0000664000076400007640000000317011345235566020213 00000000000000/* * $Id: LaconicFormatter.java,v 1.1 2007/06/01 17:03:26 dog Exp $ * Copyright (C) 2007 The Free Software Foundation * * This file is part of GNU JavaMail, a library. * * GNU JavaMail 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. * * GNU JavaMail 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * As a special exception, if you link this library with other files to * produce an executable, this library does not by itself cause the * resulting executable to be covered by the GNU General Public License. * This exception does not however invalidate any other reasons why the * executable file might be covered by the GNU General Public License. */ package gnu.inet.util; import java.util.logging.Formatter; import java.util.logging.LogRecord; /** * A logging formatter that outputs only the log message. * * @author Chris Burdess */ public class LaconicFormatter extends Formatter { public String format(LogRecord record) { return record.getMessage() + System.getProperty("line.separator"); } } inetlib-1.1.2/source/gnu/inet/util/SaslLogin.java0000664000076400007640000000734311345235566016660 00000000000000/* * SaslLogin.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.UnsupportedEncodingException; import javax.security.sasl.SaslClient; import javax.security.sasl.SaslException; /** * SASL mechanism for LOGIN. * * @author Chris Burdess */ public class SaslLogin implements SaslClient { private static final int STATE_USERNAME = 0; private static final int STATE_PASSWORD = 1; private static final int STATE_COMPLETE = 2; private String username; private String password; private int state; public SaslLogin(String username, String password) { this.username = username; this.password = password; state = STATE_USERNAME; } public String getMechanismName() { return "LOGIN"; } public boolean hasInitialResponse() { return false; } public byte[] evaluateChallenge(byte[] challenge) throws SaslException { try { switch (state) { case STATE_USERNAME: state = STATE_PASSWORD; return username.getBytes("UTF-8"); case STATE_PASSWORD: state = STATE_COMPLETE; return password.getBytes("UTF-8"); default: return new byte[0]; } } catch (UnsupportedEncodingException e) { String msg = "The UTF-8 character set is not supported by the VM"; throw new SaslException(msg, e); } } public boolean isComplete() { return (state == STATE_COMPLETE); } public byte[] unwrap(byte[] incoming, int off, int len) throws SaslException { byte[] ret = new byte[len - off]; System.arraycopy(incoming, off, ret, 0, len); return ret; } public byte[] wrap(byte[] outgoing, int off, int len) throws SaslException { byte[] ret = new byte[len - off]; System.arraycopy(outgoing, off, ret, 0, len); return ret; } public Object getNegotiatedProperty(String name) { return null; } public void dispose() { } } inetlib-1.1.2/source/gnu/inet/util/EmptyX509TrustManager.java0000664000076400007640000000501711345235566021002 00000000000000/* * EmptyX509TrustManager.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.X509TrustManager; /** * Empty implementation of an X509 trust manager. * This implementation does not check any certificates in the chain. * * @author Chris Burdess */ public class EmptyX509TrustManager implements X509TrustManager { public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } } inetlib-1.1.2/source/gnu/inet/util/BASE64.java.orig0000664000076400007640000001336511345235566016611 00000000000000/* * BASE64.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; /** * Encodes and decodes text according to the BASE64 encoding. * * @author Chris Burdess */ public final class BASE64 { private static final byte[] src = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2b, 0x2f }; private static final byte[] dst; static { dst = new byte[0x100]; for (int i = 0x0; i < 0xff; i++) { dst[i] = -1; } for (int i = 0; i < src.length; i++) { dst[src[i]] = (byte) i; } } private BASE64() { } /** * Encode the specified byte array using the BASE64 algorithm. * * @param bs the source byte array */ public static byte[] encode(byte[] bs) { int si = 0, ti = 0; // source/target array indices /* target byte array */ byte[] bt = new byte[((bs.length + 2 - ((bs.length + 2) % 3)) * 4) / 3]; for (; si < bs.length; si += 3) { int buflen = bs.length - si; if (buflen == 1) { byte b = bs[si]; int i = 0; boolean flag = false; bt[ti++] = src[b >>> 2 & 0x3f]; bt[ti++] = src[(b << 4 & 0x30) + (i >>> 4 & 0xf)]; } else if (buflen == 2) { byte b1 = bs[si], b2 = bs[si + 1]; int i = 0; bt[ti++] = src[b1 >>> 2 & 0x3f]; bt[ti++] = src[(b1 << 4 & 0x30) + (b2 >>> 4 & 0xf)]; bt[ti++] = src[(b2 << 2 & 0x3c) + (i >>> 6 & 0x3)]; } else { byte b1 = bs[si], b2 = bs[si + 1], b3 = bs[si + 2]; bt[ti++] = src[b1 >>> 2 & 0x3f]; bt[ti++] = src[(b1 << 4 & 0x30) + (b2 >>> 4 & 0xf)]; bt[ti++] = src[(b2 << 2 & 0x3c) + (b3 >>> 6 & 0x3)]; bt[ti++] = src[b3 & 0x3f]; } } while (ti < bt.length) { bt[ti++] = 0x3d; } return bt; } /** * Decode the specified byte array using the BASE64 algorithm. * * @param bs the source byte array */ public static byte[] decode(byte[] bs) { int srclen = bs.length; while (srclen > 0 && bs[srclen - 1] == 0x3d) { srclen--; /* strip padding character */ } byte[] buffer = new byte[srclen]; int buflen = 0; int si = 0; int len = srclen - si; while (len > 0) { byte b0 = dst[bs[si++] & 0xff]; byte b2 = dst[bs[si++] & 0xff]; buffer[buflen++] = (byte) (b0 << 2 & 0xfc | b2 >>> 4 & 0x3); if (len > 2) { b0 = b2; b2 = dst[bs[si++] & 0xff]; buffer[buflen++] = (byte) (b0 << 4 & 0xf0 | b2 >>> 2 & 0xf); if (len > 3) { b0 = b2; b2 = dst[bs[si++] & 0xff]; buffer[buflen++] = (byte) (b0 << 6 & 0xc0 | b2 & 0x3f); } } len = srclen - si; } byte[] bt = new byte[buflen]; System.arraycopy(buffer, 0, bt, 0, buflen); return bt; } public static void main(String[] args) { boolean decode = false; for (int i = 0; i < args.length; i++) { if (args[i].equals("-d")) { decode = true; } else { try { byte[] in = args[i].getBytes("US-ASCII"); byte[] out = decode ? decode(in) : encode(in); System.out.println(args[i] + " = " + new String(out, "US-ASCII")); } catch (java.io.UnsupportedEncodingException e) { e.printStackTrace(System.err); } } } } } inetlib-1.1.2/source/gnu/inet/util/SaslOutputStream.java0000664000076400007640000000565711345235566020272 00000000000000/* * SaslOutputStream.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; import javax.security.sasl.SaslClient; /** * A filter output stream that encodes data written to it using a SASL * client. * * @author Chris Burdess */ public class SaslOutputStream extends FilterOutputStream { /* * The SASL client used for encoding data. */ private final SaslClient sasl; /** * Constructor. * @param sasl the SASL client * @param out the target output stream */ public SaslOutputStream(SaslClient sasl, OutputStream out) { super(out); this.sasl = sasl; } /** * Character write. */ public void write(int c) throws IOException { byte[] bytes = new byte[1]; bytes[0] = (byte) c; write(bytes, 0, 1); } public void write(byte[] bytes) throws IOException { write(bytes, 0, bytes.length); } /** * Block write. */ public void write(byte[] bytes, int off, int len) throws IOException { byte[] wrapped = sasl.wrap(bytes, off, len); super.write(wrapped, 0, wrapped.length); } } inetlib-1.1.2/source/gnu/inet/util/CRLFInputStream.java0000664000076400007640000001132011345235566017675 00000000000000/* * CRLFInputStream.java * Copyright (C) 2002,2006 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.BufferedInputStream; import java.io.InputStream; import java.io.IOException; /** * An input stream that filters out CR/LF pairs into LFs. * * @author Chris Burdess */ public class CRLFInputStream extends InputStream { /** * The CR octet. */ public static final int CR = 13; /** * The LF octet. */ public static final int LF = 10; /** * The underlying input stream. */ protected InputStream in; private boolean doReset; /** * Constructs a CR/LF input stream connected to the specified input * stream. */ public CRLFInputStream(InputStream in) { this.in = in.markSupported() ? in : new BufferedInputStream(in); } /** * Reads the next byte of data from this input stream. * Returns -1 if the end of the stream has been reached. * @exception IOException if an I/O error occurs */ public int read() throws IOException { int c = in.read(); if (c == CR) { in.mark(1); int d = in.read(); if (d == LF) { c = d; } else { in.reset(); } } return c; } /** * Reads up to b.length bytes of data from this input stream into * an array of bytes. * Returns -1 if the end of the stream has been reached. * @exception IOException if an I/O error occurs */ public int read(byte[] b) throws IOException { return read(b, 0, b.length); } /** * Reads up to len bytes of data from this input stream into an * array of bytes, starting at the specified offset. * Returns -1 if the end of the stream has been reached. * @exception IOException if an I/O error occurs */ public int read(byte[] b, int off, int len) throws IOException { in.mark(len + 1); int l = in.read(b, off, len); if (l > 0) { int i = indexOfCRLF(b, off, l); if (doReset) { in.reset(); if (i != -1) { l = in.read(b, off, (i + 1) - off); // read to CR in.read(); // skip LF b[i] = LF; // fix CR as LF } else { l = in.read(b, off, len); // CR(s) but no LF } } } return l; } private int indexOfCRLF(byte[] b, int off, int len) throws IOException { doReset = false; int end = off + len; int em1 = end - 1; for (int i = off; i < end; i++) { if (b[i] == CR) { int d; if (i == em1) { d = in.read(); doReset = true; } else { d = b[i + 1]; } if (d == LF) { doReset = true; return i; } } } return -1; } } inetlib-1.1.2/source/gnu/inet/util/GetLocalHostAction.java0000664000076400007640000000443511345235566020452 00000000000000/* * GetLocalHostAction.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.net.InetAddress; import java.net.UnknownHostException; import java.security.PrivilegedAction; /** * Privileged action to retrieve the local host InetAddress. * * @author Chris Burdess */ public class GetLocalHostAction implements PrivilegedAction { public Object run() { try { return InetAddress.getLocalHost(); } catch (UnknownHostException e) { return null; } } } inetlib-1.1.2/source/gnu/inet/util/GetSystemPropertyAction.java0000664000076400007640000000447211345235566021614 00000000000000/* * GetSystemPropertyAction.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.security.PrivilegedAction; /** * Privileged action for retrieving system properties. * * @author Chris Burdess */ public class GetSystemPropertyAction implements PrivilegedAction { final String name; /** * Constructor. * @param name the the name of the system property to retrieve */ public GetSystemPropertyAction(String name) { this.name = name; } public Object run() { return System.getProperty(name); } } inetlib-1.1.2/source/gnu/inet/util/CRLFOutputStream.java0000664000076400007640000001122011345235566020075 00000000000000/* * CRLFOutputStream.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; /** * An output stream that filters LFs into CR/LF pairs. * * @author Chris Burdess */ public class CRLFOutputStream extends FilterOutputStream { static final String US_ASCII = "US-ASCII"; /** * The CR octet. */ public static final int CR = 13; /** * The LF octet. */ public static final int LF = 10; /** * The CR/LF pair. */ public static final byte[] CRLF = { CR, LF }; /** * The last byte read. */ protected int last; /** * Constructs a CR/LF output stream connected to the specified output stream. */ public CRLFOutputStream(OutputStream out) { super(out); last = -1; } /** * Writes a character to the underlying stream. * @exception IOException if an I/O error occurred */ public void write(int ch) throws IOException { if (ch == CR) { out.write(CRLF); } else if (ch == LF) { if (last != CR) { out.write(CRLF); } } else { out.write(ch); } last = ch; } /** * Writes a byte array to the underlying stream. * @exception IOException if an I/O error occurred */ public void write(byte[] b) throws IOException { write(b, 0, b.length); } /** * Writes a portion of a byte array to the underlying stream. * @exception IOException if an I/O error occurred */ public void write(byte[] b, int off, int len) throws IOException { int d = off; len += off; for (int i = off; i < len; i++) { switch (b[i]) { case CR: out.write (b, d, i - d); out.write (CRLF, 0, 2); d = i + 1; break; case LF: if (last != CR) { out.write (b, d, i - d); out.write (CRLF, 0, 2); } d = i + 1; break; } last = b[i]; } if (len - d > 0) { out.write (b, d, len - d); } } /** * Writes the specified ASCII string to the underlying stream. * @exception IOException if an I/O error occurred */ public void write(String text) throws IOException { try { byte[] bytes = text.getBytes(US_ASCII); write(bytes, 0, bytes.length); } catch (UnsupportedEncodingException e) { throw new IOException("The US-ASCII encoding is not supported " + "on this system"); } } /** * Writes a newline to the underlying stream. * @exception IOException if an I/O error occurred */ public void writeln() throws IOException { out.write(CRLF, 0, 2); } } inetlib-1.1.2/source/gnu/inet/util/MessageInputStream.java0000664000076400007640000001213411345235566020537 00000000000000/* * MessageInputStream.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.FilterInputStream; import java.io.InputStream; import java.io.IOException; /** * A utility class for feeding message contents to messages. * This stream returns -1 from read when the stream termination * sequence LF,END,LF is read from the underlying stream. * * @author Chris Burdess */ public class MessageInputStream extends FilterInputStream { /** * The stream termination octet ('.'). */ public static final int END = 46; /** * The line termination octet ('\n'). */ public static final int LF = 10; protected boolean eof; protected int buf1 = -1; protected int buf2 = -1; protected int markBuf1; protected int markBuf2; /** * Constructs a message input stream connected to the specified input stream. */ public MessageInputStream(InputStream in) { super(in); eof = false; } /** * Reads the next byte of data from this message input stream. * Returns -1 if the end of the message stream has been reached. * @exception IOException if an I/O error occurs */ public int read() throws IOException { if (eof) { return -1; } int c; if (buf1 != -1) { c = buf1; buf1 = buf2; buf2 = -1; } else { c = super.read(); } if (c == LF) { if (buf1 == -1) { buf1 = super.read(); if (buf1 == END) { buf2 = super.read(); if (buf2 == LF) { eof = true; // Allow the final LF to be read } } } else if (buf1 == END) { if (buf2 == -1) { buf2 = super.read(); if (buf2 == LF) { eof = true; } } else if (buf2 == LF) { eof = true; } } } return c; } /** * Reads up to b.length bytes of data from this input stream into * an array of bytes. * Returns -1 if the end of the stream has been reached. * @exception IOException if an I/O error occurs */ public int read(byte[] b) throws IOException { return read(b, 0, b.length); } /** * Reads up to len bytes of data from this input stream into an * array of bytes, starting at the specified offset. * Returns -1 if the end of the stream has been reached. * @exception IOException if an I/O error occurs */ public int read(byte[] b, int off, int len) throws IOException { if (eof) { return -1; } int c, end = off + len; for (int i = off; i < end; i++) { c = read(); if (c == -1) { len = i - off; break; } else { b[i] = (byte) c; } } return len; } public boolean markSupported() { return in.markSupported(); } public void mark(int readlimit) { in.mark(readlimit); markBuf1 = buf1; markBuf2 = buf2; } public void reset() throws IOException { in.reset(); buf1 = markBuf1; buf2 = markBuf2; eof = false; } } inetlib-1.1.2/source/gnu/inet/util/SaslInputStream.java0000664000076400007640000001120411345235566020052 00000000000000/* * SaslInputStream.java * Copyright (C) 2002 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; import java.io.FilterInputStream; import java.io.InputStream; import java.io.IOException; import javax.security.sasl.SaslClient; /** * A filter input stream that decodes all its received input using a SASL * client. * * @author Chris Burdess */ public class SaslInputStream extends FilterInputStream { /* * The SASL client. */ private final SaslClient sasl; /* * Overflow buffer. */ private byte[] buf; /* * Offset in overflow buffer. */ private int pos; /** * Constructor. * @param sasl the SASL client * @param in the underlying input stream */ public SaslInputStream(SaslClient sasl, InputStream in) { super(in); this.sasl = sasl; } /** * Reads a single character. */ public int read() throws IOException { if (buf != null) { // Return next characer in buffer int c = (int) buf[pos++]; if (pos == buf.length) { buf = null; } return c; } int c = super.read(); if (c == -1) { return c; } byte[] bytes = new byte[1]; byte[] unwrapped = sasl.unwrap(bytes, 0, 1); // FIXME if we get 0 bytes, we have a problem c = (int) unwrapped[0]; if (unwrapped.length > 1) { // Store in overflow buffer int l = unwrapped.length - 1; buf = new byte[l]; System.arraycopy(unwrapped, 1, buf, 0, l); pos = 0; } return c; } public int read(byte[] bytes) throws IOException { return read(bytes, 0, bytes.length); } /** * Block read. */ public int read(byte[] bytes, int off, int len) throws IOException { if (buf != null) { // Return bytes from buffer int l = buf.length; if (l - pos <= len) { System.arraycopy(buf, pos, bytes, off, l); buf = null; return l; } else { System.arraycopy(buf, pos, bytes, off, len); pos += len; return len; } } int l = super.read(bytes, off, len); if (l == -1) { return l; } byte[] unwrapped = sasl.unwrap(bytes, off, l); int l2 = unwrapped.length; if (l2 > len) { // Store excess bytes in buffer int d = l2 - len; buf = new byte[d]; System.arraycopy(unwrapped, 0, bytes, off, len); System.arraycopy(unwrapped, len, buf, 0, d); pos = 0; return len; } else { System.arraycopy(unwrapped, 0, bytes, off, l2); // Zero bytes from l2..l to ensure none of the original // bytes received can be read by the caller for (int i = l2; i < l; i++) { bytes[off + l2] = 0; } return l2; } } } inetlib-1.1.2/source/gnu/inet/util/BASE64.java0000664000076400007640000001342211345235566015644 00000000000000/* * BASE64.java * Copyright (C) 2003, 2010 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.util; /** * Encodes and decodes text according to the BASE64 encoding. * * @author Chris Burdess */ public final class BASE64 { private static final byte[] src = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2b, 0x2f }; private static final byte[] dst; static { dst = new byte[0x100]; for (int i = 0x0; i < 0xff; i++) { dst[i] = -1; } for (int i = 0; i < src.length; i++) { dst[src[i]] = (byte) i; } } private BASE64() { } /** * Encode the specified byte array using the BASE64 algorithm. * * @param bs the source byte array */ public static byte[] encode(byte[] bs) { int si = 0, ti = 0; // source/target array indices /* target byte array */ byte[] bt = new byte[((bs.length + 2 - ((bs.length + 2) % 3)) * 4) / 3]; for (; si < bs.length; si += 3) { int buflen = bs.length - si; if (buflen == 1) { byte b = bs[si]; int i = 0; boolean flag = false; bt[ti++] = src[b >>> 2 & 0x3f]; bt[ti++] = src[(b << 4 & 0x30) + (i >>> 4 & 0xf)]; } else if (buflen == 2) { byte b1 = bs[si], b2 = bs[si + 1]; int i = 0; bt[ti++] = src[b1 >>> 2 & 0x3f]; bt[ti++] = src[(b1 << 4 & 0x30) + (b2 >>> 4 & 0xf)]; bt[ti++] = src[(b2 << 2 & 0x3c) + (i >>> 6 & 0x3)]; } else { byte b1 = bs[si], b2 = bs[si + 1], b3 = bs[si + 2]; bt[ti++] = src[b1 >>> 2 & 0x3f]; bt[ti++] = src[(b1 << 4 & 0x30) + (b2 >>> 4 & 0xf)]; bt[ti++] = src[(b2 << 2 & 0x3c) + (b3 >>> 6 & 0x3)]; bt[ti++] = src[b3 & 0x3f]; } } while (ti < bt.length) { bt[ti++] = 0x3d; } return bt; } /** * Decode the specified byte array using the BASE64 algorithm. * * @param bs the source byte array */ public static byte[] decode(byte[] bs) { int padding = 0; while (bs.length - padding > 0 && bs[bs.length - padding - 1] == 0x3d) { padding++; } int srclen = bs.length - padding; /* strip padding characters */ byte[] buffer = new byte[(bs.length / 4) * 3 - padding]; /* target array */ int buflen = 0; int si = 0; int len = srclen - si; while (len > 0) { byte b0 = dst[bs[si++] & 0xff]; byte b2 = dst[bs[si++] & 0xff]; buffer[buflen++] = (byte) (b0 << 2 & 0xfc | b2 >>> 4 & 0x3); if (len > 2) { b0 = b2; b2 = dst[bs[si++] & 0xff]; buffer[buflen++] = (byte) (b0 << 4 & 0xf0 | b2 >>> 2 & 0xf); if (len > 3) { b0 = b2; b2 = dst[bs[si++] & 0xff]; buffer[buflen++] = (byte) (b0 << 6 & 0xc0 | b2 & 0x3f); } } len = srclen - si; } return buffer; } public static void main(String[] args) { boolean decode = false; for (int i = 0; i < args.length; i++) { if (args[i].equals("-d")) { decode = true; } else { try { byte[] in = args[i].getBytes("US-ASCII"); byte[] out = decode ? decode(in) : encode(in); System.out.println(args[i] + " = " + new String(out, "US-ASCII")); } catch (java.io.UnsupportedEncodingException e) { e.printStackTrace(System.err); } } } } } inetlib-1.1.2/source/gnu/inet/http/0000775000076400007640000000000011347412570014167 500000000000000inetlib-1.1.2/source/gnu/inet/http/Response.java0000664000076400007640000001122711345235566016561 00000000000000/* * Response.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; import java.util.Date; /** * An HTTP response. * * @author Chris Burdess */ public class Response { /** * The HTTP major version of the server issuing the response. */ protected final int majorVersion; /** * The HTTP minor version of the server issuing the response. */ protected final int minorVersion; /** * The HTTP status code of the response. */ protected final int code; /** * The class of the response. This is the most significant digit of the * status code. *
    *
    1xx
    Informational response
    *
    2xx
    Success
    *
    3xx
    Redirection
    *
    4xx
    Client error
    *
    5xx
    Server error
    *
    */ protected final int codeClass; /** * Human-readable text of the response. */ protected final String message; /** * The response headers. */ protected final Headers headers; /** * Constructs a new response with the specified parameters. */ protected Response(int majorVersion, int minorVersion, int code, int codeClass, String message, Headers headers) { this.majorVersion = majorVersion; this.minorVersion = minorVersion; this.code = code; this.codeClass = codeClass; this.message = message; this.headers = headers; } /** * Returns the HTTP major version of the server issuing the response. * @see #majorVersion */ public int getMajorVersion() { return majorVersion; } /** * Returns the HTTP minor version of the server issuing the response. * @see #minorVersion */ public int getMinorVersion() { return minorVersion; } /** * Returns the HTTP status code of the response. * @see #code */ public int getCode() { return code; } /** * Returns the class of the response. * @see #codeClass */ public int getCodeClass() { return codeClass; } /** * Returns the human-readable text of the response. * @see #message */ public String getMessage() { return message; } /** * Returns the headers in the response. */ public Headers getHeaders() { return headers; } /** * Returns the header value for the specified name. * @param name the header name */ public String getHeader(String name) { return headers.getValue(name); } /** * Returns the header value for the specified name as an integer. * @param name the header name */ public int getIntHeader(String name) { return headers.getIntValue(name); } /** * Returns the header value for the specified name as a date. * @param name the header name */ public Date getDateHeader(String name) { return headers.getDateValue(name); } } inetlib-1.1.2/source/gnu/inet/http/Headers.java0000664000076400007640000002006711345235566016340 00000000000000/* * Headers.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; import java.io.InputStream; import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; import java.util.Collection; import java.util.Date; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import gnu.inet.util.LineInputStream; /** * A collection of HTTP header names and associated values. * Retrieval of values is case insensitive. An iteration over the keys * returns the header names in the order they were received. * * @author Chris Burdess */ public class Headers implements Map { static final DateFormat dateFormat = new HTTPDateFormat(); static class Header { final String name; Header(String name) { if (name == null || name.length() == 0) { throw new IllegalArgumentException(name); } this.name = name; } public int hashCode() { return name.toLowerCase().hashCode(); } public boolean equals(Object other) { if (other instanceof Header) { return ((Header) other).name.equalsIgnoreCase(name); } return false; } public String toString() { return name; } } static class HeaderEntry implements Map.Entry { final Map.Entry entry; HeaderEntry(Map.Entry entry) { this.entry = entry; } public Object getKey() { return ((Header) entry.getKey()).name; } public Object getValue() { return entry.getValue(); } public Object setValue(Object value) { return entry.setValue(value); } public int hashCode() { return entry.hashCode(); } public boolean equals(Object other) { return entry.equals(other); } public String toString() { return getKey().toString() + "=" + getValue(); } } private LinkedHashMap headers; public Headers() { headers = new LinkedHashMap(); } public int size() { return headers.size(); } public boolean isEmpty() { return headers.isEmpty(); } public boolean containsKey(Object key) { return headers.containsKey(new Header((String) key)); } public boolean containsValue(Object value) { return headers.containsValue(value); } public Object get(Object key) { return headers.get(new Header((String) key)); } /** * Returns the value of the specified header as a string. */ public String getValue(String header) { return (String) headers.get(new Header(header)); } /** * Returns the value of the specified header as an integer, * or -1 if the header is not present or not an integer. */ public int getIntValue(String header) { String val = getValue(header); if (val == null) { return -1; } try { return Integer.parseInt(val); } catch (NumberFormatException e) { } return -1; } /** * Returns the value of the specified header as a date, * or null if the header is not present or not a date. */ public Date getDateValue(String header) { String val = getValue(header); if (val == null) { return null; } try { return dateFormat.parse(val); } catch (ParseException e) { return null; } } public Object put(Object key, Object value) { return headers.put(new Header((String) key), value); } public Object remove(Object key) { return headers.remove(new Header((String) key)); } public void putAll(Map t) { for (Iterator i = t.keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); String value = (String) t.get(key); headers.put(new Header(key), value); } } public void clear() { headers.clear(); } public Set keySet() { Set keys = headers.keySet(); Set ret = new LinkedHashSet(); for (Iterator i = keys.iterator(); i.hasNext(); ) { ret.add(((Header) i.next()).name); } return ret; } public Collection values() { return headers.values(); } public Set entrySet() { Set entries = headers.entrySet(); Set ret = new LinkedHashSet(); for (Iterator i = entries.iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); ret.add(new HeaderEntry(entry)); } return ret; } public boolean equals(Object other) { return headers.equals(other); } public int hashCode() { return headers.hashCode(); } /** * Parse the specified input stream, adding headers to this collection. */ public void parse(InputStream in) throws IOException { LineInputStream lin = (in instanceof LineInputStream) ? (LineInputStream) in : new LineInputStream(in); String name = null; StringBuffer value = new StringBuffer(); while (true) { String line = lin.readLine(); if (line == null) { if (name != null) { addValue(name, value.toString()); } break; } int len = line.length(); if (len < 2) { if (name != null) { addValue(name, value.toString()); } break; } char c1 = line.charAt(0); if (c1 == ' ' || c1 == '\t') { // Continuation value.append(line.substring(0, len - 1)); } else { if (name != null) { addValue(name, value.toString()); } int di = line.indexOf(':'); name = line.substring(0, di); value.setLength(0); do { di++; } while (di < len && line.charAt(di) == ' '); value.append(line.substring(di, len - 1)); } } } private void addValue(String name, String value) { Header key = new Header(name); String old = (String) headers.get(key); if (old == null) { headers.put(key, value); } else { headers.put(key, old + ", " + value); } } } inetlib-1.1.2/source/gnu/inet/http/Request.java0000664000076400007640000006617411345235566016426 00000000000000/* * Request.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.ProtocolException; import java.net.Socket; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.DateFormat; import java.text.ParseException; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.zip.GZIPInputStream; import java.util.zip.InflaterInputStream; import gnu.inet.http.event.RequestEvent; import gnu.inet.util.BASE64; import gnu.inet.util.LineInputStream; /** * A single HTTP request. * * @author Chris Burdess */ public class Request { /** * The connection context in which this request is invoked. */ protected final HTTPConnection connection; /** * The HTTP method to invoke. */ protected final String method; /** * The path identifying the resource. * This string must conform to the abs_path definition given in RFC2396, * with an optional "?query" part, and must be URI-escaped by the caller. */ protected final String path; /** * The headers in this request. */ protected final Headers requestHeaders; /** * The request body provider. */ protected RequestBodyWriter requestBodyWriter; /** * Request body negotiation threshold for 100-continue expectations. */ protected int requestBodyNegotiationThreshold; /** * The response body reader. */ protected ResponseBodyReader responseBodyReader; /** * Map of response header handlers. */ protected Map responseHeaderHandlers; /** * The authenticator. */ protected Authenticator authenticator; /** * Whether this request has been dispatched yet. */ private boolean dispatched; /** * Constructor for a new request. * @param connection the connection context * @param method the HTTP method * @param path the resource path including query part */ protected Request(HTTPConnection connection, String method, String path) { this.connection = connection; this.method = method; this.path = path; requestHeaders = new Headers(); responseHeaderHandlers = new HashMap(); requestBodyNegotiationThreshold = 4096; } /** * Returns the connection associated with this request. * @see #connection */ public HTTPConnection getConnection() { return connection; } /** * Returns the HTTP method to invoke. * @see #method */ public String getMethod() { return method; } /** * Returns the resource path. * @see #path */ public String getPath() { return path; } /** * Returns the full request-URI represented by this request, as specified * by HTTP/1.1. */ public String getRequestURI() { return connection.getURI() + path; } /** * Returns the headers in this request. */ public Headers getHeaders() { return requestHeaders; } /** * Returns the value of the specified header in this request. * @param name the header name */ public String getHeader(String name) { return requestHeaders.getValue(name); } /** * Returns the value of the specified header in this request as an integer. * @param name the header name */ public int getIntHeader(String name) { return requestHeaders.getIntValue(name); } /** * Returns the value of the specified header in this request as a date. * @param name the header name */ public Date getDateHeader(String name) { return requestHeaders.getDateValue(name); } /** * Sets the specified header in this request. * @param name the header name * @param value the header value */ public void setHeader(String name, String value) { requestHeaders.put(name, value); } /** * Convenience method to set the entire request body. * @param requestBody the request body content */ public void setRequestBody(byte[] requestBody) { setRequestBodyWriter(new ByteArrayRequestBodyWriter(requestBody)); } /** * Sets the request body provider. * @param requestBodyWriter the handler used to obtain the request body */ public void setRequestBodyWriter(RequestBodyWriter requestBodyWriter) { this.requestBodyWriter = requestBodyWriter; } /** * Sets the response body reader. * @param responseBodyReader the handler to receive notifications of * response body content */ public void setResponseBodyReader(ResponseBodyReader responseBodyReader) { this.responseBodyReader = responseBodyReader; } /** * Sets a callback handler to be invoked for the specified header name. * @param name the header name * @param handler the handler to receive the value for the header */ public void setResponseHeaderHandler(String name, ResponseHeaderHandler handler) { responseHeaderHandlers.put(name, handler); } /** * Sets an authenticator that can be used to handle authentication * automatically. * @param authenticator the authenticator */ public void setAuthenticator(Authenticator authenticator) { this.authenticator = authenticator; } /** * Sets the request body negotiation threshold. * If this is set, it determines the maximum size that the request body * may be before body negotiation occurs(via the * 100-continue expectation). This ensures that a large * request body is not sent when the server wouldn't have accepted it * anyway. * @param threshold the body negotiation threshold, or <=0 to disable * request body negotation entirely */ public void setRequestBodyNegotiationThreshold(int threshold) { requestBodyNegotiationThreshold = threshold; } /** * Dispatches this request. * A request can only be dispatched once; calling this method a second * time results in a protocol exception. * @exception IOException if an I/O error occurred * @return an HTTP response object representing the result of the operation */ public Response dispatch() throws IOException { if (dispatched) { throw new ProtocolException("request already dispatched"); } final String CRLF = "\r\n"; final String HEADER_SEP = ": "; final String US_ASCII = "US-ASCII"; final String version = connection.getVersion(); Response response; int contentLength = -1; boolean retry = false; int attempts = 0; boolean expectingContinue = false; if (requestBodyWriter != null) { contentLength = requestBodyWriter.getContentLength(); if (contentLength > requestBodyNegotiationThreshold && (connection.minorVersion > 0 || connection.majorVersion > 1)) { expectingContinue = true; setHeader("Expect", "100-continue"); } else { setHeader("Content-Length", Integer.toString(contentLength)); } } try { // Loop while authentication fails or continue do { retry = false; // Send request connection.fireRequestEvent(RequestEvent.REQUEST_SENDING, this); // Get socket output and input streams OutputStream out = connection.getOutputStream(); LineInputStream in = new LineInputStream(connection.getInputStream()); // Request line String requestUri = path; if (connection.isUsingProxy() && !"*".equals(requestUri) && !"CONNECT".equals(method)) { requestUri = getRequestURI(); } String line = method + ' ' + requestUri + ' ' + version + CRLF; out.write(line.getBytes(US_ASCII)); // Request headers for (Iterator i = requestHeaders.keySet().iterator(); i.hasNext(); ) { String name =(String) i.next(); String value =(String) requestHeaders.get(name); line = name + HEADER_SEP + value + CRLF; out.write(line.getBytes(US_ASCII)); } out.write(CRLF.getBytes(US_ASCII)); // Request body if (requestBodyWriter != null && !expectingContinue) { byte[] buffer = new byte[4096]; int len; int count = 0; requestBodyWriter.reset(); do { len = requestBodyWriter.write(buffer); if (len > 0) { out.write(buffer, 0, len); } count += len; } while (len > -1 && count < contentLength); out.write(CRLF.getBytes(US_ASCII)); } out.flush(); // Sent event connection.fireRequestEvent(RequestEvent.REQUEST_SENT, this); // Get response response = readResponse(in); int sc = response.getCode(); if (sc == 401 && authenticator != null) { if (authenticate(response, attempts++)) { retry = true; } } else if (sc == 100) { requestHeaders.remove("Expect"); setHeader("Content-Length", Integer.toString(contentLength)); expectingContinue = false; retry = true; } } while (retry); } catch (IOException e) { connection.close(); throw e; } return response; } Response readResponse(LineInputStream in) throws IOException { String line; int len; // Read response status line line = in.readLine(); if (line == null) { throw new ProtocolException("Peer closed connection"); } if (!line.startsWith("HTTP/")) { throw new ProtocolException(line); } len = line.length(); int start = 5, end = 6; while (line.charAt(end) != '.') { end++; } int majorVersion = Integer.parseInt(line.substring(start, end)); start = end + 1; end = start + 1; while (line.charAt(end) != ' ') { end++; } int minorVersion = Integer.parseInt(line.substring(start, end)); start = end + 1; end = start + 3; int code = Integer.parseInt(line.substring(start, end)); String message = line.substring(end + 1, len - 1); // Read response headers Headers responseHeaders = new Headers(); responseHeaders.parse(in); notifyHeaderHandlers(responseHeaders); // Construct response int codeClass = code / 100; Response ret = new Response(majorVersion, minorVersion, code, codeClass, message, responseHeaders); if (!"HEAD".equals(method) && !"OPTIONS".equals(method)) { switch (code) { case 204: case 205: break; default: // Does response body reader want body? boolean notify = (responseBodyReader != null); if (notify) { if (!responseBodyReader.accept(this, ret)) { notify = false; } } readResponseBody(ret, in, notify); } } return ret; } void notifyHeaderHandlers(Headers headers) { for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String name = (String) entry.getKey(); // Handle Set-Cookie if ("Set-Cookie".equalsIgnoreCase(name)) { String value = (String) entry.getValue(); handleSetCookie(value); } ResponseHeaderHandler handler = (ResponseHeaderHandler) responseHeaderHandlers.get(name); if (handler != null) { String value = (String) entry.getValue(); handler.setValue(value); } } } void readResponseBody(Response response, InputStream in, boolean notify) throws IOException { byte[] buffer = new byte[4096]; int contentLength = -1; Headers trailer = null; String transferCoding = response.getHeader("Transfer-Encoding"); if ("chunked".equalsIgnoreCase(transferCoding)) { trailer = new Headers(); in = new ChunkedInputStream(in, trailer); } else { contentLength = response.getIntHeader("Content-Length"); } String contentCoding = response.getHeader("Content-Encoding"); if (contentCoding != null && !"identity".equals(contentCoding)) { if ("gzip".equals(contentCoding)) { in = new GZIPInputStream(in); } else if ("deflate".equals(contentCoding)) { in = new InflaterInputStream(in); } else { throw new ProtocolException("Unsupported Content-Encoding: " + contentCoding); } response.headers.remove("Content-Encoding"); } // Persistent connections are the default in HTTP/1.1 boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) || "close".equalsIgnoreCase(response.getHeader("Connection")) || (connection.majorVersion == 1 && connection.minorVersion == 0) || (response.majorVersion == 1 && response.minorVersion == 0) || contentLength == -1; if (contentLength == 0) { if (doClose) { connection.closeConnection(); } } else { int count = contentLength; int len = (count > -1) ? count : buffer.length; len = (len > buffer.length) ? buffer.length : len; while (len > -1) { len = in.read(buffer, 0, len); if (len < 0) { // EOF connection.closeConnection(); break; } if (notify) { responseBodyReader.read(buffer, 0, len); } if (count > -1) { count -= len; if (count < 1) { if (doClose) { connection.closeConnection(); } break; } } } } if (notify) { responseBodyReader.close(); } if (trailer != null) { response.getHeaders().putAll(trailer); notifyHeaderHandlers(trailer); } } boolean authenticate(Response response, int attempts) throws IOException { String challenge = response.getHeader("WWW-Authenticate"); if (challenge == null) { challenge = response.getHeader("Proxy-Authenticate"); } int si = challenge.indexOf(' '); String scheme = (si == -1) ? challenge : challenge.substring(0, si); if ("Basic".equalsIgnoreCase(scheme)) { Properties params = parseAuthParams(challenge.substring(si + 1)); String realm = params.getProperty("realm"); Credentials creds = authenticator.getCredentials(realm, attempts); String userPass = creds.getUsername() + ':' + creds.getPassword(); byte[] b_userPass = userPass.getBytes("US-ASCII"); byte[] b_encoded = BASE64.encode(b_userPass); String authorization = scheme + " " + new String(b_encoded, "US-ASCII"); setHeader("Authorization", authorization); return true; } else if ("Digest".equalsIgnoreCase(scheme)) { Properties params = parseAuthParams(challenge.substring(si + 1)); String realm = params.getProperty("realm"); String nonceParam = params.getProperty("nonce"); String qop = params.getProperty("qop"); String algorithm = params.getProperty("algorithm"); String digestUri = getRequestURI(); Credentials creds = authenticator.getCredentials(realm, attempts); String username = creds.getUsername(); String password = creds.getPassword(); connection.incrementNonce(nonceParam); try { MessageDigest md5 = MessageDigest.getInstance("MD5"); final byte[] COLON = { 0x3a }; // Calculate H(A1) md5.reset(); md5.update(username.getBytes("US-ASCII")); md5.update(COLON); md5.update(realm.getBytes("US-ASCII")); md5.update(COLON); md5.update(password.getBytes("US-ASCII")); byte[] ha1 = md5.digest(); if ("md5-sess".equals(algorithm)) { byte[] cnonce = generateNonce(); md5.reset(); md5.update(ha1); md5.update(COLON); md5.update(nonceParam.getBytes("US-ASCII")); md5.update(COLON); md5.update(cnonce); ha1 = md5.digest(); } String ha1Hex = toHexString(ha1); // Calculate H(A2) md5.reset(); md5.update(method.getBytes("US-ASCII")); md5.update(COLON); md5.update(digestUri.getBytes("US-ASCII")); if ("auth-int".equals(qop)) { byte[] hEntity = null; // TODO hash of entity body md5.update(COLON); md5.update(hEntity); } byte[] ha2 = md5.digest(); String ha2Hex = toHexString(ha2); // Calculate response md5.reset(); md5.update(ha1Hex.getBytes("US-ASCII")); md5.update(COLON); md5.update(nonceParam.getBytes("US-ASCII")); if ("auth".equals(qop) || "auth-int".equals(qop)) { String nc = getNonceCount(nonceParam); byte[] cnonce = generateNonce(); md5.update(COLON); md5.update(nc.getBytes("US-ASCII")); md5.update(COLON); md5.update(cnonce); md5.update(COLON); md5.update(qop.getBytes("US-ASCII")); } md5.update(COLON); md5.update(ha2Hex.getBytes("US-ASCII")); String digestResponse = toHexString(md5.digest()); String authorization = scheme + " username=\"" + username + "\"" + " realm=\"" + realm + "\"" + " nonce=\"" + nonceParam + "\"" + " uri=\"" + digestUri + "\"" + " response=\"" + digestResponse + "\""; setHeader("Authorization", authorization); return true; } catch (NoSuchAlgorithmException e) { return false; } } // Scheme not recognised return false; } Properties parseAuthParams(String text) { int len = text.length(); String key = null; StringBuffer buf = new StringBuffer(); Properties ret = new Properties(); boolean inQuote = false; for (int i = 0; i < len; i++) { char c = text.charAt(i); if (c == '"') { inQuote = !inQuote; } else if (c == '=' && key == null) { key = buf.toString().trim(); buf.setLength(0); } else if (c == ' ' && !inQuote) { String value = unquote(buf.toString().trim()); ret.put(key, value); key = null; buf.setLength(0); } else if (c != ',' || (i <(len - 1) && text.charAt(i + 1) != ' ')) { buf.append(c); } } if (key != null) { String value = unquote(buf.toString().trim()); ret.put(key, value); } return ret; } String unquote(String text) { int len = text.length(); if (len > 0 && text.charAt(0) == '"' && text.charAt(len - 1) == '"') { return text.substring(1, len - 1); } return text; } /** * Returns the number of times the specified nonce value has been seen. * This always returns an 8-byte 0-padded hexadecimal string. */ String getNonceCount(String nonceParam) { int nc = connection.getNonceCount(nonceParam); String hex = Integer.toHexString(nc); StringBuffer buf = new StringBuffer(); for (int i = 8 - hex.length(); i > 0; i--) { buf.append('0'); } buf.append(hex); return buf.toString(); } /** * Client nonce value. */ byte[] nonce; /** * Generates a new client nonce value. */ byte[] generateNonce() throws IOException, NoSuchAlgorithmException { if (nonce == null) { long time = System.currentTimeMillis(); MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update(Long.toString(time).getBytes("US-ASCII")); nonce = md5.digest(); } return nonce; } String toHexString(byte[] bytes) { char[] ret = new char[bytes.length * 2]; for (int i = 0, j = 0; i < bytes.length; i++) { int c =(int) bytes[i]; if (c < 0) { c += 0x100; } ret[j++] = Character.forDigit(c / 0x10, 0x10); ret[j++] = Character.forDigit(c % 0x10, 0x10); } return new String(ret); } /** * Parse the specified cookie list and notify the cookie manager. */ void handleSetCookie(String text) { CookieManager cookieManager = connection.getCookieManager(); if (cookieManager == null) { return; } String name = null; String value = null; String comment = null; String domain = connection.getHostName(); String p = path; int lsi = p.lastIndexOf('/'); if (lsi != -1) { p = p.substring(0, lsi); } boolean secure = false; Date expires = null; int len = text.length(); String attr = null; StringBuffer buf = new StringBuffer(); boolean inQuote = false; for (int i = 0; i <= len; i++) { char c =(i == len) ? '\u0000' : text.charAt(i); if (c == '"') { inQuote = !inQuote; } else if (!inQuote) { if (c == '=' && attr == null) { attr = buf.toString().trim(); buf.setLength(0); } else if (c == ';' || i == len || c == ',') { String val = unquote(buf.toString().trim()); if (name == null) { name = attr; value = val; } else if ("Comment".equalsIgnoreCase(attr)) { comment = val; } else if ("Domain".equalsIgnoreCase(attr)) { domain = val; } else if ("Path".equalsIgnoreCase(attr)) { p = val; } else if ("Secure".equalsIgnoreCase(val)) { secure = true; } else if ("Max-Age".equalsIgnoreCase(attr)) { int delta = Integer.parseInt(val); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(System.currentTimeMillis()); cal.add(Calendar.SECOND, delta); expires = cal.getTime(); } else if ("Expires".equalsIgnoreCase(attr)) { DateFormat dateFormat = new HTTPDateFormat(); try { expires = dateFormat.parse(val); } catch (ParseException e) { // if this isn't a valid date, it may be that // the value was returned unquoted; in that case, we // want to continue buffering the value buf.append(c); continue; } } attr = null; buf.setLength(0); // case EOL if (i == len || c == ',') { Cookie cookie = new Cookie(name, value, comment, domain, p, secure, expires); cookieManager.setCookie(cookie); } if (c == ',') { // Reset cookie fields name = null; value = null; comment = null; domain = connection.getHostName(); p = path; if (lsi != -1) { p = p.substring(0, lsi); } secure = false; expires = null; } } else { buf.append(c); } } else { buf.append(c); } } } } inetlib-1.1.2/source/gnu/inet/http/ChunkedInputStream.java0000644000076400007640000001171311345235566020536 00000000000000/* * ChunkedInputStream.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; import java.io.FilterInputStream; import java.io.InputStream; import java.io.IOException; import java.net.ProtocolException; /** * Input stream wrapper for the "chunked" transfer-coding. * * @author Chris Burdess */ public class ChunkedInputStream extends FilterInputStream { private static final byte CR = 0x0d; private static final byte LF = 0x0a; /** Size of the chunk we're reading. */ int size; /** Number of bytes we've read in this chunk. */ int count; /** * True when we should read meta-information, false when we should * read data. */ boolean meta; /** True when we've hit EOF. */ boolean eof; Headers headers; /** * Constructor. * @param in the response socket input stream * @param headers the headers to receive additional header lines */ public ChunkedInputStream(InputStream in, Headers headers) { super(in); this.headers = headers; size = -1; count = 0; meta = true; } public int read() throws IOException { byte[] buf = new byte[1]; int len = read(buf, 0, 1); if (len == -1) { return -1; } int ret = (int) buf[0]; if (ret < 0) { ret += 0x100; } return ret; } public int read(byte[] buffer) throws IOException { return read(buffer, 0, buffer.length); } public int read(byte[] buffer, int offset, int length) throws IOException { if (eof) { return -1; } if (meta) { // Read chunk header int c, last = 0; boolean seenSemi = false; StringBuffer buf = new StringBuffer(); do { c = in.read(); if (c == 0x3b) // ; { seenSemi = true; } else if (c == 0x0a && last == 0x0d) // CRLF { size = Integer.parseInt(buf.toString(), 16); break; } else if (!seenSemi && c >= 0x30) { buf.append ((char) c); } last = c; } while(c != -1); count = 0; meta = false; } if (size == 0) { // Read trailer headers.parse(in); eof = true; return -1; } else { int canRead = Math.min(size - count, length); int len = in.read(buffer, offset, canRead); if (len == -1) { // This is an error condition but it isn't clear what we // should do with it. eof = true; return -1; } count += len; if (count == size) { // Read CRLF int c1 = in.read(); int c2 = in.read(); if (c1 == -1 || c2 == -1) { // EOF before CRLF: bad, but ignore eof = true; return -1; } if (c1 != 0x0d || c2 != 0x0a) { throw new ProtocolException("expecting CRLF: " + c1 + "," + c2); } meta = true; } return len; } } } inetlib-1.1.2/source/gnu/inet/http/Authenticator.java0000664000076400007640000000441711345235566017600 00000000000000/* * Authenticator.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; /** * Callback interface for managing authentication. * @see Request#setAuthenticator * * @author Chris Burdess */ public interface Authenticator { /** * Returns the credentials to supply for the given realm. * @param realm the authentication realm * @param attempt zero on first authentication attempt, increments on each * unsuccessful attempt */ Credentials getCredentials(String realm, int attempt); } inetlib-1.1.2/source/gnu/inet/http/ByteArrayRequestBodyWriter.java0000664000076400007640000000614611345235566022255 00000000000000/* * ByteArrayRequestBodyWriter.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; /** * A simple request body writer using a byte array. * * @author Chris Burdess */ public class ByteArrayRequestBodyWriter implements RequestBodyWriter { /** * The content. */ protected byte[] content; /** * The position within the content at which the next read will occur. */ protected int pos; /** * Constructs a new byte array request body writer with the specified * content. * @param content the content buffer */ public ByteArrayRequestBodyWriter(byte[] content) { this.content = content; pos = 0; } /** * Returns the total number of bytes that will be written in a single pass * by this writer. */ public int getContentLength() { return content.length; } /** * Initialises the writer. * This will be called before each pass. */ public void reset() { pos = 0; } /** * Writes body content to the supplied buffer. * @param buffer the content buffer * @return the number of bytes written */ public int write(byte[] buffer) { int len = content.length - pos; len = (buffer.length < len) ? buffer.length : len; if (len > -1) { System.arraycopy(content, pos, buffer, 0, len); pos += len; } return len; } } inetlib-1.1.2/source/gnu/inet/http/HTTPDateFormat.java0000664000076400007640000003311511345235566017511 00000000000000/* * HTTPDateFormat.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; import java.io.PrintStream; import java.text.*; import java.util.*; /** * HTTP date formatter and parser. * Formats dates according to RFC 822 (updated by RFC 1123). * Parses dates according to the above, or RFC 1036, or the * ANSI C asctime() format. * * @author Chris Burdess */ public class HTTPDateFormat extends DateFormat { static final String[] DAYS_OF_WEEK = { null, "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static final String[] MONTHS = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; public HTTPDateFormat() { calendar = new GregorianCalendar(TimeZone.getTimeZone ("GMT")); numberFormat = new DecimalFormat(); } /** * Appends the textual value for the specified field to the given string * buffer. This method should be avoided, use format(Date) * instead. * @param date the Date object * @param buf the buffer to append to * @param field the current field position * @return the modified buffer */ public StringBuffer format(Date date, StringBuffer buf, FieldPosition field) { calendar.clear(); calendar.setTime(date); buf.setLength(0); // Day of week buf.append(DAYS_OF_WEEK[calendar.get(Calendar.DAY_OF_WEEK)]); buf.append(','); buf.append(' '); // Day of month int day = calendar.get(Calendar.DAY_OF_MONTH); buf.append(Character.forDigit(day / 10, 10)); buf.append(Character.forDigit(day % 10, 10)); buf.append(' '); // Month buf.append(MONTHS[calendar.get(Calendar.MONTH)]); buf.append(' '); // Year int year = calendar.get(Calendar.YEAR); if (year < 1000) { buf.append('0'); if (year < 100) { buf.append('0'); if (year < 10) { buf.append('0'); } } } buf.append(Integer.toString(year)); buf.append(' '); // Hour int hour = calendar.get(Calendar.HOUR_OF_DAY); buf.append(Character.forDigit(hour / 10, 10)); buf.append(Character.forDigit(hour % 10, 10)); buf.append(':'); // Minute int minute = calendar.get(Calendar.MINUTE); buf.append(Character.forDigit(minute / 10, 10)); buf.append(Character.forDigit(minute % 10, 10)); buf.append(':'); // Second int second = calendar.get(Calendar.SECOND); buf.append(Character.forDigit(second / 10, 10)); buf.append(Character.forDigit(second % 10, 10)); buf.append(' '); // Timezone // Get time offset in minutes int zoneOffset =(calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET)) / 60000; // Apply + or - appropriately if (zoneOffset < 0) { zoneOffset = -zoneOffset; buf.append('-'); } else { buf.append('+'); } // Set the 2 2-char fields as specified above int tzhours = zoneOffset / 60; buf.append(Character.forDigit(tzhours / 10, 10)); buf.append(Character.forDigit(tzhours % 10, 10)); int tzminutes = zoneOffset % 60; buf.append(Character.forDigit(tzminutes / 10, 10)); buf.append(Character.forDigit(tzminutes % 10, 10)); field.setBeginIndex(0); field.setEndIndex(buf.length()); return buf; } /** * Parses the given date in the current TimeZone. * @param text the formatted date to be parsed * @param pos the current parse position */ public Date parse(String text, ParsePosition pos) { int date, month, year, hour, minute, second; String monthText; int start = 0, end = -1; int len = text.length(); calendar.clear(); pos.setIndex(start); try { // Advance to date if (Character.isLetter(text.charAt(start))) { start = skipNonWhitespace(text, start); } // Determine mode switch(start) { case 3: // asctime start = skipWhitespace(text, start); pos.setIndex(start); end = skipNonWhitespace(text, start + 1); monthText = text.substring(start, end); month = -1; for (int i = 0; i < 12; i++) { if (MONTHS[i].equals(monthText)) { month = i; break; } } if (month == -1) { pos.setErrorIndex(end); return null; } // Advance to date start = skipWhitespace(text, end + 1); pos.setIndex(start); end = skipNonWhitespace(text, start + 1); date = Integer.parseInt(text.substring(start, end)); // Advance to hour start = skipWhitespace(text, end + 1); pos.setIndex(start); end = skipTo(text, start + 1, ':'); hour = Integer.parseInt(text.substring(start, end)); // Advance to minute start = end + 1; pos.setIndex(start); end = skipTo(text, start + 1, ':'); minute = Integer.parseInt(text.substring(start, end)); // Advance to second start = end + 1; pos.setIndex(start); end = skipNonWhitespace(text, start + 1); second = Integer.parseInt(text.substring(start, end)); // Advance to year start = skipWhitespace(text, end + 1); pos.setIndex(start); end = skipNonWhitespace(text, start + 1); year = Integer.parseInt(text.substring(start, end)); break; case 0: case 4: // rfc822 start = skipWhitespace(text, start); pos.setIndex(start); end = skipNonWhitespace(text, start + 1); date = Integer.parseInt(text.substring(start, end)); // Advance to month start = skipWhitespace(text, end + 1); pos.setIndex(start); end = skipNonWhitespace(text, start + 1); monthText = text.substring(start, end); month = -1; for (int i = 0; i < 12; i++) { if (MONTHS[i].equals(monthText)) { month = i; break; } } if (month == -1) { pos.setErrorIndex(end); return null; } // Advance to year start = skipWhitespace(text, end + 1); pos.setIndex(start); end = skipNonWhitespace(text, start + 1); year = Integer.parseInt(text.substring(start, end)); // Advance to hour start = skipWhitespace(text, end + 1); pos.setIndex(start); end = skipTo(text, start + 1, ':'); hour = Integer.parseInt(text.substring(start, end)); // Advance to minute start = end + 1; pos.setIndex(start); end = skipTo(text, start + 1, ':'); minute = Integer.parseInt(text.substring(start, end)); // Advance to second start = end + 1; pos.setIndex(start); end = start + 1; while (end < len && !Character.isWhitespace(text.charAt(end))) { end++; } second = Integer.parseInt(text.substring(start, end)); break; default: // rfc850(obsolete) start = skipWhitespace(text, start); pos.setIndex(start); end = skipTo(text, start + 1, '-'); date = Integer.parseInt(text.substring(start, end)); // Advance to month start = end + 1; pos.setIndex(start); end = skipTo(text, start + 1, '-'); monthText = text.substring(start, end); month = -1; for (int i = 0; i < 12; i++) { if (MONTHS[i].equals(monthText)) { month = i; break; } } if (month == -1) { pos.setErrorIndex(end); return null; } // Advance to year start = end + 1; pos.setIndex(start); end = skipNonWhitespace(text, start + 1); year = 1900 + Integer.parseInt(text.substring(start, end)); // Advance to hour start = skipWhitespace(text, end + 1); pos.setIndex(start); end = skipTo(text, start + 1, ':'); hour = Integer.parseInt(text.substring(start, end)); // Advance to minute start = end + 1; pos.setIndex(start); end = skipTo(text, start + 1, ':'); minute = Integer.parseInt(text.substring(start, end)); // Advance to second start = end + 1; pos.setIndex(start); end = start + 1; while (end < len && !Character.isWhitespace(text.charAt(end))) { end++; } second = Integer.parseInt(text.substring(start, end)); } calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month); calendar.set(Calendar.DAY_OF_MONTH, date); calendar.set(Calendar.HOUR, hour); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.SECOND, second); if (end != len) { // Timezone start = skipWhitespace(text, end + 1); end = start + 1; while (end < len && !Character.isWhitespace(text.charAt(end))) { end++; } char pm = text.charAt(start); if (Character.isLetter(pm)) { TimeZone tz = TimeZone.getTimeZone(text.substring(start, end)); calendar.set(Calendar.ZONE_OFFSET, tz.getRawOffset()); } else { int zoneOffset = 0; zoneOffset += 600 * Character.digit(text.charAt(++start), 10); zoneOffset += 60 * Character.digit(text.charAt(++start), 10); zoneOffset += 10 * Character.digit(text.charAt(++start), 10); zoneOffset += Character.digit(text.charAt(++start), 10); zoneOffset *= 60000; // minutes -> ms if ('-' == pm) { zoneOffset = -zoneOffset; } calendar.set(Calendar.ZONE_OFFSET, zoneOffset); } } pos.setIndex(end); return calendar.getTime(); } catch (NumberFormatException e) { pos.setErrorIndex(Math.max(start, end)); } catch (StringIndexOutOfBoundsException e) { pos.setErrorIndex(Math.max(start, end)); } return null; } private int skipWhitespace(String text, int pos) { while(Character.isWhitespace(text.charAt(pos))) { pos++; } return pos; } private int skipNonWhitespace(String text, int pos) { while(!Character.isWhitespace(text.charAt(pos))) { pos++; } return pos; } private int skipTo(String text, int pos, char c) { while(text.charAt(pos) != c) { pos++; } return pos; } /** * Don't allow setting the calendar. */ public void setCalendar(Calendar newCalendar) { throw new UnsupportedOperationException(); } /** * Don't allow setting the NumberFormat. */ public void setNumberFormat(NumberFormat newNumberFormat) { throw new UnsupportedOperationException(); } } inetlib-1.1.2/source/gnu/inet/http/ResponseHeaderHandler.java0000664000076400007640000000424611345235566021173 00000000000000/* * ResponseHeaderHandler.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; /** * Callback interface for objects that wish to be notified of response * header values. * @see Request#setHeaderHandler(String) * * @author Chris Burdess */ public interface ResponseHeaderHandler { /** * Sets the value for the header associated with this handler. */ void setValue(String value); } inetlib-1.1.2/source/gnu/inet/http/ResponseBodyReader.java0000664000076400007640000000511611345235566020522 00000000000000/* * ResponseBodyReader.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; /** * Callback interface for receiving notification of response body content. * * @author Chris Burdess */ public interface ResponseBodyReader { /** * Indicate whether this reader is interested in the specified response. * If it returns false, it will not receive body content notifications for * that response. */ boolean accept(Request request, Response response); /** * Receive notification of body content. * @param buffer the content buffer * @param offset the offset within the buffer that content starts * @param length the length of the content */ void read(byte[] buffer, int offset, int length); /** * Notifies the reader that the end of the content was reached. */ void close(); } inetlib-1.1.2/source/gnu/inet/http/RequestBodyWriter.java0000664000076400007640000000457611345235566020437 00000000000000/* * RequestBodyWriter.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; /** * Callback interface for writing request body content. * * @author Chris Burdess */ public interface RequestBodyWriter { /** * Returns the total number of bytes that will be written in a single pass * by this writer. */ int getContentLength(); /** * Initialises the writer. * This will be called before each pass. */ void reset(); /** * Writes body content to the supplied buffer. * @param buffer the content buffer * @return the number of bytes written */ int write(byte[] buffer); } inetlib-1.1.2/source/gnu/inet/http/HTTPConnection.java0000664000076400007640000004105011345235566017557 00000000000000/* * HTTPConnection.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.net.SocketFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import gnu.inet.http.event.ConnectionEvent; import gnu.inet.http.event.ConnectionListener; import gnu.inet.http.event.RequestEvent; import gnu.inet.http.event.RequestListener; import gnu.inet.util.EmptyX509TrustManager; /** * A connection to an HTTP server. * * @author Chris Burdess */ public class HTTPConnection { /** * The default HTTP port. */ public static final int HTTP_PORT = 80; /** * The default HTTPS port. */ public static final int HTTPS_PORT = 443; private static final String userAgent = initUserAgent(); private static String initUserAgent() { try { StringBuffer buf = new StringBuffer("inetlib/1.1 ("); buf.append(System.getProperty("os.name")); buf.append("; "); buf.append(System.getProperty("os.arch")); buf.append("; "); buf.append(System.getProperty("user.language")); buf.append(")"); return buf.toString(); } catch (SecurityException e) { return "inetlib/1.1"; } } /** * The host name of the server to connect to. */ protected final String hostname; /** * The port to connect to. */ protected final int port; /** * Whether the connection should use transport level security (HTTPS). */ protected final boolean secure; /** * The connection timeout for connecting the underlying socket. */ protected final int connectionTimeout; /** * The read timeout for reads on the underlying socket. */ protected final int timeout; /** * The host name of the proxy to connect to. */ protected String proxyHostname; /** * The port on the proxy to connect to. */ protected int proxyPort; /** * The major version of HTTP supported by this client. */ protected int majorVersion; /** * The minor version of HTTP supported by this client. */ protected int minorVersion; private final List connectionListeners; private final List requestListeners; /** * The socket this connection communicates on. */ protected Socket socket; /** * The socket input stream. */ protected InputStream in; /** * The socket output stream. */ protected OutputStream out; /** * Nonce values seen by this connection. */ private Map nonceCounts; /** * The cookie manager for this connection. */ protected CookieManager cookieManager; /** * Creates a new HTTP connection. * @param hostname the name of the host to connect to */ public HTTPConnection(String hostname) { this(hostname, HTTP_PORT, false, 0, 0); } /** * Creates a new HTTP or HTTPS connection. * @param hostname the name of the host to connect to * @param secure whether to use a secure connection */ public HTTPConnection(String hostname, boolean secure) { this(hostname, secure ? HTTPS_PORT : HTTP_PORT, secure, 0, 0); } /** * Creates a new HTTP or HTTPS connection on the specified port. * @param hostname the name of the host to connect to * @param secure whether to use a secure connection * @param connectionTimeout the connection timeout * @param timeout the socket read timeout */ public HTTPConnection(String hostname, boolean secure, int connectionTimeout, int timeout) { this(hostname, secure ? HTTPS_PORT : HTTP_PORT, secure, connectionTimeout, timeout); } /** * Creates a new HTTP connection on the specified port. * @param hostname the name of the host to connect to * @param port the port on the host to connect to */ public HTTPConnection(String hostname, int port) { this(hostname, port, false, 0, 0); } /** * Creates a new HTTP or HTTPS connection on the specified port. * @param hostname the name of the host to connect to * @param port the port on the host to connect to * @param secure whether to use a secure connection */ public HTTPConnection(String hostname, int port, boolean secure) { this(hostname, port, secure, 0, 0); } /** * Creates a new HTTP or HTTPS connection on the specified port. * @param hostname the name of the host to connect to * @param port the port on the host to connect to * @param secure whether to use a secure connection * @param connectionTimeout the connection timeout * @param timeout the socket read timeout */ public HTTPConnection(String hostname, int port, boolean secure, int connectionTimeout, int timeout) { this.hostname = hostname; this.port = port; this.secure = secure; this.connectionTimeout = connectionTimeout; this.timeout = timeout; majorVersion = minorVersion = 1; connectionListeners = Collections.synchronizedList(new ArrayList(4)); requestListeners = Collections.synchronizedList(new ArrayList(4)); } /** * Returns the name of the host to connect to. */ public String getHostName() { return hostname; } /** * Returns the port on the host to connect to. */ public int getPort() { return port; } /** * Indicates whether to use a secure connection or not. */ public boolean isSecure() { return secure; } /** * Returns the HTTP version string supported by this connection. * @see #version */ public String getVersion() { return "HTTP/" + majorVersion + '.' + minorVersion; } /** * Sets the HTTP version supported by this connection. * @param majorVersion the major version * @param minorVersion the minor version */ public void setVersion(int majorVersion, int minorVersion) { if (majorVersion != 1) { throw new IllegalArgumentException("major version not supported: " + majorVersion); } if (minorVersion < 0 || minorVersion > 1) { throw new IllegalArgumentException("minor version not supported: " + minorVersion); } this.majorVersion = majorVersion; this.minorVersion = minorVersion; } /** * Directs this connection to use the specified proxy. * @param hostname the proxy host name * @param port the port on the proxy to connect to */ public void setProxy(String hostname, int port) { proxyHostname = hostname; proxyPort = port; } /** * Indicates whether this connection is using an HTTP proxy. */ public boolean isUsingProxy() { return (proxyHostname != null && proxyPort > 0); } /** * Sets the cookie manager to use for this connection. * @param cookieManager the cookie manager */ public void setCookieManager(CookieManager cookieManager) { this.cookieManager = cookieManager; } /** * Returns the cookie manager in use for this connection. */ public CookieManager getCookieManager() { return cookieManager; } /** * Creates a new request using this connection. * @param method the HTTP method to invoke * @param path the URI-escaped RFC2396 abs_path with * optional query part */ public Request newRequest(String method, String path) { if (method == null || method.length() == 0) { throw new IllegalArgumentException("method must have non-zero length"); } if (path == null || path.length() == 0) { path = "/"; } Request ret = new Request(this, method, path); if ((secure && port != HTTPS_PORT) || (!secure && port != HTTP_PORT)) { ret.setHeader("Host", hostname + ":" + port); } else { ret.setHeader("Host", hostname); } ret.setHeader("User-Agent", userAgent); ret.setHeader("Connection", "keep-alive"); ret.setHeader("Accept-Encoding", "chunked;q=1.0, gzip;q=0.9, deflate;q=0.8, " + "identity;q=0.6, *;q=0"); if (cookieManager != null) { Cookie[] cookies = cookieManager.getCookies(hostname, secure, path); if (cookies != null && cookies.length > 0) { StringBuffer buf = new StringBuffer(); buf.append("$Version=1"); for (int i = 0; i < cookies.length; i++) { buf.append(','); buf.append(' '); buf.append(cookies[i].toString()); } ret.setHeader("Cookie", buf.toString()); } } fireRequestEvent(RequestEvent.REQUEST_CREATED, ret); return ret; } /** * Closes this connection. */ public void close() throws IOException { try { closeConnection(); } finally { fireConnectionEvent(ConnectionEvent.CONNECTION_CLOSED); } } /** * Retrieves the socket associated with this connection. * This creates the socket if necessary. */ protected Socket getSocket() throws IOException { if (socket == null) { String connectHostname = hostname; int connectPort = port; if (isUsingProxy()) { connectHostname = proxyHostname; connectPort = proxyPort; } socket = new Socket(); InetAddress address = InetAddress.getByName(connectHostname); InetSocketAddress socketAddress = new InetSocketAddress(address, connectPort); if (connectionTimeout > 0) { socket.connect(socketAddress, connectionTimeout); } else { socket.connect(socketAddress); } if (timeout > 0) { socket.setSoTimeout(timeout); } if (secure) { try { TrustManager tm = new EmptyX509TrustManager(); SSLContext context = SSLContext.getInstance("SSL"); TrustManager[] trust = new TrustManager[] { tm }; context.init(null, trust, null); SSLSocketFactory factory = context.getSocketFactory(); SSLSocket ss = (SSLSocket) factory.createSocket(socket, connectHostname, connectPort, true); String[] protocols = { "TLSv1", "SSLv3" }; ss.setEnabledProtocols(protocols); ss.setUseClientMode(true); ss.startHandshake(); socket = ss; } catch (GeneralSecurityException e) { throw new IOException(e.getMessage()); } } in = socket.getInputStream(); in = new BufferedInputStream(in); out = socket.getOutputStream(); out = new BufferedOutputStream(out); } return socket; } protected InputStream getInputStream() throws IOException { if (socket == null) { getSocket(); } return in; } protected OutputStream getOutputStream() throws IOException { if (socket == null) { getSocket(); } return out; } /** * Closes the underlying socket, if any. */ protected void closeConnection() throws IOException { if (socket != null) { try { socket.close(); } finally { socket = null; } } } /** * Returns a URI representing the connection. * This does not include any request path component. */ protected String getURI() { StringBuffer buf = new StringBuffer(); buf.append(secure ? "https://" : "http://"); buf.append(hostname); if (secure) { if (port != HTTPConnection.HTTPS_PORT) { buf.append(':'); buf.append(port); } } else { if (port != HTTPConnection.HTTP_PORT) { buf.append(':'); buf.append(port); } } return buf.toString(); } /** * Get the number of times the specified nonce has been seen by this * connection. */ int getNonceCount(String nonce) { if (nonceCounts == null) { return 0; } return((Integer) nonceCounts.get(nonce)).intValue(); } /** * Increment the number of times the specified nonce has been seen. */ void incrementNonce(String nonce) { int current = getNonceCount(nonce); if (nonceCounts == null) { nonceCounts = new HashMap(); } nonceCounts.put(nonce, new Integer(current + 1)); } // -- Events -- public void addConnectionListener(ConnectionListener l) { synchronized (connectionListeners) { connectionListeners.add(l); } } public void removeConnectionListener(ConnectionListener l) { synchronized (connectionListeners) { connectionListeners.remove(l); } } protected void fireConnectionEvent(int type) { ConnectionEvent event = new ConnectionEvent(this, type); ConnectionListener[] l = null; synchronized (connectionListeners) { l = new ConnectionListener[connectionListeners.size()]; connectionListeners.toArray(l); } for (int i = 0; i < l.length; i++) { switch (type) { case ConnectionEvent.CONNECTION_CLOSED: l[i].connectionClosed(event); break; } } } public void addRequestListener(RequestListener l) { synchronized (requestListeners) { requestListeners.add(l); } } public void removeRequestListener(RequestListener l) { synchronized (requestListeners) { requestListeners.remove(l); } } protected void fireRequestEvent(int type, Request request) { RequestEvent event = new RequestEvent(this, type, request); RequestListener[] l = null; synchronized (requestListeners) { l = new RequestListener[requestListeners.size()]; requestListeners.toArray(l); } for (int i = 0; i < l.length; i++) { switch (type) { case RequestEvent.REQUEST_CREATED: l[i].requestCreated(event); break; case RequestEvent.REQUEST_SENDING: l[i].requestSent(event); break; case RequestEvent.REQUEST_SENT: l[i].requestSent(event); break; } } } } inetlib-1.1.2/source/gnu/inet/http/SimpleCookieManager.java0000664000076400007640000001045411345235566020642 00000000000000/* * CookieManager.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * A simple non-persistent cookie manager. This class can be extended to * provide cookie persistence. * * @author Chris Burdess */ public class SimpleCookieManager implements CookieManager { /** * The cookie cache. * This is a dictionary mapping domains to maps of cookies by name. */ protected Map cookies; /** * Constructor. */ public SimpleCookieManager() { cookies = new HashMap(); } public void setCookie(Cookie cookie) { String domain = cookie.getDomain(); Map map =(Map) cookies.get(domain); if (map == null) { map = new HashMap(); cookies.put(domain, map); } String name = cookie.getName(); map.put(name, cookie); // will replace a cookie of the same name } public Cookie[] getCookies(String host, boolean secure, String path) { List matches = new ArrayList(); Date now = new Date(); if (Character.isLetter(host.charAt(0))) { int di = host.indexOf('.'); while (di != -1) { addCookies(matches, host, secure, path, now); host = host.substring(di); di = host.indexOf('.', 1); } } addCookies(matches, host, secure, path, now); Cookie[] ret = new Cookie[matches.size()]; matches.toArray(ret); return ret; } private void addCookies(List matches, String domain, boolean secure, String path, Date now) { Map map = (Map) cookies.get(domain); if (map != null) { List expired = new ArrayList(); for (Iterator i = map.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); Cookie cookie = (Cookie) entry.getValue(); Date expires = cookie.getExpiryDate(); if (expires != null && expires.before(now)) { expired.add(entry.getKey()); continue; } if (secure && !cookie.isSecure()) { continue; } if (path.startsWith(cookie.getPath())) { matches.add(cookie); } } // Good housekeeping for (Iterator i = expired.iterator(); i.hasNext(); ) { map.remove(i.next()); } } } } inetlib-1.1.2/source/gnu/inet/http/CookieManager.java0000664000076400007640000000473011345235566017470 00000000000000/* * CookieManager.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; /** * Cookie manager interface. * If an application wants to handle cookies, they should implement this * interface and register the instance with each HTTPConnection they use. * * @author Chris Burdess */ public interface CookieManager { /** * Stores a cookie in the cookie manager. * @param cookie the cookie to store */ void setCookie(Cookie cookie); /** * Retrieves the cookies matching the specified criteria. * @param host the host name * @param secure whether the connection is secure * @param path the path to access */ Cookie[] getCookies(String host, boolean secure, String path); } inetlib-1.1.2/source/gnu/inet/http/Cookie.java0000664000076400007640000000754611345235566016205 00000000000000/* * Cookie.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; import java.text.ParseException; import java.util.Date; /** * An HTTP cookie, as specified in RFC 2109. * * @author Chris Burdess */ public class Cookie { /** * The name of the cookie. */ protected final String name; /** * The value of the cookie. */ protected final String value; /** * Optional documentation of the intended use of the cookie. */ protected final String comment; /** * The domain for which the cookie is valid. */ protected final String domain; /** * Optional subset of URL paths within the domain for which the cookie is * valid. */ protected final String path; /** * Indicates that the user-agent should only use secure means to transmit * this cookie to the server. */ protected final boolean secure; /** * The date at which this cookie expires. */ protected final Date expires; public Cookie(String name, String value, String comment, String domain, String path, boolean secure, Date expires) { this.name = name; this.value = value; this.comment = comment; this.domain = domain; this.path = path; this.secure = secure; this.expires = expires; } public String getName() { return name; } public String getValue() { return value; } public String getComment() { return comment; } public String getDomain() { return domain; } public String getPath() { return path; } public boolean isSecure() { return secure; } public Date getExpiryDate() { return expires; } public String toString() { return toString(true, true); } public String toString(boolean showPath, boolean showDomain) { StringBuffer buf = new StringBuffer(); buf.append(name); buf.append('='); buf.append(value); if (showPath) { buf.append("; $Path="); buf.append(path); } if (showDomain) { buf.append("; $Domain="); buf.append(domain); } return buf.toString(); } } inetlib-1.1.2/source/gnu/inet/http/event/0000775000076400007640000000000011347412570015310 500000000000000inetlib-1.1.2/source/gnu/inet/http/event/RequestEvent.java0000664000076400007640000000563611345235566020545 00000000000000/* * RequestEvent.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http.event; import java.util.EventObject; import gnu.inet.http.Request; /** * A request event. * * @author Chris Burdess */ public class RequestEvent extends EventObject { /** * The request created event type. */ public static final int REQUEST_CREATED = 0; /** * The request sending event type. */ public static final int REQUEST_SENDING = 1; /** * The request sent event type. */ public static final int REQUEST_SENT = 2; /** * The type of this event. */ protected int type; /** * The request associated with this event. */ protected Request request; /** * Constructs a request event with the specified source, type, and request. */ public RequestEvent(Object source, int type, Request request) { super(source); this.type = type; this.request = request; } /** * Returns the type of this event. * @see #type */ public int getType() { return type; } /** * Returns the request associated with this event. */ public Request getRequest() { return request; } } inetlib-1.1.2/source/gnu/inet/http/event/RequestListener.java0000664000076400007640000000470011345235566021240 00000000000000/* * RequestListener.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http.event; import java.util.EventListener; /** * A request listener. * * @author Chris Burdess */ public interface RequestListener extends EventListener { /** * Callback invoked when a request is created from the associated * connection. */ void requestCreated(RequestEvent event); /** * Callback invoked when the request has been initialised with all data * and before sending this data to the server. */ void requestSending(RequestEvent event); /** * Callback invoked after all request data has been sent to the server. */ void requestSent(RequestEvent event); } inetlib-1.1.2/source/gnu/inet/http/event/ConnectionEvent.java0000664000076400007640000000471111345235566021205 00000000000000/* * ConnectionEvent.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http.event; import java.util.EventObject; /** * A connection event. * * @author Chris Burdess */ public class ConnectionEvent extends EventObject { /** * The connection closed event type. */ public static final int CONNECTION_CLOSED = 0; /** * The type of this event. */ protected int type; /** * Constructs a connection event with the specified source and type. */ public ConnectionEvent(Object source, int type) { super(source); this.type = type; } /** * Returns the type of this event. * @see #type */ public int getType() { return type; } } inetlib-1.1.2/source/gnu/inet/http/event/ConnectionListener.java0000664000076400007640000000420711345235566021711 00000000000000/* * ConnectionListener.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http.event; import java.util.EventListener; /** * A connection listener. * * @author Chris Burdess */ public interface ConnectionListener extends EventListener { /** * Callback invoked when the associated connection is closed. */ void connectionClosed(ConnectionEvent event); } inetlib-1.1.2/source/gnu/inet/http/Credentials.java0000664000076400007640000000503611345235566017221 00000000000000/* * Credentials.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; /** * Represents a username/password combination that can be used to * authenticate to an HTTP server. * * @author Chris Burdess */ public class Credentials { /** * The username. */ private String username; /** * The password. */ private String password; /** * Constructor. * @param username the username * @param password the password */ public Credentials(String username, String password) { this.username = username; this.password = password; } /** * Returns the username. */ public String getUsername() { return username; } /** * Returns the password. */ public String getPassword() { return password; } } inetlib-1.1.2/source/gnu/inet/http/package.html0000664000076400007640000000225311345235566016400 00000000000000

    This package contains an HTTP/1.1 client, as described in RFC 2616. It supports the following features:

    • Persistent connections
    • Basic and Digest authentication (RFC 2617)
    • HTTPS
    • HTTP proxies
    • HTTP/1.0 compatibility
    • Support for WebDAV methods and other HTTP extensions
    • Automatic decoding of the chunked transfer-coding
    • Parsing of HTTP date headers
    • Support for the 100-continue expectation

    The API is similar to the neon WebDAV/HTTP library. A logical connection to the server is instantiated, and multiple requests can be issued for this connection. Each request has an atomic dispatch method which returns the response. All I/O, authentication, etc is handled by registering callback objects with the request prior to dispatch, which are notified during the dispatch procedure as necessary. Simple byte-array content callbacks are supplied which can manage any request/response content that fits in available memory.

    An URL stream handler is provided, supporting the full HttpURLConnection specification.

    inetlib-1.1.2/source/gnu/inet/http/ByteArrayResponseBodyReader.java0000664000076400007640000000666411345235566022356 00000000000000/* * ByteArrayResponseBodyReader.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.http; /** * Simple response body reader that stores content in a byte array. * * @author Chris Burdess */ public class ByteArrayResponseBodyReader implements ResponseBodyReader { /** * The content. */ protected byte[] content; /** * The position in the content at which the next write will occur. */ protected int pos; /** * The length of the buffer. */ protected int len; /** * Constructs a new byte array response body reader. */ public ByteArrayResponseBodyReader() { this(4096); } /** * Constructs a new byte array response body reader with the specified * initial buffer size. * @param size the initial buffer size */ public ByteArrayResponseBodyReader(int size) { content = new byte[size]; pos = len = 0; } /** * This reader accepts all responses. */ public boolean accept(Request request, Response response) { return true; } public void read(byte[] buffer, int offset, int length) { int l = length - offset; if (pos + l > content.length) { byte[] tmp = new byte[content.length * 2]; System.arraycopy(content, 0, tmp, 0, pos); content = tmp; } System.arraycopy(buffer, offset, content, pos, l); pos += l; len = pos; } public void close() { pos = 0; } /** * Retrieves the content of this reader as a byte array. * The size of the returned array is the number of bytes read. */ public byte[] toByteArray() { byte[] ret = new byte[len]; System.arraycopy(content, 0, ret, 0, len); return ret; } } inetlib-1.1.2/source/gnu/inet/smtp/0000775000076400007640000000000011347412570014173 500000000000000inetlib-1.1.2/source/gnu/inet/smtp/Parameter.java0000664000076400007640000000504711345235566016712 00000000000000/* * Parameter.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.smtp; /** * An ESMTP parameter. * * @author Chris Burdess */ public final class Parameter { final String key; final String value; /** * Creates a new parameter with the specified key and value. * @param key the key * @param value the value */ public Parameter(String key, String value) { this.key = key; this.value = value; } /** * Returns the key. */ public String getKey() { return key; } /** * Returns the value. */ public String getValue() { return value; } /** * String form. */ public String toString() { if (value == null) { return key; } else { return key + '=' + value; } } } inetlib-1.1.2/source/gnu/inet/smtp/SMTPConnection.java0000664000076400007640000006110711345235566017574 00000000000000/* * SMTPConnection.java * Copyright (C) 2003 Chris Burdess * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.smtp; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.ProtocolException; import java.net.Socket; import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.security.auth.callback.CallbackHandler; import javax.security.sasl.Sasl; import javax.security.sasl.SaslClient; import javax.security.sasl.SaslException; import gnu.inet.util.BASE64; import gnu.inet.util.CRLFInputStream; import gnu.inet.util.CRLFOutputStream; import gnu.inet.util.EmptyX509TrustManager; import gnu.inet.util.LineInputStream; import gnu.inet.util.MessageOutputStream; import gnu.inet.util.SaslCallbackHandler; import gnu.inet.util.SaslCramMD5; import gnu.inet.util.SaslInputStream; import gnu.inet.util.SaslLogin; import gnu.inet.util.SaslOutputStream; import gnu.inet.util.SaslPlain; import gnu.inet.util.TraceLevel; /** * An SMTP client. * This implements RFC 2821. * * @author Chris Burdess */ public class SMTPConnection { /** * The network trace level. */ public static final Level SMTP_TRACE = new TraceLevel("smtp"); /** * The default SMTP port. */ public static final int DEFAULT_PORT = 25; protected static final String MAIL_FROM = "MAIL FROM:"; protected static final String RCPT_TO = "RCPT TO:"; protected static final String SP = " "; protected static final String DATA = "DATA"; protected static final String FINISH_DATA = "\n."; protected static final String RSET = "RSET"; protected static final String VRFY = "VRFY"; protected static final String EXPN = "EXPN"; protected static final String HELP = "HELP"; protected static final String NOOP = "NOOP"; protected static final String QUIT = "QUIT"; protected static final String HELO = "HELO"; protected static final String EHLO = "EHLO"; protected static final String AUTH = "AUTH"; protected static final String STARTTLS = "STARTTLS"; protected static final int INFO = 214; protected static final int READY = 220; protected static final int OK = 250; protected static final int OK_NOT_LOCAL = 251; protected static final int OK_UNVERIFIED = 252; protected static final int SEND_DATA = 354; protected static final int AMBIGUOUS = 553; /** * The logger used for SMTP protocol traces. */ public final Logger logger = Logger.getLogger("gnu.inet.smtp"); /** * The underlying socket used for communicating with the server. */ protected Socket socket; /** * The input stream used to read responses from the server. */ protected LineInputStream in; /** * The output stream used to send commands to the server. */ protected CRLFOutputStream out; /** * The last response message received from the server. */ protected String response; /** * If true, there are more responses to read. */ protected boolean continuation; /** * The greeting message given by the server. */ protected String greeting; /** * Creates a new connection to the specified host, using the default SMTP * port. * @param host the server hostname */ public SMTPConnection(String host) throws IOException { this(host, DEFAULT_PORT, 0, 0, false, null); } /** * Creates a new connection to the specified host, using the specified * port. * @param host the server hostname * @param port the port to connect to */ public SMTPConnection(String host, int port) throws IOException { this(host, port, 0, 0, false, null); } /** * Creates a new connection to the specified host, using the specified * port. * @param host the server hostname * @param port the port to connect to * @param connectionTimeout the connection timeout in milliseconds * @param timeout the I/O timeout in milliseconds */ public SMTPConnection(String host, int port, int connectionTimeout, int timeout) throws IOException { this(host, port, connectionTimeout, timeout, false, null); } /** * Creates a new connection to the specified host, using the specified * port. * @param host the server hostname * @param port the port to connect to * @param connectionTimeout the connection timeout in milliseconds * @param timeout the I/O timeout in milliseconds * @param secure true to create an SMTPS connection * @param tm a trust manager used to check SSL certificates, or null to * use the default */ public SMTPConnection(String host, int port, int connectionTimeout, int timeout, boolean secure, TrustManager tm) throws IOException { this(host, port, connectionTimeout, timeout, secure, tm, true); } /** * Creates a new connection to the specified host, using the specified * port. * @param host the server hostname * @param port the port to connect to * @param connectionTimeout the connection timeout in milliseconds * @param timeout the I/O timeout in milliseconds * @param secure true to create an SMTPS connection * @param tm a trust manager used to check SSL certificates, or null to * use the default * @param init initialise the connection */ public SMTPConnection(String host, int port, int connectionTimeout, int timeout, boolean secure, TrustManager tm, boolean init) throws IOException { if (port <= 0) { port = DEFAULT_PORT; } response = null; continuation = false; // Initialise socket try { socket = new Socket(); InetSocketAddress address = new InetSocketAddress(host, port); if (connectionTimeout > 0) { socket.connect(address, connectionTimeout); } else { socket.connect(address); } if (timeout > 0) { socket.setSoTimeout(timeout); } if (secure) { SSLSocketFactory factory = getSSLSocketFactory(tm); SSLSocket ss = (SSLSocket) factory.createSocket(socket, host, port, true); String[] protocols = { "TLSv1", "SSLv3" }; ss.setEnabledProtocols(protocols); ss.setUseClientMode(true); ss.startHandshake(); socket = ss; } } catch (GeneralSecurityException e) { IOException e2 = new IOException(); e2.initCause(e); throw e2; } // Initialise streams InputStream is = socket.getInputStream(); is = new BufferedInputStream(is); is = new CRLFInputStream(is); in = new LineInputStream(is); OutputStream os = socket.getOutputStream(); os = new BufferedOutputStream(os); out = new CRLFOutputStream(os); if (init) init(); } /** * Initialises the connection. * Unless the init parameter was provided with the value false, * do not call this method. Otherwise call it only once after e.g. * configuring logging. */ public void init() throws IOException { // Greeting StringBuffer greetingBuffer = new StringBuffer(); boolean notFirst = false; do { if (getResponse() != READY) { throw new ProtocolException(response); } if (notFirst) { greetingBuffer.append('\n'); } else { notFirst = true; } greetingBuffer.append(response); } while (continuation); greeting = greetingBuffer.toString(); } /** * Returns the server greeting message. */ public String getGreeting() { return greeting; } /** * Returns the text of the last response received from the server. */ public String getLastResponse() { return response; } // -- 3.3 Mail transactions -- /** * Execute a MAIL command. * @param reversePath the source mailbox(from address) * @param parameters optional ESMTP parameters * @return true if accepted, false otherwise */ public boolean mailFrom(String reversePath, ParameterList parameters) throws IOException { StringBuffer command = new StringBuffer(MAIL_FROM); command.append('<'); command.append(reversePath); command.append('>'); if (parameters != null) { command.append(SP); command.append(parameters); } send(command.toString()); switch (getAllResponses()) { case OK: case OK_NOT_LOCAL: case OK_UNVERIFIED: return true; default: return false; } } /** * Execute a RCPT command. * @param forwardPath the forward-path(recipient address) * @param parameters optional ESMTP parameters * @return true if successful, false otherwise */ public boolean rcptTo(String forwardPath, ParameterList parameters) throws IOException { StringBuffer command = new StringBuffer(RCPT_TO); command.append('<'); command.append(forwardPath); command.append('>'); if (parameters != null) { command.append(SP); command.append(parameters); } send(command.toString()); switch (getAllResponses()) { case OK: case OK_NOT_LOCAL: case OK_UNVERIFIED: return true; default: return false; } } /** * Requests an output stream to write message data to. * When the entire message has been written to the stream, the * flush method must be called on the stream. Until then no * further methods should be called on the connection. * Immediately after this procedure is complete, finishData * must be called to complete the transfer and determine its success. * @return a stream for writing messages to */ public OutputStream data() throws IOException { send(DATA); switch (getAllResponses()) { case SEND_DATA: return new MessageOutputStream(out); default: throw new ProtocolException(response); } } /** * Completes the DATA procedure. * @see #data * @return true id transfer was successful, false otherwise */ public boolean finishData() throws IOException { send(FINISH_DATA); switch (getAllResponses()) { case OK: return true; default: return false; } } /** * Aborts the current mail transaction. */ public void rset() throws IOException { send(RSET); if (getAllResponses() != OK) { throw new ProtocolException(response); } } // -- 3.5 Commands for Debugging Addresses -- /** * Returns a list of valid possibilities for the specified address, or * null on failure. * @param address a mailbox, or real name and mailbox */ public List vrfy(String address) throws IOException { String command = VRFY + ' ' + address; send(command); List list = new ArrayList(); do { switch (getResponse()) { case OK: case AMBIGUOUS: response = response.trim(); if (response.indexOf('@') != -1) { list.add(response); } else if (response.indexOf('<') != -1) { list.add(response); } else if (response.indexOf(' ') == -1) { list.add(response); } break; default: return null; } } while (continuation); return Collections.unmodifiableList(list); } /** * Returns a list of valid possibilities for the specified mailing list, * or null on failure. * @param address a mailing list name */ public List expn(String address) throws IOException { String command = EXPN + ' ' + address; send(command); List list = new ArrayList(); do { switch (getResponse()) { case OK: response = response.trim(); list.add(response); break; default: return null; } } while (continuation); return Collections.unmodifiableList(list); } /** * Returns some useful information about the specified parameter. * Typically this is a command. * @param arg the context of the query, or null for general information * @return a list of possibly useful information, or null if the command * failed. */ public List help(String arg) throws IOException { String command = (arg == null) ? HELP : HELP + ' ' + arg; send(command); List list = new ArrayList(); do { switch (getResponse()) { case INFO: list.add(response); break; default: return null; } } while (continuation); return Collections.unmodifiableList(list); } /** * Issues a NOOP command. * This does nothing, but can be used to keep the connection alive. */ public void noop() throws IOException { send(NOOP); getAllResponses(); } /** * Close the connection to the server. */ public void quit() throws IOException { try { send(QUIT); getAllResponses(); /* RFC 2821 states that the server MUST send an OK reply here, but * many don't: postfix, for instance, sends 221. * In any case we have done our best. */ } catch (IOException e) { } finally { // Close the socket anyway. socket.close(); } } /** * Issues a HELO command. * @param hostname the local host name */ public boolean helo(String hostname) throws IOException { String command = HELO + ' ' + hostname; send(command); return (getAllResponses() == OK); } /** * Issues an EHLO command. * If successful, returns a list of the SMTP extensions supported by the * server. * Otherwise returns null, and HELO should be called. * @param hostname the local host name */ public List ehlo(String hostname) throws IOException { String command = EHLO + ' ' + hostname; send(command); List extensions = new ArrayList(); do { switch (getResponse()) { case OK: extensions.add(response); break; default: return null; } } while (continuation); return Collections.unmodifiableList(extensions); } /** * Returns a configured SSLSocketFactory to use in creating new SSL * sockets. * @param tm an optional trust manager to use */ protected SSLSocketFactory getSSLSocketFactory(TrustManager tm) throws GeneralSecurityException { if (tm == null) { tm = new EmptyX509TrustManager(); } SSLContext context = SSLContext.getInstance("TLS"); TrustManager[] trust = new TrustManager[] { tm }; context.init(null, trust, null); return context.getSocketFactory(); } /** * Negotiate TLS over the current connection. * This depends on many features, such as the JSSE classes being in the * classpath. Returns true if successful, false otherwise. */ public boolean starttls() throws IOException { return starttls(new EmptyX509TrustManager()); } /** * Negotiate TLS over the current connection. * This depends on many features, such as the JSSE classes being in the * classpath. Returns true if successful, false otherwise. * @param tm the custom trust manager to use */ public boolean starttls(TrustManager tm) throws IOException { try { SSLSocketFactory factory = getSSLSocketFactory(tm); send(STARTTLS); if (getAllResponses() != READY) { return false; } String hostname = socket.getInetAddress().getHostName(); int port = socket.getPort(); SSLSocket ss = (SSLSocket) factory.createSocket(socket, hostname, port, true); String[] protocols = { "TLSv1", "SSLv3" }; ss.setEnabledProtocols(protocols); ss.setUseClientMode(true); ss.startHandshake(); // Set up streams InputStream is = ss.getInputStream(); is = new BufferedInputStream(is); is = new CRLFInputStream(is); in = new LineInputStream(is); OutputStream os = ss.getOutputStream(); os = new BufferedOutputStream(os); out = new CRLFOutputStream(os); return true; } catch (GeneralSecurityException e) { return false; } } // -- Authentication -- /** * Authenticates the connection using the specified SASL mechanism, * username, and password. * @param mechanism a SASL authentication mechanism, e.g. LOGIN, PLAIN, * CRAM-MD5, GSSAPI * @param username the authentication principal * @param password the authentication credentials * @return true if authentication was successful, false otherwise */ public boolean authenticate(String mechanism, String username, String password) throws IOException { try { String[] m = new String[] { mechanism }; CallbackHandler ch = new SaslCallbackHandler(username, password); // Avoid lengthy callback procedure for GNU Crypto HashMap p = new HashMap(); p.put("gnu.crypto.sasl.username", username); p.put("gnu.crypto.sasl.password", password); SaslClient sasl = Sasl.createSaslClient(m, null, "smtp", socket.getInetAddress().getHostName(), p, ch); if (sasl == null) { // Fall back to home-grown SASL clients if ("LOGIN".equalsIgnoreCase(mechanism)) { sasl = new SaslLogin(username, password); } else if ("PLAIN".equalsIgnoreCase(mechanism)) { sasl = new SaslPlain(username, password); } else if ("CRAM-MD5".equalsIgnoreCase(mechanism)) { sasl = new SaslCramMD5(username, password); } else { return false; } } StringBuffer cmd = new StringBuffer(AUTH); cmd.append(' '); cmd.append(mechanism); if (sasl.hasInitialResponse()) { cmd.append(' '); byte[] init = sasl.evaluateChallenge(new byte[0]); if (init.length == 0) { cmd.append('='); } else { cmd.append(new String(BASE64.encode(init), "US-ASCII")); } } send(cmd.toString()); while (true) { switch (getAllResponses()) { case 334: try { byte[] c0 = response.getBytes("US-ASCII"); byte[] c1 = BASE64.decode(c0); // challenge byte[] r0 = sasl.evaluateChallenge(c1); byte[] r1 = BASE64.encode(r0); // response out.write(r1); out.write(0x0d); out.flush(); logger.log(SMTP_TRACE, "> " + new String(r1, "US-ASCII")); } catch (SaslException e) { // Error in SASL challenge evaluation - cancel exchange out.write(0x2a); out.write(0x0d); out.flush(); logger.log(SMTP_TRACE, "> *"); } break; case 235: String qop = (String) sasl.getNegotiatedProperty(Sasl.QOP); if ("auth-int".equalsIgnoreCase(qop) || "auth-conf".equalsIgnoreCase(qop)) { InputStream is = socket.getInputStream(); is = new BufferedInputStream(is); is = new SaslInputStream(sasl, is); is = new CRLFInputStream(is); in = new LineInputStream(is); OutputStream os = socket.getOutputStream(); os = new BufferedOutputStream(os); os = new SaslOutputStream(sasl, os); out = new CRLFOutputStream(os); } return true; default: return false; } } } catch (SaslException e) { logger.log(SMTP_TRACE, e.getMessage(), e); return false; // No provider for mechanism } catch (RuntimeException e) { logger.log(SMTP_TRACE, e.getMessage(), e); return false; // No javax.security.sasl classes } } // -- Utility methods -- /** * Send the specified command string to the server. * @param command the command to send */ protected void send(String command) throws IOException { logger.log(SMTP_TRACE, "> " + command); out.write(command.getBytes("US-ASCII")); out.write(0x0d); out.flush(); } /** * Returns the next response from the server. */ protected int getResponse() throws IOException { String line = null; try { line = in.readLine(); // Handle special case eg 334 where CRLF occurs after code. if (line.length() < 4) { line = line + '\n' + in.readLine(); } logger.log(SMTP_TRACE, "< " + line); int code = Integer.parseInt(line.substring(0, 3)); continuation = (line.charAt(3) == '-'); response = line.substring(4); return code; } catch (NumberFormatException e) { throw new ProtocolException("Unexpected response: " + line); } } /** * Returns the next response from the server. * If the response is a continuation, continues to read responses until * continuation ceases. If a different response code from the first is * encountered, this causes a protocol exception. */ protected int getAllResponses() throws IOException { int code1, code; boolean err = false; code1 = code = getResponse(); while (continuation) { code = getResponse(); if (code != code1) { err = true; } } if (err) { throw new ProtocolException("Conflicting response codes"); } return code; } } inetlib-1.1.2/source/gnu/inet/smtp/ParameterList.java0000664000076400007640000000606611345235566017550 00000000000000/* * ParameterList.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.smtp; import java.util.ArrayList; import java.util.List; /** * A list of ESMTP parameters. * * @author Chris Burdess */ public final class ParameterList { private List parameters = new ArrayList(); /** * Returns the number of parameters in the list. */ public int size() { synchronized (parameters) { return parameters.size(); } } /** * Returns the parameter at the specified index. */ public Parameter get(int index) { synchronized (parameters) { return(Parameter) parameters.get(index); } } /** * Adds a new parameter to the list. */ public void add(Parameter parameter) { synchronized (parameters) { parameters.add(parameter); } } /** * String form. */ public String toString() { synchronized (parameters) { int len = parameters.size(); if (len == 0) { return ""; } StringBuffer buffer = new StringBuffer(); buffer.append(parameters.get(0)); for (int i = 1; i < len; i++) { buffer.append(' '); buffer.append(parameters.get(i)); } return buffer.toString(); } } } inetlib-1.1.2/source/gnu/inet/smtp/package.html0000664000076400007640000000020011345235566016372 00000000000000

    This package includes a complete ESMTP client. SASL authentication and TLS negotiation are supported.

    inetlib-1.1.2/source/gnu/inet/ldap/0000775000076400007640000000000011347412570014130 500000000000000inetlib-1.1.2/source/gnu/inet/ldap/LDAPResult.java0000664000076400007640000001207511345235566016645 00000000000000/* * LDAPResult.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ldap; /** * An LDAP result structure. * * @author Chris Burdess */ public class LDAPResult { public static final int SUCCESS = 0; public static final int OPERATIONS_ERROR = 1; public static final int PROTOCOL_ERROR = 2; public static final int TIME_LIMIT_EXCEEDED = 3; public static final int SIZE_LIMIT_EXCEEDED = 4; public static final int COMPARE_FALSE = 5; public static final int COMPARE_TRUE = 6; public static final int AUTH_METHOD_NOT_SUPPORTED = 7; public static final int STRONG_AUTH_REQUIRED = 8; public static final int REFERRAL = 10; public static final int ADMIN_LIMIT_EXCEEDED = 11; public static final int UNAVAILABLE_CRITICAL_EXTENSION = 12; public static final int CONFIDENTIALITY_REQUIRED = 13; public static final int SASL_BIND_IN_PROGRESS = 14; public static final int NO_SUCH_ATTRIBUTE = 16; public static final int UNDEFINED_ATTRIBUTE_TYPE = 17; public static final int INAPPROPRIATE_MATCHING = 18; public static final int CONSTRAINT_VIOLATION = 19; public static final int ATTRIBUTE_OR_VALUE_EXISTS = 20; public static final int INVALID_ATTRIBUTE_SYNTAX = 21; public static final int NO_SUCH_OBJECT = 32; public static final int ALIAS_PROBLEM = 33; public static final int INVALID_DN_SYNTAX = 34; public static final int ALIAS_DEREFERENCING_PROBLEM = 36; public static final int INAPPROPRIATE_AUTHENTICATION = 48; public static final int INVALID_CREDENTIALS = 49; public static final int INSUFFICIENT_ACCESS_RIGHTS = 50; public static final int BUSY = 51; public static final int UNAVAILABLE = 52; public static final int UNWILLING_TO_PERFORM = 53; public static final int LOOP_DETECT = 54; public static final int NAMING_VIOLATION = 64; public static final int OBJECT_CLASS_VIOLATION = 65; public static final int NOT_ALLOWED_ON_NON_LEAF = 66; public static final int NOT_ALLOWED_ON_RDN = 67; public static final int ENTRY_ALREADY_EXISTS = 68; public static final int OBJECT_CLASS_MODS_PROHIBITED = 69; public static final int AFFECTS_MULTIPLE_DSAS = 71; public static final int OTHER = 80; /** * The result code associated with this result. */ public final int status; /** * The name of the matching entry. */ public final String matchedDN; /** * An associated error message. */ public final String errorMessage; /** * A list of LDAP URLs to refer to if the status is REFERRAL. */ public final String[] referrals; protected LDAPResult(int status, String matchedDN, String errorMessage, String[] referrals) { this.status = status; this.matchedDN = matchedDN; this.errorMessage = errorMessage; this.referrals = referrals; } /** * Debugging. */ public String toString() { StringBuffer buffer = new StringBuffer(getClass().getName()); buffer.append('['); buffer.append("status="); buffer.append(status); buffer.append(",matchedDN="); buffer.append(matchedDN); if (errorMessage != null) { buffer.append(",errorMessage="); buffer.append(errorMessage); } if (referrals != null) { buffer.append(",referrals="); buffer.append(referrals.toString()); } buffer.append(']'); return buffer.toString(); } } inetlib-1.1.2/source/gnu/inet/ldap/AttributeValues.java0000664000076400007640000000512611345235566020050 00000000000000/* * AttributeValues.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ldap; import java.util.Set; /** * An attribute type and set of values to associate with it. * * @author Chris Burdess */ public class AttributeValues { /** * The attribute type. */ protected final String type; /** * The values to assign. */ protected final Set values; /** * Constructor. * @param type the attribute type * @param values the values to assign */ public AttributeValues(String type, Set values) { if (type == null) { throw new NullPointerException("type"); } this.type = type; this.values = values; } /** * @see #type */ public String getType() { return type; } /** * @see #values */ public Set getValues() { return values; } } inetlib-1.1.2/source/gnu/inet/ldap/ResultHandler.java0000664000076400007640000000626511345235566017506 00000000000000/* * ResultHandler.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ldap; import java.util.List; import java.util.Map; /** * Callback handler for receiving notification of search results. * The application must pass an implementation of this interface into the * LDAPConnection.search method. Search responses received * during the execution of the method result in calls to the methods defined * in this interface. * * @author Chris Burdess */ public interface ResultHandler { /** * Receive an LDAP SearchResultEntry response. * The attributes map provides a mapping of attribute names to values. In * the case where typesOnly was true, the value * for each attribute will be null. Otherwise it will be a Set of * attribute values, which may be of the following types: *
      *
    • java.lang.String
    • *
    • java.lang.Integer
    • *
    • java.lang.Double
    • *
    • java.lang.Boolean
    • *
    • byte[]
    • *
        * @param name the object name DN * @param attributes a map of attribute names to values */ void searchResultEntry(String name, Map attributes); /** * Receive an LDAP SearchResultReference response. * The argument to this function is a sequence of LDAP URLs, one for each * entry not explored by the server during the search. * @param urls the list of LDAP URLs */ void searchResultReference(List urls); } inetlib-1.1.2/source/gnu/inet/ldap/BERDecoder.java0000664000076400007640000002061211345235566016620 00000000000000/* * BERDecoder.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ldap; import java.io.ByteArrayOutputStream; import java.io.UnsupportedEncodingException; /** * Utility class for decoding BER values. * For each value to be read, the application must call parseType * to return the type of the value, then the specific * parseXXX method for the type to return the actual * value, or skip to skip the value. * * @author Chris Burdess */ public class BERDecoder { private byte[] buffer; private int offset; private int type; private int len; private boolean control; private boolean utf8; public BERDecoder(byte[] data, boolean utf8) { buffer = data; offset = 0; control = true; this.utf8 = utf8; } /** * Returns the type of the current value record. * If there are no more records to read, this method returns -1. */ public int parseType() throws BERException { if (offset >= buffer.length) { return -1; } type = byteToInt(buffer[offset++]); len = byteToInt(buffer[offset++]); if ((len & 0x80) != 0) { int lsize = len - 0x80; if (lsize > 4) { throw new BERException("Data too long: " + lsize); } if (buffer.length - offset < lsize) { throw new BERException("Insufficient data"); } len = 0; for (int i = 0; i < lsize; i++) { len = (len << 8) + byteToInt(buffer[offset++]); } if (buffer.length - offset < len) { throw new BERException("Insufficient data"); } } control = false; return type; } static int byteToInt(byte b) { int ret = (int) b; if (ret < 0) { ret += 0x100; } return ret; } int getLength() { return len; } public boolean available() { return (offset < buffer.length); } public void skip() { offset += len; control = true; } public boolean parseBoolean() throws BERException { if (control) { parseType(); } if (type != BERConstants.BOOLEAN) { throw new BERException("Unexpected type: " + type); } int c = (int) buffer[offset++]; control = true; return (c != 0); } public int parseInt() throws BERException { if (control) { parseType(); } if (type != BERConstants.INTEGER && type != BERConstants.ENUMERATED) { throw new BERException("Unexpected type: " + type); } byte c = buffer[offset++]; int val = ((int) c) & 0x7f; for (int i = 1; i < len; i++) { val <<= 0x08; val |= ((int) buffer[offset++]) & 0xff; } if ((c & 0x80) != 0) { val = -val; } control = true; return val; } public String parseString() throws BERException { if (control) { parseType(); } if (len == 0) { control = true; return ""; } if (type != BERConstants.UTF8_STRING && type != BERConstants.OCTET_STRING) { throw new BERException("Unexpected type: " + type); } String encoding = (type == BERConstants.UTF8_STRING) ? "UTF-8" : "ISO-8859-1"; try { String ret = new String(buffer, offset, len, encoding); offset += len; control = true; return ret; } catch(UnsupportedEncodingException e) { throw new BERException("JVM does not support " + encoding); } } public byte[] parseOctetString() throws BERException { if (control) { parseType(); } if (type != BERConstants.OCTET_STRING) { throw new BERException("Unexpected type: " + type); } byte[] ret = new byte[len]; System.arraycopy(buffer, offset, ret, 0, len); offset += len; control = true; return ret; } public BERDecoder parseSequence() throws BERException { return parseSequence(BERConstants.SEQUENCE); } public BERDecoder parseSequence(int code) throws BERException { if (control) { parseType(); } if (code != -1 && type != code) { throw new BERException("Unexpected type: " + type); } byte[] ret = new byte[len]; System.arraycopy(buffer, offset, ret, 0, len); offset += len; control = true; return new BERDecoder(ret, utf8); } public BERDecoder parseSet() throws BERException { return parseSet(BERConstants.SET); } public BERDecoder parseSet(int code) throws BERException { return parseSequence(code); } public static void main(String[] args) { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); for (int c = System.in.read(); c != -1; c = System.in.read()) { out.write(c); } byte[] code = out.toByteArray(); BERDecoder decoder = new BERDecoder(code, true); debug(decoder, 0); } catch (Exception e) { e.printStackTrace(System.err); } } private static void debug(BERDecoder decoder, int depth) throws BERException { for (int t = decoder.parseType(); t != -1; t = decoder.parseType()) { for (int i = 0; i < depth; i++) { System.out.print('\t'); } switch (t) { case BERConstants.BOOLEAN: System.out.println("BOOLEAN: " + decoder.parseBoolean()); break; case BERConstants.INTEGER: System.out.println("INTEGER: " + decoder.parseInt()); break; case BERConstants.ENUMERATED: System.out.println("ENUMERATED: " + decoder.parseInt()); break; case BERConstants.OCTET_STRING: System.out.println("OCTET-STRING: " + toString(decoder.parseOctetString())); break; case BERConstants.UTF8_STRING: System.out.println("STRING: \"" + decoder.parseString() + "\""); break; default: System.out.println("SEQUENCE " + t + "(0x" + Integer.toHexString(t) + "): " + decoder.getLength()); BERDecoder sequence = decoder.parseSequence(t); debug(sequence, depth + 1); break; } } } private static String toString(byte[] bytes) { try { return "\"" + new String(bytes, "UTF-8") + "\""; } catch (UnsupportedEncodingException e) { return bytes.toString(); } } } inetlib-1.1.2/source/gnu/inet/ldap/BERException.java0000664000076400007640000000440511345235566017213 00000000000000/* * BERException.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ldap; import java.io.IOException; /** * Exception thrown to indicate a BER encoding error. * * @author Chris Burdess */ public class BERException extends IOException { /** * Constructs a BER encoding exception with no message. */ public BERException() { } /** * Constructs a BER encoding exception with the specified message. */ public BERException(String message) { super(message); } } inetlib-1.1.2/source/gnu/inet/ldap/LDAPConnection.java0000664000076400007640000005717411345235566017477 00000000000000/* * LDAPConnection.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ldap; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.net.InetSocketAddress; import java.net.ProtocolException; import java.net.Socket; import java.net.SocketAddress; import java.util.ArrayList; import javax.naming.ldap.Control; /** * An LDAPv3 client. * This client is still experimental, please contact * Chris Burdess if you want to help out * with it. * * @author Chris Burdess */ public class LDAPConnection { /** * The default LDAP port. */ public static final int DEFAULT_PORT = 389; public static final int SCOPE_BASE_OBJECT = 0; public static final int SCOPE_SINGLE_LEVEL = 1; public static final int SCOPE_WHOLE_SUBTREE = 2; /** * Do not dereference aliases in searching or in locating the base object * of the search. */ public static final int DEREF_NEVER = 0; /** * Dereference aliases in subordinates of the base object in searching, * but not in locating the base object of the search. */ public static final int DEREF_IN_SEARCHING = 1; /** * Dereference aliases in locating the base object of the search, but not * when searching subordinates of the base object. */ public static final int DEREF_FINDING_BASE_OBJ = 2; /** * Dereference aliases both in searching and in locating the base object * of the search. */ public static final int DEREF_ALWAYS = 3; private static final int SUCCESS = 0; private static final int SASL_BIND_IN_PROGRESS = 14; private static final int MESSAGE = 0x30; private static final int BIND_REQUEST = 0x60; private static final int BIND_RESPONSE = 0x61; private static final int UNBIND_REQUEST = 0x62; private static final int SEARCH_REQUEST = 0x63; private static final int SEARCH_RESULT = 0x64; private static final int SEARCH_RESULT_DONE = 0x65; private static final int MODIFY_REQUEST = 0x66; private static final int MODIFY_RESPONSE = 0x67; private static final int ADD_REQUEST = 0x68; private static final int ADD_RESPONSE = 0x69; private static final int DELETE_REQUEST = 0x6a; private static final int DELETE_RESPONSE = 0x6b; private static final int MODIFY_DN_REQUEST = 0x6c; private static final int MODIFY_DN_RESPONSE = 0x6d; private static final int SEARCH_REFERENCE = 0x73; protected String host; protected int port; protected int version; // 2 or 3 private Socket socket; private InputStream in; private OutputStream out; private int messageId; private Map asyncResponses; /** * Creates a new LDAP connection to the specified host, using the default * LDAP port. * @param host the host */ public LDAPConnection(String host) throws IOException { this(host, DEFAULT_PORT, 0, 0); } /** * Creates a new LDAP connection to the specified host and port. * @param host the host * @param port the port */ public LDAPConnection(String host, int port) throws IOException { this(host, port, 0, 0); } /** * Creates a new LDAP connection to the specified host, port, and timeouts. * @param host the host * @param port the port * @param connectionTimeout the connection timeout in ms * @param timeout the socket I/O timeout in ms */ public LDAPConnection(String host, int port, int connectionTimeout, int timeout) throws IOException { this.host = host; if (port < 0) { port = DEFAULT_PORT; } this.port = port; messageId = 0; asyncResponses = new HashMap(); version = 3; // Connect socket = new Socket(); SocketAddress address = new InetSocketAddress(host, port); if (connectionTimeout > 0) { socket.connect(address, connectionTimeout); } else { socket.connect(address); } in = new BufferedInputStream(socket.getInputStream()); out = new BufferedOutputStream(socket.getOutputStream()); } /** * Sets the version of LDAP to use. * This implementation supports versions 2 and 3. * @param version the LDAP version */ public void setVersion(int version) { if (version < 2 || version > 3) { throw new IllegalArgumentException(Integer.toString(version)); } this.version = version; } /** * Initiates a bind operation to authenticate the client to the server. * @param name the LDAP DN to authenticate to, or null for * anonymous binding * @param mechanism the SASL mechanism to use, or null for * simple authentication * @param credentials the security credentials to use * @return the LDAP result */ public LDAPResult bind(String name, String mechanism, byte[] credentials, Control[] controls) throws IOException { int id = messageId++; boolean utf8 = (version == 3); BEREncoder bind = new BEREncoder(utf8); if (mechanism == null) { bind.append(version); bind.append(name); if (credentials != null) { bind.append(credentials); } } else { bind.append(version); bind.append(name); // SASL credentials BEREncoder saslCredentials = new BEREncoder(utf8); saslCredentials.append(mechanism); if (credentials != null) { saslCredentials.append(credentials); } bind.append(saslCredentials.toByteArray(), BERConstants.SEQUENCE); } // Request controls BEREncoder ctls = new BEREncoder(utf8); if (controls != null) { for (int i = 0; i < controls.length; i++) { ctls.append(controlSequence(controls[i], utf8), BERConstants.SEQUENCE); } } bind.append(ctls.toByteArray(), BERConstants.CONTEXT); // Write request write(id, BIND_REQUEST, bind.toByteArray()); // Read response BERDecoder response = read(id); BERDecoder resultSequence = response.parseSequence(BIND_RESPONSE); LDAPResult result = parseResult(resultSequence); if (resultSequence.available()) { byte[] serverCreds = resultSequence.parseOctetString(); // TODO } // TODO response controls return result; } /** * Issues an unbind request. This indicates to the server that the client * has no more requests to issue and will terminate the connection. After * invoking this method, no further methods may be invoked. */ public void unbind() throws IOException { int id = messageId++; boolean utf8 = (version == 3); BEREncoder unbind = new BEREncoder(utf8); unbind.appendNull(); write(id, UNBIND_REQUEST, unbind.toByteArray()); // Close socket socket.close(); } /** * Issues a search request. * @param name the LDAP DN that is the base object entry relative to which * the search is to be performed * @param scope the search scope, one of the SCOPE_* constants * @param derefAliases whether to dereference aliases, one of the DEREF_* * constants * @param sizeLimit the maximum number of entries to return, or 0 for no * restriction * @param timeLimit the maximum time in seconds permitted for the search, * or 0 for no restriction * @param typesOnly whether to return only attribute types(true) or both * attribute types and values(false) * @param filter the search filter in RFC2254 format * @param attributes the IDs of the attributes to return * @param controls the request controls * @param handler the result handler to receive notification of results * @return the LDAP result */ public LDAPResult search(String name, int scope, int derefAliases, int sizeLimit, int timeLimit, boolean typesOnly, String filter, String[] attributes, Control[] controls, ResultHandler handler) throws IOException { if (filter == null || filter.length() == 0) { filter = "(objectClass=*)"; } int id = messageId++; boolean utf8 = (version == 3); BEREncoder search = new BEREncoder(utf8); search.append(name); search.append(scope, BERConstants.ENUMERATED); search.append(derefAliases, BERConstants.ENUMERATED); search.append(sizeLimit); search.append(timeLimit); search.append(typesOnly); search.appendFilter(filter); BEREncoder attributeSequence = new BEREncoder(utf8); if (attributes != null) { for (int i = 0; i < attributes.length; i++) { attributeSequence.append(attributes[i]); } } search.append(attributeSequence.toByteArray(), BERConstants.SEQUENCE); // Request controls BEREncoder ctls = new BEREncoder(utf8); if (controls != null) { for (int i = 0; i < controls.length; i++) { ctls.append(controlSequence(controls[i], utf8), BERConstants.SEQUENCE); } } search.append(ctls.toByteArray(), BERConstants.SEQUENCE); // Write request write(id, SEARCH_REQUEST, search.toByteArray()); do { BERDecoder response = read(id); int code = response.parseType(); switch (code) { case SEARCH_RESULT: BERDecoder entry = response.parseSequence(code); String objectName = entry.parseString(); BERDecoder attributeSeq = entry.parseSequence(0x30); Map attrs = new TreeMap(); while (attributeSeq.available()) { BERDecoder attribute = attributeSeq.parseSequence(0x30); String type = attribute.parseString(); BERDecoder values = attribute.parseSet(0x31); List acc = new ArrayList(); while (values.available()) { int valueType = values.parseType(); switch (valueType) { case BERConstants.BOOLEAN: acc.add(Boolean.valueOf(values.parseBoolean())); break; case BERConstants.INTEGER: case BERConstants.ENUMERATED: acc.add(new Integer(values.parseInt())); break; // TODO float case BERConstants.UTF8_STRING: acc.add(values.parseString()); break; case BERConstants.OCTET_STRING: acc.add(values.parseOctetString()); break; } } attrs.put(type, acc); } handler.searchResultEntry(objectName, attrs); break; case SEARCH_REFERENCE: List acc = new ArrayList(); BERDecoder urls = response.parseSequence(code); while (urls.available()) { acc.add(urls.parseString()); } handler.searchResultReference(acc); break; case SEARCH_RESULT_DONE: return parseResult(response.parseSequence(code)); default: throw new ProtocolException("Unexpected response: " + code); } } while (true); } /** * Issues a modify request. * @param name the LDAP DN of the object to be modified(alias * dereferencing will not be performed) * @param modifications a sequence of modifications to be executed * to be executed * @see Modification */ public LDAPResult modify(String name, final Modification[] modifications) throws IOException { int id = messageId++; boolean utf8 = (version == 3); BEREncoder modify = new BEREncoder(utf8); modify.append(name); BEREncoder modSeq = new BEREncoder(utf8); for (int i = 0; i < modifications.length; i++) { BEREncoder mod = new BEREncoder(utf8); mod.append(modifications[i].operation); BEREncoder typeAndValues = new BEREncoder(utf8); typeAndValues.append(modifications[i].type); BEREncoder values = new BEREncoder(utf8); appendValues(values, modifications[i].values); typeAndValues.append(values.toByteArray(), BERConstants.SET); mod.append(typeAndValues.toByteArray(), BERConstants.SEQUENCE); modSeq.append(mod.toByteArray(), BERConstants.SEQUENCE); } modify.append(modSeq.toByteArray(), BERConstants.SEQUENCE); // Write request write(id, MODIFY_REQUEST, modify.toByteArray()); // Read response BERDecoder response = read(id); BERDecoder resultSequence = response.parseSequence(MODIFY_RESPONSE); LDAPResult result = parseResult(resultSequence); return result; } /** * Requests the addition of a new entry into the directory. * @param name the LDAP DN of the new entry * @param attributes a sequence of attributes to assign to the new entry */ public LDAPResult add(String name, AttributeValues[] attributes) throws IOException { int id = messageId++; boolean utf8 = (version == 3); BEREncoder add = new BEREncoder(utf8); add.append(name); BEREncoder attrSeq = new BEREncoder(utf8); for (int i = 0; i < attributes.length; i++) { BEREncoder attr = new BEREncoder(utf8); attr.append(attributes[i].type); BEREncoder values = new BEREncoder(utf8); appendValues(values, attributes[i].values); attr.append(values.toByteArray(), BERConstants.SET); attrSeq.append(attr.toByteArray(), BERConstants.SEQUENCE); } add.append(attrSeq.toByteArray(), BERConstants.SEQUENCE); // Write request write(id, ADD_REQUEST, add.toByteArray()); // Read response BERDecoder response = read(id); BERDecoder resultSequence = response.parseSequence(ADD_RESPONSE); LDAPResult result = parseResult(resultSequence); return result; } /** * Requests the removal of an entry from the directory. * @param name the LDAP DN of the entry to remove */ public LDAPResult delete(String name) throws IOException { int id = messageId++; boolean utf8 = (version == 3); BEREncoder del = new BEREncoder(utf8); del.append(name); // Write request write(id, DELETE_REQUEST, del.toByteArray()); // Read response BERDecoder response = read(id); int code = response.parseType(); if (code != DELETE_RESPONSE) { throw new ProtocolException("Unexpected response type: " + code); } BERDecoder resultSequence = response.parseSequence(); LDAPResult result = parseResult(resultSequence); return result; } /** * Changes the leftmost(least significant) component of the name of an * entry in the directory, or move a subtree of entries to a new location * in the directory. * @param name the LDAP DN of the entry to be changed * @param newRDN the RDN that will form the leftmost component of the new * name of the entry * @param deleteOldRDN if false, the old RDN values will be retained as * attributes of the entry, otherwise they are deleted from the entry * @param newSuperior if non-null, the DN of the entry to become the * immediate superior of the existing entry */ public LDAPResult modifyDN(String name, String newRDN, boolean deleteOldRDN, String newSuperior) throws IOException { int id = messageId++; boolean utf8 = (version == 3); BEREncoder modifyDN = new BEREncoder(utf8); modifyDN.append(name); modifyDN.append(newRDN); modifyDN.append(deleteOldRDN); if (newSuperior != null) { modifyDN.append(newSuperior); } // Write request write(id, MODIFY_DN_REQUEST, modifyDN.toByteArray()); // Read response BERDecoder response = read(id); BERDecoder resultSequence = response.parseSequence(MODIFY_DN_RESPONSE); LDAPResult result = parseResult(resultSequence); return result; } /* TODO Compare Operation */ /* TODO Abandon Operation */ /* TODO Extended Operation */ /** * Appends the specified set of values to the given encoder. */ void appendValues(BEREncoder encoder, Set values) throws BERException { if (values != null) { for (Iterator i = values.iterator(); i.hasNext(); ) { Object value = i.next(); if (value == null) { encoder.appendNull(); } else if (value instanceof String) { encoder.append((String) value); } else if (value instanceof Integer) { encoder.append(((Integer) value).intValue()); } else if (value instanceof Boolean) { encoder.append(((Boolean) value).booleanValue()); } else if (value instanceof byte[]) { encoder.append((byte[]) value); } // TODO float else { throw new ClassCastException(value.getClass().getName()); } } } } /** * Encode a control. */ byte[] controlSequence(final Control control, boolean utf8) throws IOException { BEREncoder encoder = new BEREncoder(utf8); encoder.append(control.getID()); if (control.isCritical()) { encoder.append(true); } return encoder.toByteArray(); } /** * Parse a response into an LDAP result object. */ LDAPResult parseResult(BERDecoder response) throws IOException { int status = response.parseInt(); String matchingDN = response.parseString(); String errorMessage = response.parseString(); String[] referrals = null; if (response.available()) { int type = response.parseType(); if (type == BERConstants.SEQUENCE) { ArrayList list = new ArrayList(); BERDecoder sequence = response.parseSequence(); type = sequence.parseType(); while (type != -1) { list.add(sequence.parseString()); } referrals = new String[list.size()]; list.toArray(referrals); } } return new LDAPResult(status, matchingDN, errorMessage, referrals); } /** * Write a request. * @param id the message ID * @param code the operation code * @param request the request body */ void write(int id, int code, byte[] request) throws IOException { boolean utf8 = (version == 3); BEREncoder envelope = new BEREncoder(utf8); envelope.append(id); envelope.append(request, code); BEREncoder message = new BEREncoder(utf8); message.append(envelope.toByteArray(), MESSAGE); byte[] toSend = message.toByteArray(); // Write to socket out.write(toSend); out.flush(); } /** * Read a response associated with the given message ID. * @param id the message ID * @return a BERDecoder for the content of the message */ BERDecoder read(int id) throws IOException { // Check for an already received async response Integer key = new Integer(id); List responses = (List) asyncResponses.get(key); if (responses != null) { BERDecoder response = (BERDecoder) responses.remove(0); if (responses.size() == 0) { asyncResponses.remove(key); } return response; } do { // Read LDAP message byte[] bytes = readMessage(); boolean utf8 = (version == 3); BERDecoder message = new BERDecoder(bytes, utf8); message = message.parseSequence(MESSAGE); // Check message ID int msgId = message.parseInt(); if (msgId == id) { return message; } else { // Store this message for later processing key = new Integer(msgId); responses = (List) asyncResponses.get(key); if (responses == null) { responses = new ArrayList(); asyncResponses.put(key, responses); } responses.add(message); } } while (true); } /** * Read an LDAP message. */ byte[] readMessage() throws IOException { // Peek at the length part of the BER encoding to determine the length // of the message // TODO normalize this with functionality in BERDecoder byte[] header = new byte[6]; int offset = 0; header[offset++] = (byte) readByte(); // type int len = readByte(); // length 0 header[offset++] = (byte) len; if ((len & 0x80) != 0) { int lsize = len - 0x80; if (lsize > 4) { throw new BERException("Data too long: " + lsize); } len = 0; for (int i = 0; i < lsize; i++) { int c = readByte(); header[offset++] = (byte) c; len = (len << 8) + c; } } // Allocate message array byte[] message = new byte[offset + len]; System.arraycopy(header, 0, message, 0, offset); if (len == 0) { return message; } header = null; // Read message content do { int l = in.read(message, offset, len); if (l == -1) { throw new IOException("EOF"); } offset += l; len -= l; } while (len > 0); return message; } /** * Read a single byte. */ int readByte() throws IOException { int ret = in.read(); if (ret == -1) { throw new IOException("EOF"); } return ret & 0xff; } } inetlib-1.1.2/source/gnu/inet/ldap/Modification.java0000664000076400007640000000640511345235566017333 00000000000000/* * Modification.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ldap; import java.util.Set; /** * An individual modification of an object's attributes. * * @author Chris Burdess */ public final class Modification extends AttributeValues { /** * Add the specified values to the attribute, creating the attribute if * necessary. */ public static final int ADD = 0; /** * Delete the specified values from the given attribute, removing the * entire attribute if no values are listed, or if all current values of * the attribute are listed. */ public static final int DELETE = 1; /** * Replace all existing values of the given attribute with the new values, * creating the attribute if it did not exist. A replace with no value * deletes the entire attribute if it exists, and is ignored otherwise. */ public static final int REPLACE = 2; /** * The operation specified by this modification. * One of: ADD, DELETE, or REPLACE */ protected final int operation; /** * Constructor. * @param operation the operation * @param type the attribute type * @param values the values to assign */ public Modification(int operation, String type, Set values) { super(type, values); if (operation < ADD || operation > REPLACE) { throw new IllegalArgumentException("unknown operation"); } this.operation = operation; } /** * @see #operation */ public int getOperation() { return operation; } } inetlib-1.1.2/source/gnu/inet/ldap/BEREncoder.java0000664000076400007640000003353611345235566016643 00000000000000/* * BEREncoder.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ldap; import java.io.UnsupportedEncodingException; /** * Utility class to construct BER-encoded data. * * @author Chris Burdess */ public class BEREncoder { private byte[] buffer; private int offset; private int[] sequenceOffset; private int sequenceIndex; private boolean utf8; /** * Constructor. * @param utf whether to use UTF-8 for encoding strings */ public BEREncoder(boolean utf8) { this(utf8, 1024); } /** * Constructor. * @param utf whether to use UTF-8 for encoding strings * @param initialSize the initial buffer size */ public BEREncoder(boolean utf8, int initialSize) { this.utf8 = utf8; buffer = new byte[initialSize]; offset = 0; sequenceOffset = new int[16]; sequenceIndex = 0; } /** * Reset this encoder for reuse. */ public void reset() { for (int i = 0; i < offset; i++) { buffer[i] = 0; } offset = 0; for (int i = 0; i < sequenceIndex; i++) { sequenceOffset[i] = 0; } sequenceIndex = 0; } /** * Returns the current size of the encoded data. */ public int size() { return offset; } /** * Returns the encoded data. */ public byte[] toByteArray() { byte[] ret = new byte[offset]; System.arraycopy(buffer, 0, ret, 0, offset); return ret; } // -- 8.2 Encoding of a boolean value -- /** * Appends a boolean value. * @param value the value */ public void append(boolean value) { append(value, BERConstants.BOOLEAN); } /** * Appends a boolean value with the specified ASN.1 type code. * @param value the value * @param code the type code */ public void append(boolean value, int code) { allocate(3); buffer[offset++] = (byte) code; buffer[offset++] = (byte) 1; /* length */ buffer[offset++] = value ? (byte) 0xff :(byte) 0; } // -- 8.3 Encoding of an integer value -- /** * Appends an integer value. * @param value the value */ public void append(int value) { append(value, BERConstants.INTEGER); } /** * Appends an integer value with the specified ASN.1 type code. * @param value the value * @param code the type code */ public void append(int value, int code) { final int mask = 0xff800000; int len = 4; while (((value & mask) == 0 || (value & mask) == mask) && (len > 1)) { len--; value <<= 8; } allocate(len + 2); buffer[offset++] = (byte) code; buffer[offset++] = (byte) len; for (; len > 0; len--) { buffer[offset++] = (byte) ((value & 0xff000000) >> 24); } } // TODO -- 8.5 Encoding of a real value -- // TODO -- 8.6 Encoding of a bitstring value -- // -- 8.7 Encoding of an octetstring value -- /** * Appends an octetstring value. * @param bytes the value */ public void append(byte[] bytes) throws BERException { append(bytes, BERConstants.OCTET_STRING); } /** * Appends an octetstring value with the specified ASN.1 type code. * Sequences and sets can be appended by using the corresponding type * codes from BERConstants. * @param bytes the value * @param code the type code */ public void append(byte[] bytes, int code) throws BERException { int len = (bytes == null) ? 0 : bytes.length; append(bytes, 0, len, code); } void append(byte[] bytes, int off, int len, int code) throws BERException { allocate(len + 5); buffer[offset++] = (byte) code; appendLength(len); if (len > 0) { System.arraycopy(bytes, off, buffer, offset, len); offset += len; } } /** * Appends a string value. * @param value the value */ public void append(String value) throws BERException { append(value, BERConstants.UTF8_STRING); } /** * Appends a string value with the specified ASN.1 type code. * @param value the value * @param code the type code */ public void append(String value, int code) throws BERException { byte[] bytes = null; if (value == null) { bytes = new byte[0]; } else { String encoding = utf8 ? "UTF-8" : "ISO-8859-1"; try { bytes = value.getBytes(encoding); } catch (UnsupportedEncodingException e) { throw new BERException("JVM does not support " + encoding); } } int len = bytes.length; allocate(len + 5); buffer[offset++] = (byte) code; appendLength(len); System.arraycopy(bytes, 0, buffer, offset, len); offset += len; } // -- 8.8 Encoding of a null value -- /** * Appends a BER NULL value. */ public void appendNull() { allocate(2); buffer[offset++] = BERConstants.NULL; buffer[offset++] = (byte) 0; /* length */ } /** * Allocate at least len bytes. */ private void allocate(int len) { if (buffer.length - offset < len) { int size = buffer.length; do { size *= 2; } while (size - offset < len); byte[] ret = new byte[size]; System.arraycopy(buffer, 0, ret, 0, offset); buffer = ret; } } /** * Append the specified length for a string. */ private void appendLength(int len) throws BERException { if (len < 0x80) { buffer[offset++] = (byte) len; } else if (len < 0x100) { buffer[offset++] = (byte) 0x81; buffer[offset++] = (byte) len; } else if (len < 0x10000) { buffer[offset++] = (byte) 0x82; buffer[offset++] = (byte)(len >> 0x08); buffer[offset++] = (byte)(len & 0xff); } else if (len < 0x1000000) { buffer[offset++] = (byte) 0x83; buffer[offset++] = (byte)(len >> 0x10); buffer[offset++] = (byte)(len >> 0x08); buffer[offset++] = (byte)(len & 0xff); } else { throw new BERException("Data too long: " + len); } } /** * Appends an RFC2254 search filter to this encoder. * @param filter the filter expression */ public void appendFilter(String filter) throws BERException { if (filter == null || filter.length() == 0) { throw new BERException("Empty filter expression"); } final byte[] bytes; String charset = utf8 ? "UTF-8" : "ISO-8859-1"; try { bytes = filter.getBytes(charset); } catch (UnsupportedEncodingException e) { throw new BERException("JVM does not support " + charset); } appendFilter(bytes, 0); } int appendFilter(final byte[] bytes, int off) throws BERException { int depth = 0; while(off < bytes.length) { switch (bytes[off]) { case 0x20: // SP off++; break; /* NOOP */ case 0x28: //( depth++; off++; break; case 0x29: // ) depth--; if (depth == 0) { return off + 1; } break; case 0x26: // & off = appendFilterList(bytes, off + 1, BERConstants.FILTER_AND); break; case 0x2c: // | off = appendFilterList(bytes, off + 1, BERConstants.FILTER_OR); break; case 0x21: // ! off = appendFilterList(bytes, off + 1, BERConstants.FILTER_NOT); break; default: off = appendFilterItem(bytes, off); } } if (depth != 0) { //System.err.println("depth="+depth+", off="+off); throw new BERException("Unbalanced parentheses"); } return off; } int appendFilterList(final byte[] bytes, int off, int code) throws BERException { BEREncoder sequence = new BEREncoder(utf8); while (off < bytes.length && bytes[off] == '(') { off = sequence.appendFilter(bytes, off); } append(sequence.toByteArray(), code); return off; } int appendFilterItem(final byte[] bytes, int off) throws BERException { int ei = indexOf(bytes,(byte) 0x3d, off); // = if (ei == -1) { throw new BERException("Missing '='"); } int end = ei; int code; BEREncoder item = new BEREncoder(utf8); switch (bytes[ei - 1]) { case 0x7e: // ~ approx code = BERConstants.FILTER_APPROX; end--; break; case 0x3e: // > greater code = BERConstants.FILTER_GREATER; end--; break; case 0x3c: // < less code = BERConstants.FILTER_LESS; end--; break; case 0x3a: // : ext code = BERConstants.FILTER_EXTENSIBLE; // TODO return appendFilterExtensibleMatch(bytes, off, ei); break; default: // equal/substring int si = indexOf(bytes,(byte) 0x2a, ei + 1); // * if (si == -1) { code = BERConstants.FILTER_EQUAL; } else { if (ei + 1 == bytes.length || bytes[ei + 2] == 0x29) // * present { code = BERConstants.FILTER_PRESENT; end--; } else { // substring BEREncoder substring = new BEREncoder(utf8); substring.append(bytes, off, end, BERConstants.OCTET_STRING); end = indexOf(bytes,(byte) 0x29, ei + 1); // ) if (end == -1) { throw new BERException("No terminating ')'"); } BEREncoder value = new BEREncoder(utf8); value.append(unencode(bytes, ei + 1, end)); substring.append(value.toByteArray(), 48); append(substring.toByteArray(), BERConstants.FILTER_SUBSTRING); off = end; return off; } } } item.append(bytes, off,(end - off), BERConstants.OCTET_STRING); end = indexOf(bytes,(byte) 0x29, ei + 1); // ) if (end == -1) { throw new BERException("No terminating ')'"); } if (code != BERConstants.FILTER_PRESENT) { item.append(unencode(bytes, ei + 1, end)); } append(item.toByteArray(), code); off = end; return off; } /** * Returns the index of the first matching byte in the specified * octet-string, starting at the given index. The filterlist terminator * ')' stops the search. */ static int indexOf(final byte[] bytes, byte c, int off) { for (int i = off; i < bytes.length; i++) { if (bytes[i] == c) { return i; } else if (bytes[i] == 0x29) // ) { return -1; } } return -1; } /** * Returns the unencoded version of the specified octet-string. The * filterlist terminator ')' delimits the end of the string. * This routine converts each character encoded as "\xx" where xx is the ASCII * character code to a single character. */ static byte[] unencode(final byte[] bytes, int off, int end) throws BERException { byte[] buf = new byte[end - off]; int pos = 0; int bsi = indexOf(bytes,(byte) 0x5c, off); // \ while(bsi != -1) { if (bsi + 3 > end) { throw new BERException("Illegal filter value encoding"); } int l = bsi - off; System.arraycopy(bytes, off, buf, pos, l); pos += l; int c = Character.digit((char) bytes[bsi + 2], 0x10); c += Character.digit((char) bytes[bsi + 1], 0x10) * 0x10; buf[pos++] = (byte) c; off += l + 3; bsi = indexOf(bytes,(byte) 0x5c, off); // \ } int l = end - off; System.arraycopy(bytes, off, buf, pos, l); pos += l; off += l; if (pos != buf.length) { byte[] swap = new byte[pos]; System.arraycopy(buf, 0, swap, 0, pos); buf = swap; } return buf; } } inetlib-1.1.2/source/gnu/inet/ldap/BERConstants.java0000664000076400007640000000674711345235566017244 00000000000000/* * BERConstants.java * Copyright (C) 2004 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.ldap; /** * Constants used in BER encoding and decoding. * Universal types are described in ISO/IEC 8824-1:2003, section 8.4. * * @author Chris Burdess */ public interface BERConstants { /* -- Tag classes -- */ public static final int UNIVERSAL = 0x00; public static final int APPLICATION = 0x40; // bit 7 public static final int CONTEXT = 0x80; // bit 8 public static final int PRIVATE = 0xc0; // bits 7 and 8 /* -- Universal tags -- */ public static final int BOOLEAN = 0x01; // UNIVERSAL 1 public static final int INTEGER = 0x02; public static final int BIT_STRING = 0x03; public static final int OCTET_STRING = 0x04; public static final int NULL = 0x05; public static final int OID = 0x06; public static final int DESCRIPTOR = 0x07; public static final int EXTERNAL = 0x08; public static final int REAL = 0x09; public static final int ENUMERATED = 0x0a; public static final int EMBEDDED_PDV = 0x0b; public static final int UTF8_STRING = 0x0c; public static final int RELATIVE_OID = 0x0d; public static final int SEQUENCE = 0x10; // UNIVERSAL 16 public static final int SET = 0x11; /* -- Application tags -- */ public static final int FILTER_PRESENT = 0x87; // APPLICATION 7 public static final int FILTER_AND = 0xa0; // APPLICATION 32 public static final int FILTER_OR = 0xa1; public static final int FILTER_NOT = 0xa2; public static final int FILTER_EQUAL = 0xa3; public static final int FILTER_SUBSTRING = 0xa4; public static final int FILTER_GREATER = 0xa5; public static final int FILTER_LESS = 0xa6; public static final int FILTER_APPROX = 0xa8; public static final int FILTER_EXTENSIBLE = 0xa9; } inetlib-1.1.2/source/gnu/inet/pop3/0000775000076400007640000000000011347412570014071 500000000000000inetlib-1.1.2/source/gnu/inet/pop3/POP3Connection.java0000664000076400007640000006156511345235566017440 00000000000000/* * POP3Connection.java * Copyright (C) 2003 The Free Software Foundation * * This file is part of GNU inetlib, a library. * * GNU inetlib 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. * * GNU inetlib 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under * terms of your choice, provided that you also meet, for each linked * independent module, the terms and conditions of the license of that * module. An independent module is a module which is not derived from * or based on this library. If you modify this library, you may extend * this exception to your version of the library, but you are not * obliged to do so. If you do not wish to do so, delete this * exception statement from your version. */ package gnu.inet.pop3; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.EOFException; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.ProtocolException; import java.net.Socket; import java.net.UnknownHostException; import java.security.GeneralSecurityException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.security.auth.callback.CallbackHandler; import javax.security.sasl.Sasl; import javax.security.sasl.SaslClient; import javax.security.sasl.SaslException; import gnu.inet.util.BASE64; import gnu.inet.util.CRLFInputStream; import gnu.inet.util.CRLFOutputStream; import gnu.inet.util.EmptyX509TrustManager; import gnu.inet.util.LineInputStream; import gnu.inet.util.MessageInputStream; import gnu.inet.util.SaslCallbackHandler; import gnu.inet.util.SaslCramMD5; import gnu.inet.util.SaslInputStream; import gnu.inet.util.SaslLogin; import gnu.inet.util.SaslOutputStream; import gnu.inet.util.SaslPlain; import gnu.inet.util.TraceLevel; /** * A POP3 client connection. * This implements the entire POP3 specification as detailed in RFC 1939, * with the exception of the no-arg LIST and UIDL commands (use STAT * followed by multiple LIST and/or UIDL instead) and TOP with a specified * number of content lines. It also implements the POP3 extension mechanism * CAPA, documented in RFC 2449, as well as the STLS command to initiate TLS * over POP3 documented in RFC 2595 and the AUTH command in RFC 1734. * * @author Chris Burdess */ public class POP3Connection { /** * The network trace level. */ public static final Level POP3_TRACE = new TraceLevel("pop3"); /** * The default POP3 port. */ public static final int DEFAULT_PORT = 110; // -- POP3 vocabulary -- private static final String _OK = "+OK"; private static final String _ERR = "-ERR"; private static final String _READY = "+ "; protected static final String STAT = "STAT"; protected static final String LIST = "LIST"; protected static final String RETR = "RETR"; protected static final String DELE = "DELE"; protected static final String NOOP = "NOOP"; protected static final String RSET = "RSET"; protected static final String QUIT = "QUIT"; protected static final String TOP = "TOP"; protected static final String UIDL = "UIDL"; protected static final String USER = "USER"; protected static final String PASS = "PASS"; protected static final String APOP = "APOP"; protected static final String CAPA = "CAPA"; protected static final String STLS = "STLS"; protected static final String AUTH = "AUTH"; protected static final int OK = 0; protected static final int ERR = 1; protected static final int READY = 2; /** * The logger used for POP3 protocol traces. */ public final Logger logger = Logger.getLogger("gnu.inet.pop3"); /** * The socket used to communicate with the server. */ protected Socket socket; /** * The socket input stream. */ protected LineInputStream in; /** * The socket output stream. */ protected CRLFOutputStream out; /** * The last response received from the server. * The status code (+OK or -ERR) is stripped from the line. */ protected String response; /** * The APOP timestamp, if sent by the server on connection. * Otherwise null. */ protected byte[] timestamp; /** * Creates a new connection to the server. * @param hostname the hostname of the server to connect to */ public POP3Connection(String hostname) throws UnknownHostException, IOException { this(hostname, -1, 0, 0, false, null); } /** * Creates a new connection to the server. * @param hostname the hostname of the server to connect to * @param port the port to connect to(if <=0, use default POP3 port) */ public POP3Connection(String hostname, int port) throws UnknownHostException, IOException { this(hostname, port, 0, 0, false, null); } /** * Creates a new connection to the server. * @param hostname the hostname of the server to connect to * @param port the port to connect to(if <=0, use default POP3 port) * @param connectionTimeout the connection timeout, in milliseconds * @param timeout the I/O timeout, in milliseconds */ public POP3Connection(String hostname, int port, int connectionTimeout, int timeout) throws UnknownHostException, IOException { this(hostname, port, connectionTimeout, timeout, false, null); } /** * Creates a new connection to the server. * @param hostname the hostname of the server to connect to * @param port the port to connect to(if <=0, use default POP3 port) * @param connectionTimeout the connection timeout, in milliseconds * @param timeout the I/O timeout, in milliseconds * @param secure if true, create a POP3S connection * @param tm a trust manager used to check SSL certificates, or null to * use the default */ public POP3Connection(String hostname, int port, int connectionTimeout, int timeout, boolean secure, TrustManager tm) throws UnknownHostException, IOException { this(hostname, port, connectionTimeout, timeout, secure, tm, true); } /** * Creates a new connection to the server. * @param hostname the hostname of the server to connect to * @param port the port to connect to(if <=0, use default POP3 port) * @param connectionTimeout the connection timeout, in milliseconds * @param timeout the I/O timeout, in milliseconds * @param secure if true, create a POP3S connection * @param tm a trust manager used to check SSL certificates, or null to * use the default * @param init initialise the connection */ public POP3Connection(String hostname, int port, int connectionTimeout, int timeout, boolean secure, TrustManager tm, boolean init) throws UnknownHostException, IOException { if (port <= 0) { port = DEFAULT_PORT; } // Set up socket try { socket = new Socket(); InetSocketAddress address = new InetSocketAddress(hostname, port); if (connectionTimeout > 0) { socket.connect(address, connectionTimeout); } else { socket.connect(address); } if (timeout > 0) { socket.setSoTimeout(timeout); } if (secure) { SSLSocketFactory factory = getSSLSocketFactory(tm); SSLSocket ss = (SSLSocket) factory.createSocket(socket, hostname, port, true); String[] protocols = { "TLSv1", "SSLv3" }; ss.setEnabledProtocols(protocols); ss.setUseClientMode(true); ss.startHandshake(); socket = ss; } } catch (GeneralSecurityException e) { IOException e2 = new IOException(); e2.initCause(e); throw e2; } InputStream is = socket.getInputStream(); is = new BufferedInputStream(is); is = new CRLFInputStream(is); in = new LineInputStream(is); OutputStream os = socket.getOutputStream(); os = new BufferedOutputStream(os); out = new CRLFOutputStream(os); if (init) init(); } /** * Initialises the connection. * Unless the init parameter was provided with the value false, * do not call this method. Otherwise call it only once after e.g. * configuring logging. */ public void init() throws IOException { if (getResponse() != OK) { throw new ProtocolException("Connect failed: " + response); } // APOP timestamp timestamp = parseTimestamp(response); } /** * Authenticates the connection using the specified SASL mechanism, * username, and password. * @param mechanism a SASL authentication mechanism, e.g. LOGIN, PLAIN, * CRAM-MD5, GSSAPI * @param username the authentication principal * @param password the authentication credentials * @return true if authentication was successful, false otherwise */ public boolean auth(String mechanism, String username, String password) throws IOException { try { String[] m = new String[] { mechanism }; CallbackHandler ch = new SaslCallbackHandler(username, password); // Avoid lengthy callback procedure for GNU Crypto HashMap p = new HashMap(); p.put("gnu.crypto.sasl.username", username); p.put("gnu.crypto.sasl.password", password); SaslClient sasl = Sasl.createSaslClient(m, null, "pop3", socket.getInetAddress().getHostName(), p, ch); if (sasl == null) { // Fall back to home-grown SASL clients if ("LOGIN".equalsIgnoreCase(mechanism)) { sasl = new SaslLogin(username, password); } else if ("PLAIN".equalsIgnoreCase(mechanism)) { sasl = new SaslPlain(username, password); } else if ("CRAM-MD5".equalsIgnoreCase(mechanism)) { sasl = new SaslCramMD5(username, password); } else { return false; } } StringBuffer cmd = new StringBuffer(AUTH); cmd.append(' '); cmd.append(mechanism); send(cmd.toString()); while (true) { switch (getResponse()) { case OK: String qop = (String) sasl.getNegotiatedProperty(Sasl.QOP); if ("auth-int".equalsIgnoreCase(qop) || "auth-conf".equalsIgnoreCase(qop)) { InputStream is = socket.getInputStream(); is = new BufferedInputStream(is); is = new SaslInputStream(sasl, is); is = new CRLFInputStream(is); in = new LineInputStream(is); OutputStream os = socket.getOutputStream(); os = new BufferedOutputStream(os); os = new SaslOutputStream(sasl, os); out = new CRLFOutputStream(os); } return true; case READY: try { byte[] c0 = response.getBytes("US-ASCII"); byte[] c1 = BASE64.decode(c0); // challenge byte[] r0 = sasl.evaluateChallenge(c1); byte[] r1 = BASE64.encode(r0); // response out.write(r1); out.write(0x0d); out.flush(); logger.log(POP3_TRACE, "> " + new String(r1, "US-ASCII")); } catch (SaslException e) { // Error in SASL challenge evaluation - cancel exchange out.write(0x2a); out.write(0x0d); out.flush(); logger.log(POP3_TRACE, "> *"); } default: return false; } } } catch (SaslException e) { logger.log(POP3_TRACE, e.getMessage(), e); return false; // No provider for mechanism } catch (RuntimeException e) { logger.log(POP3_TRACE, e.getMessage(), e); return false; // No javax.security.sasl classes } } /** * Authenticate the specified user using the APOP MD5-based method. * This does not transmit the password in the clear, but doesn't provide * any transport-level privacy features either. * @param username the user to authenticate * @param password the user's password */ public boolean apop(String username, String password) throws IOException { if (username == null || password == null || timestamp == null) { return false; } // APOP try { byte[] secret = password.getBytes("US-ASCII"); // compute digest byte[] target = new byte[timestamp.length + secret.length]; System.arraycopy(timestamp, 0, target, 0, timestamp.length); System.arraycopy(secret, 0, target, timestamp.length, secret.length); MessageDigest md5 = MessageDigest.getInstance("MD5"); byte[] db = md5.digest(target); // create hexadecimal representation StringBuffer digest = new StringBuffer(); for (int i = 0; i < db.length; i++) { int c = (int) db[i]; if (c < 0) { c += 256; } digest.append(Integer.toHexString((c & 0xf0) >> 4)); digest.append(Integer.toHexString(c & 0x0f)); } // send command String cmd = new StringBuffer(APOP) .append(' ') .append(username) .append(' ') .append(digest.toString()) .toString(); send(cmd); return getResponse() == OK; } catch (NoSuchAlgorithmException e) { logger.log(POP3_TRACE, "MD5 algorithm not found"); return false; } } /** * Authenticate the user using the basic USER and PASS handshake. * It is recommended to use a more secure authentication method such as * the auth or apop method if the server * understands them. * @param username the user to authenticate * @param password the user's password */ public boolean login(String username, String password) throws IOException { if (username == null || password == null) { return false; } // USER String cmd = USER + ' ' + username; send(cmd); if (getResponse() != OK) { return false; } // PASS cmd = PASS + ' ' + password; send(cmd); return getResponse() == OK; } /** * Returns a configured SSLSocketFactory to use in creating new SSL * sockets. * @param tm an optional trust manager to use */ protected SSLSocketFactory getSSLSocketFactory(TrustManager tm) throws GeneralSecurityException { if (tm == null) { tm = new EmptyX509TrustManager(); } SSLContext context = SSLContext.getInstance("TLS"); TrustManager[] trust = new TrustManager[] { tm }; context.init(null, trust, null); return context.getSocketFactory(); } /** * Attempts to start TLS on the specified connection. * See RFC 2595 for details * @return true if successful, false otherwise */ public boolean stls() throws IOException { return stls(new EmptyX509TrustManager()); } /** * Attempts to start TLS on the specified connection. * See RFC 2595 for details * @param tm the custom trust manager to use * @return true if successful, false otherwise */ public boolean stls(TrustManager tm) throws IOException { try { SSLSocketFactory factory = getSSLSocketFactory(tm); send(STLS); if (getResponse() != OK) { return false; } String hostname = socket.getInetAddress().getHostName(); int port = socket.getPort(); SSLSocket ss = (SSLSocket) factory.createSocket(socket, hostname, port, true); String[] protocols = { "TLSv1", "SSLv3" }; ss.setEnabledProtocols(protocols); ss.setUseClientMode(true); ss.startHandshake(); // set up streams InputStream is = ss.getInputStream(); is = new BufferedInputStream(is); is = new CRLFInputStream(is); in = new LineInputStream(is); OutputStream os = ss.getOutputStream(); os = new BufferedOutputStream(os); out = new CRLFOutputStream(os); return true; } catch (GeneralSecurityException e) { return false; } } /** * Returns the number of messages in the maildrop. */ public int stat() throws IOException { send(STAT); if (getResponse() != OK) { throw new ProtocolException("STAT failed: " + response); } try { return Integer.parseInt(response.substring(0, response.indexOf(' '))); } catch (NumberFormatException e) { throw new ProtocolException("Not a number: " + response); } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException("Not a STAT response: " + response); } } /** * Returns the size of the specified message. * @param msgnum the message number */ public int list(int msgnum) throws IOException { String cmd = LIST + ' ' + msgnum; send(cmd); if (getResponse() != OK) { throw new ProtocolException("LIST failed: " + response); } try { return Integer.parseInt(response.substring(response.indexOf(' ') + 1)); } catch (NumberFormatException e) { throw new ProtocolException("Not a number: " + response); } } /** * Returns an input stream containing the entire message. * This input stream must be read in its entirety before further commands * can be issued on this connection. * @param msgnum the message number */ public InputStream retr(int msgnum) throws IOException { String cmd = RETR + ' ' + msgnum; send(cmd); if (getResponse() != OK) { throw new ProtocolException("RETR failed: " + response); } return new MessageInputStream(in); } /** * Marks the specified message as deleted. * @param msgnum the message number */ public void dele(int msgnum) throws IOException { String cmd = DELE + ' ' + msgnum; send(cmd); if (getResponse() != OK) { throw new ProtocolException("DELE failed: " + response); } } /** * Does nothing. * This can be used to keep the connection alive. */ public void noop() throws IOException { send(NOOP); if (getResponse() != OK) { throw new ProtocolException("NOOP failed: " + response); } } /** * If any messages have been marked as deleted, they are unmarked. */ public void rset() throws IOException { send(RSET); if (getResponse() != OK) { throw new ProtocolException("RSET failed: " + response); } } /** * Closes the connection. * No further commands may be issued on this connection after this method * has been called. * @return true if all deleted messages were successfully removed, false * otherwise */ public boolean quit() throws IOException { send(QUIT); int ret = getResponse(); socket.close(); return ret == OK; } /** * Returns just the headers of the specified message as an input stream. * The stream must be read in its entirety before further commands can be * issued. * @param msgnum the message number */ public InputStream top(int msgnum) throws IOException { String cmd = TOP + ' ' + msgnum + ' ' + '0'; send(cmd); if (getResponse() != OK) { throw new ProtocolException("TOP failed: " + response); } return new MessageInputStream(in); } /** * Returns a unique identifier for the specified message. * @param msgnum the message number */ public String uidl(int msgnum) throws IOException { String cmd = UIDL + ' ' + msgnum; send(cmd); if (getResponse() != OK) { throw new ProtocolException("UIDL failed: " + response); } return response.substring(response.indexOf(' ') + 1); } /** * Returns a map of message number to UID pairs. * Message numbers are Integers, UIDs are Strings. */ public Map uidl() throws IOException { send(UIDL); if (getResponse() != OK) { throw new ProtocolException("UIDL failed: " + response); } Map uids = new LinkedHashMap(); String line = in.readLine(); while (line != null && !(".".equals(line))) { int si = line.indexOf(' '); if (si < 1) { throw new ProtocolException("Invalid UIDL response: " + line); } try { uids.put(new Integer(line.substring(0, si)), line.substring(si + 1)); } catch (NumberFormatException e) { throw new ProtocolException("Invalid message number: " + line); } } return Collections.unmodifiableMap(uids); } /** * Returns a list of capabilities supported by the POP3 server. * If the server does not support POP3 extensions, returns * null. */ public List capa() throws IOException { send(CAPA); if (getResponse() == OK) { final String DOT = "."; List list = new ArrayList(); for (String line = in.readLine(); !DOT.equals(line); line = in.readLine()) { list.add(line); } return Collections.unmodifiableList(list); } return null; } /** * Send the command to the server. */ protected void send(String command) throws IOException { logger.log(POP3_TRACE, "> " + command); out.write(command); out.writeln(); out.flush(); } /** * Parse the response from the server. */ protected int getResponse() throws IOException { response = in.readLine(); if (response == null) { throw new EOFException("unexpected EOF"); } logger.log(POP3_TRACE, "< " + response); if (response.indexOf(_OK) == 0) { response = response.substring(3).trim(); return OK; } else if (response.indexOf(_ERR) == 0) { response = response.substring(4).trim(); return ERR; } else if (response.indexOf(_READY) == 0) { response = response.substring(2).trim(); return READY; } else { throw new ProtocolException("Unexpected response: " + response); } } /* * Parse the APOP timestamp from the server's banner greeting. */ byte[] parseTimestamp(String greeting) throws IOException { int bra = greeting.indexOf('<'); if (bra != -1) { int ket = greeting.indexOf('>', bra); if (ket != -1) { String mid = greeting.substring(bra, ket + 1); int at = mid.indexOf('@'); if (at != -1) // This is a valid RFC822 msg-id { return mid.getBytes("US-ASCII"); } } } return null; } } inetlib-1.1.2/source/gnu/inet/pop3/package.html0000664000076400007640000000034711345235566016304 00000000000000

        This package contains a simple POP3 client, as specified in RFC 1939. It supports the POP3 extension mechanism CAPA, extensible SASL authentiction using the AUTH mechanism, and TLS negotiation using STLS.

        inetlib-1.1.2/m4/0000775000076400007640000000000011347426737010512 500000000000000inetlib-1.1.2/m4/ac_check_class.m40000664000076400007640000000621211345235565013575 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_check_class.html dnl AC_DEFUN([AC_CHECK_CLASS],[ AC_REQUIRE([AC_PROG_JAVA]) ac_var_name=`echo $1 | sed 's/\./_/g'` dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is dnl dynamic I need an extra level of extraction AC_MSG_CHECKING([for $1 class]) AC_CACHE_VAL(ac_cv_class_$ac_var_name, [ if test x$ac_cv_prog_uudecode_base64 = xyes; then dnl /** dnl * Test.java: used to test dynamicaly if a class exists. dnl */ dnl public class Test dnl { dnl dnl public static void dnl main( String[] argv ) dnl { dnl Class lib; dnl if (argv.length < 1) dnl { dnl System.err.println ("Missing argument"); dnl System.exit (77); dnl } dnl try dnl { dnl lib = Class.forName (argv[0]); dnl } dnl catch (ClassNotFoundException e) dnl { dnl System.exit (1); dnl } dnl lib = null; dnl System.exit (0); dnl } dnl dnl } cat << \EOF > Test.uue begin-base64 644 Test.class yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA JwAAAAIAKA== ==== EOF if uudecode$EXEEXT Test.uue; then : else echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC echo "configure: failed file was:" >&AC_FD_CC cat Test.uue >&AC_FD_CC ac_cv_prog_uudecode_base64=no fi rm -f Test.uue if AC_TRY_COMMAND(CLASSPATH=.:$CLASSPATH $JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then eval "ac_cv_class_$ac_var_name=yes" else eval "ac_cv_class_$ac_var_name=no" fi rm -f Test.class else AC_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], [eval "ac_cv_class_$ac_var_name=no"]) fi eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" HAVE_LAST_CLASS=$ac_var_val if test x$ac_var_val = xyes; then ifelse([$2], , :, [$2]) else ifelse([$3], , :, [$3]) fi ]) dnl for some reason the above statment didn't fall though here? dnl do scripts have variable scoping? eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" AC_MSG_RESULT($ac_var_val) ]) inetlib-1.1.2/m4/ac_prog_java.m40000664000076400007640000000132011345235565013276 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_java.html dnl dnl Changes for classpathx: check for "jamvm, kaffe, sablevm, cacao, gij, java", not only "kaffe, java" dnl AC_DEFUN([AC_PROG_JAVA],[ AC_REQUIRE([AC_EXEEXT])dnl if test x$JAVAPREFIX = x; then test x$JAVA = x && AC_CHECK_PROGS(JAVA, jamvm$EXEEXT kaffe$EXEEXT sablevm$EXEEXT cacao$EXEEXT gij$EXEEXT java$EXEEXT) else test x$JAVA = x && AC_CHECK_PROGS(JAVA, jamvm$EXEEXT kaffe$EXEEXT sablevm$EXEEXT cacao$EXEEXT gij$EXEEXT java$EXEEXT, $JAVAPREFIX) fi test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) AC_PROG_JAVA_WORKS AC_PROVIDE([$0])dnl ]) inetlib-1.1.2/m4/inetlib_with_sasl.m40000664000076400007640000000214411345235566014374 00000000000000dnl @synopsis INETLIB_WITH_SASL dnl AC_DEFUN([INETLIB_WITH_SASL],[ AC_REQUIRE([AC_PROG_JAVAC])dnl AC_REQUIRE([AC_PROG_JAVA])dnl AC_MSG_CHECKING([for SASL]) SASL_JAR="" SASL_CLASSPATH=. if test "x" != "x$CLASSPATH" ; then SASL_CLASSPATH="$SASL_CLASSPATH:$CLASSPATH" fi AC_ARG_WITH([sasl], AC_HELP_STRING([--with-sasl=FILE], [path to external SASL library]), [ if test -r "${withval}" ; then SASL_JAR="${withval}" SASL_CLASSPATH="$SASL_CLASSPATH:$SASL_JAR" fi ]) changequote(, )dnl cat << \EOF > Test.java /* [#]line __oline__ "configure" */ public class Test { public static void main(String[] args) { try { Class.forName("javax.security.sasl.SaslClient"); } catch (Throwable e) { System.exit(1); } } } EOF changequote([, ])dnl if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS -classpath "$SASL_CLASSPATH" Test) 2>/dev/null then AC_MSG_RESULT(yes) else AC_MSG_ERROR([can't find SASL classes; use --with-sasl]) fi rm Test.java Test.class AC_SUBST(SASL_JAR) ]) inetlib-1.1.2/m4/ac_check_classpath.m40000664000076400007640000000051111345235565014446 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_check_classpath.html dnl AC_DEFUN([AC_CHECK_CLASSPATH],[ if test "x$CLASSPATH" = x; then echo "You have no CLASSPATH, I hope it is good" else echo "You have CLASSPATH $CLASSPATH, hope it is correct" fi ]) inetlib-1.1.2/m4/ac_prog_javac.m40000664000076400007640000000216011345235565013444 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_javac.html dnl AC_DEFUN([AC_PROG_JAVAC],[ AC_REQUIRE([AC_EXEEXT])dnl if test "x$JAVAPREFIX" = x; then test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "gcj$EXEEXT -C" jikes$EXEEXT ejc$EXEEXT guavac$EXEEXT javac$EXEEXT) else test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "gcj$EXEEXT -C" jikes$EXEEXT ejc$EXEEXT guavac$EXEEXT javac$EXEEXT, $JAVAPREFIX) fi test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) AC_PROG_JAVAC_WORKS (echo "$JAVAC" | grep -e " -C$" >/dev/null 2>/dev/null) && AC_MSG_WARN([ The build seems to be using gcj for bytecode generation. Some versions of gcj are known to produce bad bytecode. See here for a list of bugs that may be relevant: http://gcc.gnu.org/bugzilla/buglist.cgi?component=java&keywords=wrong-code&order=default At least bug 19921 is known to affect gjdoc (in Feb 2005). You may want to set the environment variable JAVAC to an alternate compiler, such as jikes, to make sure that you end up with valid bytecode. ]); AC_PROVIDE([$0])dnl ]) inetlib-1.1.2/m4/ac_prog_java_works.m40000664000076400007640000000647111345235565014537 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_java_works.html dnl AC_DEFUN([AC_PROG_JAVA_WORKS], [ AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes) if test x$uudecode = xyes; then AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ dnl /** dnl * Test.java: used to test if java compiler works. dnl */ dnl public class Test dnl { dnl dnl public static void dnl main( String[] argv ) dnl { dnl System.exit (0); dnl } dnl dnl } cat << \EOF > Test.uue begin-base64 644 Test.class yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= ==== EOF if uudecode$EXEEXT Test.uue; then ac_cv_prog_uudecode_base64=yes else echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC echo "configure: failed file was:" >&AC_FD_CC cat Test.uue >&AC_FD_CC ac_cv_prog_uudecode_base64=no fi rm -f Test.uue]) fi if test x$ac_cv_prog_uudecode_base64 != xyes; then rm -f Test.class AC_MSG_WARN([I have to compile Test.class from scratch]) if test x$ac_cv_prog_javac_works = xno; then AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) fi if test x$ac_cv_prog_javac_works = x; then AC_PROG_JAVAC fi fi AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ JAVA_TEST=Test.java CLASS_TEST=Test.class TEST=Test changequote(, )dnl cat << \EOF > $JAVA_TEST /* [#]line __oline__ "configure" */ public class Test { public static void main (String args[]) { System.exit (0); } } EOF changequote([, ])dnl if test x$ac_cv_prog_uudecode_base64 != xyes; then if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then : else echo "configure: failed program was:" >&AC_FD_CC cat $JAVA_TEST >&AC_FD_CC AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) fi fi if AC_TRY_COMMAND(CLASSPATH=.:$CLASSPATH $JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then ac_cv_prog_java_works=yes else echo "configure: failed program was:" >&AC_FD_CC cat $JAVA_TEST >&AC_FD_CC AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) fi rm -fr $JAVA_TEST $CLASS_TEST Test.uue ]) AC_PROVIDE([$0])dnl ] ) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_try_compile_java.html dnl AC_DEFUN([AC_TRY_COMPILE_JAVA],[ AC_REQUIRE([AC_PROG_JAVAC])dnl cat << \EOF > Test.java /* [#]line __oline__ "configure" */ ifelse([$1], , , [import $1;]) public class Test { [$2] } EOF if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class then dnl Don't remove the temporary files here, so they can be examined. ifelse([$3], , :, [$3]) else echo "configure: failed program was:" >&AC_FD_CC cat Test.java >&AC_FD_CC ifelse([$4], , , [ rm -fr Test* $4 ])dnl fi rm -fr Test*]) inetlib-1.1.2/m4/ac_java_options.m40000664000076400007640000000162511345235565014032 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_java_options.html dnl AC_DEFUN([AC_JAVA_OPTIONS],[ AC_ARG_WITH(java-prefix, [ --with-java-prefix=PFX prefix where Java runtime is installed (optional)]) AC_ARG_WITH(javac-flags, [ --with-javac-flags=FLAGS flags to pass to the Java compiler (optional)]) AC_ARG_WITH(java-flags, [ --with-java-flags=FLAGS flags to pass to the Java VM (optional)]) AC_ARG_WITH(javadoc-flags, [ --with-javadoc-flags=FLAGS flags to pass to the Javadoc generator (optional)]) JAVAPREFIX=$with_java_prefix JAVACFLAGS=$with_javac_flags JAVAFLAGS=$with_java_flags JAVADOCFLAGS=$with_javadoc_flags AC_SUBST(JAVAPREFIX)dnl AC_SUBST(JAVACFLAGS)dnl AC_SUBST(JAVAFLAGS)dnl AC_SUBST(JAVADOCFLAGS)dnl AC_SUBST(JAVA)dnl AC_SUBST(JAVAC)dnl ]) inetlib-1.1.2/m4/ac_prog_jar.m40000664000076400007640000000326711345235565013145 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_jar.html dnl dnl Changes for gjdoc: dnl - check for "fastjar, jar", not only "jar"; dnl - output warning if detected jar is kaffe jar. dnl AC_DEFUN([AC_PROG_JAR],[ AC_REQUIRE([AC_EXEEXT])dnl if test "x$JAVAPREFIX" = x; then test "x$JAR" = x && AC_CHECK_PROGS(JAR, fastjar$EXEEXT jar$EXEEXT) else test "x$JAR" = x && AC_CHECK_PROGS(JAR, fastjar$EXEEXT jar$EXEEXT, $JAVAPREFIX) fi dnl Complain if not found test "x$JAR" = "x" && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) dnl Strip any parameters sed_expr_param=['s/[ ][^"]*$//'] jarabs=`echo $JAR | sed -e "$sed_expr_param"` dnl Convert ~/ to $HOME/ sed_expr_home="s|^~/|$HOME/|" jarabs=`echo $jarabs | sed -e "$sed_expr_home"` dnl If not already absolute filename, find on PATH sed_expr_abspath=['s/^~?\/.*$//'] if (test `echo $jarabs | sed -e "$sed_expr_abspath"`); then dnl Stolen from libtool.m4: lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH; do IFS="$lt_save_ifs" if (test -f $dir/$jarabs || test -f $dir/$jarabs$ac_exeext); then jarabs="$dir/$jarabs" break fi done fi dnl Warn if it's the kaffe jar grep 'kaffe\.tools\.jar\.Jar' "$jarabs" >/dev/null test "$?" != "0" || \ AC_MSG_WARN([ The build seems to be using the Jar tool that comes with Kaffe. Note that there are known issues in some versions of this tool. Unfortunately it does not support any --version option, so I can't detect whether your version works. If you see error messages from the Jar tool, or the build hangs, please set environment variable JAR to a working Jar tool. ]) AC_PROVIDE([$0])dnl ]) inetlib-1.1.2/m4/inetlib_with_jsse.m40000664000076400007640000000212311345235566014373 00000000000000dnl @synopsis INETLIB_WITH_JSSE dnl AC_DEFUN([INETLIB_WITH_JSSE],[ AC_REQUIRE([AC_PROG_JAVAC])dnl AC_REQUIRE([AC_PROG_JAVA])dnl AC_MSG_CHECKING([for JSSE]) JSSE_JAR="" JSSE_CLASSPATH=. if test "x" != "x$CLASSPATH" ; then JSSE_CLASSPATH="$JSSE_CLASSPATH:$CLASSPATH" fi AC_ARG_WITH([jsse], AC_HELP_STRING([--with-jsse=FILE], [path to external JSSE library]), [ if test -r "${withval}" ; then JSSE_JAR="${withval}" JSSE_CLASSPATH="$JSSE_CLASSPATH:$JSSE_JAR" fi ]) changequote(, )dnl cat << \EOF > Test.java /* [#]line __oline__ "configure" */ public class Test { public static void main(String[] args) { try { Class.forName("javax.net.ssl.SSLSocket"); } catch (Throwable e) { System.exit(1); } } } EOF changequote([, ])dnl if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS -classpath "$JSSE_CLASSPATH" Test; exit) 2>/dev/null then AC_MSG_RESULT(yes) else AC_MSG_ERROR([can't find JSSE classes; use --with-jsse]) fi rm Test.java Test.class AC_SUBST(JSSE_JAR) ]) inetlib-1.1.2/m4/ac_prog_javadoc.m40000664000076400007640000000113011345235566013764 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_javadoc.html dnl dnl Changes for classpathx: check for "gjdoc, javadoc" not just "javadoc" dnl AC_DEFUN([AC_PROG_JAVADOC],[ AC_REQUIRE([AC_EXEEXT])dnl if test "x$JAVAPREFIX" = x; then test "x$JAVADOC" = x && AC_CHECK_PROGS(JAVADOC, gjdoc$EXEEXT javadoc$EXEEXT) else test "x$JAVADOC" = x && AC_CHECK_PROGS(JAVADOC, gjdoc$EXEEXT javadoc$EXEEXT, $JAVAPREFIX) fi test "x$JAVADOC" = x && AC_MSG_ERROR([no acceptable javadoc generator found in \$PATH]) AC_PROVIDE([$0])dnl ]) inetlib-1.1.2/m4/am_prog_gcj.m40000664000076400007640000000211511345235566013136 00000000000000# Check for Java compiler. # For now we only handle the GNU compiler. # Copyright (C) 1999, 2000, 2003 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., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. AC_DEFUN([AM_PROG_GCJ],[ AC_CHECK_PROGS(GCJ, gcj, false) test -z "$GCJ" && AC_MSG_ERROR([no acceptable gcj found in \$PATH]) if test "x${GCJFLAGS-unset}" = xunset; then GCJFLAGS="-g -O2" fi AC_SUBST(GCJFLAGS) _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(GCJ)]) ]) inetlib-1.1.2/m4/ac_prog_javac_works.m40000664000076400007640000000130711345235566014674 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_javac_works.html dnl AC_DEFUN([AC_PROG_JAVAC_WORKS],[ AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST /* [#]line __oline__ "configure" */ public class Test { } EOF if AC_TRY_COMMAND($JAVAC $JAVACFLAGS -classpath .:$CLASSPATH $JAVA_TEST) >/dev/null 2>&1; then ac_cv_prog_javac_works=yes else AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) echo "configure: failed program was:" >&AC_FD_CC cat $JAVA_TEST >&AC_FD_CC fi rm -f $JAVA_TEST $CLASS_TEST ]) AC_PROVIDE([$0])dnl ]) inetlib-1.1.2/m4/inetlib_with_auth_callback.m40000664000076400007640000000251211345235566016206 00000000000000dnl @synopsis INETLIB_WITH_AUTH_CALLBACK dnl AC_DEFUN([INETLIB_WITH_AUTH_CALLBACK],[ AC_REQUIRE([AC_PROG_JAVAC])dnl AC_REQUIRE([AC_PROG_JAVA])dnl AC_MSG_CHECKING([for javax.security.auth.callback]) AUTH_CALLBACK_JAR="" AUTH_CALLBACK_CLASSPATH=. if test "x" != "x$CLASSPATH" ; then AUTH_CALLBACK_CLASSPATH="$AUTH_CALLBACK_CLASSPATH:$CLASSPATH" fi AC_ARG_WITH([auth_callback], AC_HELP_STRING([--with-auth-callback=FILE], [path to external javax.security.auth.callback library]), [ if test -r "${withval}" ; then AUTH_CALLBACK_JAR="${withval}" AUTH_CALLBACK_CLASSPATH="$AUTH_CALLBACK_CLASSPATH:$AUTH_CALLBACK_JAR" fi ]) changequote(, )dnl cat << \EOF > Test.java /* [#]line __oline__ "configure" */ public class Test { public static void main(String[] args) { try { Class.forName("javax.security.auth.callback.Callback"); } catch (Throwable e) { System.exit(1); } } } EOF changequote([, ])dnl if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS -classpath "$AUTH_CALLBACK_CLASSPATH" Test) 2>/dev/null then AC_MSG_RESULT(yes) else AC_MSG_ERROR([can't find javax.security.auth.callback classes; use --with-auth-callback]) fi rm Test.java Test.class AC_SUBST(AUTH_CALLBACK_JAR) ]) inetlib-1.1.2/m4/ac_check_rqrd_class.m40000664000076400007640000000050311345235565014622 00000000000000dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_check_rqrd_class.html dnl AC_DEFUN([AC_CHECK_RQRD_CLASS],[ CLASS=`echo $1|sed 's/\./_/g'` AC_CHECK_CLASS($1) if test "$HAVE_LAST_CLASS" = "no"; then AC_MSG_ERROR([Required class $1 missing, exiting.]) fi ]) inetlib-1.1.2/acinclude.m40000664000076400007640000000100711345235565012274 00000000000000m4_include([m4/ac_check_class.m4]) m4_include([m4/ac_check_classpath.m4]) m4_include([m4/ac_check_rqrd_class.m4]) m4_include([m4/ac_java_options.m4]) m4_include([m4/ac_prog_jar.m4]) m4_include([m4/ac_prog_java.m4]) m4_include([m4/ac_prog_java_works.m4]) m4_include([m4/ac_prog_javac.m4]) m4_include([m4/ac_prog_javac_works.m4]) m4_include([m4/ac_prog_javadoc.m4]) m4_include([m4/am_prog_gcj.m4]) m4_include([m4/inetlib_with_jsse.m4]) m4_include([m4/inetlib_with_sasl.m4]) m4_include([m4/inetlib_with_auth_callback.m4]) inetlib-1.1.2/AUTHORS0000664000076400007640000000020011345235565011145 00000000000000Chris Burdess wrote the SMTP, IMAP, POP3, NNTP, FTP, and Gopher clients and utility classes. Jan Michalica added NNTPS support. inetlib-1.1.2/configure0000775000076400007640000040543111347426734012025 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for inetlib 1.1.2. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell bug-autoconf@gnu.org about your system, echo including any error possibly output before this message. echo This can help us improve future autoconf versions. echo Configuration will now proceed without shell functions. } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='inetlib' PACKAGE_TARNAME='inetlib' PACKAGE_VERSION='1.1.2' PACKAGE_STRING='inetlib 1.1.2' PACKAGE_BUGREPORT='' ac_unique_file="source/gnu/inet/util/LineInputStream.java" ac_subst_vars='LTLIBOBJS LIBOBJS AUTH_CALLBACK_JAR SASL_JAR JSSE_JAR uudecode JAVA JAVADOCFLAGS JAVAFLAGS JAVACFLAGS JAVAPREFIX JAVADOC JAR JAVAC ENABLE_COMSAT_FALSE ENABLE_COMSAT_TRUE ENABLE_LDAP_FALSE ENABLE_LDAP_TRUE ENABLE_HTTP_FALSE ENABLE_HTTP_TRUE ENABLE_FINGER_FALSE ENABLE_FINGER_TRUE ENABLE_GOPHER_FALSE ENABLE_GOPHER_TRUE ENABLE_FTP_FALSE ENABLE_FTP_TRUE ENABLE_NNTP_FALSE ENABLE_NNTP_TRUE ENABLE_POP3_FALSE ENABLE_POP3_TRUE ENABLE_IMAP_FALSE ENABLE_IMAP_TRUE ENABLE_SMTP_FALSE ENABLE_SMTP_TRUE am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_smtp enable_imap enable_pop3 enable_nntp enable_ftp enable_gopher enable_finger enable_http enable_ldap enable_comsat with_java_prefix with_javac_flags with_java_flags with_javadoc_flags with_jsse with_sasl with_auth_callback ' ac_precious_vars='build_alias host_alias target_alias' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { $as_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { $as_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { $as_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures inetlib 1.1.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/inetlib] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of inetlib 1.1.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-smtp Enable the SMTP client (default=yes). --enable-imap Enable the IMAP client (default=yes). --enable-pop3 Enable the POP3 client (default=yes). --enable-nntp Enable the NNTP client (default=yes). --enable-ftp Enable the FTP client (default=yes). --enable-gopher Enable the Gopher client (default=yes). --enable-finger Enable the finger client (default=yes). --enable-http Enable the HTTP client (default=yes). --enable-ldap Enable the experimental LDAP client (default=yes). --enable-comsat Enable the experimental comsat client (default=yes). Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-java-prefix=PFX prefix where Java runtime is installed (optional) --with-javac-flags=FLAGS flags to pass to the Java compiler (optional) --with-java-flags=FLAGS flags to pass to the Java VM (optional) --with-javadoc-flags=FLAGS flags to pass to the Javadoc generator (optional) --with-jsse=FILE path to external JSSE library --with-sasl=FILE path to external SASL library --with-auth-callback=FILE path to external javax.security.auth.callback library _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF inetlib configure 1.1.2 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by inetlib $as_me 1.1.2, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 $as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in config "$srcdir"/config; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5 $as_echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) { { $as_echo "$as_me:$LINENO: error: unsafe absolute working directory name" >&5 $as_echo "$as_me: error: unsafe absolute working directory name" >&2;} { (exit 1); exit 1; }; };; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) { { $as_echo "$as_me:$LINENO: error: unsafe srcdir value: \`$srcdir'" >&5 $as_echo "$as_me: error: unsafe srcdir value: \`$srcdir'" >&2;} { (exit 1); exit 1; }; };; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 $as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 $as_echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:$LINENO: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 $as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='inetlib' VERSION='1.1.2' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' PACKAGE="inetlib" VERSION="1.1.2" # Check whether --enable-smtp was given. if test "${enable_smtp+set}" = set; then enableval=$enable_smtp; case "$enableval" in no) enable_smtp=no ;; *) enable_smtp=yes ;; esac else enable_smtp=yes fi if test "x$enable_smtp" = "xyes"; then ENABLE_SMTP_TRUE= ENABLE_SMTP_FALSE='#' else ENABLE_SMTP_TRUE='#' ENABLE_SMTP_FALSE= fi # Check whether --enable-imap was given. if test "${enable_imap+set}" = set; then enableval=$enable_imap; case "$enableval" in no) enable_imap=no ;; *) enable_imap=yes ;; esac else enable_imap=yes fi if test "x$enable_imap" = "xyes"; then ENABLE_IMAP_TRUE= ENABLE_IMAP_FALSE='#' else ENABLE_IMAP_TRUE='#' ENABLE_IMAP_FALSE= fi # Check whether --enable-pop3 was given. if test "${enable_pop3+set}" = set; then enableval=$enable_pop3; case "$enableval" in no) enable_pop3=no ;; *) enable_pop3=yes ;; esac else enable_pop3=yes fi if test "x$enable_pop3" = "xyes"; then ENABLE_POP3_TRUE= ENABLE_POP3_FALSE='#' else ENABLE_POP3_TRUE='#' ENABLE_POP3_FALSE= fi # Check whether --enable-nntp was given. if test "${enable_nntp+set}" = set; then enableval=$enable_nntp; case "$enableval" in no) enable_nntp=no ;; *) enable_nntp=yes ;; esac else enable_nntp=yes fi if test "x$enable_nntp" = "xyes"; then ENABLE_NNTP_TRUE= ENABLE_NNTP_FALSE='#' else ENABLE_NNTP_TRUE='#' ENABLE_NNTP_FALSE= fi # Check whether --enable-ftp was given. if test "${enable_ftp+set}" = set; then enableval=$enable_ftp; case "$enableval" in no) enable_ftp=no ;; *) enable_ftp=yes ;; esac else enable_ftp=yes fi if test "x$enable_ftp" = "xyes"; then ENABLE_FTP_TRUE= ENABLE_FTP_FALSE='#' else ENABLE_FTP_TRUE='#' ENABLE_FTP_FALSE= fi # Check whether --enable-gopher was given. if test "${enable_gopher+set}" = set; then enableval=$enable_gopher; case "$enableval" in no) enable_gopher=no ;; *) enable_gopher=yes ;; esac else enable_gopher=yes fi if test "x$enable_gopher" = "xyes"; then ENABLE_GOPHER_TRUE= ENABLE_GOPHER_FALSE='#' else ENABLE_GOPHER_TRUE='#' ENABLE_GOPHER_FALSE= fi # Check whether --enable-finger was given. if test "${enable_finger+set}" = set; then enableval=$enable_finger; case "$enableval" in no) enable_finger=no ;; *) enable_finger=yes ;; esac else enable_finger=yes fi if test "x$enable_finger" = "xyes"; then ENABLE_FINGER_TRUE= ENABLE_FINGER_FALSE='#' else ENABLE_FINGER_TRUE='#' ENABLE_FINGER_FALSE= fi # Check whether --enable-http was given. if test "${enable_http+set}" = set; then enableval=$enable_http; case "$enableval" in no) enable_http=no ;; *) enable_http=yes ;; esac else enable_http=yes fi if test "x$enable_http" = "xyes"; then ENABLE_HTTP_TRUE= ENABLE_HTTP_FALSE='#' else ENABLE_HTTP_TRUE='#' ENABLE_HTTP_FALSE= fi # Check whether --enable-ldap was given. if test "${enable_ldap+set}" = set; then enableval=$enable_ldap; case "$enableval" in no) enable_ldap=no ;; *) enable_ldap=yes ;; esac else enable_ldap=yes fi if test "x$enable_ldap" = "xyes"; then ENABLE_LDAP_TRUE= ENABLE_LDAP_FALSE='#' else ENABLE_LDAP_TRUE='#' ENABLE_LDAP_FALSE= fi # Check whether --enable-comsat was given. if test "${enable_comsat+set}" = set; then enableval=$enable_comsat; case "$enableval" in no) enable_comsat=no ;; *) enable_comsat=yes ;; esac else enable_comsat=yes fi if test "x$enable_comsat" = "xyes"; then ENABLE_COMSAT_TRUE= ENABLE_COMSAT_FALSE='#' else ENABLE_COMSAT_TRUE='#' ENABLE_COMSAT_FALSE= fi if test "x$JAVAPREFIX" = x; then test "x$JAVAC" = x && for ac_prog in "gcj$EXEEXT -C" jikes$EXEEXT ejc$EXEEXT guavac$EXEEXT javac$EXEEXT do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_JAVAC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$JAVAC"; then ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_JAVAC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAVAC=$ac_cv_prog_JAVAC if test -n "$JAVAC"; then { $as_echo "$as_me:$LINENO: result: $JAVAC" >&5 $as_echo "$JAVAC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAVAC" && break done else test "x$JAVAC" = x && for ac_prog in "gcj$EXEEXT -C" jikes$EXEEXT ejc$EXEEXT guavac$EXEEXT javac$EXEEXT do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_JAVAC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$JAVAC"; then ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_JAVAC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAVAC=$ac_cv_prog_JAVAC if test -n "$JAVAC"; then { $as_echo "$as_me:$LINENO: result: $JAVAC" >&5 $as_echo "$JAVAC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAVAC" && break done test -n "$JAVAC" || JAVAC="$JAVAPREFIX" fi test "x$JAVAC" = x && { { $as_echo "$as_me:$LINENO: error: no acceptable Java compiler found in \$PATH" >&5 $as_echo "$as_me: error: no acceptable Java compiler found in \$PATH" >&2;} { (exit 1); exit 1; }; } { $as_echo "$as_me:$LINENO: checking if $JAVAC works" >&5 $as_echo_n "checking if $JAVAC works... " >&6; } if test "${ac_cv_prog_javac_works+set}" = set; then $as_echo_n "(cached) " >&6 else JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST /* #line 2635 "configure" */ public class Test { } EOF if { ac_try='$JAVAC $JAVACFLAGS -classpath .:$CLASSPATH $JAVA_TEST' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } >/dev/null 2>&1; then ac_cv_prog_javac_works=yes else { { $as_echo "$as_me:$LINENO: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&5 $as_echo "$as_me: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&2;} { (exit 1); exit 1; }; } echo "configure: failed program was:" >&5 cat $JAVA_TEST >&5 fi rm -f $JAVA_TEST $CLASS_TEST fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_javac_works" >&5 $as_echo "$ac_cv_prog_javac_works" >&6; } (echo "$JAVAC" | grep -e " -C$" >/dev/null 2>/dev/null) && { $as_echo "$as_me:$LINENO: WARNING: The build seems to be using gcj for bytecode generation. Some versions of gcj are known to produce bad bytecode. See here for a list of bugs that may be relevant: http://gcc.gnu.org/bugzilla/buglist.cgi?component=java&keywords=wrong-code&order=default At least bug 19921 is known to affect gjdoc (in Feb 2005). You may want to set the environment variable JAVAC to an alternate compiler, such as jikes, to make sure that you end up with valid bytecode. " >&5 $as_echo "$as_me: WARNING: The build seems to be using gcj for bytecode generation. Some versions of gcj are known to produce bad bytecode. See here for a list of bugs that may be relevant: http://gcc.gnu.org/bugzilla/buglist.cgi?component=java&keywords=wrong-code&order=default At least bug 19921 is known to affect gjdoc (in Feb 2005). You may want to set the environment variable JAVAC to an alternate compiler, such as jikes, to make sure that you end up with valid bytecode. " >&2;}; if test "x$JAVAPREFIX" = x; then test "x$JAR" = x && for ac_prog in fastjar$EXEEXT jar$EXEEXT do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_JAR+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$JAR"; then ac_cv_prog_JAR="$JAR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_JAR="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAR=$ac_cv_prog_JAR if test -n "$JAR"; then { $as_echo "$as_me:$LINENO: result: $JAR" >&5 $as_echo "$JAR" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAR" && break done else test "x$JAR" = x && for ac_prog in fastjar$EXEEXT jar$EXEEXT do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_JAR+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$JAR"; then ac_cv_prog_JAR="$JAR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_JAR="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAR=$ac_cv_prog_JAR if test -n "$JAR"; then { $as_echo "$as_me:$LINENO: result: $JAR" >&5 $as_echo "$JAR" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAR" && break done test -n "$JAR" || JAR="$JAVAPREFIX" fi test "x$JAR" = "x" && { { $as_echo "$as_me:$LINENO: error: no acceptable jar program found in \$PATH" >&5 $as_echo "$as_me: error: no acceptable jar program found in \$PATH" >&2;} { (exit 1); exit 1; }; } sed_expr_param='s/[ ][^"]*$//' jarabs=`echo $JAR | sed -e "$sed_expr_param"` sed_expr_home="s|^~/|$HOME/|" jarabs=`echo $jarabs | sed -e "$sed_expr_home"` sed_expr_abspath='s/^~?\/.*$//' if (test `echo $jarabs | sed -e "$sed_expr_abspath"`); then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH; do IFS="$lt_save_ifs" if (test -f $dir/$jarabs || test -f $dir/$jarabs$ac_exeext); then jarabs="$dir/$jarabs" break fi done fi grep 'kaffe\.tools\.jar\.Jar' "$jarabs" >/dev/null test "$?" != "0" || \ { $as_echo "$as_me:$LINENO: WARNING: The build seems to be using the Jar tool that comes with Kaffe. Note that there are known issues in some versions of this tool. Unfortunately it does not support any --version option, so I can't detect whether your version works. If you see error messages from the Jar tool, or the build hangs, please set environment variable JAR to a working Jar tool. " >&5 $as_echo "$as_me: WARNING: The build seems to be using the Jar tool that comes with Kaffe. Note that there are known issues in some versions of this tool. Unfortunately it does not support any --version option, so I can't detect whether your version works. If you see error messages from the Jar tool, or the build hangs, please set environment variable JAR to a working Jar tool. " >&2;} if test "x$JAVAPREFIX" = x; then test "x$JAVADOC" = x && for ac_prog in gjdoc$EXEEXT javadoc$EXEEXT do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_JAVADOC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$JAVADOC"; then ac_cv_prog_JAVADOC="$JAVADOC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_JAVADOC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAVADOC=$ac_cv_prog_JAVADOC if test -n "$JAVADOC"; then { $as_echo "$as_me:$LINENO: result: $JAVADOC" >&5 $as_echo "$JAVADOC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAVADOC" && break done else test "x$JAVADOC" = x && for ac_prog in gjdoc$EXEEXT javadoc$EXEEXT do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_JAVADOC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$JAVADOC"; then ac_cv_prog_JAVADOC="$JAVADOC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_JAVADOC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAVADOC=$ac_cv_prog_JAVADOC if test -n "$JAVADOC"; then { $as_echo "$as_me:$LINENO: result: $JAVADOC" >&5 $as_echo "$JAVADOC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAVADOC" && break done test -n "$JAVADOC" || JAVADOC="$JAVAPREFIX" fi test "x$JAVADOC" = x && { { $as_echo "$as_me:$LINENO: error: no acceptable javadoc generator found in \$PATH" >&5 $as_echo "$as_me: error: no acceptable javadoc generator found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Check whether --with-java-prefix was given. if test "${with_java_prefix+set}" = set; then withval=$with_java_prefix; fi # Check whether --with-javac-flags was given. if test "${with_javac_flags+set}" = set; then withval=$with_javac_flags; fi # Check whether --with-java-flags was given. if test "${with_java_flags+set}" = set; then withval=$with_java_flags; fi # Check whether --with-javadoc-flags was given. if test "${with_javadoc_flags+set}" = set; then withval=$with_javadoc_flags; fi JAVAPREFIX=$with_java_prefix JAVACFLAGS=$with_javac_flags JAVAFLAGS=$with_java_flags JAVADOCFLAGS=$with_javadoc_flags if test x$JAVAPREFIX = x; then test x$JAVA = x && for ac_prog in jamvm$EXEEXT kaffe$EXEEXT sablevm$EXEEXT cacao$EXEEXT gij$EXEEXT java$EXEEXT do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_JAVA+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$JAVA"; then ac_cv_prog_JAVA="$JAVA" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_JAVA="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAVA=$ac_cv_prog_JAVA if test -n "$JAVA"; then { $as_echo "$as_me:$LINENO: result: $JAVA" >&5 $as_echo "$JAVA" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAVA" && break done else test x$JAVA = x && for ac_prog in jamvm$EXEEXT kaffe$EXEEXT sablevm$EXEEXT cacao$EXEEXT gij$EXEEXT java$EXEEXT do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_JAVA+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$JAVA"; then ac_cv_prog_JAVA="$JAVA" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_JAVA="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAVA=$ac_cv_prog_JAVA if test -n "$JAVA"; then { $as_echo "$as_me:$LINENO: result: $JAVA" >&5 $as_echo "$JAVA" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAVA" && break done test -n "$JAVA" || JAVA="$JAVAPREFIX" fi test x$JAVA = x && { { $as_echo "$as_me:$LINENO: error: no acceptable Java virtual machine found in \$PATH" >&5 $as_echo "$as_me: error: no acceptable Java virtual machine found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Extract the first word of "uudecode$EXEEXT", so it can be a program name with args. set dummy uudecode$EXEEXT; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_uudecode+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$uudecode"; then ac_cv_prog_uudecode="$uudecode" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_uudecode="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi uudecode=$ac_cv_prog_uudecode if test -n "$uudecode"; then { $as_echo "$as_me:$LINENO: result: $uudecode" >&5 $as_echo "$uudecode" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test x$uudecode = xyes; then { $as_echo "$as_me:$LINENO: checking if uudecode can decode base 64 file" >&5 $as_echo_n "checking if uudecode can decode base 64 file... " >&6; } if test "${ac_cv_prog_uudecode_base64+set}" = set; then $as_echo_n "(cached) " >&6 else cat << \EOF > Test.uue begin-base64 644 Test.class yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= ==== EOF if uudecode$EXEEXT Test.uue; then ac_cv_prog_uudecode_base64=yes else echo "configure: 3094: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 echo "configure: failed file was:" >&5 cat Test.uue >&5 ac_cv_prog_uudecode_base64=no fi rm -f Test.uue fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_uudecode_base64" >&5 $as_echo "$ac_cv_prog_uudecode_base64" >&6; } fi if test x$ac_cv_prog_uudecode_base64 != xyes; then rm -f Test.class { $as_echo "$as_me:$LINENO: WARNING: I have to compile Test.class from scratch" >&5 $as_echo "$as_me: WARNING: I have to compile Test.class from scratch" >&2;} if test x$ac_cv_prog_javac_works = xno; then { { $as_echo "$as_me:$LINENO: error: Cannot compile java source. $JAVAC does not work properly" >&5 $as_echo "$as_me: error: Cannot compile java source. $JAVAC does not work properly" >&2;} { (exit 1); exit 1; }; } fi if test x$ac_cv_prog_javac_works = x; then if test "x$JAVAPREFIX" = x; then test "x$JAVAC" = x && for ac_prog in "gcj$EXEEXT -C" jikes$EXEEXT ejc$EXEEXT guavac$EXEEXT javac$EXEEXT do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_JAVAC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$JAVAC"; then ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_JAVAC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAVAC=$ac_cv_prog_JAVAC if test -n "$JAVAC"; then { $as_echo "$as_me:$LINENO: result: $JAVAC" >&5 $as_echo "$JAVAC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAVAC" && break done else test "x$JAVAC" = x && for ac_prog in "gcj$EXEEXT -C" jikes$EXEEXT ejc$EXEEXT guavac$EXEEXT javac$EXEEXT do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_JAVAC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$JAVAC"; then ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_JAVAC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAVAC=$ac_cv_prog_JAVAC if test -n "$JAVAC"; then { $as_echo "$as_me:$LINENO: result: $JAVAC" >&5 $as_echo "$JAVAC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAVAC" && break done test -n "$JAVAC" || JAVAC="$JAVAPREFIX" fi test "x$JAVAC" = x && { { $as_echo "$as_me:$LINENO: error: no acceptable Java compiler found in \$PATH" >&5 $as_echo "$as_me: error: no acceptable Java compiler found in \$PATH" >&2;} { (exit 1); exit 1; }; } { $as_echo "$as_me:$LINENO: checking if $JAVAC works" >&5 $as_echo_n "checking if $JAVAC works... " >&6; } if test "${ac_cv_prog_javac_works+set}" = set; then $as_echo_n "(cached) " >&6 else JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST /* #line 3216 "configure" */ public class Test { } EOF if { ac_try='$JAVAC $JAVACFLAGS -classpath .:$CLASSPATH $JAVA_TEST' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } >/dev/null 2>&1; then ac_cv_prog_javac_works=yes else { { $as_echo "$as_me:$LINENO: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&5 $as_echo "$as_me: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&2;} { (exit 1); exit 1; }; } echo "configure: failed program was:" >&5 cat $JAVA_TEST >&5 fi rm -f $JAVA_TEST $CLASS_TEST fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_javac_works" >&5 $as_echo "$ac_cv_prog_javac_works" >&6; } (echo "$JAVAC" | grep -e " -C$" >/dev/null 2>/dev/null) && { $as_echo "$as_me:$LINENO: WARNING: The build seems to be using gcj for bytecode generation. Some versions of gcj are known to produce bad bytecode. See here for a list of bugs that may be relevant: http://gcc.gnu.org/bugzilla/buglist.cgi?component=java&keywords=wrong-code&order=default At least bug 19921 is known to affect gjdoc (in Feb 2005). You may want to set the environment variable JAVAC to an alternate compiler, such as jikes, to make sure that you end up with valid bytecode. " >&5 $as_echo "$as_me: WARNING: The build seems to be using gcj for bytecode generation. Some versions of gcj are known to produce bad bytecode. See here for a list of bugs that may be relevant: http://gcc.gnu.org/bugzilla/buglist.cgi?component=java&keywords=wrong-code&order=default At least bug 19921 is known to affect gjdoc (in Feb 2005). You may want to set the environment variable JAVAC to an alternate compiler, such as jikes, to make sure that you end up with valid bytecode. " >&2;}; fi fi { $as_echo "$as_me:$LINENO: checking if $JAVA works" >&5 $as_echo_n "checking if $JAVA works... " >&6; } if test "${ac_cv_prog_java_works+set}" = set; then $as_echo_n "(cached) " >&6 else JAVA_TEST=Test.java CLASS_TEST=Test.class TEST=Test cat << \EOF > $JAVA_TEST /* [#]line 3279 "configure" */ public class Test { public static void main (String args[]) { System.exit (0); } } EOF if test x$ac_cv_prog_uudecode_base64 != xyes; then if { ac_try='$JAVAC $JAVACFLAGS $JAVA_TEST' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && test -s $CLASS_TEST; then : else echo "configure: failed program was:" >&5 cat $JAVA_TEST >&5 { { $as_echo "$as_me:$LINENO: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&5 $as_echo "$as_me: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&2;} { (exit 1); exit 1; }; } fi fi if { ac_try='CLASSPATH=.:$CLASSPATH $JAVA $JAVAFLAGS $TEST' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } >/dev/null 2>&1; then ac_cv_prog_java_works=yes else echo "configure: failed program was:" >&5 cat $JAVA_TEST >&5 { { $as_echo "$as_me:$LINENO: error: The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" >&5 $as_echo "$as_me: error: The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" >&2;} { (exit 1); exit 1; }; } fi rm -fr $JAVA_TEST $CLASS_TEST Test.uue fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_java_works" >&5 $as_echo "$ac_cv_prog_java_works" >&6; } { $as_echo "$as_me:$LINENO: checking for JSSE" >&5 $as_echo_n "checking for JSSE... " >&6; } JSSE_JAR="" JSSE_CLASSPATH=. if test "x" != "x$CLASSPATH" ; then JSSE_CLASSPATH="$JSSE_CLASSPATH:$CLASSPATH" fi # Check whether --with-jsse was given. if test "${with_jsse+set}" = set; then withval=$with_jsse; if test -r "${withval}" ; then JSSE_JAR="${withval}" JSSE_CLASSPATH="$JSSE_CLASSPATH:$JSSE_JAR" fi fi cat << \EOF > Test.java /* [#]line 3343 "configure" */ public class Test { public static void main(String[] args) { try { Class.forName("javax.net.ssl.SSLSocket"); } catch (Throwable e) { System.exit(1); } } } EOF if { ac_try='$JAVAC $JAVACFLAGS Test.java' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && test -s Test.class && ($JAVA $JAVAFLAGS -classpath "$JSSE_CLASSPATH" Test; exit) 2>/dev/null then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else { { $as_echo "$as_me:$LINENO: error: can't find JSSE classes; use --with-jsse" >&5 $as_echo "$as_me: error: can't find JSSE classes; use --with-jsse" >&2;} { (exit 1); exit 1; }; } fi rm Test.java Test.class { $as_echo "$as_me:$LINENO: checking for SASL" >&5 $as_echo_n "checking for SASL... " >&6; } SASL_JAR="" SASL_CLASSPATH=. if test "x" != "x$CLASSPATH" ; then SASL_CLASSPATH="$SASL_CLASSPATH:$CLASSPATH" fi # Check whether --with-sasl was given. if test "${with_sasl+set}" = set; then withval=$with_sasl; if test -r "${withval}" ; then SASL_JAR="${withval}" SASL_CLASSPATH="$SASL_CLASSPATH:$SASL_JAR" fi fi cat << \EOF > Test.java /* [#]line 3388 "configure" */ public class Test { public static void main(String[] args) { try { Class.forName("javax.security.sasl.SaslClient"); } catch (Throwable e) { System.exit(1); } } } EOF if { ac_try='$JAVAC $JAVACFLAGS Test.java' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && test -s Test.class && ($JAVA $JAVAFLAGS -classpath "$SASL_CLASSPATH" Test) 2>/dev/null then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else { { $as_echo "$as_me:$LINENO: error: can't find SASL classes; use --with-sasl" >&5 $as_echo "$as_me: error: can't find SASL classes; use --with-sasl" >&2;} { (exit 1); exit 1; }; } fi rm Test.java Test.class { $as_echo "$as_me:$LINENO: checking for javax.security.auth.callback" >&5 $as_echo_n "checking for javax.security.auth.callback... " >&6; } AUTH_CALLBACK_JAR="" AUTH_CALLBACK_CLASSPATH=. if test "x" != "x$CLASSPATH" ; then AUTH_CALLBACK_CLASSPATH="$AUTH_CALLBACK_CLASSPATH:$CLASSPATH" fi # Check whether --with-auth_callback was given. if test "${with_auth_callback+set}" = set; then withval=$with_auth_callback; if test -r "${withval}" ; then AUTH_CALLBACK_JAR="${withval}" AUTH_CALLBACK_CLASSPATH="$AUTH_CALLBACK_CLASSPATH:$AUTH_CALLBACK_JAR" fi fi cat << \EOF > Test.java /* [#]line 3433 "configure" */ public class Test { public static void main(String[] args) { try { Class.forName("javax.security.auth.callback.Callback"); } catch (Throwable e) { System.exit(1); } } } EOF if { ac_try='$JAVAC $JAVACFLAGS Test.java' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && test -s Test.class && ($JAVA $JAVAFLAGS -classpath "$AUTH_CALLBACK_CLASSPATH" Test) 2>/dev/null then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else { { $as_echo "$as_me:$LINENO: error: can't find javax.security.auth.callback classes; use --with-auth-callback" >&5 $as_echo "$as_me: error: can't find javax.security.auth.callback classes; use --with-auth-callback" >&2;} { (exit 1); exit 1; }; } fi rm Test.java Test.class ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${ENABLE_SMTP_TRUE}" && test -z "${ENABLE_SMTP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_SMTP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"ENABLE_SMTP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_IMAP_TRUE}" && test -z "${ENABLE_IMAP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_IMAP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"ENABLE_IMAP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_POP3_TRUE}" && test -z "${ENABLE_POP3_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_POP3\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"ENABLE_POP3\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_NNTP_TRUE}" && test -z "${ENABLE_NNTP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_NNTP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"ENABLE_NNTP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_FTP_TRUE}" && test -z "${ENABLE_FTP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_FTP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"ENABLE_FTP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_GOPHER_TRUE}" && test -z "${ENABLE_GOPHER_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_GOPHER\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"ENABLE_GOPHER\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_FINGER_TRUE}" && test -z "${ENABLE_FINGER_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_FINGER\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"ENABLE_FINGER\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_HTTP_TRUE}" && test -z "${ENABLE_HTTP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_HTTP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"ENABLE_HTTP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_LDAP_TRUE}" && test -z "${ENABLE_LDAP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_LDAP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"ENABLE_LDAP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_COMSAT_TRUE}" && test -z "${ENABLE_COMSAT_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_COMSAT\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"ENABLE_COMSAT\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by inetlib $as_me 1.1.2, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ inetlib config.status 1.1.2 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { $as_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 $as_echo "$as_me: error: could not setup config files machinery" >&2;} { (exit 1); exit 1; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 $as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi inetlib-1.1.2/Makefile.am0000664000076400007640000002216511347426313012142 00000000000000## Process this file with automake to produce Makefile.in. # Makefile.am for GNU classpath inetlib. AUTOMAKE_OPTIONS = 1.10 EXTRA_DIST = source JAVAC = @JAVAC@ JAVACFLAGS = @JAVACFLAGS@ JAVADOC = @JAVADOC@ JAVADOCFLAGS = @JAVADOCFLAGS@ src = @srcdir@/source dst = classes doc = @srcdir@/docs inetlib_jar = inetlib.jar # Utility and helper classes for the clients. util_sources = \ $(src)/gnu/inet/util/BASE64.java \ $(src)/gnu/inet/util/CRLFInputStream.java \ $(src)/gnu/inet/util/CRLFOutputStream.java \ $(src)/gnu/inet/util/EmptyX509TrustManager.java \ $(src)/gnu/inet/util/GetLocalHostAction.java \ $(src)/gnu/inet/util/GetSystemPropertyAction.java \ $(src)/gnu/inet/util/LaconicFormatter.java \ $(src)/gnu/inet/util/LineInputStream.java \ $(src)/gnu/inet/util/MessageInputStream.java \ $(src)/gnu/inet/util/MessageOutputStream.java \ $(src)/gnu/inet/util/SaslCallbackHandler.java \ $(src)/gnu/inet/util/SaslCramMD5.java \ $(src)/gnu/inet/util/SaslInputStream.java \ $(src)/gnu/inet/util/SaslLogin.java \ $(src)/gnu/inet/util/SaslOutputStream.java \ $(src)/gnu/inet/util/SaslPlain.java \ $(src)/gnu/inet/util/TraceLevel.java # The SMTP client smtp_sources = \ $(src)/gnu/inet/smtp/Parameter.java \ $(src)/gnu/inet/smtp/ParameterList.java \ $(src)/gnu/inet/smtp/SMTPConnection.java # The IMAP client imap_sources = \ $(src)/gnu/inet/imap/IMAPConnection.java \ $(src)/gnu/inet/imap/IMAPConstants.java \ $(src)/gnu/inet/imap/IMAPException.java \ $(src)/gnu/inet/imap/IMAPResponse.java \ $(src)/gnu/inet/imap/IMAPResponseTokenizer.java \ $(src)/gnu/inet/imap/ListEntry.java \ $(src)/gnu/inet/imap/MailboxStatus.java \ $(src)/gnu/inet/imap/MessageSetTokenizer.java \ $(src)/gnu/inet/imap/MessageStatus.java \ $(src)/gnu/inet/imap/Namespaces.java \ $(src)/gnu/inet/imap/Pair.java \ $(src)/gnu/inet/imap/Quota.java \ $(src)/gnu/inet/imap/UIDPlusHandler.java \ $(src)/gnu/inet/imap/UTF7imap.java # The POP3 client pop3_sources = \ $(src)/gnu/inet/pop3/POP3Connection.java # The NNTP client nntp_sources = \ $(src)/gnu/inet/nntp/ActiveTime.java \ $(src)/gnu/inet/nntp/ActiveTimesIterator.java \ $(src)/gnu/inet/nntp/ArticleNumberIterator.java \ $(src)/gnu/inet/nntp/ArticleResponse.java \ $(src)/gnu/inet/nntp/ArticleStream.java \ $(src)/gnu/inet/nntp/FileNewsrc.java \ $(src)/gnu/inet/nntp/GroupIterator.java \ $(src)/gnu/inet/nntp/Group.java \ $(src)/gnu/inet/nntp/GroupResponse.java \ $(src)/gnu/inet/nntp/HeaderEntry.java \ $(src)/gnu/inet/nntp/HeaderIterator.java \ $(src)/gnu/inet/nntp/LineIterator.java \ $(src)/gnu/inet/nntp/Newsrc.java \ $(src)/gnu/inet/nntp/NNTPConnection.java \ $(src)/gnu/inet/nntp/NNTPConstants.java \ $(src)/gnu/inet/nntp/NNTPException.java \ $(src)/gnu/inet/nntp/OverviewIterator.java \ $(src)/gnu/inet/nntp/Overview.java \ $(src)/gnu/inet/nntp/PairIterator.java \ $(src)/gnu/inet/nntp/Pair.java \ $(src)/gnu/inet/nntp/PendingData.java \ $(src)/gnu/inet/nntp/PostStream.java \ $(src)/gnu/inet/nntp/Range.java \ $(src)/gnu/inet/nntp/StatusResponse.java # The FTP client. ftp_sources = \ $(src)/gnu/inet/ftp/ActiveModeDTP.java \ $(src)/gnu/inet/ftp/BlockInputStream.java \ $(src)/gnu/inet/ftp/BlockOutputStream.java \ $(src)/gnu/inet/ftp/CompressedInputStream.java \ $(src)/gnu/inet/ftp/CompressedOutputStream.java \ $(src)/gnu/inet/ftp/DTPInputStream.java \ $(src)/gnu/inet/ftp/DTP.java \ $(src)/gnu/inet/ftp/DTPOutputStream.java \ $(src)/gnu/inet/ftp/FTPConnection.java \ $(src)/gnu/inet/ftp/FTPException.java \ $(src)/gnu/inet/ftp/FTPResponse.java \ $(src)/gnu/inet/ftp/FTPURLConnection.java \ $(src)/gnu/inet/ftp/Handler.java \ $(src)/gnu/inet/ftp/PassiveModeDTP.java \ $(src)/gnu/inet/ftp/StreamInputStream.java \ $(src)/gnu/inet/ftp/StreamOutputStream.java # The Gopher client. gopher_sources = \ $(src)/gnu/inet/gopher/DirectoryEntry.java \ $(src)/gnu/inet/gopher/DirectoryListing.java \ $(src)/gnu/inet/gopher/GopherConnection.java \ $(src)/gnu/inet/gopher/GopherContentHandler.java \ $(src)/gnu/inet/gopher/GopherURLConnection.java \ $(src)/gnu/inet/gopher/Handler.java # The finger client. finger_sources = \ $(src)/gnu/inet/finger/FingerConnection.java \ $(src)/gnu/inet/finger/FingerURLConnection.java \ $(src)/gnu/inet/finger/Handler.java # The HTTP client. http_sources = \ $(src)/gnu/inet/http/Authenticator.java \ $(src)/gnu/inet/http/ByteArrayRequestBodyWriter.java \ $(src)/gnu/inet/http/ByteArrayResponseBodyReader.java \ $(src)/gnu/inet/http/ChunkedInputStream.java \ $(src)/gnu/inet/http/Cookie.java \ $(src)/gnu/inet/http/CookieManager.java \ $(src)/gnu/inet/http/Credentials.java \ $(src)/gnu/inet/http/HTTPConnection.java \ $(src)/gnu/inet/http/HTTPDateFormat.java \ $(src)/gnu/inet/http/Headers.java \ $(src)/gnu/inet/http/Request.java \ $(src)/gnu/inet/http/RequestBodyWriter.java \ $(src)/gnu/inet/http/Response.java \ $(src)/gnu/inet/http/ResponseBodyReader.java \ $(src)/gnu/inet/http/ResponseHeaderHandler.java \ $(src)/gnu/inet/http/SimpleCookieManager.java \ $(src)/gnu/inet/http/event/ConnectionEvent.java \ $(src)/gnu/inet/http/event/ConnectionListener.java \ $(src)/gnu/inet/http/event/RequestEvent.java \ $(src)/gnu/inet/http/event/RequestListener.java # The LDAP client. ldap_sources = \ $(src)/gnu/inet/ldap/AttributeValues.java \ $(src)/gnu/inet/ldap/BERConstants.java \ $(src)/gnu/inet/ldap/BERDecoder.java \ $(src)/gnu/inet/ldap/BEREncoder.java \ $(src)/gnu/inet/ldap/BERException.java \ $(src)/gnu/inet/ldap/LDAPConnection.java \ $(src)/gnu/inet/ldap/LDAPResult.java \ $(src)/gnu/inet/ldap/Modification.java \ $(src)/gnu/inet/ldap/ResultHandler.java # The comsat client. comsat_sources = \ $(src)/gnu/inet/comsat/ComsatClient.java \ $(src)/gnu/inet/comsat/ComsatInfo.java # Package names for gjdoc package_names = \ gnu.inet.util \ gnu.inet.smtp \ gnu.inet.imap \ gnu.inet.pop3 \ gnu.inet.nntp \ gnu.inet.ftp \ gnu.inet.gopher \ gnu.inet.finger \ gnu.inet.http \ gnu.inet.http.event \ gnu.inet.ldap \ gnu.inet.comsat # Targets BUILT_SOURCES = $(inetlib_jar) jsse = @JSSE_JAR@ sasl = @SASL_JAR@ auth_callback = @AUTH_CALLBACK_JAR@ INETLIB_CLASSPATH = $(dst):$(src):$(jsse):$(sasl):$(auth_callback) META_INF = $(dst)/META-INF META_INF_FILES = $(META_INF)/COPYING util_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(util_sources)) smtp_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(smtp_sources)) imap_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(imap_sources)) pop3_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(pop3_sources)) nntp_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(nntp_sources)) ftp_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(ftp_sources)) gopher_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(gopher_sources)) finger_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(finger_sources)) http_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(http_sources)) ldap_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(ldap_sources)) comsat_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(comsat_sources)) # Targets... # Jar $(inetlib_jar): $(dst) $(META_INF_FILES) $(smtp_classes) $(imap_classes) $(pop3_classes) $(nntp_classes) $(ftp_classes) $(gopher_classes) $(finger_classes) $(http_classes) $(ldap_classes) $(comsat_classes) $(JAR) cf $(inetlib_jar) -C $(dst) META-INF -C $(dst) gnu $(dst): mkdir -p $(dst) $(META_INF): mkdir -p $(META_INF) $(META_INF)/COPYING: $(META_INF) COPYING cp @srcdir@/COPYING $(META_INF)/ # Compilation $(util_classes): $(dst)/%.class: $(src)/%.java $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(smtp_classes): $(dst)/%.class: $(src)/%.java $(util_classes) if ENABLE_SMTP $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< endif $(imap_classes): $(dst)/%.class: $(src)/%.java $(util_classes) if ENABLE_IMAP $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< endif $(pop3_classes): $(dst)/%.class: $(src)/%.java $(util_classes) if ENABLE_POP3 $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< endif $(nntp_classes): $(dst)/%.class: $(src)/%.java $(util_classes) if ENABLE_NNTP $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< endif $(ftp_classes): $(dst)/%.class: $(src)/%.java $(util_classes) if ENABLE_FTP $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< endif $(gopher_classes): $(dst)/%.class: $(src)/%.java $(util_classes) if ENABLE_GOPHER $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< endif $(finger_classes): $(dst)/%.class: $(src)/%.java if ENABLE_FINGER $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< endif $(http_classes): $(dst)/%.class: $(src)/%.java if ENABLE_HTTP $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< endif $(ldap_classes): $(dst)/%.class: $(src)/%.java if ENABLE_LDAP $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< endif $(comsat_classes): $(dst)/%.class: $(src)/%.java if ENABLE_COMSAT $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< endif javadoc: mkdir -p $(doc) $(JAVADOC) -d $(doc) -windowtitle "GNU inetlib API documentation" -sourcepath $(src) $(package_names) clean-local: rm -rf $(META_INF) $(doc) $(inetlib_jar) find $(dst) -name '*.class' -exec rm -f '{}' ';' datadir = $(prefix)/share/java data_DATA = $(inetlib_jar) # End of Makefile.am inetlib-1.1.2/README0000664000076400007640000000057211345235566010772 00000000000000GNU Classpath inetlib - Created September 28, 2003 GNU Classpath inetlib is an extension library to provide extra network protocol support for GNU Classpath and ClasspathX project, but it can also used standalone to add http, imap, pop3 and smtp client support to applications. Primary contacts: - Chris Burdess - Nic Ferrier inetlib-1.1.2/Makefile.in0000664000076400007640000006176511347426735012174 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Makefile.am for GNU classpath inetlib. VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ ChangeLog INSTALL NEWS config/compile config/config.guess \ config/config.sub config/depcomp config/install-sh \ config/ltmain.sh config/missing config/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/m4/ac_check_class.m4 \ $(top_srcdir)/m4/ac_check_classpath.m4 \ $(top_srcdir)/m4/ac_check_rqrd_class.m4 \ $(top_srcdir)/m4/ac_java_options.m4 \ $(top_srcdir)/m4/ac_prog_jar.m4 \ $(top_srcdir)/m4/ac_prog_java.m4 \ $(top_srcdir)/m4/ac_prog_java_works.m4 \ $(top_srcdir)/m4/ac_prog_javac.m4 \ $(top_srcdir)/m4/ac_prog_javac_works.m4 \ $(top_srcdir)/m4/ac_prog_javadoc.m4 \ $(top_srcdir)/m4/am_prog_gcj.m4 \ $(top_srcdir)/m4/inetlib_with_jsse.m4 \ $(top_srcdir)/m4/inetlib_with_sasl.m4 \ $(top_srcdir)/m4/inetlib_with_auth_callback.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(datadir)" DATA = $(data_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTH_CALLBACK_JAR = @AUTH_CALLBACK_JAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVACFLAGS = @JAVACFLAGS@ JAVADOC = @JAVADOC@ JAVADOCFLAGS = @JAVADOCFLAGS@ JAVAFLAGS = @JAVAFLAGS@ JAVAPREFIX = @JAVAPREFIX@ JSSE_JAR = @JSSE_JAR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SASL_JAR = @SASL_JAR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = $(prefix)/share/java datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ uudecode = @uudecode@ AUTOMAKE_OPTIONS = 1.10 EXTRA_DIST = source src = @srcdir@/source dst = classes doc = @srcdir@/docs inetlib_jar = inetlib.jar # Utility and helper classes for the clients. util_sources = \ $(src)/gnu/inet/util/BASE64.java \ $(src)/gnu/inet/util/CRLFInputStream.java \ $(src)/gnu/inet/util/CRLFOutputStream.java \ $(src)/gnu/inet/util/EmptyX509TrustManager.java \ $(src)/gnu/inet/util/GetLocalHostAction.java \ $(src)/gnu/inet/util/GetSystemPropertyAction.java \ $(src)/gnu/inet/util/LaconicFormatter.java \ $(src)/gnu/inet/util/LineInputStream.java \ $(src)/gnu/inet/util/MessageInputStream.java \ $(src)/gnu/inet/util/MessageOutputStream.java \ $(src)/gnu/inet/util/SaslCallbackHandler.java \ $(src)/gnu/inet/util/SaslCramMD5.java \ $(src)/gnu/inet/util/SaslInputStream.java \ $(src)/gnu/inet/util/SaslLogin.java \ $(src)/gnu/inet/util/SaslOutputStream.java \ $(src)/gnu/inet/util/SaslPlain.java \ $(src)/gnu/inet/util/TraceLevel.java # The SMTP client smtp_sources = \ $(src)/gnu/inet/smtp/Parameter.java \ $(src)/gnu/inet/smtp/ParameterList.java \ $(src)/gnu/inet/smtp/SMTPConnection.java # The IMAP client imap_sources = \ $(src)/gnu/inet/imap/IMAPConnection.java \ $(src)/gnu/inet/imap/IMAPConstants.java \ $(src)/gnu/inet/imap/IMAPException.java \ $(src)/gnu/inet/imap/IMAPResponse.java \ $(src)/gnu/inet/imap/IMAPResponseTokenizer.java \ $(src)/gnu/inet/imap/ListEntry.java \ $(src)/gnu/inet/imap/MailboxStatus.java \ $(src)/gnu/inet/imap/MessageSetTokenizer.java \ $(src)/gnu/inet/imap/MessageStatus.java \ $(src)/gnu/inet/imap/Namespaces.java \ $(src)/gnu/inet/imap/Pair.java \ $(src)/gnu/inet/imap/Quota.java \ $(src)/gnu/inet/imap/UIDPlusHandler.java \ $(src)/gnu/inet/imap/UTF7imap.java # The POP3 client pop3_sources = \ $(src)/gnu/inet/pop3/POP3Connection.java # The NNTP client nntp_sources = \ $(src)/gnu/inet/nntp/ActiveTime.java \ $(src)/gnu/inet/nntp/ActiveTimesIterator.java \ $(src)/gnu/inet/nntp/ArticleNumberIterator.java \ $(src)/gnu/inet/nntp/ArticleResponse.java \ $(src)/gnu/inet/nntp/ArticleStream.java \ $(src)/gnu/inet/nntp/FileNewsrc.java \ $(src)/gnu/inet/nntp/GroupIterator.java \ $(src)/gnu/inet/nntp/Group.java \ $(src)/gnu/inet/nntp/GroupResponse.java \ $(src)/gnu/inet/nntp/HeaderEntry.java \ $(src)/gnu/inet/nntp/HeaderIterator.java \ $(src)/gnu/inet/nntp/LineIterator.java \ $(src)/gnu/inet/nntp/Newsrc.java \ $(src)/gnu/inet/nntp/NNTPConnection.java \ $(src)/gnu/inet/nntp/NNTPConstants.java \ $(src)/gnu/inet/nntp/NNTPException.java \ $(src)/gnu/inet/nntp/OverviewIterator.java \ $(src)/gnu/inet/nntp/Overview.java \ $(src)/gnu/inet/nntp/PairIterator.java \ $(src)/gnu/inet/nntp/Pair.java \ $(src)/gnu/inet/nntp/PendingData.java \ $(src)/gnu/inet/nntp/PostStream.java \ $(src)/gnu/inet/nntp/Range.java \ $(src)/gnu/inet/nntp/StatusResponse.java # The FTP client. ftp_sources = \ $(src)/gnu/inet/ftp/ActiveModeDTP.java \ $(src)/gnu/inet/ftp/BlockInputStream.java \ $(src)/gnu/inet/ftp/BlockOutputStream.java \ $(src)/gnu/inet/ftp/CompressedInputStream.java \ $(src)/gnu/inet/ftp/CompressedOutputStream.java \ $(src)/gnu/inet/ftp/DTPInputStream.java \ $(src)/gnu/inet/ftp/DTP.java \ $(src)/gnu/inet/ftp/DTPOutputStream.java \ $(src)/gnu/inet/ftp/FTPConnection.java \ $(src)/gnu/inet/ftp/FTPException.java \ $(src)/gnu/inet/ftp/FTPResponse.java \ $(src)/gnu/inet/ftp/FTPURLConnection.java \ $(src)/gnu/inet/ftp/Handler.java \ $(src)/gnu/inet/ftp/PassiveModeDTP.java \ $(src)/gnu/inet/ftp/StreamInputStream.java \ $(src)/gnu/inet/ftp/StreamOutputStream.java # The Gopher client. gopher_sources = \ $(src)/gnu/inet/gopher/DirectoryEntry.java \ $(src)/gnu/inet/gopher/DirectoryListing.java \ $(src)/gnu/inet/gopher/GopherConnection.java \ $(src)/gnu/inet/gopher/GopherContentHandler.java \ $(src)/gnu/inet/gopher/GopherURLConnection.java \ $(src)/gnu/inet/gopher/Handler.java # The finger client. finger_sources = \ $(src)/gnu/inet/finger/FingerConnection.java \ $(src)/gnu/inet/finger/FingerURLConnection.java \ $(src)/gnu/inet/finger/Handler.java # The HTTP client. http_sources = \ $(src)/gnu/inet/http/Authenticator.java \ $(src)/gnu/inet/http/ByteArrayRequestBodyWriter.java \ $(src)/gnu/inet/http/ByteArrayResponseBodyReader.java \ $(src)/gnu/inet/http/ChunkedInputStream.java \ $(src)/gnu/inet/http/Cookie.java \ $(src)/gnu/inet/http/CookieManager.java \ $(src)/gnu/inet/http/Credentials.java \ $(src)/gnu/inet/http/HTTPConnection.java \ $(src)/gnu/inet/http/HTTPDateFormat.java \ $(src)/gnu/inet/http/Headers.java \ $(src)/gnu/inet/http/Request.java \ $(src)/gnu/inet/http/RequestBodyWriter.java \ $(src)/gnu/inet/http/Response.java \ $(src)/gnu/inet/http/ResponseBodyReader.java \ $(src)/gnu/inet/http/ResponseHeaderHandler.java \ $(src)/gnu/inet/http/SimpleCookieManager.java \ $(src)/gnu/inet/http/event/ConnectionEvent.java \ $(src)/gnu/inet/http/event/ConnectionListener.java \ $(src)/gnu/inet/http/event/RequestEvent.java \ $(src)/gnu/inet/http/event/RequestListener.java # The LDAP client. ldap_sources = \ $(src)/gnu/inet/ldap/AttributeValues.java \ $(src)/gnu/inet/ldap/BERConstants.java \ $(src)/gnu/inet/ldap/BERDecoder.java \ $(src)/gnu/inet/ldap/BEREncoder.java \ $(src)/gnu/inet/ldap/BERException.java \ $(src)/gnu/inet/ldap/LDAPConnection.java \ $(src)/gnu/inet/ldap/LDAPResult.java \ $(src)/gnu/inet/ldap/Modification.java \ $(src)/gnu/inet/ldap/ResultHandler.java # The comsat client. comsat_sources = \ $(src)/gnu/inet/comsat/ComsatClient.java \ $(src)/gnu/inet/comsat/ComsatInfo.java # Package names for gjdoc package_names = \ gnu.inet.util \ gnu.inet.smtp \ gnu.inet.imap \ gnu.inet.pop3 \ gnu.inet.nntp \ gnu.inet.ftp \ gnu.inet.gopher \ gnu.inet.finger \ gnu.inet.http \ gnu.inet.http.event \ gnu.inet.ldap \ gnu.inet.comsat # Targets BUILT_SOURCES = $(inetlib_jar) jsse = @JSSE_JAR@ sasl = @SASL_JAR@ auth_callback = @AUTH_CALLBACK_JAR@ INETLIB_CLASSPATH = $(dst):$(src):$(jsse):$(sasl):$(auth_callback) META_INF = $(dst)/META-INF META_INF_FILES = $(META_INF)/COPYING util_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(util_sources)) smtp_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(smtp_sources)) imap_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(imap_sources)) pop3_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(pop3_sources)) nntp_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(nntp_sources)) ftp_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(ftp_sources)) gopher_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(gopher_sources)) finger_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(finger_sources)) http_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(http_sources)) ldap_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(ldap_sources)) comsat_classes = $(patsubst $(src)/%.java, $(dst)/%.class, $(comsat_sources)) data_DATA = $(inetlib_jar) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): install-dataDATA: $(data_DATA) @$(NORMAL_INSTALL) test -z "$(datadir)" || $(MKDIR_P) "$(DESTDIR)$(datadir)" @list='$(data_DATA)'; test -n "$(datadir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(datadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(datadir)" || exit $$?; \ done uninstall-dataDATA: @$(NORMAL_UNINSTALL) @list='$(data_DATA)'; test -n "$(datadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(datadir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(datadir)" && rm -f $$files tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(datadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dataDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dataDATA .MAKE: all check install install-am install-strip .PHONY: all all-am am--refresh check check-am clean clean-generic \ clean-local dist dist-all dist-bzip2 dist-gzip dist-lzma \ dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ distclean-generic distcleancheck distdir distuninstallcheck \ dvi dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dataDATA install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-dataDATA # Targets... # Jar $(inetlib_jar): $(dst) $(META_INF_FILES) $(smtp_classes) $(imap_classes) $(pop3_classes) $(nntp_classes) $(ftp_classes) $(gopher_classes) $(finger_classes) $(http_classes) $(ldap_classes) $(comsat_classes) $(JAR) cf $(inetlib_jar) -C $(dst) META-INF -C $(dst) gnu $(dst): mkdir -p $(dst) $(META_INF): mkdir -p $(META_INF) $(META_INF)/COPYING: $(META_INF) COPYING cp @srcdir@/COPYING $(META_INF)/ # Compilation $(util_classes): $(dst)/%.class: $(src)/%.java $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(smtp_classes): $(dst)/%.class: $(src)/%.java $(util_classes) @ENABLE_SMTP_TRUE@ $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(imap_classes): $(dst)/%.class: $(src)/%.java $(util_classes) @ENABLE_IMAP_TRUE@ $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(pop3_classes): $(dst)/%.class: $(src)/%.java $(util_classes) @ENABLE_POP3_TRUE@ $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(nntp_classes): $(dst)/%.class: $(src)/%.java $(util_classes) @ENABLE_NNTP_TRUE@ $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(ftp_classes): $(dst)/%.class: $(src)/%.java $(util_classes) @ENABLE_FTP_TRUE@ $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(gopher_classes): $(dst)/%.class: $(src)/%.java $(util_classes) @ENABLE_GOPHER_TRUE@ $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(finger_classes): $(dst)/%.class: $(src)/%.java @ENABLE_FINGER_TRUE@ $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(http_classes): $(dst)/%.class: $(src)/%.java @ENABLE_HTTP_TRUE@ $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(ldap_classes): $(dst)/%.class: $(src)/%.java @ENABLE_LDAP_TRUE@ $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< $(comsat_classes): $(dst)/%.class: $(src)/%.java @ENABLE_COMSAT_TRUE@ $(JAVAC) $(JAVACFLAGS) -classpath $(INETLIB_CLASSPATH) -d $(dst) $< javadoc: mkdir -p $(doc) $(JAVADOC) -d $(doc) -windowtitle "GNU inetlib API documentation" -sourcepath $(src) $(package_names) clean-local: rm -rf $(META_INF) $(doc) $(inetlib_jar) find $(dst) -name '*.class' -exec rm -f '{}' ';' # End of Makefile.am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: inetlib-1.1.2/COPYING0000664000076400007640000004314111345235565011143 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. inetlib-1.1.2/configure.ac0000664000076400007640000000761011347413025012366 00000000000000dnl Process this file with autoconf to produce a configure script. dnl dnl $Id: configure.ac,v 1.13 2005/08/25 12:32:02 dog Exp $ dnl Copyright (C) 2003 The Free Software Foundation dnl dnl This file is part of GNU classpath inetlib. dnl dnl GNU classpath is free software; you can redistribute it and/or modify it dnl under the terms of the GNU General Public License as published by the dnl Free Software Foundation; either version 2, or (at your option) any dnl later version. dnl dnl GNU classpath is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with GNU JavaMail; see the file COPYING. If not, write to the dnl Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA dnl 02110-1301 USA. dnl AC_INIT(inetlib, 1.1.2) AC_CONFIG_SRCDIR(source/gnu/inet/util/LineInputStream.java) AC_CONFIG_AUX_DIR([config]) AM_INIT_AUTOMAKE PACKAGE="inetlib" VERSION="1.1.2" AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_ARG_ENABLE(smtp, AC_HELP_STRING([--enable-smtp], [Enable the SMTP client (default=yes).]), [case "$enableval" in no) enable_smtp=no ;; *) enable_smtp=yes ;; esac], [enable_smtp=yes]) AM_CONDITIONAL(ENABLE_SMTP, test "x$enable_smtp" = "xyes") AC_ARG_ENABLE(imap, AC_HELP_STRING([--enable-imap], [Enable the IMAP client (default=yes).]), [case "$enableval" in no) enable_imap=no ;; *) enable_imap=yes ;; esac], [enable_imap=yes]) AM_CONDITIONAL(ENABLE_IMAP, test "x$enable_imap" = "xyes") AC_ARG_ENABLE(pop3, AC_HELP_STRING([--enable-pop3], [Enable the POP3 client (default=yes).]), [case "$enableval" in no) enable_pop3=no ;; *) enable_pop3=yes ;; esac], [enable_pop3=yes]) AM_CONDITIONAL(ENABLE_POP3, test "x$enable_pop3" = "xyes") AC_ARG_ENABLE(nntp, AC_HELP_STRING([--enable-nntp], [Enable the NNTP client (default=yes).]), [case "$enableval" in no) enable_nntp=no ;; *) enable_nntp=yes ;; esac], [enable_nntp=yes]) AM_CONDITIONAL(ENABLE_NNTP, test "x$enable_nntp" = "xyes") AC_ARG_ENABLE(ftp, AC_HELP_STRING([--enable-ftp], [Enable the FTP client (default=yes).]), [case "$enableval" in no) enable_ftp=no ;; *) enable_ftp=yes ;; esac], [enable_ftp=yes]) AM_CONDITIONAL(ENABLE_FTP, test "x$enable_ftp" = "xyes") AC_ARG_ENABLE(gopher, AC_HELP_STRING([--enable-gopher], [Enable the Gopher client (default=yes).]), [case "$enableval" in no) enable_gopher=no ;; *) enable_gopher=yes ;; esac], [enable_gopher=yes]) AM_CONDITIONAL(ENABLE_GOPHER, test "x$enable_gopher" = "xyes") AC_ARG_ENABLE(finger, AC_HELP_STRING([--enable-finger], [Enable the finger client (default=yes).]), [case "$enableval" in no) enable_finger=no ;; *) enable_finger=yes ;; esac], [enable_finger=yes]) AM_CONDITIONAL(ENABLE_FINGER, test "x$enable_finger" = "xyes") AC_ARG_ENABLE(http, AC_HELP_STRING([--enable-http], [Enable the HTTP client (default=yes).]), [case "$enableval" in no) enable_http=no ;; *) enable_http=yes ;; esac], [enable_http=yes]) AM_CONDITIONAL(ENABLE_HTTP, test "x$enable_http" = "xyes") AC_ARG_ENABLE(ldap, AC_HELP_STRING([--enable-ldap], [Enable the experimental LDAP client (default=yes).]), [case "$enableval" in no) enable_ldap=no ;; *) enable_ldap=yes ;; esac], [enable_ldap=yes]) AM_CONDITIONAL(ENABLE_LDAP, test "x$enable_ldap" = "xyes") AC_ARG_ENABLE(comsat, AC_HELP_STRING([--enable-comsat], [Enable the experimental comsat client (default=yes).]), [case "$enableval" in no) enable_comsat=no ;; *) enable_comsat=yes ;; esac], [enable_comsat=yes]) AM_CONDITIONAL(ENABLE_COMSAT, test "x$enable_comsat" = "xyes") AC_PROG_JAVAC AC_PROG_JAR AC_PROG_JAVADOC AC_JAVA_OPTIONS dnl AC_CHECK_CLASSPATH INETLIB_WITH_JSSE INETLIB_WITH_SASL INETLIB_WITH_AUTH_CALLBACK AC_CONFIG_FILES(Makefile) AC_OUTPUT inetlib-1.1.2/INSTALL0000644000076400007640000003633211347426735011146 00000000000000Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. inetlib-1.1.2/aclocal.m40000664000076400007640000005510411347426734011754 00000000000000# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],, [m4_warning([this file was generated for autoconf 2.63. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) inetlib-1.1.2/ChangeLog0000664000076400007640000002743711345235565011674 000000000000002010-01-11 Jorge Barreiro * source/gnu/inet/util/BASE64.java: Fix length of target arrays in encode and decode functions. 2009-12-08 Chris Burdess * source/gnu/inet/imap/IMAPConnection.java, source/gnu/inet/imap/MailboxStatus.java: Mailbox status indicates whether select was performed. 2009-02-12 Jan Michalica * source/gnu/inet/nntp/NNTPConnection.java: Support for NNTPS. * source/gnu/inet/nntp/NNTPConstants.java: NNTPS default port number. 2006-06-01 Chris Burdess * source/gnu/inet/imap/IMAPConnection.java: Quote wildcards. 2006-06-01 Chris Burdess * source/gnu/inet/http/Request.java: Remove compiler warnings. * source/gnu/inet/ftp/FTPConnection.java, source/gnu/inet/imap/IMAPConnection.java, source/gnu/inet/nntp/NNTPConnection.java, source/gnu/inet/pop3/POP3Connection.java, source/gnu/inet/smtp/SMTPConnection.java: Rework logging. * source/gnu/inet/util/LaconicFormatter.java: New file. 2006-05-30 Chris Burdess * source/gnu/inet/http/Request.java: Don't send Expect header for HTTP/1.0 requests. * source/gnu/inet/imap/IMAPConnection.java: Allow public access to utility method. 2006-03-04 Chris Burdess * Makefile.am, Makefile.in, source/gnu/inet/http/HTTPURLConnection.java, source/gnu/inet/http/Handler.java, source/gnu/inet/https/Handler.java: Remove flawed HTTP URL stream handler. 2006-02-25 Chris Burdess * source/gnu/inet/util/CRLFInputStream.java, source/gnu/inet/util/LineInputStream.java: Streams that use mark capabilities on the underlying stream do not expose mark functionality themselves. 2006-02-24 Chris Burdess * gnu/java/net/CRLFInputStream.java: Fix incorrect end condition when off > 0. 2006-02-17 Jeroen Frijters * gnu/java/net/protocol/ftp/ActiveModeDTP.java (ActiveModeDTP): Mark accept thread as daemon. * gnu/java/net/protocol/ftp/FTPURLConnection.java (getInputStream): Try changeWorkingDirectory to figure out if url is a directory, if not use retrieve. (getOutputStream): Don't worry about directories, simply always try to do a store. 2006-01-26 Tom Tromey * gnu/java/net/protocol/http/ChunkedInputStream.java (read): Fixed calculation of number of bytes to read. (size, count, meta, eof): Document. 2006-01-24 Chris Burdess * CRLFInputStream.java: Fix for case where off != 0. 2006-01-16 Chris Burdess * Request.java, HTTPURLConnection.java: Remove Content-Encoding for compressed streams. 2005-11-25 Chris Burdess * UTF7imap.java: Fix case of single ampersand. 2005-09-04 Chris Burdess * Makefile.am, Makefile.in, source/gnu/inet/imap/IMAPConnection.java, source/gnu/inet/imap/IMAPConstants.java, source/gnu/inet/imap/MessageSetTokenizer.java, source/gnu/inet/imap/UIDPlusHandler.java, source/gnu/inet/imap/package.html: UIDPLUS IMAP extension. 2005-06-20 Chris Burdess * Request.java: If request method is HEAD or OPTIONS, never attempt to read response body. 2005-06-15 Goffredo Baroncelli * HTTPURLConnection.java: Check index. 2005-06-06 Chris Burdess * IMAPConnection.java,POP3Connection.java,SMTPConnection.java, NNTPConnection.java,TraceLevel.java: New logging framework. * POP3Connection.java,SMTPConnection.java: Permit TLS negotiation on socket connection. 2005-05-28 Chris Burdess * HTTPURLConnection.java: Check that Location is not null on redirect. * FTPURLConnection.java: URL paths are relative. 2005-04-28 Chris Burdess * NNTPConnection.java: As below for createSaslClient. 2005-04-27 Chris Burdess * HTTPURLConnection.java: Accept absolute and relative paths in Location header. Throw FileNotFoundException and implement getErrorStream on 404. * SMTPConnection.java,IMAPConnection.java,POP3Connection.java: Use HashMap instead of Properties in argument to createSaslClient to ensure compatibility with Java 1.5 generics syntax. 2005-04-23 Chris Burdess * Makefile.am, Makefile.in, acinclude.m4, aclocal.m4, build.xml, configure, configure.ac, m4/ac_check_class.m4, m4/ac_check_classpath.m4, m4/ac_check_home.m4, m4/ac_check_junit.m4, m4/ac_check_rqrd_class.m4, m4/ac_java_options.m4, m4/ac_prog_jar.m4, m4/ac_prog_java.m4, m4/ac_prog_java_cc.m4, m4/ac_prog_java_works.m4, m4/ac_prog_javac.m4, m4/ac_prog_javac_works.m4, m4/ac_prog_javadoc.m4, m4/ac_prog_javah.m4, m4/ac_try_run_javac.m4, m4/am_prog_gcj.m4, m4/inetlib_with_auth_callback.m4, m4/inetlib_with_jsse.m4, m4/inetlib_with_sasl.m4: Updated build system to detect common free JVMs, compilers and utilities. * INSTALL: Updated install documentation. 2005-04-20 Robert Mitchell * IMAPConnection.java: Avoid NullPointerException when the server returns no matches. 2005-04-06 Chris Burdess * CRLFInputStream.java: New algorithm, returning CRLF-delimited chunks on each read. 2005-02-17 Chris Burdess * BASE64.java: Truncate encoded byte array. 2005-02-14 Kai Mueller * SMTPConnection.java: Define SP as character 0x20. 2005-01-19 Chris Burdess * acinclude.m4,configure.ac,Makefile.am: Detect JSSE, SASL, and java.security.auth.callback classes in runtime, permitting configure options to select external jars if required. 2005-01-11 Chris Burdess * HTTPConnection.java: Use correct form of Host header when using a non-default port number. 2005-01-11 Chris Burdess * HTTPConnection.java: set path to "/" if none given. 2004-12-07 Chris Burdess * gnu/java/net/protocol/http/HTTPURLConnection.java: Added support for http.agent, http.keepAlive, and http.maxConnections system properties (and LRU connection pool). 2004-12-06 Chris Burdess * HTTPURLConnection.java: (getHeaderField) return null if index out of range. * build.xml: Added debug=true for javac tasks. * LineInputStream.java: Fixed possible infinite loop. 2004-12-01 Chris Burdess * HTTPURLConnection.java: HTTPURLConnection now returns Lists as getHeaderFields() values. 2004-11-30 Chris Burdess * HTTPURLConnection.java: Fixed typo in getHeaderField[Key]. 2004-11-25 Chris Burdess * Request.java: Fixed potential StringIndexOutOfBoundsException unquoting parameters. * http/Handler.java,https/Handler.java: Corrected documentation. * HTTPURLConnection.java: Improved Mauve conformance. * all: reformatted according to Classpath style. 2004-11-12 Chris Burdess * HTTPURLConnection.java: Silently switch to POST on getOutputStream when doOutput is true. 2004-10-05 Chris Burdess * ChunkedInputStream.java: Permit EOF before CRLF. * FTPConnection.java: Implement FTP/TLS. * comsat: Experimental comsat client. 2004-10-04 Chris Burdess * LDAPConnection.java: LDAP anonymous binding. 2004-09-29 Chris Burdess * IMAPConnection.java,Quota.java: Implement IMAP ACLs and quotas. * ldap: LDAP debugging. * http: Implement gzip and deflate content-codings. 2004-09-28 Chris Burdess * IMAPConnection.java,Namespaces.java: Implement IMAP namespaces. 2004-09-26 Chris Burdess * BASE64.java: Revert padding characters regression. 2004-09-24 Chris Burdess * SaslPlain.java: Fix for authorised principal. * SaslPlain.java: Character encoding is UTF-8. 2004-09-20 Chris Burdess * BASE64.java: Padding characters at end of encoded data. 2004-09-12 Chris Burdess * IMAPConnection.java,POP3Connection.java,SMTPConnection.java,util: Fallback SASL clients for LOGIN, PLAIN, and CRAM-MD5. 2004-09-10 Chris Burdess * imap,Logger.java: More verbose debugging messages. 2004-09-07 Chris Burdess * smtp: Corrections to ESMTP parameter list string form. 2004-08-25 Chris Burdess * ldap: Experimental LDAP client. 2004-08-07 Chris Burdess * all: Change default timeout values from -1 to 0. 2004-08-06 Chris Burdess * BASE64.java: Strip padding characters during decode. 2004-08-01 Chris Burdess * http: Implemented cookies. 2004-07-31 Chris Burdess * IMAPConnection.java: Implemented UID FETCH and UID STORE. 2004-07-30 Chris Burdess * all: Implemented connection timeouts. * http: Using buffered streams to increase performance. * LineInputStream.java: Handle block reads. 2004-07-28 Chris Burdess * nntp: Corrections to newsrc file handling. 2004-07-23 Chris Burdess * http: Headers in chunked transfer-coding trailer, HTTP date parsing, proxy handling, followRedirects in stream handler, 100-continue expectation. 2004-07-22 Chris Burdess * IMAPConnection.java: Support IMAP over SSL (port 993). * http: URL stream handler. 2004-07-21 Chris Burdess * http: Initial import of HTTP client code. 2004-07-07 Chris Burdess * ftp: Fixes to FTPURLConnection. 2004-07-06 Chris Burdess * SMTPConnection.java: Greeting permits continuation. 2004-06-20 Chris Burdess * build.xml: removed premature generation of HTTP library. 2004-06-16 Chris Burdess * SMTPConnection.java, POP3Connection.java, IMAPConnection.java: TLS initiation methods overloaded to accept custom trust manager. 2004-06-14 Chris Burdess * SMTPConnection.java: Changed STARTTLS response to 220. 2004-06-14 Chris Burdess * POP3Connection.java: Applied no-arg UIDL patch from petite_abeille@mac.com. 2004-06-08 Chris Burdess * PostStream.java: Ensure final dot appears on a line by itself. 2004-06-08 Chris Burdess * imap,pop3,smtp: Fixed STARTTLS. * all: Use strict GNU style. 2004-06-07 Chris Burdess * PostStream.java: Fixed stream close bug. * finger: Added finger implementation. 2004-05-25 Chris Burdess * IMAPConnection.java: capability command accepts more response variants. 2004-05-20 Chris Burdess * NNTPConnection.java: Unexpected server responses are now reported as protocol exceptions. 2004-05-03 Chris Burdess * ftp,gopher: Changed names of handler classes to allow automatic lookup. 2004-05-02 Chris Burdess * NNTPConnection.java: Fixed handling of LISTGROUP command. 2004-04-26 Chris Burdess * POP3Connection.java: Fixed APOP bug (#8657). 2004-04-01 Chris Burdess * IMAPConnection.java: Fixed bug determining path delimiter. 2004-03-28 Chris Burdess * configure.ac: Remove AC_PROG_JAVADOC. * Makefile.am: Added install targets. 2004-03-15 Chris Burdess * acinclude.m4: Added macros to search for jarfile dependencies. * configure.ac: Check for jarfiles. * Makefile.am: Enable building in a separate directory. 2004-03-02 Chris Burdess * IMAPConnection.java: Throw IOException on EOF from server. 2004-01-12 Chris Burdess * DTPInputStream.java: Removed abstract methods so that subclasses can call super implementation. * DTPOutputStream.java: See above. 2004-01-08 Chris Burdess * Makefile.am: Correct problem with infinite recursion during build. inetlib-1.1.2/NEWS0000664000076400007640000000000011345235566010573 00000000000000